Kaydet (Commit) 18ab9180 authored tarafından Thomas Lange's avatar Thomas Lange

#103417# dropdown list for paste icon in function bar fixed

üst b4e33c4f
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: clipboardctl.hxx,v $ * $RCSfile: clipboardctl.hxx,v $
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: tl $ $Date: 2001-03-30 14:21:22 $ * last change: $Author: tl $ $Date: 2002-09-20 13:06:57 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -74,10 +74,13 @@ ...@@ -74,10 +74,13 @@
class PopupMenu; class PopupMenu;
class SvxClipboardFmtItem;
class SvxClipBoardControl : public SfxToolBoxControl class SvxClipBoardControl : public SfxToolBoxControl
{ {
SfxStatusForwarder aForwarder;
SfxPoolItem* pClipboardFmtItem;
PopupMenu* pPopup; PopupMenu* pPopup;
USHORT nItemId; USHORT nItemId;
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: clipboardctl.cxx,v $ * $RCSfile: clipboardctl.cxx,v $
* *
* $Revision: 1.4 $ * $Revision: 1.5 $
* *
* last change: $Author: fs $ $Date: 2002-05-24 06:03:26 $ * last change: $Author: tl $ $Date: 2002-09-20 13:07:15 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -109,7 +109,9 @@ SvxClipBoardControl::SvxClipBoardControl( ...@@ -109,7 +109,9 @@ SvxClipBoardControl::SvxClipBoardControl(
SfxToolBoxControl( nId, rTbx, rBind ), SfxToolBoxControl( nId, rTbx, rBind ),
pPopup (0), pPopup (0),
nItemId (nId) nItemId (nId),
aForwarder( SID_CLIPBOARD_FORMAT_ITEMS, *this ),
pClipboardFmtItem( 0 )
{ {
ToolBox& rBox = GetToolBox(); ToolBox& rBox = GetToolBox();
rBox.SetItemBits( nId, TIB_DROPDOWN | rBox.GetItemBits( nId ) ); rBox.SetItemBits( nId, TIB_DROPDOWN | rBox.GetItemBits( nId ) );
...@@ -120,16 +122,14 @@ SvxClipBoardControl::SvxClipBoardControl( ...@@ -120,16 +122,14 @@ SvxClipBoardControl::SvxClipBoardControl(
SvxClipBoardControl::~SvxClipBoardControl() SvxClipBoardControl::~SvxClipBoardControl()
{ {
DelPopup(); DelPopup();
delete pClipboardFmtItem;
} }
SfxPopupWindow* SvxClipBoardControl::CreatePopupWindow() SfxPopupWindow* SvxClipBoardControl::CreatePopupWindow()
{ {
SfxPoolItem* pState = NULL; const SvxClipboardFmtItem* pFmtItem = PTR_CAST( SvxClipboardFmtItem, pClipboardFmtItem );
SfxItemState eState = GetBindings().QueryState( SID_CLIPBOARD_FORMAT_ITEMS, pState ); if ( pFmtItem )
const SvxClipboardFmtItem* pFmtItem = PTR_CAST( SvxClipboardFmtItem, pState );
if ( eState >= SFX_ITEM_AVAILABLE && pFmtItem )
{ {
if (pPopup) if (pPopup)
pPopup->Clear(); pPopup->Clear();
...@@ -179,18 +179,27 @@ SfxPopupWindowType SvxClipBoardControl::GetPopupWindowType() const ...@@ -179,18 +179,27 @@ SfxPopupWindowType SvxClipBoardControl::GetPopupWindowType() const
void SvxClipBoardControl::StateChanged( void SvxClipBoardControl::StateChanged(
USHORT nSID, SfxItemState eState, const SfxPoolItem* pState ) USHORT nSID, SfxItemState eState, const SfxPoolItem* pState )
{ {
const SfxBoolItem* pDropDownDisabler = PTR_CAST( SfxBoolItem, pState ); if (SID_CLIPBOARD_FORMAT_ITEMS == nSID)
sal_Bool bEnableDropDown = !pDropDownDisabler || pDropDownDisabler->GetValue(); {
DELETEZ(pClipboardFmtItem);
// if not, we need to disable the drop-down if (eState >= SFX_ITEM_AVAILABLE)
if ( bEnableDropDown ) pClipboardFmtItem = pState->Clone();
GetToolBox().SetItemBits( GetId(), GetToolBox().GetItemBits( GetId() ) | TIB_DROPDOWN ); }
else else
GetToolBox().SetItemBits( GetId(), GetToolBox().GetItemBits( GetId() ) & ~TIB_DROPDOWN ); {
GetToolBox().Invalidate( GetToolBox().GetItemRect( GetId() ) ); 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 // enable the item as a whole
GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SFX_ITEM_DISABLED) ); GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SFX_ITEM_DISABLED) );
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment