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

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Mon May 11 03:00:30 PDT 2015


 svtools/source/hatchwindow/ipwin.cxx       |   34 +--
 svtools/source/hatchwindow/ipwin.hxx       |   55 +++---
 svtools/source/table/gridtablerenderer.cxx |  255 +++++++++++++----------------
 svtools/source/table/tablecontrol_impl.cxx |   89 +++-------
 svtools/source/table/tablecontrol_impl.hxx |    5 
 svtools/source/table/tabledatawindow.cxx   |   16 -
 svtools/source/table/tabledatawindow.hxx   |   18 +-
 svtools/source/toolpanel/paneltabbar.cxx   |  224 ++++++++++++-------------
 8 files changed, 331 insertions(+), 365 deletions(-)

New commits:
commit 373edbd7a3eb5eed089c1addbf5e19947bed24c9
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon May 11 18:58:38 2015 +0900

    refactor PanelTabBar to use RenderContext
    
    Change-Id: I67865bc2512760a8dfcb6dc1b7688400f7986a6a

diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx
index 62dccf9..4c12b9f 100644
--- a/svtools/source/toolpanel/paneltabbar.cxx
+++ b/svtools/source/toolpanel/paneltabbar.cxx
@@ -343,18 +343,19 @@ namespace svt
     class PanelTabBar_Impl : public IToolPanelDeckListener
     {
     public:
-        PanelTabBar_Impl( PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent );
+        PanelTabBar_Impl(PanelTabBar& i_rTabBar, IToolPanelDeck& i_rPanelDeck,
+                         const TabAlignment i_eAlignment, const TabItemContent i_eItemContent);
 
         virtual ~PanelTabBar_Impl()
         {
-            m_rPanelDeck.RemoveListener( *this );
+            m_rPanelDeck.RemoveListener(*this);
         }
 
         // IToolPanelDeckListener
-        virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition ) SAL_OVERRIDE
+        virtual void PanelInserted(const PToolPanel& i_pPanel, const size_t i_nPosition) SAL_OVERRIDE
         {
-            (void)i_pPanel;
-            (void)i_nPosition;
+            (void) i_pPanel;
+            (void) i_nPosition;
             m_bItemsDirty = true;
             m_rTabBar.Invalidate();
 
@@ -372,22 +373,23 @@ namespace svt
             Relayout();
         }
 
-        virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive ) SAL_OVERRIDE;
-        virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter ) SAL_OVERRIDE;
+        virtual void ActivePanelChanged(const boost::optional<size_t>& i_rOldActive,
+                                        const boost::optional<size_t>& i_rNewActive) SAL_OVERRIDE;
+        virtual void LayouterChanged(const PDeckLayouter& i_rNewLayouter) SAL_OVERRIDE;
         virtual void Dying() SAL_OVERRIDE;
 
-        void    UpdateScrollButtons()
+        void UpdateScrollButtons()
         {
-            m_aScrollBack->Enable( m_nScrollPosition > 0 );
-            m_aScrollForward->Enable( m_nScrollPosition < m_aItems.size() - 1 );
+            m_aScrollBack->Enable(m_nScrollPosition > 0);
+            m_aScrollForward->Enable(m_nScrollPosition < m_aItems.size() - 1);
         }
 
         void                        Relayout();
         void                        EnsureItemsCache();
-        ::boost::optional< size_t > FindItemForPoint( const Point& i_rPoint ) const;
-        void                        DrawItem( const size_t i_nItemIndex, const Rectangle& i_rBoundaries ) const;
+        boost::optional<size_t>     FindItemForPoint( const Point& i_rPoint ) const;
+        void                        DrawItem(vcl::RenderContext& rRenderContext, const size_t i_nItemIndex, const Rectangle& i_rBoundaries) const;
         void                        InvalidateItem( const size_t i_nItemIndex, const ItemFlags i_nAdditionalItemFlags = 0 ) const;
-        void                        CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const;
+        void                        CopyFromRenderDevice(vcl::RenderContext& rRenderContext, const Rectangle& i_rLogicalRect) const;
         Rectangle                   GetActualLogicalItemRect( const Rectangle& i_rLogicalItemRect ) const;
         Rectangle                   GetItemScreenRect( const size_t i_nItemPos ) const;
 
@@ -405,7 +407,8 @@ namespace svt
 
         void        impl_calcItemRects();
         Size        impl_calculateItemContentSize( const PToolPanel& i_pPanel, const TabItemContent i_eItemContent ) const;
-        void        impl_renderItemContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) const;
+        void        impl_renderItemContent(vcl::RenderContext& rRenderContext, const PToolPanel& i_pPanel,
+                                           const Rectangle& i_rContentArea, const TabItemContent i_eItemContent) const;
         ItemFlags   impl_getItemFlags( const size_t i_nItemIndex ) const;
 
     public:
@@ -418,8 +421,8 @@ namespace svt
         ScopedVclPtr<VirtualDevice> m_aRenderDevice;
         PTabBarRenderer             m_pRenderer;
 
-        ::boost::optional< size_t > m_aHoveredItem;
-        ::boost::optional< size_t > m_aFocusedItem;
+        boost::optional<size_t>     m_aHoveredItem;
+        boost::optional<size_t>     m_aFocusedItem;
         bool                        m_bMouseButtonDown;
 
         ItemDescriptors             m_aItems;
@@ -511,17 +514,17 @@ namespace svt
         ,m_nScrollPosition( 0 )
     {
 #ifdef WNT
-        if ( m_aRenderDevice->IsNativeControlSupported( CTRL_TAB_ITEM, PART_ENTIRE_CONTROL ) )
+        if (m_aRenderDevice->IsNativeControlSupported(CTRL_TAB_ITEM, PART_ENTIRE_CONTROL))
             // this mode requires the NWF framework to be able to render those items onto a virtual
             // device. For some frameworks (some GTK themes, in particular), this is known to fail.
             // So, be on the safe side for the moment.
-            m_pRenderer.reset( new NWFTabItemRenderer( *m_aRenderDevice.get() ) );
+            m_pRenderer.reset(new NWFTabItemRenderer(*m_aRenderDevice.get()));
         else
 #endif
-        if ( m_aRenderDevice->IsNativeControlSupported( CTRL_TOOLBAR, PART_BUTTON ) )
-            m_pRenderer.reset( new NWFToolboxItemRenderer( *m_aRenderDevice.get() ) );
+        if (m_aRenderDevice->IsNativeControlSupported(CTRL_TOOLBAR, PART_BUTTON))
+            m_pRenderer.reset(new NWFToolboxItemRenderer(*m_aRenderDevice.get()));
         else
-            m_pRenderer.reset( new VCLItemRenderer( *m_aRenderDevice.get() ) );
+            m_pRenderer.reset(new VCLItemRenderer(*m_aRenderDevice.get()));
 
         m_aRenderDevice->SetLineColor();
 
@@ -625,12 +628,12 @@ namespace svt
     }
 
 
-    void PanelTabBar_Impl::impl_renderItemContent( const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent ) const
+    void PanelTabBar_Impl::impl_renderItemContent(vcl::RenderContext& rRenderContext, const PToolPanel& i_pPanel, const Rectangle& i_rContentArea, const TabItemContent i_eItemContent) const
     {
-        OSL_ENSURE( i_eItemContent != TABITEM_AUTO, "PanelTabBar_Impl::impl_renderItemContent: illegal TabItemContent value!" );
+        OSL_ENSURE(i_eItemContent != TABITEM_AUTO, "PanelTabBar_Impl::impl_renderItemContent: illegal TabItemContent value!");
 
-        Rectangle aRenderArea( i_rContentArea );
-        if ( IsVertical() )
+        Rectangle aRenderArea(i_rContentArea);
+        if (IsVertical())
         {
             aRenderArea.Top() += ITEM_OUTER_SPACE;
         }
@@ -640,96 +643,91 @@ namespace svt
         }
 
         // draw the image
-        const Image aItemImage( i_pPanel->GetImage() );
-        const Size aImageSize( aItemImage.GetSizePixel() );
-        const bool bUseImage = !!aItemImage && ( i_eItemContent != TABITEM_TEXT_ONLY );
+        const Image aItemImage(i_pPanel->GetImage());
+        const Size aImageSize(aItemImage.GetSizePixel());
+        const bool bUseImage = !!aItemImage && (i_eItemContent != TABITEM_TEXT_ONLY);
 
-        if ( bUseImage )
+        if (bUseImage)
         {
             Point aImagePos;
-            if ( IsVertical() )
+            if (IsVertical())
             {
-                aImagePos.X() = aRenderArea.Left() + ( aRenderArea.GetWidth() - aImageSize.Width() ) / 2;
+                aImagePos.X() = aRenderArea.Left() + (aRenderArea.GetWidth() - aImageSize.Width()) / 2;
                 aImagePos.Y() = aRenderArea.Top();
             }
             else
             {
                 aImagePos.X() = aRenderArea.Left();
-                aImagePos.Y() = aRenderArea.Top() + ( aRenderArea.GetHeight() - aImageSize.Height() ) / 2;
+                aImagePos.Y() = aRenderArea.Top() + (aRenderArea.GetHeight() - aImageSize.Height()) / 2;
             }
-            m_rTabBar.DrawImage( aImagePos, aItemImage );
+            rRenderContext.DrawImage(aImagePos, aItemImage);
         }
 
-        const OUString sItemText( i_pPanel->GetDisplayName() );
-        const bool bUseText = ( !sItemText.isEmpty() ) && ( i_eItemContent != TABITEM_IMAGE_ONLY );
+        const OUString sItemText(i_pPanel->GetDisplayName());
+        const bool bUseText = (!sItemText.isEmpty()) && (i_eItemContent != TABITEM_IMAGE_ONLY);
 
-        if ( bUseText )
+        if (bUseText)
         {
-            if ( IsVertical() )
+            if (IsVertical())
             {
-                if ( bUseImage )
+                if (bUseImage)
                     aRenderArea.Top() += aImageSize.Height() + ITEM_ICON_TEXT_DISTANCE;
                 aRenderArea.Top() += ITEM_TEXT_FLOW_SPACE;
             }
             else
             {
-                if ( bUseImage )
+                if (bUseImage)
                     aRenderArea.Left() += aImageSize.Width() + ITEM_ICON_TEXT_DISTANCE;
                 aRenderArea.Left() += ITEM_TEXT_FLOW_SPACE;
             }
 
             // draw the text
-            const Size aTextSize( m_rTabBar.GetCtrlTextWidth( sItemText ), m_rTabBar.GetTextHeight() );
-            Point aTextPos( aRenderArea.TopLeft() );
-            if ( IsVertical() )
+            const Size aTextSize(m_rTabBar.GetCtrlTextWidth(sItemText), rRenderContext.GetTextHeight());
+            Point aTextPos(aRenderArea.TopLeft());
+            if (IsVertical())
             {
-                m_rTabBar.Push( PushFlags::FONT );
+                rRenderContext.Push(PushFlags::FONT);
 
-                vcl::Font aFont( m_rTabBar.GetFont() );
-                aFont.SetOrientation( 2700 );
-                aFont.SetVertical( true );
-                m_rTabBar.SetFont( aFont );
+                vcl::Font aFont(rRenderContext.GetFont());
+                aFont.SetOrientation(2700);
+                aFont.SetVertical(true);
+                rRenderContext.SetFont(aFont);
 
                 aTextPos.X() += aTextSize.Height();
-                aTextPos.X() += ( aRenderArea.GetWidth() - aTextSize.Height() ) / 2;
+                aTextPos.X() += (aRenderArea.GetWidth() - aTextSize.Height()) / 2;
             }
             else
             {
-                aTextPos.Y() += ( aRenderArea.GetHeight() - aTextSize.Height() ) / 2;
+                aTextPos.Y() += (aRenderArea.GetHeight() - aTextSize.Height()) / 2;
             }
 
-            m_rTabBar.DrawText( aTextPos, sItemText );
+            rRenderContext.DrawText(aTextPos, sItemText);
 
-            if ( IsVertical() )
+            if (IsVertical())
             {
-                m_rTabBar.Pop();
+                rRenderContext.Pop();
             }
         }
     }
 
-
-    void PanelTabBar_Impl::CopyFromRenderDevice( const Rectangle& i_rLogicalRect ) const
+    void PanelTabBar_Impl::CopyFromRenderDevice(vcl::RenderContext& rRenderContext, const Rectangle& i_rLogicalRect) const
     {
-        BitmapEx aBitmap( m_aRenderDevice->GetBitmapEx(
-            i_rLogicalRect.TopLeft(),
-            Size(
-                i_rLogicalRect.GetSize().Width(),
-                i_rLogicalRect.GetSize().Height()
-            )
-        ) );
-        if ( IsVertical() )
+        BitmapEx aBitmap(m_aRenderDevice->GetBitmapEx(i_rLogicalRect.TopLeft(),
+                                                      Size(i_rLogicalRect.GetSize().Width(),
+                                                           i_rLogicalRect.GetSize().Height())));
+        if (IsVertical())
         {
-            aBitmap.Rotate( 2700, COL_BLACK );
-            if ( m_eTabAlignment == TABS_LEFT )
-                aBitmap.Mirror( BmpMirrorFlags::Horizontal );
+            aBitmap.Rotate(2700, COL_BLACK);
+            if (m_eTabAlignment == TABS_LEFT)
+                aBitmap.Mirror(BmpMirrorFlags::Horizontal);
         }
-        else if ( m_eTabAlignment == TABS_BOTTOM )
+        else if (m_eTabAlignment == TABS_BOTTOM)
         {
-            aBitmap.Mirror( BmpMirrorFlags::Vertical );
+            aBitmap.Mirror(BmpMirrorFlags::Vertical);
         }
 
-        const Rectangle aActualRect( m_aNormalizer.getTransformed( i_rLogicalRect, m_eTabAlignment ) );
-        m_rTabBar.DrawBitmapEx( aActualRect.TopLeft(), aBitmap );
+        const Rectangle aActualRect(m_aNormalizer.getTransformed(i_rLogicalRect, m_eTabAlignment));
+        rRenderContext.DrawBitmapEx(aActualRect.TopLeft(), aBitmap);
     }
 
 
@@ -772,42 +770,42 @@ namespace svt
     }
 
 
