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

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


 svx/source/tbxctrls/tbcontrl.cxx |   36 +++++++++++++-----------------------
 1 file changed, 13 insertions(+), 23 deletions(-)

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

    draw all entries the same way
    
    Change-Id: I9da3c8dca4db4a02197a67e1fbedd9b525dc7768

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 031aabc2..8817b22 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -582,15 +582,17 @@ void SvxStyleBox_Impl::UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString
 void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
 {
     sal_uInt16 nItem = rUDEvt.GetItemId();
+    OUString aStyleName( GetEntry( nItem ) );
 
-    if ( nItem == 0 || nItem == GetEntryCount() - 1 )
+    OutputDevice *pDevice = rUDEvt.GetDevice();
+    pDevice->Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
+
+    if (nItem == 0 || nItem == GetEntryCount() - 1)
     {
         Rectangle aRect(rUDEvt.GetRect());
         unsigned int nId = (aRect.getY() / aRect.GetSize().Height());
         if(nId < MAX_STYLES_ENTRIES && m_pButtons[nId])
             m_pButtons[nId]->Hide();
-        // draw the non-style entries, ie. "Clear Formatting" or "More..."
-        DrawEntry( rUDEvt, true, true );
     }
     else
     {
@@ -598,8 +600,6 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
         SfxStyleSheetBasePool* pPool = pShell->GetStyleSheetPool();
         SfxStyleSheetBase* pStyle = NULL;
 
-        OUString aStyleName( GetEntry( nItem ) );
-
         if ( pPool )
         {
             pPool->SetSearchMask( eStyleFamily, SFXSTYLEBIT_ALL );
@@ -609,12 +609,7 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
                 pStyle = pPool->Next();
         }
 
-        if ( !pStyle )
-        {
-            // cannot find the style for whatever reason
-            DrawEntry( rUDEvt, true, true );
-        }
-        else
+        if (pStyle )
         {
             const SfxItemSet& aItemSet = pStyle->GetItemSet();
 
@@ -623,8 +618,6 @@ 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() ) );
 
@@ -676,7 +669,6 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
 
                 // setup the device & draw
                 vcl::Font aOldFont( pDevice->GetFont() );
-                pDevice->Push(PushFlags::FILLCOLOR | PushFlags::FONT | PushFlags::TEXTCOLOR);
 
                 Color aFontCol = COL_AUTO, aBackCol = COL_AUTO;
 
@@ -748,18 +740,16 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt )
                         m_pButtons[nId]->Show();
                     }
                 }
-
-                UserDrawEntry(rUDEvt, aStyleName);
-
-                pDevice->Pop();
-
-                // draw separator, if present
-                DrawEntry( rUDEvt, false, false );
             }
-            else
-                DrawEntry( rUDEvt, true, true );
         }
     }
+
+    UserDrawEntry(rUDEvt, aStyleName);
+
+    pDevice->Pop();
+    // draw separator, if present
+    DrawEntry( rUDEvt, false, false );
+
 }
 
 // test is the color between Font- and background-color to be identify


More information about the Libreoffice-commits mailing list