diff options
-rw-r--r-- | framework/source/layoutmanager/toolbarlayoutmanager.cxx | 6 | ||||
-rw-r--r-- | framework/source/uielement/addonstoolbarmanager.cxx | 2 | ||||
-rw-r--r-- | framework/source/uielement/toolbarmanager.cxx | 4 | ||||
-rw-r--r-- | include/vcl/toolbox.hxx | 17 | ||||
-rw-r--r-- | vcl/inc/toolbox.h | 4 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 12 |
7 files changed, 27 insertions, 20 deletions
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index e264e97db947..e8779f1d9778 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -537,11 +537,11 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL ) if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) { ToolBox* pToolbar = static_cast<ToolBox *>(pWindow); - sal_uInt16 nMenuType = pToolbar->GetMenuType(); + ToolBoxMenuType nMenuType = pToolbar->GetMenuType(); if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, "ConfigureDialog" )) - pToolbar->SetMenuType( nMenuType & ~TOOLBOX_MENUTYPE_CUSTOMIZE ); + pToolbar->SetMenuType( nMenuType & ~ToolBoxMenuType::Customize ); else - pToolbar->SetMenuType( nMenuType | TOOLBOX_MENUTYPE_CUSTOMIZE ); + pToolbar->SetMenuType( nMenuType | ToolBoxMenuType::Customize ); } bNotify = true; diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx index 0154bddb5f81..fe3aadc5b9bc 100644 --- a/framework/source/uielement/addonstoolbarmanager.cxx +++ b/framework/source/uielement/addonstoolbarmanager.cxx @@ -80,7 +80,7 @@ AddonsToolBarManager::AddonsToolBarManager( const Reference< XComponentContext > ToolBox* pToolBar ) : ToolBarManager( rxContext, rFrame, rResourceName, pToolBar ) { - m_pToolBar->SetMenuType( TOOLBOX_MENUTYPE_CLIPPEDITEMS ); + m_pToolBar->SetMenuType( ToolBoxMenuType::ClippedItems ); m_pToolBar->SetSelectHdl( LINK( this, AddonsToolBarManager, Select) ); m_pToolBar->SetClickHdl( LINK( this, AddonsToolBarManager, Click ) ); m_pToolBar->SetDoubleClickHdl( LINK( this, AddonsToolBarManager, DoubleClick ) ); diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 1a6eacab14f3..4eb687710dd0 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -167,9 +167,9 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, // enables a menu for clipped items and customization SvtCommandOptions aCmdOptions; - sal_uInt16 nMenuType = TOOLBOX_MENUTYPE_CLIPPEDITEMS; + ToolBoxMenuType nMenuType = ToolBoxMenuType::ClippedItems; if ( !aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, "CreateDialog")) - nMenuType |= TOOLBOX_MENUTYPE_CUSTOMIZE; + nMenuType |= ToolBoxMenuType::Customize; m_pToolBar->SetCommandHdl( LINK( this, ToolBarManager, Command ) ); m_pToolBar->SetMenuType( nMenuType ); diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index d559c59c7d9e..408964f3a739 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -25,6 +25,7 @@ #include <vcl/dllapi.h> #include <vcl/dockwin.hxx> #include <vcl/image.hxx> +#include <o3tl/typed_flags_set.hxx> #include <vector> #include <com/sun/star/frame/XFrame.hpp> @@ -47,9 +48,15 @@ class PopupMenu; #define TOOLBOX_MENUITEM_START ((sal_uInt16)0x1000) // defines for the menubutton -#define TOOLBOX_MENUTYPE_NONE ((sal_uInt16)0x0000) // no menu at all, scrolling by spin buttons -#define TOOLBOX_MENUTYPE_CLIPPEDITEMS ((sal_uInt16)0x0001) // menu will contain "more" indicator -#define TOOLBOX_MENUTYPE_CUSTOMIZE ((sal_uInt16)0x0002) // menu will contain "customization" and "more" indicator +enum class ToolBoxMenuType { + NONE = 0x0000, // no menu at all, scrolling by spin buttons + ClippedItems = 0x0001, // menu will contain "more" indicator + Customize = 0x0002 // menu will contain "customization" and "more" indicator +}; +namespace o3tl +{ + template<> struct typed_flags<ToolBoxMenuType> : is_typed_flags<ToolBoxMenuType, 0x0003> {}; +} // small or large force an exact toolbox size for proper alignemnt // dontcare will let the toolbox decide about its size @@ -477,8 +484,8 @@ public: // the private toolbox items will only use item ids starting from TOOLBOX_MENUITEM_START // to allow for customization of the menu the coresponding handler is called // when the menu button was clicked and before the menu is executed - void SetMenuType( sal_uInt16 aType = TOOLBOX_MENUTYPE_CUSTOMIZE ); - sal_uInt16 GetMenuType() const; + void SetMenuType( ToolBoxMenuType aType = ToolBoxMenuType::Customize ); + ToolBoxMenuType GetMenuType() const; bool IsMenuEnabled() const; PopupMenu* GetMenu() const; void UpdateCustomMenu(); diff --git a/vcl/inc/toolbox.h b/vcl/inc/toolbox.h index 5ecd438ee860..2f412bf67b12 100644 --- a/vcl/inc/toolbox.h +++ b/vcl/inc/toolbox.h @@ -133,8 +133,8 @@ struct ImplToolBoxPrivateData ToolBoxButtonSize meButtonSize; // the optional custom menu - PopupMenu* mpMenu; - sal_uInt16 maMenuType; + PopupMenu* mpMenu; + ToolBoxMenuType maMenuType; ImplSVEvent * mnEventId; // called when menu button is clicked and before the popup menu is executed diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 09d35239204f..4fa7ecaefff0 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -881,7 +881,7 @@ void ToolBox::ImplSetMinMaxFloatSize( ToolBox *pThis ) { pWrapper->SetMinOutputSizePixel( aMinSize ); pWrapper->SetMaxOutputSizePixel( aMaxSize ); - pWrapper->ShowTitleButton( TitleButton::Menu, ( pThis->GetMenuType() & TOOLBOX_MENUTYPE_CUSTOMIZE) != 0 ); + pWrapper->ShowTitleButton( TitleButton::Menu, bool( pThis->GetMenuType() & ToolBoxMenuType::Customize) ); } else { diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 83a517618b9f..7a93e507f185 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -53,7 +53,7 @@ ImplToolBoxPrivateData::ImplToolBoxPrivateData() : mpMenu = new PopupMenu(); mnEventId = nullptr; - maMenuType = TOOLBOX_MENUTYPE_NONE; + maMenuType = ToolBoxMenuType::NONE; maMenubuttonItem.maItemSize = Size( TB_MENUBUTTON_SIZE+TB_MENUBUTTON_OFFSET, TB_MENUBUTTON_SIZE+TB_MENUBUTTON_OFFSET ); maMenubuttonItem.meState = TRISTATE_FALSE; mnMenuButtonWidth = TB_MENUBUTTON_SIZE; @@ -1737,7 +1737,7 @@ void ToolBox::SetDropdownClickHdl( const Link<ToolBox *, void>& rLink ) } } -void ToolBox::SetMenuType( sal_uInt16 aType ) +void ToolBox::SetMenuType( ToolBoxMenuType aType ) { if( aType != mpData->maMenuType ) { @@ -1747,7 +1747,7 @@ void ToolBox::SetMenuType( sal_uInt16 aType ) // the menu button may have to be moved into the decoration which changes the layout ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this ); if( pWrapper ) - pWrapper->ShowTitleButton( TitleButton::Menu, ( aType & TOOLBOX_MENUTYPE_CUSTOMIZE) != 0 ); + pWrapper->ShowTitleButton( TitleButton::Menu, bool( aType & ToolBoxMenuType::Customize) ); mbFormat = true; ImplFormat(); @@ -1762,14 +1762,14 @@ void ToolBox::SetMenuType( sal_uInt16 aType ) } } -sal_uInt16 ToolBox::GetMenuType() const +ToolBoxMenuType ToolBox::GetMenuType() const { return mpData->maMenuType; } bool ToolBox::IsMenuEnabled() const { - return mpData->maMenuType != TOOLBOX_MENUTYPE_NONE; + return mpData->maMenuType != ToolBoxMenuType::NONE; } PopupMenu* ToolBox::GetMenu() const @@ -1894,7 +1894,7 @@ void ToolBox::ImplExecuteCustomMenu() { if( IsMenuEnabled() ) { - if( GetMenuType() & TOOLBOX_MENUTYPE_CUSTOMIZE ) + if( GetMenuType() & ToolBoxMenuType::Customize ) // call button handler to allow for menu customization mpData->maMenuButtonHdl.Call( this ); |