-    void PanelTabBar_Impl::DrawItem( const size_t i_nItemIndex, const Rectangle& i_rBoundaries ) const
+    void PanelTabBar_Impl::DrawItem(vcl::RenderContext& rRenderContext, const size_t i_nItemIndex, const Rectangle& i_rBoundaries) const
     {
-        const ItemDescriptor& rItem( m_aItems[ i_nItemIndex ] );
-        const ItemFlags nItemFlags( impl_getItemFlags( i_nItemIndex ) );
+        const ItemDescriptor& rItem(m_aItems[i_nItemIndex]);
+        const ItemFlags nItemFlags(impl_getItemFlags(i_nItemIndex));
 
         // the normalized bounding and content rect
-        const Rectangle aNormalizedContent( GetActualLogicalItemRect( rItem.GetCurrentRect() ) );
-        const Rectangle aNormalizedBounds( m_pRenderer->calculateDecorations( aNormalizedContent, nItemFlags ) );
+        const Rectangle aNormalizedContent(GetActualLogicalItemRect(rItem.GetCurrentRect()));
+        const Rectangle aNormalizedBounds(m_pRenderer->calculateDecorations(aNormalizedContent, nItemFlags));
 
         // check whether the item actually overlaps with the painting area
-        if ( !i_rBoundaries.IsEmpty() )
+        if (!i_rBoundaries.IsEmpty())
         {
-            const Rectangle aItemRect( GetActualLogicalItemRect( rItem.GetCurrentRect() ) );
-            if ( !aItemRect.IsOver( i_rBoundaries ) )
+            const Rectangle aItemRect(GetActualLogicalItemRect(rItem.GetCurrentRect()));
+            if (!aItemRect.IsOver(i_rBoundaries))
                 return;
         }
 
-        m_rTabBar.SetUpdateMode( false );
+        m_rTabBar.SetUpdateMode(false);
 
         // the aligned bounding and content rect
         const Rectangle aActualBounds = m_aNormalizer.getTransformed( aNormalizedBounds, m_eTabAlignment );
         const Rectangle aActualContent = m_aNormalizer.getTransformed( aNormalizedContent, m_eTabAlignment );
 
         // render item "background" layer
-        m_pRenderer->preRenderItem( aNormalizedContent, nItemFlags );
+        m_pRenderer->preRenderItem(aNormalizedContent, nItemFlags);
 
         // copy from the virtual device to ourself
-        CopyFromRenderDevice( aNormalizedBounds );
+        CopyFromRenderDevice(rRenderContext, aNormalizedBounds);
 
         // render the actual item content
-        impl_renderItemContent( rItem.pPanel, aActualContent, rItem.eContent );
+        impl_renderItemContent(rRenderContext, rItem.pPanel, aActualContent, rItem.eContent);
 
         // render item "foreground" layer
-        m_pRenderer->postRenderItem( m_rTabBar, aActualBounds, nItemFlags );
+        m_pRenderer->postRenderItem(m_rTabBar, aActualBounds, nItemFlags);
 
-        m_rTabBar.SetUpdateMode( true );
+        m_rTabBar.SetUpdateMode(true);
     }
 
 
@@ -1044,54 +1042,52 @@ namespace svt
     }
 
 
-    void PanelTabBar::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& i_rRect )
+    void PanelTabBar::Paint(vcl::RenderContext& rRenderContext, const Rectangle& i_rRect)
     {
         m_pImpl->EnsureItemsCache();
 
         // background
-        const Rectangle aNormalizedPaintArea( m_pImpl->m_aNormalizer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) );
-        m_pImpl->m_aRenderDevice->Push( PushFlags::CLIPREGION );
+        const Rectangle aNormalizedPaintArea(m_pImpl->m_aNormalizer.getNormalized(i_rRect, m_pImpl->m_eTabAlignment));
+        m_pImpl->m_aRenderDevice->Push(PushFlags::CLIPREGION);
         m_pImpl->m_aRenderDevice->SetClipRegion(vcl::Region(aNormalizedPaintArea));
         m_pImpl->m_pRenderer->renderBackground();
         m_pImpl->m_aRenderDevice->Pop();
-        m_pImpl->CopyFromRenderDevice( aNormalizedPaintArea );
+        m_pImpl->CopyFromRenderDevice(rRenderContext, aNormalizedPaintArea);
 
         // ensure the items really paint into their own playground only
-        ClipItemRegion aClipItems( *m_pImpl );
+        ClipItemRegion aClipItems(*m_pImpl);
 
-        const Rectangle aLogicalPaintRect( m_pImpl->m_aNormalizer.getNormalized( i_rRect, m_pImpl->m_eTabAlignment ) );
+        const Rectangle aLogicalPaintRect(m_pImpl->m_aNormalizer.getNormalized(i_rRect, m_pImpl->m_eTabAlignment));
 
-        const ::boost::optional< size_t > aActivePanel( m_pImpl->m_rPanelDeck.GetActivePanel() );
-        const ::boost::optional< size_t > aHoveredPanel( m_pImpl->m_aHoveredItem );
+        const boost::optional<size_t> aActivePanel(m_pImpl->m_rPanelDeck.GetActivePanel());
+        const boost::optional<size_t> aHoveredPanel(m_pImpl->m_aHoveredItem);
 
         // items:
         // 1. paint all non-active, non-hovered items
-        size_t i=0;
-        for (   ItemDescriptors::const_iterator item = m_pImpl->m_aItems.begin();
-                item != m_pImpl->m_aItems.end();
-                ++item, ++i
-            )
+        size_t i = 0;
+        ItemDescriptors::const_iterator item;
+        for (item = m_pImpl->m_aItems.begin(); item != m_pImpl->m_aItems.end(); ++item, ++i)
         {
-            if ( i == aActivePanel )
+            if (i == aActivePanel)
                 continue;
 
-            if ( aHoveredPanel == i )
+            if (aHoveredPanel == i)
                 continue;
 
-            m_pImpl->DrawItem( i, aLogicalPaintRect );
+            m_pImpl->DrawItem(rRenderContext, i, aLogicalPaintRect);
         }
 
         // 2. paint the item which is hovered, /without/ the mouse button pressed down
-        if ( !!aHoveredPanel && !m_pImpl->m_bMouseButtonDown )
-            m_pImpl->DrawItem( *aHoveredPanel, aLogicalPaintRect );
+        if (!!aHoveredPanel && !m_pImpl->m_bMouseButtonDown)
+            m_pImpl->DrawItem(rRenderContext, *aHoveredPanel, aLogicalPaintRect);
 
         // 3. paint the active item
-        if ( !!aActivePanel )
-            m_pImpl->DrawItem( *aActivePanel, aLogicalPaintRect );
+        if (!!aActivePanel)
+            m_pImpl->DrawItem(rRenderContext, *aActivePanel, aLogicalPaintRect);
 
         // 4. paint the item which is hovered, /with/ the mouse button pressed down
-        if ( !!aHoveredPanel && m_pImpl->m_bMouseButtonDown )
-            m_pImpl->DrawItem( *aHoveredPanel, aLogicalPaintRect );
+        if (!!aHoveredPanel && m_pImpl->m_bMouseButtonDown)
+            m_pImpl->DrawItem(rRenderContext, *aHoveredPanel, aLogicalPaintRect);
     }
 
 
@@ -1099,25 +1095,25 @@ namespace svt
     {
         m_pImpl->EnsureItemsCache();
 
-        ::boost::optional< size_t > aOldItem( m_pImpl->m_aHoveredItem );
-        ::boost::optional< size_t > aNewItem( m_pImpl->FindItemForPoint( i_rMouseEvent.GetPosPixel() ) );
+        boost::optional< size_t > aOldItem(m_pImpl->m_aHoveredItem);
+        boost::optional< size_t > aNewItem(m_pImpl->FindItemForPoint(i_rMouseEvent.GetPosPixel()));
 
-        if  ( i_rMouseEvent.IsLeaveWindow() )
-            aNewItem = ::boost::optional< size_t >();
+        if (i_rMouseEvent.IsLeaveWindow())
+            aNewItem = boost::optional<size_t>();
 
         bool const bChanged(
                 ( !aOldItem && aNewItem )
                 || ( aOldItem && !aNewItem )
-                || ( aOldItem && aNewItem && aOldItem != aNewItem ) )
-            ;
-        if ( bChanged )
+                || ( aOldItem && aNewItem && aOldItem != aNewItem ) );
+
+        if (bChanged)
         {
-            if ( aOldItem )
+            if (aOldItem)
                 m_pImpl->InvalidateItem( *aOldItem );
 
             m_pImpl->m_aHoveredItem = aNewItem;
 
-            if ( aNewItem )
+            if (aNewItem)
                 m_pImpl->InvalidateItem( *aNewItem );
         }
     }
commit f4147a39374c7692728e8506961f23e59a069c45
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon May 11 18:36:28 2015 +0900

    refactor TableControl to use RenderContext
    
    Change-Id: I4a84cdc8517b69b28fbb8521d0593ae5ed4c3a79

diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index d4b9843..ee7600a 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -36,22 +36,20 @@
 
 namespace svt { namespace table
 {
-
-
-    using ::com::sun::star::uno::Any;
-    using ::com::sun::star::uno::Reference;
-    using ::com::sun::star::uno::UNO_QUERY;
-    using ::com::sun::star::uno::XInterface;
-    using ::com::sun::star::uno::TypeClass_INTERFACE;
-    using ::com::sun::star::graphic::XGraphic;
-    using ::com::sun::star::style::HorizontalAlignment;
-    using ::com::sun::star::style::HorizontalAlignment_LEFT;
-    using ::com::sun::star::style::HorizontalAlignment_CENTER;
-    using ::com::sun::star::style::HorizontalAlignment_RIGHT;
-    using ::com::sun::star::style::VerticalAlignment;
-    using ::com::sun::star::style::VerticalAlignment_TOP;
-    using ::com::sun::star::style::VerticalAlignment_MIDDLE;
-    using ::com::sun::star::style::VerticalAlignment_BOTTOM;
+    using ::css::uno::Any;
+    using ::css::uno::Reference;
+    using ::css::uno::UNO_QUERY;
+    using ::css::uno::XInterface;
+    using ::css::uno::TypeClass_INTERFACE;
+    using ::css::graphic::XGraphic;
+    using ::css::style::HorizontalAlignment;
+    using ::css::style::HorizontalAlignment_LEFT;
+    using ::css::style::HorizontalAlignment_CENTER;
+    using ::css::style::HorizontalAlignment_RIGHT;
+    using ::css::style::VerticalAlignment;
+    using ::css::style::VerticalAlignment_TOP;
+    using ::css::style::VerticalAlignment_MIDDLE;
+    using ::css::style::VerticalAlignment_BOTTOM;
 
 
     //= CachedSortIndicator
@@ -60,26 +58,26 @@ namespace svt { namespace table
     {
     public:
         CachedSortIndicator()
-            :m_lastHeaderHeight( 0 )
-            ,m_lastArrowColor( COL_TRANSPARENT )
+            : m_lastHeaderHeight( 0 )
+            , m_lastArrowColor( COL_TRANSPARENT )
         {
         }
 
-        BitmapEx const & getBitmapFor( OutputDevice const & i_device, long const i_headerHeight, StyleSettings const & i_style, bool const i_sortAscending );
+        BitmapEx const & getBitmapFor(OutputDevice const & i_device, long const i_headerHeight,
+                                      StyleSettings const & i_style, bool const i_sortAscending);
 
     private:
-        long        m_lastHeaderHeight;
-        Color       m_lastArrowColor;
-        BitmapEx    m_sortAscending;
-        BitmapEx    m_sortDescending;
+        long m_lastHeaderHeight;
+        Color m_lastArrowColor;
+        BitmapEx m_sortAscending;
+        BitmapEx m_sortDescending;
     };
 
-
-    BitmapEx const & CachedSortIndicator::getBitmapFor( OutputDevice const & i_device, long const i_headerHeight,
+    BitmapEx const & CachedSortIndicator::getBitmapFor(vcl::RenderContext const& i_device, long const i_headerHeight,
         StyleSettings const & i_style, bool const i_sortAscending )
     {
-        BitmapEx & rBitmap( i_sortAscending ? m_sortAscending : m_sortDescending );
-        if ( !rBitmap || ( i_headerHeight != m_lastHeaderHeight ) || ( i_style.GetActiveColor() != m_lastArrowColor ) )
+        BitmapEx& rBitmap(i_sortAscending ? m_sortAscending : m_sortDescending);
+        if (!rBitmap || (i_headerHeight != m_lastHeaderHeight) || (i_style.GetActiveColor() != m_lastArrowColor))
         {
             long const nSortIndicatorWidth = 2 * i_headerHeight / 3;
             long const nSortIndicatorHeight = 2 * nSortIndicatorWidth / 3;
@@ -89,14 +87,12 @@ namespace svt { namespace table
             ScopedVclPtrInstance< VirtualDevice > aDevice( i_device, 0, 0 );
             aDevice->SetOutputSizePixel( aBitmapSize );
 
-            DecorationView aDecoView( aDevice.get() );
-            aDecoView.DrawSymbol(
-                Rectangle( aBitmapPos, aBitmapSize ),
-                i_sortAscending ? SymbolType::SPIN_UP : SymbolType::SPIN_DOWN,
-                i_style.GetActiveColor()
-            );
+            DecorationView aDecoView(aDevice.get());
+            aDecoView.DrawSymbol(Rectangle(aBitmapPos, aBitmapSize),
+                                 i_sortAscending ? SymbolType::SPIN_UP : SymbolType::SPIN_DOWN,
+                                 i_style.GetActiveColor());
 
-            rBitmap = aDevice->GetBitmapEx( aBitmapPos, aBitmapSize );
+            rBitmap = aDevice->GetBitmapEx(aBitmapPos, aBitmapSize);
             m_lastHeaderHeight = i_headerHeight;
             m_lastArrowColor = i_style.GetActiveColor();
         }
@@ -115,11 +111,11 @@ namespace svt { namespace table
         CellValueConversion aStringConverter;
 
         GridTableRenderer_Impl( ITableModel& _rModel )
-            :rModel( _rModel )
-            ,nCurrentRow( ROW_INVALID )
-            ,bUseGridLines( true )
-            ,aSortIndicator( )
-            ,aStringConverter()
+            : rModel( _rModel )
+            , nCurrentRow( ROW_INVALID )
+            , bUseGridLines( true )
+            , aSortIndicator( )
+            , aStringConverter()
         {
         }
     };
@@ -205,51 +201,48 @@ namespace svt { namespace table
 
     namespace
     {
-        Color lcl_getEffectiveColor(
-            ::boost::optional< ::Color > const & i_modelColor,
-            StyleSettings const & i_styleSettings,
-            ::Color const & ( StyleSettings::*i_getDefaultColor ) () const
-        )
+        Color lcl_getEffectiveColor(boost::optional<Color> const& i_modelColor,
+                                    StyleSettings const& i_styleSettings,
+                                    Color const& (StyleSettings::*i_getDefaultColor) () const)
         {
-            if ( !!i_modelColor )
+            if (!!i_modelColor)
                 return *i_modelColor;
-            return ( i_styleSettings.*i_getDefaultColor )();
+            return (i_styleSettings.*i_getDefaultColor)();
         }
     }
 
 
-    void GridTableRenderer::PaintHeaderArea(
-        OutputDevice& _rDevice, const Rectangle& _rArea, bool _bIsColHeaderArea, bool _bIsRowHeaderArea,
-        const StyleSettings& _rStyle )
+    void GridTableRenderer::PaintHeaderArea(vcl::RenderContext& rRenderContext, const Rectangle& _rArea,
+                                            bool _bIsColHeaderArea, bool _bIsRowHeaderArea, const StyleSettings& _rStyle)
     {
-        OSL_PRECOND( _bIsColHeaderArea || _bIsRowHeaderArea,
-            "GridTableRenderer::PaintHeaderArea: invalid area flags!" );
+        OSL_PRECOND(_bIsColHeaderArea || _bIsRowHeaderArea, "GridTableRenderer::PaintHeaderArea: invalid area flags!");
 
-        _rDevice.Push( PushFlags::FILLCOLOR | PushFlags::LINECOLOR );
+        rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
 
-        Color const background = lcl_getEffectiveColor( m_pImpl->rModel.getHeaderBackgroundColor(), _rStyle, &StyleSettings::GetDialogColor );
-        _rDevice.SetFillColor( background );
+        Color const background = lcl_getEffectiveColor(m_pImpl->rModel.getHeaderBackgroundColor(),
+                                                       _rStyle, &StyleSettings::GetDialogColor);
+        rRenderContext.SetFillColor(background);
 
-        _rDevice.SetLineColor();
-        _rDevice.DrawRect( _rArea );
+        rRenderContext.SetLineColor();
+        rRenderContext.DrawRect(_rArea);
 
         // delimiter lines at bottom/right
-        ::boost::optional< ::Color > aLineColor( m_pImpl->rModel.getLineColor() );
-        ::Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
-        _rDevice.SetLineColor( lineColor );
-        _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
-        _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+        boost::optional<Color> aLineColor(m_pImpl->rModel.getLineColor());
+        Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
+        rRenderContext.SetLineColor(lineColor);
+        rRenderContext.DrawLine(_rArea.BottomLeft(), _rArea.BottomRight());
+        rRenderContext.DrawLine(_rArea.BottomRight(), _rArea.TopRight());
 
-        _rDevice.Pop();
+        rRenderContext.Pop();
         (void)_bIsColHeaderArea;
         (void)_bIsRowHeaderArea;
     }
 
 
-    void GridTableRenderer::PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
-        OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle )
+    void GridTableRenderer::PaintColumnHeader(ColPos _nCol, bool _bActive, bool _bSelected, vcl::RenderContext& rRenderContext,
+                                              const Rectangle& _rArea, const StyleSettings& _rStyle)
     {
-        _rDevice.Push( PushFlags::LINECOLOR);
+        rRenderContext.Push(PushFlags::LINECOLOR);
 
         OUString sHeaderText;
         PColumnModel const pColumn = m_pImpl->rModel.getColumnModel( _nCol );
@@ -257,20 +250,20 @@ namespace svt { namespace table
         if ( !!pColumn )
             sHeaderText = pColumn->getName();
 
-        ::Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getTextColor(), _rStyle, &StyleSettings::GetFieldTextColor );
-        _rDevice.SetTextColor( textColor );
+        Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getTextColor(), _rStyle, &StyleSettings::GetFieldTextColor );
+        rRenderContext.SetTextColor(textColor);
 
         Rectangle const aTextRect( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl, _rArea ) ) );
         sal_uLong nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, _nCol ) | TEXT_DRAW_CLIP;
-        if ( !m_pImpl->rModel.isEnabled() )
+        if (!m_pImpl->rModel.isEnabled())
             nDrawTextFlags |= TEXT_DRAW_DISABLE;
-        _rDevice.DrawText( aTextRect, sHeaderText, nDrawTextFlags );
+        rRenderContext.DrawText( aTextRect, sHeaderText, nDrawTextFlags );
 
-        ::boost::optional< ::Color > const aLineColor( m_pImpl->rModel.getLineColor() );
-        ::Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
-        _rDevice.SetLineColor( lineColor );
-        _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight());
-        _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
+        boost::optional<Color> const aLineColor( m_pImpl->rModel.getLineColor() );
+        Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
+        rRenderContext.SetLineColor( lineColor );
+        rRenderContext.DrawLine( _rArea.BottomRight(), _rArea.TopRight());
+        rRenderContext.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
 
         // draw sort indicator if the model data is sorted by the given column
         ITableDataSort const * pSortAdapter = m_pImpl->rModel.getSortAdapter();
@@ -280,8 +273,8 @@ namespace svt { namespace table
         if ( aCurrentSortOrder.nColumnPos == _nCol )
         {
             long const nHeaderHeight( _rArea.GetHeight() );
-            BitmapEx const aIndicatorBitmap = m_pImpl->aSortIndicator.getBitmapFor( _rDevice, nHeaderHeight, _rStyle,
-                aCurrentSortOrder.eSortDirection == ColumnSortAscending );
+            BitmapEx const aIndicatorBitmap = m_pImpl->aSortIndicator.getBitmapFor(rRenderContext, nHeaderHeight, _rStyle,
+                                                                                   aCurrentSortOrder.eSortDirection == ColumnSortAscending);
             Size const aBitmapSize( aIndicatorBitmap.GetSizePixel() );
             long const nSortIndicatorPaddingX = 2;
             long const nSortIndicatorPaddingY = ( nHeaderHeight - aBitmapSize.Height() ) / 2;
@@ -289,22 +282,18 @@ namespace svt { namespace table
             if ( ( nDrawTextFlags & TEXT_DRAW_RIGHT ) != 0 )
             {
                 // text is right aligned => draw the sort indicator at the left hand side
-                _rDevice.DrawBitmapEx(
-                    Point( _rArea.Left() + nSortIndicatorPaddingX, _rArea.Top() + nSortIndicatorPaddingY ),
-                    aIndicatorBitmap
-                );
+                rRenderContext.DrawBitmapEx(Point(_rArea.Left() + nSortIndicatorPaddingX, _rArea.Top() + nSortIndicatorPaddingY),
+                                            aIndicatorBitmap);
             }
             else
             {
                 // text is left-aligned or centered => draw the sort indicator at the right hand side
-                _rDevice.DrawBitmapEx(
-                    Point( _rArea.Right() - nSortIndicatorPaddingX - aBitmapSize.Width(), nSortIndicatorPaddingY ),
-                    aIndicatorBitmap
-                );
+                rRenderContext.DrawBitmapEx(Point(_rArea.Right() - nSortIndicatorPaddingX - aBitmapSize.Width(), nSortIndicatorPaddingY),
+                                            aIndicatorBitmap);
             }
         }
 
-        _rDevice.Pop();
+        rRenderContext.Pop();
 
         (void)_bActive;
         // no special painting for the active column at the moment
@@ -314,38 +303,38 @@ namespace svt { namespace table
     }
 
 
-    void GridTableRenderer::PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected,
-        OutputDevice& _rDevice, const Rectangle& _rRowArea, const StyleSettings& _rStyle )
+    void GridTableRenderer::PrepareRow(RowPos _nRow, bool i_hasControlFocus, bool _bSelected, vcl::RenderContext& rRenderContext,
+                                       const Rectangle& _rRowArea, const StyleSettings& _rStyle)
     {
         // remember the row for subsequent calls to the other ->ITableRenderer methods
         m_pImpl->nCurrentRow = _nRow;
 
-        _rDevice.Push( PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+        rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
 
-        ::Color backgroundColor = _rStyle.GetFieldColor();
+        Color backgroundColor = _rStyle.GetFieldColor();
 
-        ::boost::optional< ::Color > const aLineColor( m_pImpl->rModel.getLineColor() );
-        ::Color lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
+        boost::optional<Color> const aLineColor( m_pImpl->rModel.getLineColor() );
+        Color lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
 
-        ::Color const activeSelectionBackColor =
-            lcl_getEffectiveColor( m_pImpl->rModel.getActiveSelectionBackColor(), _rStyle, &StyleSettings::GetHighlightColor );
-        if ( _bSelected )
+        Color const activeSelectionBackColor = lcl_getEffectiveColor(m_pImpl->rModel.getActiveSelectionBackColor(),
+                                                                     _rStyle, &StyleSettings::GetHighlightColor);
+        if (_bSelected)
         {
             // selected rows use the background color from the style
             backgroundColor = i_hasControlFocus
-                ?   activeSelectionBackColor
-                :   lcl_getEffectiveColor( m_pImpl->rModel.getInactiveSelectionBackColor(), _rStyle, &StyleSettings::GetDeactiveColor );
-            if ( !aLineColor )
+                ? activeSelectionBackColor
+                : lcl_getEffectiveColor(m_pImpl->rModel.getInactiveSelectionBackColor(), _rStyle, &StyleSettings::GetDeactiveColor);
+            if (!aLineColor)
                 lineColor = backgroundColor;
         }
         else
         {
-            ::boost::optional< ::std::vector< ::Color > > aRowColors = m_pImpl->rModel.getRowBackgroundColors();
-            if ( !aRowColors )
+            boost::optional< std::vector<Color> > aRowColors = m_pImpl->rModel.getRowBackgroundColors();
+            if (!aRowColors)
             {
                 // use alternating default colors
                 Color const fieldColor = _rStyle.GetFieldColor();
-                if ( _rStyle.GetHighContrastMode() || ( ( m_pImpl->nCurrentRow % 2 ) == 0 ) )
+                if (_rStyle.GetHighContrastMode() || ((m_pImpl->nCurrentRow % 2) == 0))
                 {
                     backgroundColor = fieldColor;
                 }
@@ -360,55 +349,53 @@ namespace svt { namespace table
             }
             else
             {
-                if ( aRowColors->empty() )
+                if (aRowColors->empty())
                 {
                     // all colors have the same background color
                     backgroundColor = _rStyle.GetFieldColor();
                 }
                 else
                 {
-                    backgroundColor = aRowColors->at( m_pImpl->nCurrentRow % aRowColors->size() );
+                    backgroundColor = aRowColors->at(m_pImpl->nCurrentRow % aRowColors->size());
                 }
             }
         }
 
-        //m_pImpl->bUseGridLines ? _rDevice.SetLineColor( lineColor ) : _rDevice.SetLineColor();
-        _rDevice.SetLineColor();
-        _rDevice.SetFillColor( backgroundColor );
-        _rDevice.DrawRect( _rRowArea );
+        rRenderContext.SetLineColor();
+        rRenderContext.SetFillColor(backgroundColor);
+        rRenderContext.DrawRect(_rRowArea);
 
-        _rDevice.Pop();
+        rRenderContext.Pop();
     }
 
 
-    void GridTableRenderer::PaintRowHeader( bool i_hasControlFocus, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea,
-        const StyleSettings& _rStyle )
+    void GridTableRenderer::PaintRowHeader(bool /*i_hasControlFocus*/, bool /*_bSelected*/, vcl::RenderContext& rRenderContext,
+                                           const Rectangle& _rArea, const StyleSettings& _rStyle)
     {
-        _rDevice.Push( PushFlags::LINECOLOR | PushFlags::TEXTCOLOR );
+        rRenderContext.Push( PushFlags::LINECOLOR | PushFlags::TEXTCOLOR );
 
-        ::boost::optional< ::Color > const aLineColor( m_pImpl->rModel.getLineColor() );
-        ::Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
-        _rDevice.SetLineColor( lineColor );
-        _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
+        boost::optional<Color> const aLineColor( m_pImpl->rModel.getLineColor() );
+        Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
+        rRenderContext.SetLineColor(lineColor);
+        rRenderContext.DrawLine(_rArea.BottomLeft(), _rArea.BottomRight());
 
         Any const rowHeading( m_pImpl->rModel.getRowHeading( m_pImpl->nCurrentRow ) );
         OUString const rowTitle( m_pImpl->aStringConverter.convertToString( rowHeading ) );
-        if ( !rowTitle.isEmpty() )
+        if (!rowTitle.isEmpty())
         {
-            ::Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getHeaderTextColor(), _rStyle, &StyleSettings::GetFieldTextColor );
-            _rDevice.SetTextColor( textColor );
+            Color const textColor = lcl_getEffectiveColor(m_pImpl->rModel.getHeaderTextColor(),
+                                                          _rStyle, &StyleSettings::GetFieldTextColor);
+            rRenderContext.SetTextColor(textColor);
 
-            Rectangle const aTextRect( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl, _rArea ) ) );
-            sal_uLong nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, 0 ) | TEXT_DRAW_CLIP;
-            if ( !m_pImpl->rModel.isEnabled() )
+            Rectangle const aTextRect(lcl_getTextRenderingArea(lcl_getContentArea(*m_pImpl, _rArea)));
+            sal_uLong nDrawTextFlags = lcl_getAlignmentTextDrawFlags(*m_pImpl, 0) | TEXT_DRAW_CLIP;
+            if (!m_pImpl->rModel.isEnabled())
                 nDrawTextFlags |= TEXT_DRAW_DISABLE;
                 // TODO: is using the horizontal alignment of the 0'th column a good idea here? This is pretty ... arbitray ..
-            _rDevice.DrawText( aTextRect, rowTitle, nDrawTextFlags );
+            rRenderContext.DrawText(aTextRect, rowTitle, nDrawTextFlags);
         }
 
-        (void)i_hasControlFocus;
-        (void)_bSelected;
-        _rDevice.Pop();
+        rRenderContext.Pop();
     }
 
 
@@ -434,14 +421,14 @@ namespace svt { namespace table
     };
 
 
-    void GridTableRenderer::PaintCell( ColPos const i_column, bool _bSelected, bool i_hasControlFocus,
-        OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle )
+    void GridTableRenderer::PaintCell(ColPos const i_column, bool _bSelected, bool i_hasControlFocus,
+                                      vcl::RenderContext& rRenderContext, const Rectangle& _rArea, const StyleSettings& _rStyle)
     {
-        _rDevice.Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
+        rRenderContext.Push(PushFlags::LINECOLOR | PushFlags::FILLCOLOR);
 
-        Rectangle const aContentArea( lcl_getContentArea( *m_pImpl, _rArea ) );
-        CellRenderContext const aRenderContext( _rDevice, aContentArea, _rStyle, i_column, _bSelected, i_hasControlFocus );
-        impl_paintCellContent( aRenderContext );
+        Rectangle const aContentArea(lcl_getContentArea(*m_pImpl, _rArea));
+        CellRenderContext const aCellRenderContext(rRenderContext, aContentArea, _rStyle, i_column, _bSelected, i_hasControlFocus);
+        impl_paintCellContent(aCellRenderContext);
 
         if ( m_pImpl->bUseGridLines )
         {
@@ -456,12 +443,12 @@ namespace svt { namespace table
                     :   lcl_getEffectiveColor( m_pImpl->rModel.getInactiveSelectionBackColor(), _rStyle, &StyleSettings::GetDeactiveColor );
             }
 
-            _rDevice.SetLineColor( lineColor );
-            _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
-            _rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
+            rRenderContext.SetLineColor( lineColor );
+            rRenderContext.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
+            rRenderContext.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
         }
 
-        _rDevice.Pop();
+        rRenderContext.Pop();
     }
 
 
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index 1d11146..4842dc7 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -1197,124 +1197,103 @@ namespace svt { namespace table
     }
 
 
-    void TableControl_Impl::doPaintContent( const Rectangle& _rUpdateRect )
+    void TableControl_Impl::doPaintContent(vcl::RenderContext& rRenderContext, const Rectangle& _rUpdateRect)
     {
-        if ( !getModel() )
+        if (!getModel())
             return;
         PTableRenderer pRenderer = getModel()->getRenderer();
-        DBG_ASSERT( !!pRenderer, "TableDataWindow::doPaintContent: invalid renderer!" );
-        if ( !pRenderer )
+        DBG_ASSERT(!!pRenderer, "TableDataWindow::doPaintContent: invalid renderer!");
+        if (!pRenderer)
             return;
 
         // our current style settings, to be passed to the renderer
-        const StyleSettings& rStyle = m_rAntiImpl.GetSettings().GetStyleSettings();
+        const StyleSettings& rStyle = rRenderContext.GetSettings().GetStyleSettings();
         m_nRowCount = m_pModel->getRowCount();
         // the area occupied by all (at least partially) visible cells, including
         // headers
         Rectangle const aAllCellsWithHeaders( impl_getAllVisibleCellsArea() );
 
-
         // draw the header column area
-        if ( m_pModel->hasColumnHeaders() )
+        if (m_pModel->hasColumnHeaders())
         {
-            TableRowGeometry const aHeaderRow( *this, Rectangle( Point( 0, 0 ),
-                aAllCellsWithHeaders.BottomRight() ), ROW_COL_HEADERS );
+            TableRowGeometry const aHeaderRow(*this, Rectangle(Point(0, 0), aAllCellsWithHeaders.BottomRight()), ROW_COL_HEADERS);
             Rectangle const aColRect(aHeaderRow.getRect());
-            pRenderer->PaintHeaderArea(
-                *m_pDataWindow, aColRect, true, false, rStyle
-            );
+            pRenderer->PaintHeaderArea(rRenderContext, aColRect, true, false, rStyle);
             // Note that strictly, aHeaderRow.getRect() also contains the intersection between column
             // and row header area. However, below we go to paint this intersection, again,
             // so this hopefully doesn't hurt if we already paint it here.
 
-            for ( TableCellGeometry aCell( aHeaderRow, m_nLeftColumn );
-                  aCell.isValid();
-                  aCell.moveRight()
-                )
+            for (TableCellGeometry aCell(aHeaderRow, m_nLeftColumn); aCell.isValid(); aCell.moveRight())
             {
-                if ( _rUpdateRect.GetIntersection( aCell.getRect() ).IsEmpty() )
+                if (_rUpdateRect.GetIntersection(aCell.getRect()).IsEmpty())
                     continue;
 
-                bool isActiveColumn = ( aCell.getColumn() == getCurrentColumn() );
+                bool isActiveColumn = (aCell.getColumn() == getCurrentColumn());
                 bool isSelectedColumn = false;
-                pRenderer->PaintColumnHeader( aCell.getColumn(), isActiveColumn, isSelectedColumn,
-                    *m_pDataWindow, aCell.getRect(), rStyle );
+                pRenderer->PaintColumnHeader(aCell.getColumn(), isActiveColumn, isSelectedColumn, rRenderContext, aCell.getRect(), rStyle);
             }
         }
         // the area occupied by the row header, if any
         Rectangle aRowHeaderArea;
-        if ( m_pModel->hasRowHeaders() )
+        if (m_pModel->hasRowHeaders())
         {
             aRowHeaderArea = aAllCellsWithHeaders;
             aRowHeaderArea.Right() = m_nRowHeaderWidthPixel - 1;
 
-            TableSize const nVisibleRows = impl_getVisibleRows( true );
+            TableSize const nVisibleRows = impl_getVisibleRows(true);
             TableSize nActualRows = nVisibleRows;
-            if ( m_nTopRow + nActualRows > m_nRowCount )
+            if (m_nTopRow + nActualRows > m_nRowCount)
                 nActualRows = m_nRowCount - m_nTopRow;
             aRowHeaderArea.Bottom() = m_nColHeaderHeightPixel + m_nRowHeightPixel * nActualRows - 1;
 
-            pRenderer->PaintHeaderArea( *m_pDataWindow, aRowHeaderArea, false, true, rStyle );
+            pRenderer->PaintHeaderArea(rRenderContext, aRowHeaderArea, false, true, rStyle);
             // Note that strictly, aRowHeaderArea also contains the intersection between column
             // and row header area. However, below we go to paint this intersection, again,
             // so this hopefully doesn't hurt if we already paint it here.
 
-            if ( m_pModel->hasColumnHeaders() )
+            if (m_pModel->hasColumnHeaders())
             {
-                TableCellGeometry const aIntersection( *this, Rectangle( Point( 0, 0 ),
-                    aAllCellsWithHeaders.BottomRight() ), COL_ROW_HEADERS, ROW_COL_HEADERS );
-                Rectangle const aInters( aIntersection.getRect() );
-                pRenderer->PaintHeaderArea(
-                    *m_pDataWindow, aInters, true, true, rStyle
-                );
+                TableCellGeometry const aIntersection(*this, Rectangle(Point(0, 0), aAllCellsWithHeaders.BottomRight()),
+                                                      COL_ROW_HEADERS, ROW_COL_HEADERS);
+                Rectangle const aInters(aIntersection.getRect());
+                pRenderer->PaintHeaderArea(rRenderContext, aInters, true, true, rStyle);
             }
         }
 
-
         // draw the table content row by row
-
         TableSize colCount = getModel()->getColumnCount();
 
         // paint all rows
-        Rectangle const aAllDataCellsArea( impl_getAllVisibleDataCellArea() );
-        for ( TableRowGeometry aRowIterator( *this, aAllCellsWithHeaders, getTopRow() );
-              aRowIterator.isValid();
-              aRowIterator.moveDown() )
+        Rectangle const aAllDataCellsArea(impl_getAllVisibleDataCellArea());
+        for (TableRowGeometry aRowIterator(*this, aAllCellsWithHeaders, getTopRow()); aRowIterator.isValid(); aRowIterator.moveDown())
         {
-            if ( _rUpdateRect.GetIntersection( aRowIterator.getRect() ).IsEmpty() )
+            if (_rUpdateRect.GetIntersection(aRowIterator.getRect() ).IsEmpty())
                 continue;
 
             bool const isControlFocused = m_rAntiImpl.HasControlFocus();
-            bool const isSelectedRow = isRowSelected( aRowIterator.getRow() );
+            bool const isSelectedRow = isRowSelected(aRowIterator.getRow());
 
-            Rectangle const aRect = aRowIterator.getRect().GetIntersection( aAllDataCellsArea );
+            Rectangle const aRect = aRowIterator.getRect().GetIntersection(aAllDataCellsArea);
 
             // give the redenderer a chance to prepare the row
-            pRenderer->PrepareRow(
-                aRowIterator.getRow(), isControlFocused, isSelectedRow,
-                *m_pDataWindow, aRect, rStyle
-            );
+            pRenderer->PrepareRow(aRowIterator.getRow(), isControlFocused, isSelectedRow, rRenderContext, aRect, rStyle);
 
             // paint the row header
-            if ( m_pModel->hasRowHeaders() )
+            if (m_pModel->hasRowHeaders())
             {
-                const Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) );
-                pRenderer->PaintRowHeader( isControlFocused, isSelectedRow, *m_pDataWindow, aCurrentRowHeader,
-                    rStyle );
+                const Rectangle aCurrentRowHeader(aRowHeaderArea.GetIntersection(aRowIterator.getRect()));
+                pRenderer->PaintRowHeader(isControlFocused, isSelectedRow, rRenderContext, aCurrentRowHeader, rStyle);
             }
 
-            if ( !colCount )
+            if (!colCount)
                 continue;
 
             // paint all cells in this row
-            for ( TableCellGeometry aCell( aRowIterator, m_nLeftColumn );
-                  aCell.isValid();
-                  aCell.moveRight()
-                )
+            for (TableCellGeometry aCell(aRowIterator, m_nLeftColumn); aCell.isValid(); aCell.moveRight())
             {
                 bool isSelectedColumn = false;
-                pRenderer->PaintCell( aCell.getColumn(), isSelectedRow || isSelectedColumn, isControlFocused,
-                                *m_pDataWindow, aCell.getRect(), rStyle );
+                pRenderer->PaintCell(aCell.getColumn(), isSelectedRow || isSelectedColumn, isControlFocused,
+                                     rRenderContext, aCell.getRect(), rStyle);
             }
         }
     }
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index 5f7dac6..feadf1c 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -34,11 +34,8 @@
 class ScrollBar;
 class ScrollBarBox;
 
