summaryrefslogtreecommitdiff
path: root/svx/source/tbxctrls/tbcontrl.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-01-22 12:11:17 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-01-22 12:25:28 +0000
commit3b0cf674925dd8fd0f34c5a810afc470ce5b4a0f (patch)
tree3e76537c6cc61a0910af755693a33087b19cefa5 /svx/source/tbxctrls/tbcontrl.cxx
parent4aa04075fbfcecd33a5c257e69d0c5858fcfb973 (diff)
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
Diffstat (limited to 'svx/source/tbxctrls/tbcontrl.cxx')
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx47
1 files changed, 16 insertions, 31 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 5118449c165d..725c50c004f7 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();
+ }
}
}
}