From 1692998399eecb79e7b59456cff805bcb77aece4 Mon Sep 17 00:00:00 2001 From: Noel Date: Mon, 8 Mar 2021 21:37:43 +0200 Subject: 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 --- include/sfx2/tbxctrl.hxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include/sfx2/tbxctrl.hxx') diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx index daa9d77b84ac..65d44088629e 100644 --- a/include/sfx2/tbxctrl.hxx +++ b/include/sfx2/tbxctrl.hxx @@ -35,9 +35,9 @@ class InterimItemWindow; class SfxToolBoxControl; class SfxModule; -rtl::Reference SfxToolBoxControllerFactory( const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const OUString& aCommandURL ); +rtl::Reference SfxToolBoxControllerFactory( const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolbox, ToolBoxItemId nID, const OUString& aCommandURL ); -typedef rtl::Reference (*SfxToolBoxControlCtor)( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox ); +typedef rtl::Reference (*SfxToolBoxControlCtor)( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rBox ); struct SfxTbxCtrlFactory { @@ -55,7 +55,7 @@ struct SfxTbxCtrlFactory #define SFX_DECL_TOOLBOX_CONTROL() \ - static rtl::Reference CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ); \ + static rtl::Reference CreateImpl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx ); \ static void RegisterControl(sal_uInt16 nSlotId = 0, SfxModule *pMod=nullptr) /* For special ToolBox controls, such as a font selection box or toolbox @@ -102,11 +102,11 @@ public: public: SFX_DECL_TOOLBOX_CONTROL(); - SfxToolBoxControl( sal_uInt16 nSlotID, sal_uInt16 nId, ToolBox& rBox, bool bShowStrings = false ); + SfxToolBoxControl( sal_uInt16 nSlotID, ToolBoxItemId nId, ToolBox& rBox, bool bShowStrings = false ); virtual ~SfxToolBoxControl() override; ToolBox& GetToolBox() const; - unsigned short GetId() const; + ToolBoxItemId GetId() const; unsigned short GetSlotId() const; void Dispatch( const OUString& aCommand, @@ -116,19 +116,19 @@ public: css::uno::Sequence< css::beans::PropertyValue > const & aArgs ); static SfxItemState GetItemState( const SfxPoolItem* pState ); - static rtl::Reference CreateControl( sal_uInt16 nSlotId, sal_uInt16 nTbxId, ToolBox *pBox, SfxModule const *pMod ); + static rtl::Reference CreateControl( sal_uInt16 nSlotId, ToolBoxItemId nTbxId, ToolBox *pBox, SfxModule const *pMod ); static void RegisterToolBoxControl( SfxModule*, const SfxTbxCtrlFactory&); }; #define SFX_IMPL_TOOLBOX_CONTROL(Class, nItemClass) \ - rtl::Reference Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \ + rtl::Reference Class::CreateImpl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx ) \ { return new Class( nSlotId, nId, rTbx ); } \ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ { SfxToolBoxControl::RegisterToolBoxControl( pMod, SfxTbxCtrlFactory( \ Class::CreateImpl, typeid(nItemClass), nSlotId ) ); } #define SFX_IMPL_TOOLBOX_CONTROL_ARG(Class, nItemClass, Arg) \ - rtl::Reference Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \ + rtl::Reference Class::CreateImpl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox &rTbx ) \ { return new Class( nSlotId, nId, rTbx, Arg); } \ void Class::RegisterControl(sal_uInt16 nSlotId, SfxModule *pMod) \ { SfxToolBoxControl::RegisterToolBoxControl( pMod, SfxTbxCtrlFactory( \ -- cgit