tdf#127411 Broken mouse status in Impress status bar

regression from
	commit c53f3f8f58f55d0978fb968446975856d72a52f8
tdf#126819 Can't retrieve the mouse position written in the
statusbar

Change-Id: I3072de28bcc512d98c43d5cc7110aa3f80d51e61
Reviewed-on: https://gerrit.libreoffice.org/79519
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index f4d0df5..03b9b41 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -387,37 +387,40 @@
        rRenderContext.SetClipRegion(aRegion);
    }

    SalLayout* pLayoutCache = pItem->mxLayoutCache.get();

    if(!pLayoutCache)
    // if the framework code is drawing status, let it do all the work
    if (!(pItem->mnBits & StatusBarItemBits::UserDraw))
    {
        // update cache
        pItem->mxLayoutCache = rRenderContext.ImplLayout(pItem->maText, 0, -1);
        pLayoutCache = pItem->mxLayoutCache.get();
    }
        SalLayout* pLayoutCache = pItem->mxLayoutCache.get();

    const SalLayoutGlyphs* pGlyphs = pLayoutCache ? pLayoutCache->GetGlyphs() : nullptr;
    Size aTextSize(rRenderContext.GetTextWidth(pItem->maText,0,-1,nullptr,pGlyphs), rRenderContext.GetTextHeight());
        if(!pLayoutCache)
        {
            // update cache
            pItem->mxLayoutCache = rRenderContext.ImplLayout(pItem->maText, 0, -1);
            pLayoutCache = pItem->mxLayoutCache.get();
        }

    Point aTextPos = ImplGetItemTextPos(aTextRectSize, aTextSize, pItem->mnBits);
        const SalLayoutGlyphs* pGlyphs = pLayoutCache ? pLayoutCache->GetGlyphs() : nullptr;
        Size aTextSize(rRenderContext.GetTextWidth(pItem->maText,0,-1,nullptr,pGlyphs), rRenderContext.GetTextHeight());
        Point aTextPos = ImplGetItemTextPos(aTextRectSize, aTextSize, pItem->mnBits);

    if (bOffScreen)
    {
        mpImplData->mpVirDev->DrawText(
                    aTextPos,
                    pItem->maText,
                    0, -1, nullptr, nullptr,
                    pGlyphs );
    }
    else
    {
        aTextPos.AdjustX(aTextRect.Left() );
        aTextPos.AdjustY(aTextRect.Top() );
        rRenderContext.DrawText(
                    aTextPos,
                    pItem->maText,
                    0, -1, nullptr, nullptr,
                    pGlyphs );
        if (bOffScreen)
        {
            mpImplData->mpVirDev->DrawText(
                        aTextPos,
                        pItem->maText,
                        0, -1, nullptr, nullptr,
                        pGlyphs );
        }
        else
        {
            aTextPos.AdjustX(aTextRect.Left() );
            aTextPos.AdjustY(aTextRect.Top() );
            rRenderContext.DrawText(
                        aTextPos,
                        pItem->maText,
                        0, -1, nullptr, nullptr,
                        pGlyphs );
        }
    }

    // call DrawItem if necessary