[Libreoffice-commits] core.git: 3 commits - dbaccess/source include/svtools svtools/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Sun May 10 19:30:26 PDT 2015


 dbaccess/source/ui/misc/WNameMatch.cxx |    4 
 include/svtools/headbar.hxx            |   14 
 svtools/source/control/headbar.cxx     |  484 ++++++++++++---------------------
 3 files changed, 185 insertions(+), 317 deletions(-)

New commits:
commit 020a52d855233164a4a1346eeacd3f07592ef36e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon May 11 11:21:26 2015 +0900

    unused parameter
    
    Change-Id: Ied856c05594a0ee5bd43ec61e65d12dd18e746d8

diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index cf2c49f..0b35a87 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -349,11 +349,11 @@ public:
     {
     }
 
-    virtual void Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext,
+    virtual void Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
                        const SvViewDataEntry* pView, const SvTreeListEntry* pEntry) SAL_OVERRIDE;
 };
 
-void OColumnString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
+void OColumnString::Paint(const Point& rPos, SvTreeListBox& /*rDev*/, vcl::RenderContext& rRenderContext,
                           const SvViewDataEntry* /*pView*/, const SvTreeListEntry* /*pEntry*/)
 {
     rRenderContext.Push(PushFlags::TEXTCOLOR | PushFlags::TEXTFILLCOLOR);
commit ec55cab06c67cff558a6245cd993c7d6187f58ef
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon May 11 11:18:54 2015 +0900

    remove whitespace
    
    Change-Id: I34995118b06319a8ff5b5c51b22cbe1898cb2756

diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx
index bc05547..90f0781 100644
--- a/svtools/source/control/headbar.cxx
+++ b/svtools/source/control/headbar.cxx
@@ -42,8 +42,6 @@ public:
     OUString            maHelpText;
 };
 
-
-
 #define HEAD_ARROWSIZE1             4
 #define HEAD_ARROWSIZE2             7
 
@@ -56,8 +54,6 @@ public:
 #define HEAD_HITTEST_ITEM           ((sal_uInt16)0x0001)
 #define HEAD_HITTEST_DIVIDER        ((sal_uInt16)0x0002)
 
-
-
 void HeaderBar::ImplInit( WinBits nWinStyle )
 {
     mpItemList      = new ImplHeadItemList;
@@ -101,8 +97,6 @@ void HeaderBar::ImplInit( WinBits nWinStyle )
     ImplInitSettings( true, true, true );
 }
 
-
-
 HeaderBar::HeaderBar( vcl::Window* pParent, WinBits nWinStyle ) :
     Window( pParent, nWinStyle & WB_3DLOOK )
 {
@@ -110,8 +104,6 @@ HeaderBar::HeaderBar( vcl::Window* pParent, WinBits nWinStyle ) :
     SetSizePixel( CalcWindowSizePixel() );
 }
 
-
-
 HeaderBar::~HeaderBar()
 {
     disposeOnce();
@@ -165,8 +157,6 @@ void HeaderBar::ImplInitSettings( bool bFont,
     }
 }
 
-
-
 long HeaderBar::ImplGetItemPos( sal_uInt16 nPos ) const
 {
     long nX = -mnOffset;
@@ -175,8 +165,6 @@ long HeaderBar::ImplGetItemPos( sal_uInt16 nPos ) const
     return nX;
 }
 
-
-
 Rectangle HeaderBar::ImplGetItemRect( sal_uInt16 nPos ) const
 {
     Rectangle aRect( ImplGetItemPos( nPos ), 0, 0, mnDY-1 );
@@ -187,8 +175,6 @@ Rectangle HeaderBar::ImplGetItemRect( sal_uInt16 nPos ) const
     return aRect;
 }
 
-
-
 sal_uInt16 HeaderBar::ImplHitTest( const Point& rPos,
                                long& nMouseOff, sal_uInt16& nPos ) const
 {
@@ -252,8 +238,6 @@ sal_uInt16 HeaderBar::ImplHitTest( const Point& rPos,
     return 0;
 }
 
-
-
 void HeaderBar::ImplInvertDrag( sal_uInt16 nStartPos, sal_uInt16 nEndPos )
 {
     Rectangle aRect1 = ImplGetItemRect( nStartPos );
@@ -300,8 +284,6 @@ void HeaderBar::ImplInvertDrag( sal_uInt16 nStartPos, sal_uInt16 nEndPos )
     SetRasterOp( ROP_OVERPAINT );
 }
 
-
-
 void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHigh, bool bDrag,
                              const Rectangle& rItemRect, const Rectangle* pRect, sal_uLong )
 {
@@ -640,8 +622,6 @@ void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos
     }
 }
 
-
-
 void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos,
                              bool bHigh, bool bDrag, const Rectangle* pRect )
 {
@@ -649,8 +629,6 @@ void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos
     ImplDrawItem(rRenderContext, nPos, bHigh, bDrag, aRect, pRect, 0 );
 }
 
-
-
 void HeaderBar::ImplUpdate(sal_uInt16 nPos, bool bEnd, bool /*bDirect*/)
 {
     if (IsVisible() && IsUpdateMode())
@@ -673,8 +651,6 @@ void HeaderBar::ImplUpdate(sal_uInt16 nPos, bool bEnd, bool /*bDirect*/)
     }
 }
 
-
-
 void HeaderBar::ImplStartDrag( const Point& rMousePos, bool bCommand )
 {
     sal_uInt16  nPos;
@@ -736,8 +712,6 @@ void HeaderBar::ImplStartDrag( const Point& rMousePos, bool bCommand )
     }
 }
 
-
-
 void HeaderBar::ImplDrag( const Point& rMousePos )
 {
     sal_uInt16  nPos = GetItemPos( mnCurItemId );
@@ -844,8 +818,6 @@ void HeaderBar::ImplDrag( const Point& rMousePos )
     Drag();
 }
 
-
-
 void HeaderBar::ImplEndDrag( bool bCancel )
 {
     HideTracking();
@@ -904,8 +876,6 @@ void HeaderBar::ImplEndDrag( bool bCancel )
     mbItemDrag      = false;
 }
 
-
-
 void HeaderBar::MouseButtonDown( const MouseEvent& rMEvt )
 {
     if ( rMEvt.IsLeft() )
@@ -933,8 +903,6 @@ void HeaderBar::MouseButtonDown( const MouseEvent& rMEvt )
     }
 }
 
