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

Caolán McNamara caolanm at redhat.com
Wed Jan 22 04:26:00 PST 2014


 svx/source/tbxctrls/tbcontrl.cxx |   47 +++++++++++++--------------------------
 1 file changed, 16 insertions(+), 31 deletions(-)

New commits:
commit 3b0cf674925dd8fd0f34c5a810afc470ce5b4a0f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 22 12:11:17 2014 +0000

    Resolves: fdo#72989 color buttons not disabled in readonly docs
    
    we we not calling EnableItem for most of the color options so it didn't get
    disabled in readonly mode, and anyway it was using nSID as the itemid rather
    than getId() so even if EnableItem was called it didn't have an effect.
    
    Change-Id: Ia7b55d78d369a79d3e45c8407f859d47fceac753

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 5118449..725c50c0 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2547,41 +2547,26 @@ void SvxColorExtToolBoxControl::StateChanged(
     sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
 
 {
-    const SvxColorItem* pItem = 0;
-    if ( bChoiceFromPalette && nSID == GetSlotId() )
+    if (nSID == GetSlotId())
     {
-        bChoiceFromPalette = sal_False;
-        switch( nSID )
-        {
-            case SID_ATTR_CHAR_COLOR :
-            case SID_ATTR_CHAR_COLOR2 :
-            case SID_ATTR_CHAR_COLOR_BACKGROUND :
-            case SID_BACKGROUND_COLOR :
-                if ( SFX_ITEM_DONTCARE != eState )
-                    pItem = PTR_CAST( SvxColorItem, pState );
+        ToolBox& rTbx = GetToolBox();
+        sal_uInt16 nId = GetId();
+        rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
+        rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
 
-                if ( pItem )
-                {
-                    pBtnUpdater->Update( pItem->GetValue() );
-                    mLastColor = pItem->GetValue();
-                }
-                break;
+        if (bChoiceFromPalette)
+        {
+            bChoiceFromPalette = sal_False;
 
-            case SID_FRAME_LINECOLOR :
-                ToolBox& rTbx = GetToolBox();
-                rTbx.EnableItem( nSID, SFX_ITEM_DISABLED != eState );
-                rTbx.SetItemState( nSID, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
+            const SvxColorItem* pItem = 0;
+            if ( SFX_ITEM_DONTCARE != eState )
+                pItem = PTR_CAST( SvxColorItem, pState );
 
-                if ( SFX_ITEM_DONTCARE != eState )
-                {
-                    pItem = PTR_CAST( SvxColorItem, pState );
-                    if ( pItem )
-                    {
-                        pBtnUpdater->Update( pItem->GetValue());
-                        mLastColor = pItem->GetValue();
-                    }
-                }
-                break;
+            if ( pItem )
+            {
+                pBtnUpdater->Update( pItem->GetValue() );
+                mLastColor = pItem->GetValue();
+            }
         }
     }
 }


More information about the Libreoffice-commits mailing list