-
 namespace svt { namespace table
 {
-
-
     struct MutableColumnMetrics : protected ColumnMetrics
     {
         MutableColumnMetrics()
@@ -170,7 +167,7 @@ namespace svt { namespace table
 
         /** paints the table control content which intersects with the given rectangle
         */
-        void    doPaintContent( const Rectangle& _rUpdateRect );
+        void    doPaintContent(vcl::RenderContext& rRenderContext, const Rectangle& _rUpdateRect);
 
         /** moves the cursor to the cell with the given coordinates
 
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index fad922d..8691b32 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -17,7 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
 #include "table/tablecontrol.hxx"
 
 #include "tabledatawindow.hxx"
@@ -27,16 +26,9 @@
 #include <vcl/help.hxx>
 #include <vcl/settings.hxx>
 
-
 namespace svt { namespace table
 {
-
-
-    using ::com::sun::star::uno::Any;
-
-
-    //= TableDataWindow
-
+    using css::uno::Any;
 
     TableDataWindow::TableDataWindow( TableControl_Impl& _rTableControl )
         :Window( &_rTableControl.getAntiImpl() )
@@ -60,9 +52,9 @@ namespace svt { namespace table
         Window::dispose();
     }
 
-    void TableDataWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rUpdateRect )
+    void TableDataWindow::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rUpdateRect )
     {
-        m_rTableControl.doPaintContent( rUpdateRect );
+        m_rTableControl.doPaintContent(rRenderContext, rUpdateRect);
     }
 
     void TableDataWindow::SetBackground( const Wallpaper& rColor )
@@ -221,7 +213,7 @@ namespace svt { namespace table
         return nDone || Window::Notify( rNEvt );
     }
 
-} } // namespace svt::table
+}} // namespace svt::table
 
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/table/tabledatawindow.hxx b/svtools/source/table/tabledatawindow.hxx
index 34a1a93..36e0587 100644
--- a/svtools/source/table/tabledatawindow.hxx
+++ b/svtools/source/table/tabledatawindow.hxx
@@ -26,15 +26,9 @@
 
 namespace svt { namespace table
 {
-
-
     class TableControl_Impl;
     class TableFunctionSet;
 
-
-
-    //= TableDataWindow
-
     /** the window containing the content area (including headers) of
         a table control
     */
@@ -51,11 +45,17 @@ namespace svt { namespace table
         virtual ~TableDataWindow();
         virtual void dispose() SAL_OVERRIDE;
 
-        inline void         SetSelectHdl( const Link<>& rLink ) { m_aSelectHdl = rLink; }
-        inline const Link<>& GetSelectHdl() const               { return m_aSelectHdl; }
+        inline void SetSelectHdl(const Link<>& rLink)
+        {
+            m_aSelectHdl = rLink;
+        }
+        inline const Link<>& GetSelectHdl() const
+        {
+            return m_aSelectHdl;
+        }
 
         // Window overridables
-        virtual void        Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
+        virtual void        Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
         virtual void        MouseMove( const MouseEvent& rMEvt) SAL_OVERRIDE;
         virtual void        MouseButtonDown( const MouseEvent& rMEvt) SAL_OVERRIDE;
         virtual void        MouseButtonUp( const MouseEvent& rMEvt) SAL_OVERRIDE;
commit f54212fb24a21401edd6593735898c9b42c09d0f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon May 11 18:03:15 2015 +0900

    refactor SvResizeWindow to use RenderContext
    
    Change-Id: I3c986ff077a6183b6067c5a16a226954fa84b44c

diff --git a/svtools/source/hatchwindow/ipwin.cxx b/svtools/source/hatchwindow/ipwin.cxx
index f0787a1..a04dd8f 100644
--- a/svtools/source/hatchwindow/ipwin.cxx
+++ b/svtools/source/hatchwindow/ipwin.cxx
@@ -106,31 +106,31 @@ void SvResizeHelper::FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const
 |*
 |*    Description
 *************************************************************************/
-void SvResizeHelper::Draw( OutputDevice * pDev )
+void SvResizeHelper::Draw(vcl::RenderContext& rRenderContext)
 {
-    pDev->Push();
-    pDev->SetMapMode( MapMode() );
+    rRenderContext.Push();
+    rRenderContext.SetMapMode( MapMode() );
     Color aColBlack;
     Color aFillColor( COL_LIGHTGRAY );
 
-    pDev->SetFillColor( aFillColor );
-    pDev->SetLineColor();
+    rRenderContext.SetFillColor( aFillColor );
+    rRenderContext.SetLineColor();
 
-    Rectangle   aMoveRects[ 4 ];
+    Rectangle aMoveRects[ 4 ];
     FillMoveRectsPixel( aMoveRects );
     sal_uInt16 i;
-    for( i = 0; i < 4; i++ )
-        pDev->DrawRect( aMoveRects[ i ] );
-    if( bResizeable )
+    for (i = 0; i < 4; i++)
+        rRenderContext.DrawRect(aMoveRects[i]);
+    if (bResizeable)
     {
         // draw handles
-        pDev->SetFillColor( aColBlack );
-        Rectangle   aRects[ 8 ];
-        FillHandleRectsPixel( aRects );
-        for( i = 0; i < 8; i++ )
-            pDev->DrawRect( aRects[ i ] );
+        rRenderContext.SetFillColor(aColBlack);
+        Rectangle aRects[ 8 ];
+        FillHandleRectsPixel(aRects);
+        for (i = 0; i < 8; i++)
+            rRenderContext.DrawRect( aRects[ i ] );
     }
-    pDev->Pop();
+    rRenderContext.Pop();
 }
 
 /*************************************************************************
@@ -612,9 +612,9 @@ void SvResizeWindow::Resize()
 |*
 |*    Description
 *************************************************************************/
-void SvResizeWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle & /*rRect*/ )
+void SvResizeWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle & /*rRect*/ )
 {
-    m_aResizer.Draw( this );
+    m_aResizer.Draw(rRenderContext);
 }
 
 bool SvResizeWindow::PreNotify( NotifyEvent& rEvt )
diff --git a/svtools/source/hatchwindow/ipwin.hxx b/svtools/source/hatchwindow/ipwin.hxx
index c706cae..efc536d 100644
--- a/svtools/source/hatchwindow/ipwin.hxx
+++ b/svtools/source/hatchwindow/ipwin.hxx
@@ -33,31 +33,46 @@ class SvResizeHelper
     Point       aSelPos;
     bool        bResizeable;
 public:
-                SvResizeHelper();
+    SvResizeHelper();
 
-    void        SetResizeable( bool b ) { bResizeable = b; }
-    short       GetGrab() const { return nGrab; }
-    void        SetBorderPixel( const Size & rBorderP )
-                { aBorder = rBorderP; }
-    const Size & GetBorderPixel() const { return aBorder; }
-    const Rectangle & GetOuterRectPixel() const
-                { return aOuter; }
-    void        SetOuterRectPixel( const Rectangle & rRect )
-                { aOuter = rRect; }
-    Rectangle   GetInnerRectPixel() const
-                {
-                    Rectangle aRect( aOuter );
-                    aRect.Top()    += aBorder.Height();
-                    aRect.Left()   += aBorder.Width();
-                    aRect.Bottom() -= aBorder.Height();
-                    aRect.Right()  -= aBorder.Width();
-                    return aRect;
-                }
+    void SetResizeable(bool b)
+    {
+        bResizeable = b;
+    }
+    short GetGrab() const
+    {
+        return nGrab;
+    }
+    void SetBorderPixel(const Size & rBorderP)
+    {
+        aBorder = rBorderP;
+    }
+    const Size& GetBorderPixel() const
+    {
+        return aBorder;
+    }
+    const Rectangle& GetOuterRectPixel() const
+    {
+        return aOuter;
+    }
+    void SetOuterRectPixel(const Rectangle& rRect)
+    {
+        aOuter = rRect;
+    }
+    Rectangle GetInnerRectPixel() const
+    {
+        Rectangle aRect( aOuter );
+        aRect.Top()    += aBorder.Height();
+        aRect.Left()   += aBorder.Width();
+        aRect.Bottom() -= aBorder.Height();
+        aRect.Right()  -= aBorder.Width();
+        return aRect;
+    }
                 // Clockwise, start at upper left
 
     void        FillHandleRectsPixel( Rectangle aRects[ 8 ] ) const;
     void        FillMoveRectsPixel( Rectangle aRects[ 4 ] ) const;
-    void        Draw( OutputDevice * );
+    void        Draw(vcl::RenderContext& rRenderContext);
     void        InvalidateBorder( vcl::Window * );
     bool        SelectBegin( vcl::Window *, const Point & rPos );
     short       SelectMove( vcl::Window * pWin, const Point & rPos );


More information about the Libreoffice-commits mailing list