-
-
 void HeaderBar::MouseMove( const MouseEvent& rMEvt )
 {
     long            nTemp1;
@@ -948,8 +916,6 @@ void HeaderBar::MouseMove( const MouseEvent& rMEvt )
     SetPointer( aPtr );
 }
 
-
-
 void HeaderBar::Tracking( const TrackingEvent& rTEvt )
 {
     Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
@@ -960,8 +926,6 @@ void HeaderBar::Tracking( const TrackingEvent& rTEvt )
         ImplDrag( aMousePos );
 }
 
-
-
 void HeaderBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
 {
     if (mnBorderOff1 || mnBorderOff2)
@@ -989,8 +953,6 @@ void HeaderBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect
         ImplDrawItem(rRenderContext, i, (i == nCurItemPos), false, &rRect);
 }
 
-
-
 void HeaderBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
                       sal_uLong nFlags )
 {
@@ -1045,8 +1007,6 @@ void HeaderBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
     pDev->Pop();
 }
 
-
-
 void HeaderBar::Resize()
 {
     Size aSize = GetOutputSizePixel();
@@ -1056,8 +1016,6 @@ void HeaderBar::Resize()
     mnDY = aSize.Height();
 }
 
-
-
 void HeaderBar::Command( const CommandEvent& rCEvt )
 {
     if ( rCEvt.IsMouseEvent() && (rCEvt.GetCommand() == COMMAND_STARTDRAG) && !mbDrag )
@@ -1069,8 +1027,6 @@ void HeaderBar::Command( const CommandEvent& rCEvt )
     Window::Command( rCEvt );
 }
 
-
-
 void HeaderBar::RequestHelp( const HelpEvent& rHEvt )
 {
     sal_uInt16 nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
@@ -1124,8 +1080,6 @@ void HeaderBar::RequestHelp( const HelpEvent& rHEvt )
     Window::RequestHelp( rHEvt );
 }
 
-
-
 void HeaderBar::StateChanged( StateChangedType nType )
 {
     Window::StateChanged( nType );
@@ -1150,8 +1104,6 @@ void HeaderBar::StateChanged( StateChangedType nType )
     }
 }
 
-
-
 void HeaderBar::DataChanged( const DataChangedEvent& rDCEvt )
 {
     Window::DataChanged( rDCEvt );
@@ -1166,43 +1118,31 @@ void HeaderBar::DataChanged( const DataChangedEvent& rDCEvt )
     }
 }
 
-
-
 void HeaderBar::StartDrag()
 {
     maStartDragHdl.Call( this );
 }
 
-
-
 void HeaderBar::Drag()
 {
     maDragHdl.Call( this );
 }
 
-
-
 void HeaderBar::EndDrag()
 {
     maEndDragHdl.Call( this );
 }
 
-
-
 void HeaderBar::Select()
 {
     maSelectHdl.Call( this );
 }
 
-
-
 void HeaderBar::DoubleClick()
 {
     maDoubleClickHdl.Call( this );
 }
 
-
-
 void HeaderBar::InsertItem( sal_uInt16 nItemId, const OUString& rText,
                             long nSize, HeaderBarItemBits nBits, sal_uInt16 nPos )
 {
@@ -1228,8 +1168,6 @@ void HeaderBar::InsertItem( sal_uInt16 nItemId, const OUString& rText,
     ImplUpdate( nPos, true );
 }
 
-
-
 void HeaderBar::RemoveItem( sal_uInt16 nItemId )
 {
     sal_uInt16 nPos = GetItemPos( nItemId );
@@ -1244,8 +1182,6 @@ void HeaderBar::RemoveItem( sal_uInt16 nItemId )
     }
 }
 
-
-
 void HeaderBar::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos )
 {
     sal_uInt16 nPos = GetItemPos( nItemId );
@@ -1267,8 +1203,6 @@ void HeaderBar::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos )
     }
 }
 
-
-
 void HeaderBar::Clear()
 {
     // delete all items
@@ -1280,8 +1214,6 @@ void HeaderBar::Clear()
     ImplUpdate( 0, true );
 }
 
-
-
 void HeaderBar::SetOffset( long nNewOffset )
 {
     // move area
@@ -1291,15 +1223,11 @@ void HeaderBar::SetOffset( long nNewOffset )
     Scroll( nDelta, 0, aRect );
 }
 
-
-
 sal_uInt16 HeaderBar::GetItemCount() const
 {
     return (sal_uInt16)mpItemList->size();
 }
 
-
-
 sal_uInt16 HeaderBar::GetItemPos( sal_uInt16 nItemId ) const
 {
     for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
@@ -1310,8 +1238,6 @@ sal_uInt16 HeaderBar::GetItemPos( sal_uInt16 nItemId ) const
     return HEADERBAR_ITEM_NOTFOUND;
 }
 
-
-
 sal_uInt16 HeaderBar::GetItemId( sal_uInt16 nPos ) const
 {
     ImplHeadItem* pItem = (nPos < mpItemList->size() ) ? (*mpItemList)[ nPos ] : NULL;
@@ -1321,8 +1247,6 @@ sal_uInt16 HeaderBar::GetItemId( sal_uInt16 nPos ) const
         return 0;
 }
 
-
-
 sal_uInt16 HeaderBar::GetItemId( const Point& rPos ) const
 {
     for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
@@ -1333,8 +1257,6 @@ sal_uInt16 HeaderBar::GetItemId( const Point& rPos ) const
     return 0;
 }
 
-
-
 Rectangle HeaderBar::GetItemRect( sal_uInt16 nItemId ) const
 {
     Rectangle aRect;
@@ -1344,8 +1266,6 @@ Rectangle HeaderBar::GetItemRect( sal_uInt16 nItemId ) const
     return aRect;
 }
 
-
-
 void HeaderBar::SetItemSize( sal_uInt16 nItemId, long nNewSize )
 {
     sal_uInt16 nPos = GetItemPos( nItemId );
@@ -1360,8 +1280,6 @@ void HeaderBar::SetItemSize( sal_uInt16 nItemId, long nNewSize )
     }
 }
 
-
-
 long HeaderBar::GetItemSize( sal_uInt16 nItemId ) const
 {
     sal_uInt16 nPos = GetItemPos( nItemId );
@@ -1371,8 +1289,6 @@ long HeaderBar::GetItemSize( sal_uInt16 nItemId ) const
         return 0;
 }
 
-
-
 void HeaderBar::SetItemBits( sal_uInt16 nItemId, HeaderBarItemBits nNewBits )
 {
     sal_uInt16 nPos = GetItemPos( nItemId );
@@ -1387,8 +1303,6 @@ void HeaderBar::SetItemBits( sal_uInt16 nItemId, HeaderBarItemBits nNewBits )
     }
 }
 
-
-
 HeaderBarItemBits HeaderBar::GetItemBits( sal_uInt16 nItemId ) const
 {
     sal_uInt16 nPos = GetItemPos( nItemId );
@@ -1398,8 +1312,6 @@ HeaderBarItemBits HeaderBar::GetItemBits( sal_uInt16 nItemId ) const
         return HeaderBarItemBits::NONE;
 }
 
-
-
 void HeaderBar::SetItemText( sal_uInt16 nItemId, const OUString& rText )
 {
     sal_uInt16 nPos = GetItemPos( nItemId );
@@ -1410,8 +1322,6 @@ void HeaderBar::SetItemText( sal_uInt16 nItemId, const OUString& rText )
     }
 }
 
-
-
 OUString HeaderBar::GetItemText( sal_uInt16 nItemId ) const
 {
     sal_uInt16 nPos = GetItemPos( nItemId );
@@ -1420,8 +1330,6 @@ OUString HeaderBar::GetItemText( sal_uInt16 nItemId ) const
     return OUString();
 }
 
-
-
 OUString HeaderBar::GetHelpText( sal_uInt16 nItemId ) const
 {
     sal_uInt16 nPos = GetItemPos( nItemId );
@@ -1441,8 +1349,6 @@ OUString HeaderBar::GetHelpText( sal_uInt16 nItemId ) const
     return OUString();
 }
 
-
-
 OString HeaderBar::GetHelpId( sal_uInt16 nItemId ) const
 {
     sal_uInt16 nPos = GetItemPos( nItemId );
@@ -1452,8 +1358,6 @@ OString HeaderBar::GetHelpId( sal_uInt16 nItemId ) const
     return aRet;
 }
 
-
-
 Size HeaderBar::CalcWindowSizePixel() const
 {
     long nMaxImageSize = 0;
@@ -1519,6 +1423,4 @@ void HeaderBar::SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::sta
     else
         return xPeer;
 }
-
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit a0ba87f92d27d9096c14c3d422b1efe9c17d9b9b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon May 11 11:17:18 2015 +0900

    refactor HeadBar to use RenderContext
    
    Change-Id: Ica05591754633fc64216aecbdf8010800133dfd4

diff --git a/include/svtools/headbar.hxx b/include/svtools/headbar.hxx
index 0f411f2..cd99e31 100644
--- a/include/svtools/headbar.hxx
+++ b/include/svtools/headbar.hxx
@@ -271,14 +271,10 @@ private:
     using Window::ImplHitTest;
     SVT_DLLPRIVATE sal_uInt16               ImplHitTest( const Point& rPos, long& nMouseOff, sal_uInt16& nPos ) const;
     SVT_DLLPRIVATE void             ImplInvertDrag( sal_uInt16 nStartPos, sal_uInt16 nEndPos );
-    SVT_DLLPRIVATE void             ImplDrawItem( OutputDevice* pDev,
-                                      sal_uInt16 nPos, bool bHigh, bool bDrag,
-                                      const Rectangle& rItemRect,
-                                      const Rectangle* pRect,
-                                      sal_uLong nFlags );
-    SVT_DLLPRIVATE void             ImplDrawItem( sal_uInt16 nPos, bool bHigh = false,
-                                      bool bDrag = false,
-                                      const Rectangle* pRect = NULL );
+    SVT_DLLPRIVATE void             ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHigh, bool bDrag,
+                                                 const Rectangle& rItemRect, const Rectangle* pRect, sal_uLong nFlags);
+    SVT_DLLPRIVATE void             ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHigh = false,
+                                                 bool bDrag = false, const Rectangle* pRect = NULL);
     SVT_DLLPRIVATE void             ImplUpdate( sal_uInt16 nPos,
                                        bool bEnd = false, bool bDirect = false );
     SVT_DLLPRIVATE void             ImplStartDrag( const Point& rPos, bool bCommand );
@@ -293,7 +289,7 @@ public:
     virtual void        MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void        MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     virtual void        Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
-    virtual void        Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
+    virtual void        Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
     virtual void        Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
     virtual void        Resize() SAL_OVERRIDE;
     virtual void        Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx
index 01e9445..bc05547 100644
--- a/svtools/source/control/headbar.cxx
+++ b/svtools/source/control/headbar.cxx
@@ -302,13 +302,9 @@ void HeaderBar::ImplInvertDrag( sal_uInt16 nStartPos, sal_uInt16 nEndPos )
 
 
 
-void HeaderBar::ImplDrawItem( OutputDevice* pDev,
-                              sal_uInt16 nPos, bool bHigh, bool bDrag,
-                              const Rectangle& rItemRect,
-                              const Rectangle* pRect,
-                              sal_uLong )
+void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHigh, bool bDrag,
+                             const Rectangle& rItemRect, const Rectangle* pRect, sal_uLong )
 {
-    vcl::Window *const pWin = (pDev->GetOutDevType()==OUTDEV_WINDOW) ? static_cast<vcl::Window*>(pDev) : NULL;
     ImplControlValue aControlValue(0);
     Rectangle aCtrlRegion;
     ControlState nState(ControlState::NONE);
@@ -316,35 +312,34 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
     Rectangle aRect = rItemRect;
 
     // do not display if there is no space
-    if ( aRect.GetWidth() <= 1 )
+    if (aRect.GetWidth() <= 1)
         return;
 
     // check of rectangle is visible
-    if ( pRect )
+    if (pRect)
     {
-        if ( aRect.Right() < pRect->Left() )
+        if (aRect.Right() < pRect->Left())
             return;
-        else if ( aRect.Left() > pRect->Right() )
+        else if (aRect.Left() > pRect->Right())
             return;
     }
     else
     {
-        if ( aRect.Right() < 0 )
+        if (aRect.Right() < 0)
             return;
-        else if ( aRect.Left() > mnDX )
+        else if (aRect.Left() > mnDX)
             return;
     }
 
-    ImplHeadItem*           pItem  = (*mpItemList)[ nPos ];
-    HeaderBarItemBits       nBits = pItem->mnBits;
-    const StyleSettings&    rStyleSettings = GetSettings().GetStyleSettings();
+    ImplHeadItem* pItem  = (*mpItemList)[nPos];
+    HeaderBarItemBits nBits = pItem->mnBits;
+    const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
 
-    if( pWin && pWin->IsNativeControlSupported(CTRL_WINDOW_BACKGROUND, PART_ENTIRE_CONTROL) )
+    if (rRenderContext.IsNativeControlSupported(CTRL_WINDOW_BACKGROUND, PART_ENTIRE_CONTROL))
     {
         aCtrlRegion=aRect;
-        pWin->DrawNativeControl( CTRL_WINDOW_BACKGROUND, PART_ENTIRE_CONTROL,
-                                 aCtrlRegion, nState, aControlValue,
-                                 OUString() );
+        rRenderContext.DrawNativeControl(CTRL_WINDOW_BACKGROUND, PART_ENTIRE_CONTROL,
+                                         aCtrlRegion, nState, aControlValue, OUString());
 
     }
     else
@@ -356,64 +351,62 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
         // delete background
         if ( !pRect || bDrag )
         {
-            if ( bDrag )
+            if (bDrag)
             {
-                pDev->SetLineColor();
-                pDev->SetFillColor( rStyleSettings.GetCheckedColor() );
-                pDev->DrawRect( aRect );
+                rRenderContext.SetLineColor();
+                rRenderContext.SetFillColor(rStyleSettings.GetCheckedColor());
+                rRenderContext.DrawRect(aRect);
             }
             else
-                pDev->DrawWallpaper( aRect, GetBackground() );
+                rRenderContext.DrawWallpaper(aRect, rRenderContext.GetBackground());
         }
     }
 
-    Color aSelectionTextColor( COL_TRANSPARENT );
+    Color aSelectionTextColor(COL_TRANSPARENT);
 
-    if( pWin && pWin->IsNativeControlSupported(CTRL_LISTHEADER, PART_BUTTON) )
+    if (rRenderContext.IsNativeControlSupported(CTRL_LISTHEADER, PART_BUTTON))
     {
-        aCtrlRegion=aRect;
+        aCtrlRegion = aRect;
         aControlValue.setTristateVal(BUTTONVALUE_ON);
-        nState|=ControlState::ENABLED;
-        if(bHigh)
-            nState|=ControlState::PRESSED;
-        pWin->DrawNativeControl( CTRL_LISTHEADER, PART_BUTTON,
-                                 aCtrlRegion, nState, aControlValue,
-                                 OUString() );
+        nState |= ControlState::ENABLED;
+        if (bHigh)
+            nState |= ControlState::PRESSED;
+        rRenderContext.DrawNativeControl(CTRL_LISTHEADER, PART_BUTTON,
+                                         aCtrlRegion, nState, aControlValue, OUString());
     }
     else
     {
         // draw separation line
-        pDev->SetLineColor( rStyleSettings.GetDarkShadowColor() );
-        pDev->DrawLine( Point( aRect.Right(), aRect.Top() ),
-                        Point( aRect.Right(), aRect.Bottom() ) );
+        rRenderContext.SetLineColor(rStyleSettings.GetDarkShadowColor());
+        rRenderContext.DrawLine(Point(aRect.Right(), aRect.Top()), Point(aRect.Right(), aRect.Bottom()));
 
         // draw ButtonStyle
         // avoid 3D borders
-        if( bHigh )
-            DrawSelectionBackground( aRect, 1, true, false, false, &aSelectionTextColor );
-        else if ( !mbButtonStyle || (nBits & HeaderBarItemBits::FLAT) )
-            DrawSelectionBackground( aRect, 0, true, false, false, &aSelectionTextColor );
+        if (bHigh)
+            DrawSelectionBackground(aRect, 1, true, false, false, &aSelectionTextColor);
+        else if (!mbButtonStyle || (nBits & HeaderBarItemBits::FLAT))
+            DrawSelectionBackground(aRect, 0, true, false, false, &aSelectionTextColor);
     }
 
     // do not draw if there is no space
-    if ( aRect.GetWidth() < 1 )
+    if (aRect.GetWidth() < 1)
         return;
 
     // calculate size and position and draw content
     pItem->maOutText = pItem->maText;
     Size aImageSize = pItem->maImage.GetSizePixel();
-    Size aTxtSize( pDev->GetTextWidth( pItem->maOutText ), 0  );
+    Size aTxtSize(rRenderContext.GetTextWidth(pItem->maOutText), 0);
     if (!pItem->maOutText.isEmpty())
-        aTxtSize.Height() = pDev->GetTextHeight();
+        aTxtSize.Height() = rRenderContext.GetTextHeight();
     long nArrowWidth = 0;
-    if ( nBits & (HeaderBarItemBits::UPARROW | HeaderBarItemBits::DOWNARROW) )
-        nArrowWidth = HEAD_ARROWSIZE2+HEADERBAR_ARROWOFF;
+    if (nBits & (HeaderBarItemBits::UPARROW | HeaderBarItemBits::DOWNARROW))
+        nArrowWidth = HEAD_ARROWSIZE2 + HEADERBAR_ARROWOFF;
 
     // do not draw if there is not enough space for the image
     long nTestHeight = aImageSize.Height();
-    if ( !(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) )
+    if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)))
         nTestHeight += aTxtSize.Height();
-    if ( (aImageSize.Width() > aRect.GetWidth()) || (nTestHeight > aRect.GetHeight()) )
+    if ((aImageSize.Width() > aRect.GetWidth()) || (nTestHeight > aRect.GetHeight()))
     {
         aImageSize.Width() = 0;
         aImageSize.Height() = 0;
@@ -421,83 +414,82 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
 
     // cut text to correct length
     bool bLeftText = false;
-    long nMaxTxtWidth = aRect.GetWidth()-(HEADERBAR_TEXTOFF*2)-nArrowWidth;
-    if ( nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE) )
+    long nMaxTxtWidth = aRect.GetWidth() - (HEADERBAR_TEXTOFF * 2) - nArrowWidth;
+    if (nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE))
         nMaxTxtWidth -= aImageSize.Width();
     long nTxtWidth = aTxtSize.Width();
-    if ( nTxtWidth > nMaxTxtWidth )
+    if (nTxtWidth > nMaxTxtWidth)
     {
         bLeftText = true;
         OUStringBuffer aBuf(pItem->maOutText);
         aBuf.append("...");
         do
         {
-            aBuf.remove(aBuf.getLength()-3-1, 1);
-            nTxtWidth = pDev->GetTextWidth( aBuf.toString() );
+            aBuf.remove(aBuf.getLength() - 3 - 1, 1);
+            nTxtWidth = rRenderContext.GetTextWidth(aBuf.toString());
         }
-        while ( (nTxtWidth > nMaxTxtWidth) && (aBuf.getLength() > 3) );
+        while ((nTxtWidth > nMaxTxtWidth) && (aBuf.getLength() > 3));
         pItem->maOutText = aBuf.makeStringAndClear();
-        if ( pItem->maOutText.getLength() == 3 )
+        if (pItem->maOutText.getLength() == 3)
         {
             nTxtWidth = 0;
-            (pItem->maOutText).clear();
+            pItem->maOutText.clear();
         }
     }
 
     // calculate text/imageposition
     long nTxtPos;
-    if ( !bLeftText && (nBits & HeaderBarItemBits::RIGHT) )
+    if (!bLeftText && (nBits & HeaderBarItemBits::RIGHT))
     {
-        nTxtPos = aRect.Right()-nTxtWidth-HEADERBAR_TEXTOFF;
-        if ( nBits & HeaderBarItemBits::RIGHTIMAGE )
+        nTxtPos = aRect.Right() - nTxtWidth - HEADERBAR_TEXTOFF;
+        if (nBits & HeaderBarItemBits::RIGHTIMAGE)
             nTxtPos -= aImageSize.Width();
     }
-    else if ( !bLeftText && (nBits & HeaderBarItemBits::CENTER) )
+    else if (!bLeftText && (nBits & HeaderBarItemBits::CENTER))
     {
         long nTempWidth = nTxtWidth;
-        if ( nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE) )
+        if (nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE))
             nTempWidth += aImageSize.Width();
-        nTxtPos = aRect.Left()+(aRect.GetWidth()-nTempWidth)/2;
-        if ( nBits & HeaderBarItemBits::LEFTIMAGE )
+        nTxtPos = aRect.Left() + (aRect.GetWidth() - nTempWidth) / 2;
+        if (nBits & HeaderBarItemBits::LEFTIMAGE)
             nTxtPos += aImageSize.Width();
-        if ( nArrowWidth )
+        if (nArrowWidth)
         {
-            if ( nTxtPos+nTxtWidth+nArrowWidth >= aRect.Right() )
+            if (nTxtPos + nTxtWidth + nArrowWidth >= aRect.Right())
             {
-                nTxtPos = aRect.Left()+HEADERBAR_TEXTOFF;
-                if ( nBits & HeaderBarItemBits::LEFTIMAGE )
+                nTxtPos = aRect.Left() + HEADERBAR_TEXTOFF;
+                if (nBits & HeaderBarItemBits::LEFTIMAGE)
                     nTxtPos += aImageSize.Width();
             }
         }
     }
     else
     {
-        nTxtPos = aRect.Left()+HEADERBAR_TEXTOFF;
-        if ( nBits & HeaderBarItemBits::LEFTIMAGE )
+        nTxtPos = aRect.Left() + HEADERBAR_TEXTOFF;
+        if (nBits & HeaderBarItemBits::LEFTIMAGE)
             nTxtPos += aImageSize.Width();
-        if ( nBits & HeaderBarItemBits::RIGHT )
+        if (nBits & HeaderBarItemBits::RIGHT)
             nTxtPos += nArrowWidth;
     }
 
     // calculate text/imageposition
     long nTxtPosY = 0;
-    if ( !pItem->maOutText.isEmpty() || (nArrowWidth && aTxtSize.Height()) )
+    if (!pItem->maOutText.isEmpty() || (nArrowWidth && aTxtSize.Height()))
     {
-        if ( nBits & HeaderBarItemBits::TOP )
+        if (nBits & HeaderBarItemBits::TOP)
         {
             nTxtPosY = aRect.Top();
-            if ( !(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) )
+            if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)))
                 nTxtPosY += aImageSize.Height();
         }
-        else if ( nBits & HeaderBarItemBits::BOTTOM )
+        else if (nBits & HeaderBarItemBits::BOTTOM)
             nTxtPosY = aRect.Bottom()-aTxtSize.Height();
         else
         {
             long nTempHeight = aTxtSize.Height();
-            if ( !(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) )
                 nTempHeight += aImageSize.Height();
             nTxtPosY = aRect.Top()+((aRect.GetHeight()-nTempHeight)/2);
-            if ( !(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) )
+            if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)))
                 nTxtPosY += aImageSize.Height();
         }
     }
@@ -505,80 +497,80 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
     // display text
     if (!pItem->maOutText.isEmpty())
     {
-        if( aSelectionTextColor != Color( COL_TRANSPARENT ) )
+        if (aSelectionTextColor != Color(COL_TRANSPARENT))
         {
-            pDev->Push( PushFlags::TEXTCOLOR );
-            pDev->SetTextColor( aSelectionTextColor );
+            rRenderContext.Push(PushFlags::TEXTCOLOR);
+            rRenderContext.SetTextColor(aSelectionTextColor);
         }
-        if ( IsEnabled() )
-            pDev->DrawText( Point( nTxtPos, nTxtPosY ), pItem->maOutText );
+        if (IsEnabled())
+            rRenderContext.DrawText(Point(nTxtPos, nTxtPosY), pItem->maOutText);
         else
-            pDev->DrawCtrlText( Point( nTxtPos, nTxtPosY ), pItem->maOutText, 0, pItem->maOutText.getLength(), TEXT_DRAW_DISABLE );
-        if( aSelectionTextColor != Color( COL_TRANSPARENT ) )
-            pDev->Pop();
+            rRenderContext.DrawCtrlText(Point(nTxtPos, nTxtPosY), pItem->maOutText, 0, pItem->maOutText.getLength(), TEXT_DRAW_DISABLE);
+        if (aSelectionTextColor != Color(COL_TRANSPARENT))
+            rRenderContext.Pop();
     }
 
     // calculate the position and draw image if it is available
     long nImagePosY = 0;
