[Libreoffice-commits] core.git: svx/source

Caolán McNamara caolanm at redhat.com
Tue Apr 21 07:32:04 PDT 2015


 svx/source/tbxctrls/tbcontrl.cxx |   26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

New commits:
commit e367337e58047c4c69869330b36c1f027f5ca5f0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 21 15:27:33 2015 +0100

    split out the code that sets up the device for each entry
    
    Change-Id: Iad426e1cb1eaac24edf1e7bb61307f29d33d8786

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 8817b22..a1c1c7d 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -158,6 +158,7 @@ private:
 
     void            ReleaseFocus();
     Color           TestColorsVisible(const Color &FontCol, const Color &BackCol);
+    void            SetupEntry(const UserDrawEvent& rUDEvt, const OUString &rStyleName);
     void            UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString &rStyleName);
     DECL_LINK( MenuSelectHdl, Menu * );
 };
@@ -578,15 +579,9 @@ void SvxStyleBox_Impl::UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString
     pDevice->DrawText(aPos, rStyleName);
 }
 
-
-void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
+void SvxStyleBox_Impl::SetupEntry(const UserDrawEvent& rUDEvt, const OUString& rStyleName)
 {
     sal_uInt16 nItem = rUDEvt.GetItemId();
-    OUString aStyleName( GetEntry( nItem ) );
-
-    OutputDevice *pDevice = rUDEvt.GetDevice();
-    pDevice->Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
-
     if (nItem == 0 || nItem == GetEntryCount() - 1)
     {
         Rectangle aRect(rUDEvt.GetRect());
@@ -605,7 +600,7 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
             pPool->SetSearchMask( eStyleFamily, SFXSTYLEBIT_ALL );
 
             pStyle = pPool->First();
-            while ( pStyle && OUString( pStyle->GetName() ) != aStyleName )
+            while (pStyle && pStyle->GetName() != rStyleName)
                 pStyle = pPool->Next();
         }
 
@@ -618,6 +613,8 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
 
             if ( pFontItem && pFontHeightItem )
             {
+                OutputDevice *pDevice = rUDEvt.GetDevice();
+
                 Size aFontSize( 0, pFontHeightItem->GetHeight() );
                 Size aPixelSize( pDevice->LogicToPixel( aFontSize, pShell->GetMapUnit() ) );
 
@@ -743,6 +740,17 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
             }
         }
     }
+}
+
+void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
+{
+    sal_uInt16 nItem = rUDEvt.GetItemId();
+    OUString aStyleName( GetEntry( nItem ) );
+
+    OutputDevice *pDevice = rUDEvt.GetDevice();
+    pDevice->Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
+
+    SetupEntry(rUDEvt, aStyleName);
 
     UserDrawEntry(rUDEvt, aStyleName);
 
@@ -2097,7 +2105,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
     if ( pStyleSheetPool && pBox && nActFamily!=0xffff )
     {
         const SfxStyleFamily    eFamily     = GetActFamily();
-        sal_uInt16                  nCount      = pStyleSheetPool->Count();
+        sal_uInt16              nCount      = pStyleSheetPool->Count();
         SfxStyleSheetBase*      pStyle      = NULL;
         bool                    bDoFill     = false;
 


More information about the Libreoffice-commits mailing list