diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-03-08 21:37:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-11 14:10:30 +0100 |
commit | 1692998399eecb79e7b59456cff805bcb77aece4 (patch) | |
tree | 8cc22c633e88f19c39f5736e87a0934f041729de /framework/inc | |
parent | 665a2b477dd4f412b42ffb58a183f7a702cd7645 (diff) |
use strong_int for item ids in vcl::ToolBox
(*) fix bug in SfxToolBoxControl::StateChanged where it was using the slot id
instead of the toolbox item id
(*) I left the logic in SbaTableQueryBrowser alone, but it looks suspicious,
casting slot ids to toolbox ids
Change-Id: Ied229164c27fb4456b0515c6fdcbd1682766a1a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112186
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/inc')
12 files changed, 21 insertions, 19 deletions
diff --git a/framework/inc/uielement/FixedImageToolbarController.hxx b/framework/inc/uielement/FixedImageToolbarController.hxx index 66533fbc9cde..30359a051b20 100644 --- a/framework/inc/uielement/FixedImageToolbarController.hxx +++ b/framework/inc/uielement/FixedImageToolbarController.hxx @@ -36,7 +36,7 @@ class FixedImageToolbarController final : public ComplexToolbarController public: FixedImageToolbarController(const css::uno::Reference<css::uno::XComponentContext>& rxContext, const css::uno::Reference<css::frame::XFrame>& rFrame, - ToolBox* pToolBar, sal_uInt16 nID, const OUString& aCommand); + ToolBox* pToolBar, ToolBoxItemId nID, const OUString& aCommand); // XComponent virtual void SAL_CALL dispose() override; diff --git a/framework/inc/uielement/FixedTextToolbarController.hxx b/framework/inc/uielement/FixedTextToolbarController.hxx index 3d257414b6d2..b51d0de53654 100644 --- a/framework/inc/uielement/FixedTextToolbarController.hxx +++ b/framework/inc/uielement/FixedTextToolbarController.hxx @@ -36,7 +36,7 @@ class FixedTextToolbarController final : public ComplexToolbarController public: FixedTextToolbarController(const css::uno::Reference<css::uno::XComponentContext>& rxContext, const css::uno::Reference<css::frame::XFrame>& rFrame, - ToolBox* pToolBar, sal_uInt16 nID, const OUString& aCommand); + ToolBox* pToolBar, ToolBoxItemId nID, const OUString& aCommand); // XComponent virtual void SAL_CALL dispose() override; diff --git a/framework/inc/uielement/comboboxtoolbarcontroller.hxx b/framework/inc/uielement/comboboxtoolbarcontroller.hxx index 8dcf79b03510..4762d595ace9 100644 --- a/framework/inc/uielement/comboboxtoolbarcontroller.hxx +++ b/framework/inc/uielement/comboboxtoolbarcontroller.hxx @@ -36,7 +36,7 @@ class ComboboxToolbarController final : public ComplexToolbarController ComboboxToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ); virtual ~ComboboxToolbarController() override; diff --git a/framework/inc/uielement/commandinfo.hxx b/framework/inc/uielement/commandinfo.hxx index b2c7c3e880a9..de3bee8ee88f 100644 --- a/framework/inc/uielement/commandinfo.hxx +++ b/framework/inc/uielement/commandinfo.hxx @@ -21,6 +21,7 @@ #define INCLUDED_FRAMEWORK_INC_UIELEMENT_COMMANDINFO_HXX #include <rtl/ustring.hxx> +#include <vcl/toolbox.hxx> #include <unordered_map> #include <vector> @@ -33,8 +34,8 @@ struct CommandInfo CommandInfo() : nId( 0 ), nImageInfo( 0 ) {} - sal_uInt16 nId; - ::std::vector< sal_uInt16 > aIds; + ToolBoxItemId nId; + ::std::vector< ToolBoxItemId > aIds; sal_Int16 nImageInfo; }; diff --git a/framework/inc/uielement/complextoolbarcontroller.hxx b/framework/inc/uielement/complextoolbarcontroller.hxx index 5036943299e9..5855d2cb41b3 100644 --- a/framework/inc/uielement/complextoolbarcontroller.hxx +++ b/framework/inc/uielement/complextoolbarcontroller.hxx @@ -43,7 +43,7 @@ class ComplexToolbarController : public svt::ToolboxController ComplexToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, const OUString& aCommand ); virtual ~ComplexToolbarController() override; @@ -88,7 +88,7 @@ class ComplexToolbarController : public svt::ToolboxController void notifyTextChanged( const OUString& aText ); VclPtr<ToolBox> m_xToolbar; - sal_uInt16 m_nID; + ToolBoxItemId m_nID; bool m_bMadeInvisible; mutable css::util::URL m_aURL; css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; diff --git a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx index eb95c142cef3..d9f1664dfc87 100644 --- a/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx +++ b/framework/inc/uielement/dropdownboxtoolbarcontroller.hxx @@ -39,7 +39,7 @@ class DropdownToolbarController final : public ComplexToolbarController DropdownToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ); virtual ~DropdownToolbarController() override; diff --git a/framework/inc/uielement/edittoolbarcontroller.hxx b/framework/inc/uielement/edittoolbarcontroller.hxx index 21e7f6935f6d..e7acaafe8aae 100644 --- a/framework/inc/uielement/edittoolbarcontroller.hxx +++ b/framework/inc/uielement/edittoolbarcontroller.hxx @@ -38,7 +38,7 @@ class EditToolbarController final : public ComplexToolbarController EditToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ); virtual ~EditToolbarController() override; diff --git a/framework/inc/uielement/imagebuttontoolbarcontroller.hxx b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx index 9b625059717f..0888e390b037 100644 --- a/framework/inc/uielement/imagebuttontoolbarcontroller.hxx +++ b/framework/inc/uielement/imagebuttontoolbarcontroller.hxx @@ -37,7 +37,7 @@ class ImageButtonToolbarController final : public ComplexToolbarController ImageButtonToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, const OUString& aCommand ); virtual ~ImageButtonToolbarController() override; diff --git a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx index beb95049a206..80a0d26ebdc0 100644 --- a/framework/inc/uielement/spinfieldtoolbarcontroller.hxx +++ b/framework/inc/uielement/spinfieldtoolbarcontroller.hxx @@ -39,7 +39,7 @@ class SpinfieldToolbarController final : public ComplexToolbarController SpinfieldToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, sal_Int32 nWidth, const OUString& aCommand ); virtual ~SpinfieldToolbarController() override; diff --git a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx index 9e667da83ba0..aeab78785556 100644 --- a/framework/inc/uielement/togglebuttontoolbarcontroller.hxx +++ b/framework/inc/uielement/togglebuttontoolbarcontroller.hxx @@ -51,7 +51,7 @@ class ToggleButtonToolbarController final : public ComplexToolbarController ToggleButtonToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolBar, - sal_uInt16 nID, + ToolBoxItemId nID, Style eStyle, const OUString& aCommand ); virtual ~ToggleButtonToolbarController() override; diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index d77ae16312aa..3b5e37d8dbb0 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -41,6 +41,7 @@ #include <tools/link.hxx> #include <vcl/window.hxx> #include <vcl/timer.hxx> +#include <vcl/toolbox.hxx> #include <unordered_map> @@ -141,7 +142,7 @@ class ToolBarManager final : public ToolbarManager_Base void setToolBarImage(const Image& _aImage,const CommandToInfoMap::const_iterator& _pIter); void impl_elementChanged(bool _bRemove,const css::ui::ConfigurationEvent& Event ); - typedef std::unordered_map< sal_uInt16, css::uno::Reference< css::frame::XStatusListener > > ToolBarControllerMap; + typedef std::unordered_map< ToolBoxItemId, css::uno::Reference< css::frame::XStatusListener > > ToolBarControllerMap; typedef ::std::vector< css::uno::Reference< css::frame::XSubToolbarController > > SubToolBarControllerVector; typedef std::unordered_map<OUString, SubToolBarControllerVector> SubToolBarToSubToolBarControllerMap; diff --git a/framework/inc/uielement/toolbarmerger.hxx b/framework/inc/uielement/toolbarmerger.hxx index bd07bb17e7e4..01defd7b2e0f 100644 --- a/framework/inc/uielement/toolbarmerger.hxx +++ b/framework/inc/uielement/toolbarmerger.hxx @@ -81,7 +81,7 @@ class ToolBarMerger static bool ProcessMergeOperation( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, @@ -89,7 +89,7 @@ class ToolBarMerger const AddonToolbarItemContainer& rItems ); static bool ProcessMergeFallback( ToolBox* pToolbar, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, @@ -99,14 +99,14 @@ class ToolBarMerger static void MergeItems( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, sal_uInt16 nModIndex, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer& rAddonToolbarItems ); static void ReplaceItem( ToolBox* pToolbar, ToolBox::ImplToolItems::size_type nPos, - sal_uInt16& rItemId, + ToolBoxItemId& rItemId, CommandToInfoMap& rCommandMap, std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer& rAddonToolbarItems ); @@ -120,13 +120,13 @@ class ToolBarMerger const css::uno::Reference< css::frame::XFrame > & xFrame, ToolBox* pToolbar, const OUString& rCommandURL, - sal_uInt16 nId, + ToolBoxItemId nId, sal_uInt16 nWidth, std::u16string_view rControlType ); static void CreateToolbarItem( ToolBox* pToolbox, ToolBox::ImplToolItems::size_type nPos, - sal_uInt16 nItemId, + ToolBoxItemId nItemId, const AddonToolbarItem& rAddonToolbarItem ); private: |