-    if ( aImageSize.Width() && aImageSize.Height() )
+    if (aImageSize.Width() && aImageSize.Height())
     {
         long nImagePos = nTxtPos;
-        if ( nBits & HeaderBarItemBits::LEFTIMAGE )
+        if (nBits & HeaderBarItemBits::LEFTIMAGE)
         {
             nImagePos -= aImageSize.Width();
-            if ( nBits & HeaderBarItemBits::RIGHT )
+            if (nBits & HeaderBarItemBits::RIGHT)
                 nImagePos -= nArrowWidth;
         }
-        else if ( nBits & HeaderBarItemBits::RIGHTIMAGE )
+        else if (nBits & HeaderBarItemBits::RIGHTIMAGE)
         {
             nImagePos += nTxtWidth;
-            if ( !(nBits & HeaderBarItemBits::RIGHT) )
+            if (!(nBits & HeaderBarItemBits::RIGHT))
                 nImagePos += nArrowWidth;
         }
         else
         {
-            if ( nBits & HeaderBarItemBits::RIGHT )
+            if (nBits & HeaderBarItemBits::RIGHT )
                 nImagePos = aRect.Right()-aImageSize.Width();
-            else if ( nBits & HeaderBarItemBits::CENTER )
-                nImagePos = aRect.Left()+(aRect.GetWidth()-aImageSize.Width())/2;
+            else if (nBits & HeaderBarItemBits::CENTER)
+                nImagePos = aRect.Left() + (aRect.GetWidth() - aImageSize.Width()) / 2;
             else
-                nImagePos = aRect.Left()+HEADERBAR_TEXTOFF;
+                nImagePos = aRect.Left() + HEADERBAR_TEXTOFF;
         }
 
-        if ( nBits & HeaderBarItemBits::TOP )
+        if (nBits & HeaderBarItemBits::TOP)
             nImagePosY = aRect.Top();
-        else if ( nBits & HeaderBarItemBits::BOTTOM )
+        else if (nBits & HeaderBarItemBits::BOTTOM)
         {
-            nImagePosY = aRect.Bottom()-aImageSize.Height();
-            if ( !(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) )
+            nImagePosY = aRect.Bottom() - aImageSize.Height();
+            if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)))
                 nImagePosY -= aTxtSize.Height();
         }
         else
         {
             long nTempHeight = aImageSize.Height();
-            if ( !(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) )
+            if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)))
                 nTempHeight += aTxtSize.Height();
-            nImagePosY = aRect.Top()+((aRect.GetHeight()-nTempHeight)/2);
+            nImagePosY = aRect.Top() + ((aRect.GetHeight() - nTempHeight) / 2);
         }
-        if ( nImagePos+aImageSize.Width() <= aRect.Right() )
+        if (nImagePos + aImageSize.Width() <= aRect.Right())
         {
             sal_uInt16 nStyle = 0;
-            if ( !IsEnabled() )
+            if (!IsEnabled())
                 nStyle |= IMAGE_DRAW_DISABLE;
-            pDev->DrawImage( Point( nImagePos, nImagePosY ), pItem->maImage, nStyle );
+            rRenderContext.DrawImage(Point(nImagePos, nImagePosY), pItem->maImage, nStyle);
         }
     }
 
-    if ( nBits & (HeaderBarItemBits::UPARROW | HeaderBarItemBits::DOWNARROW) )
+    if (nBits & (HeaderBarItemBits::UPARROW | HeaderBarItemBits::DOWNARROW))
     {
         long nArrowX = nTxtPos;
-        if ( nBits & HeaderBarItemBits::RIGHT )
+        if (nBits & HeaderBarItemBits::RIGHT)
             nArrowX -= nArrowWidth;
         else
-            nArrowX += nTxtWidth+HEADERBAR_ARROWOFF;
-        if ( !(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) && pItem->maText.isEmpty() )
+            nArrowX += nTxtWidth + HEADERBAR_ARROWOFF;
+        if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) && pItem->maText.isEmpty())
         {
-            if ( nBits & HeaderBarItemBits::RIGHT )
+            if (nBits & HeaderBarItemBits::RIGHT)
                 nArrowX -= aImageSize.Width();
             else
                 nArrowX += aImageSize.Width();
@@ -586,63 +578,62 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
 
         // is there enough space to draw the item?
         bool bDraw = true;
-        if ( nArrowX < aRect.Left()+HEADERBAR_TEXTOFF )
+        if (nArrowX < aRect.Left() + HEADERBAR_TEXTOFF)
             bDraw = false;
-        else if ( nArrowX+HEAD_ARROWSIZE2 > aRect.Right() )
+        else if (nArrowX + HEAD_ARROWSIZE2 > aRect.Right())
             bDraw = false;
 
-        if ( bDraw )
+        if (bDraw)
         {
-            if( pWin && pWin->IsNativeControlSupported(CTRL_LISTHEADER, PART_ARROW) )
+            if (rRenderContext.IsNativeControlSupported(CTRL_LISTHEADER, PART_ARROW))
             {
-                aCtrlRegion=Rectangle(Point(nArrowX,aRect.Top()),Size(nArrowWidth,aRect.GetHeight()));
+                aCtrlRegion = Rectangle(Point(nArrowX, aRect.Top()), Size(nArrowWidth, aRect.GetHeight()));
                 // control value passes 1 if arrow points down, 0 otherwise
-                aControlValue.setNumericVal((nBits&HeaderBarItemBits::DOWNARROW)?1:0);
-                nState|=ControlState::ENABLED;
-                if(bHigh)
-                    nState|=ControlState::PRESSED;
-                pWin->DrawNativeControl( CTRL_LISTHEADER, PART_ARROW,
-                                         aCtrlRegion, nState, aControlValue,
-                                         OUString() );
+                aControlValue.setNumericVal((nBits & HeaderBarItemBits::DOWNARROW) ? 1 : 0);
+                nState |= ControlState::ENABLED;
+                if (bHigh)
+                    nState |= ControlState::PRESSED;
+                rRenderContext.DrawNativeControl(CTRL_LISTHEADER, PART_ARROW, aCtrlRegion,
+                                                 nState, aControlValue, OUString());
             }
             else
             {
                 long nArrowY;
-                if ( aTxtSize.Height() )
-                    nArrowY = nTxtPosY+(aTxtSize.Height()/2);
-                else if ( aImageSize.Width() && aImageSize.Height() )
-                    nArrowY = nImagePosY+(aImageSize.Height()/2);
+                if (aTxtSize.Height())
+                    nArrowY = nTxtPosY + (aTxtSize.Height() / 2);
+                else if (aImageSize.Width() && aImageSize.Height())
+                    nArrowY = nImagePosY + (aImageSize.Height() / 2);
                 else
                 {
-                    if ( nBits & HeaderBarItemBits::TOP )
-                        nArrowY = aRect.Top()+1;
-                    else if ( nBits & HeaderBarItemBits::BOTTOM )
-                        nArrowY = aRect.Bottom()-HEAD_ARROWSIZE2-1;
+                    if (nBits & HeaderBarItemBits::TOP)
+                        nArrowY = aRect.Top() + 1;
+                    else if (nBits & HeaderBarItemBits::BOTTOM)
+                        nArrowY = aRect.Bottom() - HEAD_ARROWSIZE2 - 1;
                     else
-                        nArrowY = aRect.Top()+((aRect.GetHeight()-HEAD_ARROWSIZE2)/2);
+                        nArrowY = aRect.Top() + ((aRect.GetHeight() - HEAD_ARROWSIZE2) / 2);
                 }
-                nArrowY -= HEAD_ARROWSIZE1-1;
-                if ( nBits & HeaderBarItemBits::DOWNARROW )
+                nArrowY -= HEAD_ARROWSIZE1 - 1;
+                if (nBits & HeaderBarItemBits::DOWNARROW)
                 {
-                    pDev->SetLineColor( rStyleSettings.GetLightColor() );
-                    pDev->DrawLine( Point( nArrowX, nArrowY ),
-                                    Point( nArrowX+HEAD_ARROWSIZE2, nArrowY ) );
-                    pDev->DrawLine( Point( nArrowX, nArrowY ),
-                                    Point( nArrowX+HEAD_ARROWSIZE1, nArrowY+HEAD_ARROWSIZE2 ) );
-                    pDev->SetLineColor( rStyleSettings.GetShadowColor() );
-                    pDev->DrawLine( Point( nArrowX+HEAD_ARROWSIZE1, nArrowY+HEAD_ARROWSIZE2 ),
-                                    Point( nArrowX+HEAD_ARROWSIZE2, nArrowY ) );
+                    rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
+                    rRenderContext.DrawLine(Point(nArrowX, nArrowY),
+                                            Point(nArrowX + HEAD_ARROWSIZE2, nArrowY));
+                    rRenderContext.DrawLine(Point(nArrowX, nArrowY),
+                                            Point(nArrowX + HEAD_ARROWSIZE1, nArrowY + HEAD_ARROWSIZE2));
+                    rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+                    rRenderContext.DrawLine(Point(nArrowX + HEAD_ARROWSIZE1, nArrowY + HEAD_ARROWSIZE2),
+                                            Point(nArrowX + HEAD_ARROWSIZE2, nArrowY));
                 }
                 else
                 {
-                    pDev->SetLineColor( rStyleSettings.GetLightColor() );
-                    pDev->DrawLine( Point( nArrowX, nArrowY+HEAD_ARROWSIZE2 ),
-                                    Point( nArrowX+HEAD_ARROWSIZE1, nArrowY ) );
-                    pDev->SetLineColor( rStyleSettings.GetShadowColor() );
-                    pDev->DrawLine( Point( nArrowX, nArrowY+HEAD_ARROWSIZE2 ),
-                                    Point( nArrowX+HEAD_ARROWSIZE2, nArrowY+HEAD_ARROWSIZE2 ) );
-                    pDev->DrawLine( Point( nArrowX+HEAD_ARROWSIZE2, nArrowY+HEAD_ARROWSIZE2 ),
-                                    Point( nArrowX+HEAD_ARROWSIZE1, nArrowY ) );
+                    rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
+                    rRenderContext.DrawLine(Point(nArrowX, nArrowY + HEAD_ARROWSIZE2),
+                                            Point(nArrowX + HEAD_ARROWSIZE1, nArrowY));
+                    rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
+                    rRenderContext.DrawLine(Point(nArrowX, nArrowY + HEAD_ARROWSIZE2),
+                                            Point(nArrowX + HEAD_ARROWSIZE2, nArrowY + HEAD_ARROWSIZE2));
+                    rRenderContext.DrawLine(Point(nArrowX + HEAD_ARROWSIZE2, nArrowY + HEAD_ARROWSIZE2),
+                                            Point(nArrowX + HEAD_ARROWSIZE1, nArrowY));
                 }
             }
         }
@@ -651,54 +642,34 @@ void HeaderBar::ImplDrawItem( OutputDevice* pDev,
 
 
 
-void HeaderBar::ImplDrawItem( sal_uInt16 nPos, bool bHigh, bool bDrag,
-                              const Rectangle* pRect )
+void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos,
+                             bool bHigh, bool bDrag, const Rectangle* pRect )
 {
-    Rectangle aRect = ImplGetItemRect( nPos );
-    ImplDrawItem( this, nPos, bHigh, bDrag, aRect, pRect, 0 );
+    Rectangle aRect = ImplGetItemRect(nPos);
+    ImplDrawItem(rRenderContext, nPos, bHigh, bDrag, aRect, pRect, 0 );
 }
 
 
 
-void HeaderBar::ImplUpdate( sal_uInt16 nPos, bool bEnd, bool bDirect )
+void HeaderBar::ImplUpdate(sal_uInt16 nPos, bool bEnd, bool /*bDirect*/)
 {
-    if ( IsVisible() && IsUpdateMode() )
+    if (IsVisible() && IsUpdateMode())
     {
-        if ( !bDirect )
-        {
-            Rectangle   aRect;
-            size_t      nItemCount = mpItemList->size();
-            if ( nPos < nItemCount )
-                aRect = ImplGetItemRect( nPos );
-            else
-            {
-                aRect.Bottom() = mnDY-1;
-                if ( nItemCount )
-                    aRect.Left() = ImplGetItemRect( nItemCount-1 ).Right();
-            }
-            if ( bEnd )
-                aRect.Right() = mnDX-1;
-            aRect.Top()     += mnBorderOff1;
-            aRect.Bottom()  -= mnBorderOff2;
-            Invalidate( aRect );
-        }
+        Rectangle aRect;
+        size_t nItemCount = mpItemList->size();
+        if (nPos < nItemCount)
+            aRect = ImplGetItemRect(nPos);
         else
         {
-            for ( size_t i = nPos; i < mpItemList->size(); i++ )
-                ImplDrawItem( i );
-            if ( bEnd )
-            {
-                Rectangle aRect = ImplGetItemRect( (sal_uInt16)mpItemList->size() );
-                aRect.Left()  = aRect.Right();
-                aRect.Right() = mnDX-1;
-                if ( aRect.Left() < aRect.Right() )
-                {
-                    aRect.Top()     += mnBorderOff1;
-                    aRect.Bottom()  -= mnBorderOff2;
-                    Erase( aRect );
-                }
-            }
+            aRect.Bottom() = mnDY - 1;
+            if (nItemCount)
+                aRect.Left() = ImplGetItemRect(nItemCount - 1).Right();
         }
+        if (bEnd)
+            aRect.Right() = mnDX - 1;
+        aRect.Top() += mnBorderOff1;
+        aRect.Bottom() -= mnBorderOff2;
+        Invalidate(aRect);
     }
 }
 
@@ -752,8 +723,8 @@ void HeaderBar::ImplStartDrag( const Point& rMousePos, bool bCommand )
             mnStartPos = rMousePos.X()-mnMouseOff;
             mnDragPos = mnStartPos;
             StartDrag();
-            if ( mbItemMode )
-                ImplDrawItem( nPos, true, mbItemDrag );
+            if (mbItemMode)
+                Invalidate();
             else
             {
                 Rectangle aSizeRect( mnDragPos, 0, mnDragPos, mnDragSize+mnDY );
@@ -789,7 +760,7 @@ void HeaderBar::ImplDrag( const Point& rMousePos )
             if ( (rMousePos.Y() >= aItemRect.Top()) && (rMousePos.Y() <= aItemRect.Bottom()) )
             {
                 mbItemDrag = true;
-                ImplDrawItem( nPos, true, mbItemDrag );
+                Invalidate();
             }
         }
 
@@ -836,12 +807,12 @@ void HeaderBar::ImplDrag( const Point& rMousePos )
                  (nOldItemDragPos != HEADERBAR_ITEM_NOTFOUND) )
             {
                 ImplInvertDrag( nPos, nOldItemDragPos );
-                ImplDrawItem( nOldItemDragPos );
+                Invalidate();
             }
         }
 
         if ( bNewOutDrag != mbOutDrag )
