refactor to use RenderContext for vcl StatusBar

Change-Id: I3f3797d323ea6f438d4fdcb7f89c28b658e75b57
diff --git a/include/vcl/status.hxx b/include/vcl/status.hxx
index f0fdbf6..3520b0e 100644
--- a/include/vcl/status.hxx
+++ b/include/vcl/status.hxx
@@ -101,11 +101,13 @@ private:
    SAL_DLLPRIVATE void      ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
    SAL_DLLPRIVATE void      ImplFormat();
    SAL_DLLPRIVATE bool      ImplIsItemUpdate();
    using OutputDevice::ImplDrawText;
    SAL_DLLPRIVATE void      ImplDrawText( bool bOffScreen, long nOldTextWidth );
    SAL_DLLPRIVATE void      ImplDrawItem( bool bOffScreen, sal_uInt16 nPos, bool bDrawText, bool bDrawFrame );
    SAL_DLLPRIVATE void      ImplDrawProgress( bool bPaint,
                                               sal_uInt16 nOldPerc, sal_uInt16 nNewPerc );

    SAL_DLLPRIVATE void      ImplDrawText(vcl::RenderContext& rRenderContext, bool bOffScreen,
                                          long nOldTextWidth);
    SAL_DLLPRIVATE void      ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen,
                                          sal_uInt16 nPos, bool bDrawText, bool bDrawFrame);
    SAL_DLLPRIVATE void      ImplDrawProgress(vcl::RenderContext& rRenderContext, bool bPaint,
                                              sal_uInt16 nOldPerc, sal_uInt16 nNewPerc);
    SAL_DLLPRIVATE void      ImplCalcProgressRect();
    SAL_DLLPRIVATE Rectangle ImplGetItemRectPos( sal_uInt16 nPos ) const;
    SAL_DLLPRIVATE sal_uInt16    ImplGetFirstVisiblePos() const;
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 8896cea..7b7efaf 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -334,7 +334,7 @@ sal_uInt16 StatusBar::ImplGetFirstVisiblePos() const
    return SAL_MAX_UINT16;
}

void StatusBar::ImplDrawText( bool bOffScreen, long nOldTextWidth )
void StatusBar::ImplDrawText(vcl::RenderContext& /*rRenderContext*/, bool bOffScreen, long nOldTextWidth)
{
    // prevent item box from being overwritten
    Rectangle aTextRect;
@@ -369,7 +369,7 @@ void StatusBar::ImplDrawText( bool bOffScreen, long nOldTextWidth )
    }
}

void StatusBar::ImplDrawItem( bool bOffScreen, sal_uInt16 nPos, bool bDrawText, bool bDrawFrame )
void StatusBar::ImplDrawItem(vcl::RenderContext& /*rRenderContext*/, bool bOffScreen, sal_uInt16 nPos, bool bDrawText, bool bDrawFrame)
{
    Rectangle aRect = ImplGetItemRectPos( nPos );

@@ -584,17 +584,17 @@ void DrawProgress( vcl::Window* pWindow, const Point& rPos,
    }
}

void StatusBar::ImplDrawProgress( bool bPaint,
                                  sal_uInt16 nPercent1, sal_uInt16 nPercent2 )
void StatusBar::ImplDrawProgress(vcl::RenderContext& rRenderContext, bool bPaint,
                                 sal_uInt16 nPercent1, sal_uInt16 nPercent2)
{
    bool bNative = IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL );
    // bPaint: draw text also, else only update progress
    if ( bPaint )
    if (bPaint)
    {
        DrawText( maPrgsTxtPos, maPrgsTxt );
        if( ! bNative )
        {
            DecorationView aDecoView( this );
            DecorationView aDecoView(&rRenderContext);
            aDecoView.DrawFrame( maPrgsFrameRect, FRAME_DRAW_IN );
        }
    }
@@ -607,8 +607,8 @@ void StatusBar::ImplDrawProgress( bool bPaint,
        aPos = maPrgsFrameRect.TopLeft();
        nPrgsHeight = maPrgsFrameRect.GetHeight();
    }
    DrawProgress( this, aPos, mnPrgsSize/2, mnPrgsSize, nPrgsHeight,
                  nPercent1*100, nPercent2*100, mnPercentCount, maPrgsFrameRect );
    DrawProgress( this, aPos, mnPrgsSize / 2, mnPrgsSize, nPrgsHeight,
                  nPercent1 * 100, nPercent2 * 100, mnPercentCount, maPrgsFrameRect );
}

void StatusBar::ImplCalcProgressRect()
@@ -700,7 +700,7 @@ void StatusBar::MouseButtonDown( const MouseEvent& rMEvt )
    }
}

void StatusBar::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& )
void StatusBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
    if ( mbFormat )
        ImplFormat();
@@ -708,18 +708,18 @@ void StatusBar::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& 
    sal_uInt16 nItemCount = sal_uInt16( mpItemList->size() );

    if ( mbProgressMode )
        ImplDrawProgress( true, 0, mnPercent );
        ImplDrawProgress(rRenderContext, true, 0, mnPercent);
    else
    {
        // draw text
        if ( !mbVisibleItems || (GetStyle() & WB_RIGHT) )
            ImplDrawText( false, 0 );
            ImplDrawText(rRenderContext, false, 0);

        // draw items
        if ( mbVisibleItems )
        {
            for ( sal_uInt16 i = 0; i < nItemCount; i++ )
                ImplDrawItem( false, i, true, true );
                ImplDrawItem(rRenderContext, false, i, true, true);
        }
    }

@@ -1166,7 +1166,7 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const OUString& rText )
            if ( pItem->mbVisible && !mbFormat && ImplIsItemUpdate() )
            {
                Update();
                ImplDrawItem( true, nPos, true, false );
                ImplDrawItem(*this, true, nPos, true, false);
                Flush();
            }
        }
@@ -1219,7 +1219,7 @@ void StatusBar::SetItemData( sal_uInt16 nItemId, void* pNewData )
             !mbFormat && ImplIsItemUpdate() )
        {
            Update();
            ImplDrawItem( true, nPos, false, false );
            ImplDrawItem(*this, true, nPos, false, false);
            Flush();
        }
    }
@@ -1249,7 +1249,7 @@ void StatusBar::RedrawItem( sal_uInt16 nItemId )
         pItem->mbVisible && ImplIsItemUpdate() )
    {
        Update();
        ImplDrawItem( true, nPos, false, false );
        ImplDrawItem(*this, true, nPos, false, false);
        Flush();
    }
}
@@ -1364,7 +1364,7 @@ void StatusBar::SetProgressValue( sal_uInt16 nNewPercent )
    {
        Update();
        SetLineColor();
        ImplDrawProgress( false, mnPercent, nNewPercent );
        ImplDrawProgress(*this, false, mnPercent, nNewPercent);
        Flush();
    }
    mnPercent = nNewPercent;
@@ -1402,7 +1402,7 @@ void StatusBar::SetText( const OUString& rText )
            Update();
            long nOldTextWidth = GetTextWidth( GetText() );
            Window::SetText( rText );
            ImplDrawText( true, nOldTextWidth );
            ImplDrawText(*this, true, nOldTextWidth);
            Flush();
        }
    }