diff options
author | Frank Schönheit <fs@openoffice.org> | 2002-05-24 05:03:26 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2002-05-24 05:03:26 +0000 |
commit | 7472ac575a01842a65fc3216a311cf0f6cb7dddd (patch) | |
tree | d6e5775c82350d3fa4a56e270509ac9c2ca366f2 /svx/source/mnuctrls/clipboardctl.cxx | |
parent | 6557e2c362602476dcafa460cafb531d87efeeec (diff) |
#99030# use the BoolItem in the state to disallow drop-down / use the bindings, not the dispatcher directly
Diffstat (limited to 'svx/source/mnuctrls/clipboardctl.cxx')
-rw-r--r-- | svx/source/mnuctrls/clipboardctl.cxx | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/svx/source/mnuctrls/clipboardctl.cxx b/svx/source/mnuctrls/clipboardctl.cxx index 7ef03efb3125..2f076953b7b5 100644 --- a/svx/source/mnuctrls/clipboardctl.cxx +++ b/svx/source/mnuctrls/clipboardctl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: clipboardctl.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jp $ $Date: 2001-08-16 07:53:09 $ + * last change: $Author: fs $ $Date: 2002-05-24 06:03:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -125,23 +125,22 @@ SvxClipBoardControl::~SvxClipBoardControl() SfxPopupWindow* SvxClipBoardControl::CreatePopupWindow() { - const SfxPoolItem* pState = 0; - SfxDispatcher &rDispatch = *GetBindings().GetDispatcher(); - SfxItemState eState = rDispatch.QueryState( SID_CLIPBOARD_FORMAT_ITEMS, - pState ); - if (eState >= SFX_ITEM_AVAILABLE && pState) + SfxPoolItem* pState = NULL; + SfxItemState eState = GetBindings().QueryState( SID_CLIPBOARD_FORMAT_ITEMS, pState ); + const SvxClipboardFmtItem* pFmtItem = PTR_CAST( SvxClipboardFmtItem, pState ); + + if ( eState >= SFX_ITEM_AVAILABLE && pFmtItem ) { if (pPopup) pPopup->Clear(); else pPopup = new PopupMenu; - const SvxClipboardFmtItem &rFmtItem = *(SvxClipboardFmtItem *) pState; - USHORT nCount = rFmtItem.Count(); + USHORT nCount = pFmtItem->Count(); for (USHORT i = 0; i < nCount; ++i) { - ULONG nFmtID = rFmtItem.GetClipbrdFormatId( i ); - String aFmtStr( rFmtItem.GetClipbrdFormatName( i ) ); + ULONG nFmtID = pFmtItem->GetClipbrdFormatId( i ); + String aFmtStr( pFmtItem->GetClipbrdFormatName( i ) ); if (!aFmtStr.Len()) aFmtStr = SvPasteObjectDialog::GetSotFormatUIName( nFmtID ); pPopup->InsertItem( (USHORT)nFmtID, aFmtStr ); @@ -158,8 +157,11 @@ SfxPopupWindow* SvxClipBoardControl::CreatePopupWindow() rBox.SetItemDown( nId, FALSE ); SfxUInt32Item aItem( SID_CLIPBOARD_FORMAT_ITEMS, pPopup->GetCurItemId() ); - rDispatch.Execute( SID_CLIPBOARD_FORMAT_ITEMS, - SFX_CALLMODE_SYNCHRON, &aItem, 0L ); + const SfxPoolItem* pArgs[] = + { + &aItem, NULL + }; + GetBindings().ExecuteSynchron( SID_CLIPBOARD_FORMAT_ITEMS, pArgs ); } GetToolBox().EndSelection(); @@ -177,6 +179,17 @@ SfxPopupWindowType SvxClipBoardControl::GetPopupWindowType() const void SvxClipBoardControl::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) { + const SfxBoolItem* pDropDownDisabler = PTR_CAST( SfxBoolItem, pState ); + sal_Bool bEnableDropDown = !pDropDownDisabler || pDropDownDisabler->GetValue(); + + // if not, we need to disable the drop-down + if ( bEnableDropDown ) + GetToolBox().SetItemBits( GetId(), GetToolBox().GetItemBits( GetId() ) | TIB_DROPDOWN ); + else + GetToolBox().SetItemBits( GetId(), GetToolBox().GetItemBits( GetId() ) & ~TIB_DROPDOWN ); + GetToolBox().Invalidate( GetToolBox().GetItemRect( GetId() ) ); + + // enable the item as a whole GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SFX_ITEM_DISABLED) ); } |