-            ImplDrawItem( nPos, !bNewOutDrag, mbItemDrag );
+            Invalidate();
 
         if ( mbItemDrag  )
         {
@@ -849,7 +820,7 @@ void HeaderBar::ImplDrag( const Point& rMousePos )
                  (mnItemDragPos != nPos) &&
                  (mnItemDragPos != HEADERBAR_ITEM_NOTFOUND) )
             {
-                ImplDrawItem( mnItemDragPos, false, true );
+                Invalidate();
                 ImplInvertDrag( nPos, mnItemDragPos );
             }
         }
@@ -883,8 +854,7 @@ void HeaderBar::ImplEndDrag( bool bCancel )
     {
         if ( mbItemMode && (!mbOutDrag || mbItemDrag) )
         {
-            sal_uInt16 nPos = GetItemPos( mnCurItemId );
-            ImplDrawItem( nPos );
+            Invalidate();
         }
 
         mnCurItemId = 0;
@@ -905,7 +875,7 @@ void HeaderBar::ImplEndDrag( bool bCancel )
                     MoveItem( mnCurItemId, mnItemDragPos );
                 }
                 else
-                    ImplDrawItem( nPos );
+                    Invalidate();
             }
             else
             {
@@ -992,31 +962,31 @@ void HeaderBar::Tracking( const TrackingEvent& rTEvt )
 
 
 
-void HeaderBar::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect )
+void HeaderBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
 {
-    if ( mnBorderOff1 || mnBorderOff2 )
+    if (mnBorderOff1 || mnBorderOff2)
     {
-        SetLineColor( GetSettings().GetStyleSettings().GetDarkShadowColor() );
-        if ( mnBorderOff1 )
-            DrawLine( Point( 0, 0 ), Point( mnDX-1, 0 ) );
-        if ( mnBorderOff2 )
-            DrawLine( Point( 0, mnDY-1 ), Point( mnDX-1, mnDY-1 ) );
+        rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetDarkShadowColor());
+        if (mnBorderOff1)
+            rRenderContext.DrawLine(Point(0, 0), Point(mnDX - 1, 0));
+        if (mnBorderOff2)
+            rRenderContext.DrawLine(Point(0, mnDY - 1), Point(mnDX - 1, mnDY - 1));
         // #i40393# draw left and right border, if WB_BORDER was set in ImplInit()
-        if ( mnBorderOff1 && mnBorderOff2 )
+        if (mnBorderOff1 && mnBorderOff2)
         {
-            DrawLine( Point( 0, 0 ), Point( 0, mnDY-1 ) );
-            DrawLine( Point( mnDX-1, 0 ), Point( mnDX-1, mnDY-1 ) );
+            rRenderContext.DrawLine(Point(0, 0), Point(0, mnDY - 1));
+            rRenderContext.DrawLine(Point(mnDX - 1, 0), Point(mnDX - 1, mnDY - 1));
         }
     }
 
     sal_uInt16 nCurItemPos;
-    if ( mbDrag )
-        nCurItemPos = GetItemPos( mnCurItemId );
+    if (mbDrag)
+        nCurItemPos = GetItemPos(mnCurItemId);
     else
         nCurItemPos = HEADERBAR_ITEM_NOTFOUND;
-    sal_uInt16 nItemCount = (sal_uInt16)mpItemList->size();
-    for ( sal_uInt16 i = 0; i < nItemCount; i++ )
-        ImplDrawItem( i, (i == nCurItemPos), false, &rRect );
+    sal_uInt16 nItemCount = static_cast<sal_uInt16>(mpItemList->size());
+    for (sal_uInt16 i = 0; i < nItemCount; i++)
+        ImplDrawItem(rRenderContext, i, (i == nCurItemPos), false, &rRect);
 }
 
 
@@ -1068,7 +1038,7 @@ void HeaderBar::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
             aItemRect.Right() = 16000;
         vcl::Region aRegion( aRect );
         pDev->SetClipRegion( aRegion );
-        ImplDrawItem( pDev, i, false, false, aItemRect, &aRect, nFlags );
+        ImplDrawItem(*pDev, i, false, false, aItemRect, &aRect, nFlags );
         pDev->SetClipRegion();
     }
 


More information about the Libreoffice-commits mailing list