summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-03-08 21:37:43 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-03-11 14:10:30 +0100
commit1692998399eecb79e7b59456cff805bcb77aece4 (patch)
tree8cc22c633e88f19c39f5736e87a0934f041729de /include
parent665a2b477dd4f412b42ffb58a183f7a702cd7645 (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 'include')
-rw-r--r--include/avmedia/mediatoolbox.hxx2
-rw-r--r--include/framework/generictoolbarcontroller.hxx4
-rw-r--r--include/framework/sfxhelperfunctions.hxx5
-rw-r--r--include/sfx2/tbxctrl.hxx16
-rw-r--r--include/svtools/toolboxcontroller.hxx5
-rw-r--r--include/svx/ParaSpacingControl.hxx14
-rw-r--r--include/svx/clipboardctl.hxx2
-rw-r--r--include/svx/colorwindow.hxx4
-rw-r--r--include/svx/fillctrl.hxx2
-rw-r--r--include/svx/formatpaintbrushctrl.hxx2
-rw-r--r--include/svx/grafctrl.hxx18
-rw-r--r--include/svx/linectrl.hxx2
-rw-r--r--include/svx/tbxctl.hxx2
-rw-r--r--include/vcl/builder.hxx3
-rw-r--r--include/vcl/toolbox.hxx128
15 files changed, 111 insertions, 98 deletions
diff --git a/include/avmedia/mediatoolbox.hxx b/include/avmedia/mediatoolbox.hxx
index 23a766d7829c..0a742abd6214 100644
--- a/include/avmedia/mediatoolbox.hxx
+++ b/include/avmedia/mediatoolbox.hxx
@@ -36,7 +36,7 @@ public:
SFX_DECL_TOOLBOX_CONTROL();
- MediaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbX );
+ MediaToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbX );
virtual ~MediaToolBoxControl() override;
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
diff --git a/include/framework/generictoolbarcontroller.hxx b/include/framework/generictoolbarcontroller.hxx
index bebdf78621c2..8184de97e92f 100644
--- a/include/framework/generictoolbarcontroller.hxx
+++ b/include/framework/generictoolbarcontroller.hxx
@@ -34,7 +34,7 @@ class FWK_DLLPUBLIC GenericToolbarController final : public svt::ToolboxControll
GenericToolbarController( 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 );
GenericToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
const css::uno::Reference< css::frame::XFrame >& rFrame,
@@ -62,7 +62,7 @@ class FWK_DLLPUBLIC GenericToolbarController final : public svt::ToolboxControll
private:
VclPtr<ToolBox> m_xToolbar;
- sal_uInt16 m_nID;
+ ToolBoxItemId m_nID;
bool m_bEnumCommand : 1,
m_bMadeInvisible : 1;
OUString m_aEnumCommand;
diff --git a/include/framework/sfxhelperfunctions.hxx b/include/framework/sfxhelperfunctions.hxx
index 7a30899d97de..4858960f7edf 100644
--- a/include/framework/sfxhelperfunctions.hxx
+++ b/include/framework/sfxhelperfunctions.hxx
@@ -23,6 +23,7 @@
#include <framework/fwkdllapi.h>
#include <rtl/ustring.hxx>
#include <rtl/ref.hxx>
+#include <vcl/toolbox.hxx>
namespace com::sun::star::frame { class XFrame; }
namespace com::sun::star::uno { template <typename > class Reference; }
@@ -35,7 +36,7 @@ class ToolBox;
typedef rtl::Reference<svt::ToolboxController> ( *pfunc_setToolBoxControllerCreator)(
const css::uno::Reference< css::frame::XFrame >& rFrame,
ToolBox* pToolbox,
- unsigned short nID,
+ ToolBoxItemId nID,
const OUString& aCommandURL );
typedef rtl::Reference<svt::StatusbarController> ( *pfunc_setStatusBarControllerCreator)(
@@ -62,7 +63,7 @@ FWK_DLLPUBLIC pfunc_setToolBoxControllerCreator SetToolBoxControllerCreator( pfu
FWK_DLLPUBLIC rtl::Reference<svt::ToolboxController> CreateToolBoxController(
const css::uno::Reference< css::frame::XFrame >& rFrame,
ToolBox* pToolbox,
- unsigned short nID,
+ ToolBoxItemId nID,
const OUString& aCommandURL );
FWK_DLLPUBLIC pfunc_setStatusBarControllerCreator SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator );
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<svt::ToolboxController> SfxToolBoxControllerFactory( const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const OUString& aCommandURL );
+rtl::Reference<svt::ToolboxController> SfxToolBoxControllerFactory( const css::uno::Reference< css::frame::XFrame >& rFrame, ToolBox* pToolbox, ToolBoxItemId nID, const OUString& aCommandURL );
-typedef rtl::Reference<SfxToolBoxControl> (*SfxToolBoxControlCtor)( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rBox );
+typedef rtl::Reference<SfxToolBoxControl> (*SfxToolBoxControlCtor)( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rBox );
struct SfxTbxCtrlFactory
{
@@ -55,7 +55,7 @@ struct SfxTbxCtrlFactory
#define SFX_DECL_TOOLBOX_CONTROL() \
- static rtl::Reference<SfxToolBoxControl> CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ); \
+ static rtl::Reference<SfxToolBoxControl> 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<SfxToolBoxControl> CreateControl( sal_uInt16 nSlotId, sal_uInt16 nTbxId, ToolBox *pBox, SfxModule const *pMod );
+ static rtl::Reference<SfxToolBoxControl> 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<SfxToolBoxControl> Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \
+ rtl::Reference<SfxToolBoxControl> 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<SfxToolBoxControl> Class::CreateImpl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox &rTbx ) \
+ rtl::Reference<SfxToolBoxControl> 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( \
diff --git a/include/svtools/toolboxcontroller.hxx b/include/svtools/toolboxcontroller.hxx
index 0bf372e9502f..ef15f70c263b 100644
--- a/include/svtools/toolboxcontroller.hxx
+++ b/include/svtools/toolboxcontroller.hxx
@@ -33,6 +33,7 @@
#include <comphelper/propertycontainer.hxx>
#include <cppuhelper/propshlp.hxx>
#include <tools/link.hxx>
+#include <vcl/toolbox.hxx>
#include <unordered_map>
@@ -131,7 +132,7 @@ class SVT_DLLPUBLIC ToolboxController :
bool IsInSidebar() const { return m_bSidebar; }
protected:
- bool getToolboxId( sal_uInt16& rItemId, ToolBox** ppToolBox );
+ bool getToolboxId( ToolBoxItemId& rItemId, ToolBox** ppToolBox );
struct Listener
{
Listener( const css::util::URL& rURL, const css::uno::Reference< css::frame::XDispatch >& rDispatch ) :
@@ -175,7 +176,7 @@ class SVT_DLLPUBLIC ToolboxController :
bool m_bInitialized,
m_bDisposed,
m_bSidebar;
- sal_uInt16 m_nToolBoxId;
+ ToolBoxItemId m_nToolBoxId;
css::uno::Reference< css::frame::XFrame > m_xFrame;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
OUString m_aCommandURL;
diff --git a/include/svx/ParaSpacingControl.hxx b/include/svx/ParaSpacingControl.hxx
index f6403e45207b..877ab9abd52e 100644
--- a/include/svx/ParaSpacingControl.hxx
+++ b/include/svx/ParaSpacingControl.hxx
@@ -41,7 +41,7 @@ namespace svx
class ParaULSpacingControl : public SfxToolBoxControl
{
public:
- ParaULSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+ ParaULSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
virtual ~ParaULSpacingControl() override;
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
@@ -54,7 +54,7 @@ class SVX_DLLPUBLIC ParaAboveSpacingControl final : public ParaULSpacingControl
public:
SFX_DECL_TOOLBOX_CONTROL();
- ParaAboveSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+ ParaAboveSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
};
@@ -63,14 +63,14 @@ class SVX_DLLPUBLIC ParaBelowSpacingControl final : public ParaULSpacingControl
public:
SFX_DECL_TOOLBOX_CONTROL();
- ParaBelowSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+ ParaBelowSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
};
class ParaLRSpacingControl : public SfxToolBoxControl, public css::ui::XContextChangeEventListener
{
public:
- ParaLRSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+ ParaLRSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
virtual ~ParaLRSpacingControl() override;
virtual void SAL_CALL dispose() override;
@@ -100,7 +100,7 @@ class SVX_DLLPUBLIC ParaLeftSpacingControl final : public ParaLRSpacingControl
public:
SFX_DECL_TOOLBOX_CONTROL();
- ParaLeftSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+ ParaLeftSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
};
@@ -109,7 +109,7 @@ class SVX_DLLPUBLIC ParaRightSpacingControl final : public ParaLRSpacingControl
public:
SFX_DECL_TOOLBOX_CONTROL();
- ParaRightSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+ ParaRightSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
};
@@ -118,7 +118,7 @@ class SVX_DLLPUBLIC ParaFirstLineSpacingControl final : public ParaLRSpacingCont
public:
SFX_DECL_TOOLBOX_CONTROL();
- ParaFirstLineSpacingControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+ ParaFirstLineSpacingControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
virtual VclPtr<InterimItemWindow> CreateItemWindow(vcl::Window* pParent) override;
};
}
diff --git a/include/svx/clipboardctl.hxx b/include/svx/clipboardctl.hxx
index 00a0a301d7f7..2c93dedfaf86 100644
--- a/include/svx/clipboardctl.hxx
+++ b/include/svx/clipboardctl.hxx
@@ -37,7 +37,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxClipBoardControl final : public SfxToolBo
public:
SFX_DECL_TOOLBOX_CONTROL();
- SvxClipBoardControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ SvxClipBoardControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
virtual ~SvxClipBoardControl() override;
void CreatePopupWindow() override;
diff --git a/include/svx/colorwindow.hxx b/include/svx/colorwindow.hxx
index 784f273e87a7..95f7c5c13d86 100644
--- a/include/svx/colorwindow.hxx
+++ b/include/svx/colorwindow.hxx
@@ -61,11 +61,11 @@ private:
// or
SvxColorToolBoxControl* m_pControl;
VclPtr<ToolBox> m_xToolBox;
- sal_uInt16 m_nId;
+ ToolBoxItemId m_nId;
public:
MenuOrToolMenuButton(weld::MenuButton* pMenuButton);
MenuOrToolMenuButton(weld::Toolbar* pToolbar, const OString& rIdent);
- MenuOrToolMenuButton(SvxColorToolBoxControl* pControl, ToolBox* pToolbar, sal_uInt16 nId);
+ MenuOrToolMenuButton(SvxColorToolBoxControl* pControl, ToolBox* pToolbar, ToolBoxItemId nId);
~MenuOrToolMenuButton();
MenuOrToolMenuButton(MenuOrToolMenuButton const &) = default;
diff --git a/include/svx/fillctrl.hxx b/include/svx/fillctrl.hxx
index 7155d261a090..ad428a10529f 100644
--- a/include/svx/fillctrl.hxx
+++ b/include/svx/fillctrl.hxx
@@ -65,7 +65,7 @@ private:
public:
SFX_DECL_TOOLBOX_CONTROL();
- SvxFillToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
+ SvxFillToolBoxControl(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx);
virtual ~SvxFillToolBoxControl() override;
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) override;
diff --git a/include/svx/formatpaintbrushctrl.hxx b/include/svx/formatpaintbrushctrl.hxx
index 826344064051..a9bb530da25c 100644
--- a/include/svx/formatpaintbrushctrl.hxx
+++ b/include/svx/formatpaintbrushctrl.hxx
@@ -33,7 +33,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC FormatPaintBrushToolBoxControl final : publi
{
public:
SFX_DECL_TOOLBOX_CONTROL();
- FormatPaintBrushToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ FormatPaintBrushToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
virtual ~FormatPaintBrushToolBoxControl() override;
virtual void DoubleClick() override;
diff --git a/include/svx/grafctrl.hxx b/include/svx/grafctrl.hxx
index b22b82392409..ad3187c6dcb3 100644
--- a/include/svx/grafctrl.hxx
+++ b/include/svx/grafctrl.hxx
@@ -28,7 +28,7 @@
class SvxGrafToolBoxControl : public SfxToolBoxControl
{
public:
- SvxGrafToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ SvxGrafToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
virtual ~SvxGrafToolBoxControl() override;
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
@@ -40,7 +40,7 @@ class SVX_DLLPUBLIC SvxGrafRedToolBoxControl final : public SvxGrafToolBoxContro
{
public:
SFX_DECL_TOOLBOX_CONTROL();
- SvxGrafRedToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ SvxGrafRedToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
};
@@ -48,7 +48,7 @@ class SVX_DLLPUBLIC SvxGrafGreenToolBoxControl final : public SvxGrafToolBoxCont
{
public:
SFX_DECL_TOOLBOX_CONTROL();
- SvxGrafGreenToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ SvxGrafGreenToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
};
@@ -56,7 +56,7 @@ class SVX_DLLPUBLIC SvxGrafBlueToolBoxControl final : public SvxGrafToolBoxContr
{
public:
SFX_DECL_TOOLBOX_CONTROL();
- SvxGrafBlueToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ SvxGrafBlueToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
};
@@ -64,7 +64,7 @@ class SVX_DLLPUBLIC SvxGrafLuminanceToolBoxControl final : public SvxGrafToolBox
{
public:
SFX_DECL_TOOLBOX_CONTROL();
- SvxGrafLuminanceToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ SvxGrafLuminanceToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
};
@@ -72,7 +72,7 @@ class SVX_DLLPUBLIC SvxGrafContrastToolBoxControl final : public SvxGrafToolBoxC
{
public:
SFX_DECL_TOOLBOX_CONTROL();
- SvxGrafContrastToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ SvxGrafContrastToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
};
@@ -80,7 +80,7 @@ class SVX_DLLPUBLIC SvxGrafGammaToolBoxControl final : public SvxGrafToolBoxCont
{
public:
SFX_DECL_TOOLBOX_CONTROL();
- SvxGrafGammaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ SvxGrafGammaToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
};
@@ -88,7 +88,7 @@ class SVX_DLLPUBLIC SvxGrafTransparenceToolBoxControl final : public SvxGrafTool
{
public:
SFX_DECL_TOOLBOX_CONTROL();
- SvxGrafTransparenceToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ SvxGrafTransparenceToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
};
@@ -96,7 +96,7 @@ class SVX_DLLPUBLIC SvxGrafModeToolBoxControl final : public SfxToolBoxControl,
{
public:
SFX_DECL_TOOLBOX_CONTROL();
- SvxGrafModeToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ SvxGrafModeToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
virtual ~SvxGrafModeToolBoxControl() override;
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override;
diff --git a/include/svx/linectrl.hxx b/include/svx/linectrl.hxx
index 7ade8dc06643..2fd24305ca2e 100644
--- a/include/svx/linectrl.hxx
+++ b/include/svx/linectrl.hxx
@@ -79,7 +79,7 @@ class SVX_DLLPUBLIC SvxLineWidthToolBoxControl final : public SfxToolBoxControl
public:
SFX_DECL_TOOLBOX_CONTROL();
- SvxLineWidthToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ SvxLineWidthToolBoxControl( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
virtual ~SvxLineWidthToolBoxControl() override;
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
diff --git a/include/svx/tbxctl.hxx b/include/svx/tbxctl.hxx
index 46b8d6dbbfa0..f2e28c9ec47d 100644
--- a/include/svx/tbxctl.hxx
+++ b/include/svx/tbxctl.hxx
@@ -38,7 +38,7 @@ private:
protected:
public:
- SvxTbxCtlDraw( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+ SvxTbxCtlDraw( sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx );
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index c7d7f645532c..153d52887d7a 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -17,6 +17,7 @@
#include <vcl/dllapi.h>
#include <vcl/window.hxx>
#include <vcl/vclptr.hxx>
+#include <vcl/toolbox.hxx>
#include <tools/wintypes.hxx>
#include <vcl/EnumContext.hxx>
@@ -282,7 +283,7 @@ private:
std::vector< VclPtr<MessageDialog> > m_aMessageDialogs;
- sal_uInt16 m_nLastToolbarId;
+ ToolBoxItemId m_nLastToolbarId;
sal_uInt16 m_nLastMenuItemId;
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 98d60ba1d73b..649cc0fe3093 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -68,6 +68,16 @@ enum class ToolBoxLayoutMode
// Position of the text when icon and text are painted
enum class ToolBoxTextPosition { Right, Bottom };
+typedef o3tl::strong_int<sal_uInt16, struct ToolBoxItemIdTag> ToolBoxItemId;
+namespace std {
+ template<>
+ struct hash<ToolBoxItemId>
+ {
+ std::size_t operator()(ToolBoxItemId const & s) const
+ { return std::size_t(sal_uInt16(s)); }
+ };
+}
+
class Idle;
class VCL_DLLPUBLIC ToolBox : public DockingWindow
{
@@ -79,7 +89,7 @@ public:
virtual FactoryFunction GetUITestFactory() const override;
- void SetCurItemId( sal_uInt16 CurID ) { mnCurItemId=CurID; }
+ void SetCurItemId( ToolBoxItemId CurID ) { mnCurItemId=CurID; }
static constexpr auto APPEND
= std::numeric_limits<ImplToolItems::size_type>::max();
@@ -114,10 +124,10 @@ private:
tools::Long mnLastResizeDY;
tools::Long mnActivateCount;
Degree10 mnImagesRotationAngle;
- sal_uInt16 mnLastFocusItemId;
- sal_uInt16 mnHighItemId;
- sal_uInt16 mnCurItemId;
- sal_uInt16 mnDownItemId;
+ ToolBoxItemId mnLastFocusItemId;
+ ToolBoxItemId mnHighItemId;
+ ToolBoxItemId mnCurItemId;
+ ToolBoxItemId mnDownItemId;
ImplToolItems::size_type mnCurPos;
ImplToolItems::size_type mnLines; // total number of toolbox lines
ImplToolItems::size_type mnCurLine; // the currently visible line
@@ -173,7 +183,7 @@ private:
SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
using DockingWindow::ImplInitSettings;
SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
- SAL_DLLPRIVATE ImplToolItem* ImplGetItem( sal_uInt16 nId ) const;
+ SAL_DLLPRIVATE ImplToolItem* ImplGetItem( ToolBoxItemId nId ) const;
SAL_DLLPRIVATE bool ImplCalcItem();
SAL_DLLPRIVATE ImplToolItems::size_type ImplCalcBreaks( tools::Long nWidth, tools::Long* pMaxLineWidth, bool bCalcHorz ) const;
SAL_DLLPRIVATE void ImplFormat( bool bResize = false );
@@ -199,7 +209,7 @@ private:
SAL_DLLPRIVATE Point ImplGetPopupPosition( const tools::Rectangle& rRect ) const;
SAL_DLLPRIVATE bool ImplIsFloatingMode() const;
SAL_DLLPRIVATE bool ImplIsInPopupMode() const;
- SAL_DLLPRIVATE const OUString& ImplGetHelpText( sal_uInt16 nItemId ) const;
+ SAL_DLLPRIVATE const OUString& ImplGetHelpText( ToolBoxItemId nItemId ) const;
SAL_DLLPRIVATE Size ImplGetOptimalFloatingSize();
SAL_DLLPRIVATE bool ImplHasExternalMenubutton();
SAL_DLLPRIVATE void ImplDrawFloatwinBorder(vcl::RenderContext& rRenderContext, ImplToolItem const * pItem );
@@ -300,24 +310,24 @@ public:
ToolBoxItemBits nBits,
const Size& rRequestedSize,
ImplToolItems::size_type nPos = APPEND );
- void InsertItem( sal_uInt16 nItemId, const Image& rImage,
+ void InsertItem( ToolBoxItemId nItemId, const Image& rImage,
ToolBoxItemBits nBits = ToolBoxItemBits::NONE,
ImplToolItems::size_type nPos = APPEND );
- void InsertItem( sal_uInt16 nItemId, const Image& rImage,
+ void InsertItem( ToolBoxItemId nItemId, const Image& rImage,
const OUString& rText,
ToolBoxItemBits nBits = ToolBoxItemBits::NONE,
ImplToolItems::size_type nPos = APPEND );
- void InsertItem( sal_uInt16 nItemId, const OUString& rText,
+ void InsertItem( ToolBoxItemId nItemId, const OUString& rText,
ToolBoxItemBits nBits = ToolBoxItemBits::NONE,
ImplToolItems::size_type nPos = APPEND );
- void InsertWindow( sal_uInt16 nItemId, vcl::Window* pWindow,
+ void InsertWindow( ToolBoxItemId nItemId, vcl::Window* pWindow,
ToolBoxItemBits nBits = ToolBoxItemBits::NONE,
ImplToolItems::size_type nPos = APPEND );
void InsertSpace();
void InsertSeparator( ImplToolItems::size_type nPos = APPEND, sal_uInt16 nPixSize = 0 );
void InsertBreak( ImplToolItems::size_type nPos = APPEND );
void RemoveItem( ImplToolItems::size_type nPos );
- void CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId );
+ void CopyItem( const ToolBox& rToolBox, ToolBoxItemId nItemId );
void Clear();
void SetButtonType( ButtonType eNewType );
@@ -337,80 +347,80 @@ public:
ImplToolItems::size_type GetItemCount() const;
ToolBoxItemType GetItemType( ImplToolItems::size_type nPos ) const;
- ImplToolItems::size_type GetItemPos( sal_uInt16 nItemId ) const;
+ ImplToolItems::size_type GetItemPos( ToolBoxItemId nItemId ) const;
ImplToolItems::size_type GetItemPos( const Point& rPos ) const;
- sal_uInt16 GetItemId( ImplToolItems::size_type nPos ) const;
- sal_uInt16 GetItemId( const Point& rPos ) const;
+ ToolBoxItemId GetItemId( ImplToolItems::size_type nPos ) const;
+ ToolBoxItemId GetItemId( const Point& rPos ) const;
/// Map the command name (like .uno:Save) back to item id.
- sal_uInt16 GetItemId( const OUString& rCommand ) const;
- tools::Rectangle GetItemRect( sal_uInt16 nItemId );
+ ToolBoxItemId GetItemId( const OUString& rCommand ) const;
+ tools::Rectangle GetItemRect( ToolBoxItemId nItemId );
tools::Rectangle GetItemPosRect( ImplToolItems::size_type nPos );
tools::Rectangle const & GetOverflowRect() const;
/// Returns size of the bitmap / text that is inside this toolbox item.
- Size GetItemContentSize( sal_uInt16 nItemId );
+ Size GetItemContentSize( ToolBoxItemId nItemId );
- sal_uInt16 GetCurItemId() const { return mnCurItemId; }
- sal_uInt16 GetDownItemId() const { return mnDownItemId; }
+ ToolBoxItemId GetCurItemId() const { return mnCurItemId; }
+ ToolBoxItemId GetDownItemId() const { return mnDownItemId; }
sal_uInt16 GetModifier() const { return mnMouseModifier; }
- void SetItemBits( sal_uInt16 nItemId, ToolBoxItemBits nBits );
- ToolBoxItemBits GetItemBits( sal_uInt16 nItemId ) const;
+ void SetItemBits( ToolBoxItemId nItemId, ToolBoxItemBits nBits );
+ ToolBoxItemBits GetItemBits( ToolBoxItemId nItemId ) const;
- void SetItemExpand( sal_uInt16 nItemId, bool bExpand );
+ void SetItemExpand( ToolBoxItemId nItemId, bool bExpand );
// e.g. a label used as an itemwindow
- void SetItemWindowNonInteractive(sal_uInt16 nItemId, bool bNonInteractive);
+ void SetItemWindowNonInteractive(ToolBoxItemId nItemId, bool bNonInteractive);
- void SetItemData( sal_uInt16 nItemId, void* pNewData );
- void* GetItemData( sal_uInt16 nItemId ) const;
- void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
- Image GetItemImage( sal_uInt16 nItemId ) const;
- void SetItemImageAngle( sal_uInt16 nItemId, Degree10 nAngle10 );
- void SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror );
- void SetItemText( sal_uInt16 nItemId, const OUString& rText );
- const OUString& GetItemText( sal_uInt16 nItemId ) const;
- void SetItemWindow( sal_uInt16 nItemId, vcl::Window* pNewWindow );
- vcl::Window* GetItemWindow( sal_uInt16 nItemId ) const;
- sal_uInt16 GetHighlightItemId() const { return mnHighItemId; }
+ void SetItemData( ToolBoxItemId nItemId, void* pNewData );
+ void* GetItemData( ToolBoxItemId nItemId ) const;
+ void SetItemImage( ToolBoxItemId nItemId, const Image& rImage );
+ Image GetItemImage( ToolBoxItemId nItemId ) const;
+ void SetItemImageAngle( ToolBoxItemId nItemId, Degree10 nAngle10 );
+ void SetItemImageMirrorMode( ToolBoxItemId nItemId, bool bMirror );
+ void SetItemText( ToolBoxItemId nItemId, const OUString& rText );
+ const OUString& GetItemText( ToolBoxItemId nItemId ) const;
+ void SetItemWindow( ToolBoxItemId nItemId, vcl::Window* pNewWindow );
+ vcl::Window* GetItemWindow( ToolBoxItemId nItemId ) const;
+ ToolBoxItemId GetHighlightItemId() const { return mnHighItemId; }
void EndSelection();
- void SetItemDown( sal_uInt16 nItemId, bool bDown );
+ void SetItemDown( ToolBoxItemId nItemId, bool bDown );
- void SetItemState( sal_uInt16 nItemId, TriState eState );
- TriState GetItemState( sal_uInt16 nItemId ) const;
+ void SetItemState( ToolBoxItemId nItemId, TriState eState );
+ TriState GetItemState( ToolBoxItemId nItemId ) const;
- void CheckItem( sal_uInt16 nItemId, bool bCheck = true );
- bool IsItemChecked( sal_uInt16 nItemId ) const;
+ void CheckItem( ToolBoxItemId nItemId, bool bCheck = true );
+ bool IsItemChecked( ToolBoxItemId nItemId ) const;
- void EnableItem( sal_uInt16 nItemId, bool bEnable = true );
- bool IsItemEnabled( sal_uInt16 nItemId ) const;
+ void EnableItem( ToolBoxItemId nItemId, bool bEnable = true );
+ bool IsItemEnabled( ToolBoxItemId nItemId ) const;
- void TriggerItem( sal_uInt16 nItemId );
+ void TriggerItem( ToolBoxItemId nItemId );
/// Shows or hides items.
- void ShowItem(sal_uInt16 nItemId, bool bVisible = true);
+ void ShowItem(ToolBoxItemId nItemId, bool bVisible = true);
/// Convenience method to hide items (via ShowItem).
- void HideItem(sal_uInt16 nItemId) { ShowItem( nItemId, false ); }
+ void HideItem(ToolBoxItemId nItemId) { ShowItem( nItemId, false ); }
- bool IsItemClipped( sal_uInt16 nItemId ) const;
- bool IsItemVisible( sal_uInt16 nItemId ) const;
- bool IsItemReallyVisible( sal_uInt16 nItemId ) const;
+ bool IsItemClipped( ToolBoxItemId nItemId ) const;
+ bool IsItemVisible( ToolBoxItemId nItemId ) const;
+ bool IsItemReallyVisible( ToolBoxItemId nItemId ) const;
- void SetItemCommand( sal_uInt16 nItemId, const OUString& rCommand );
- OUString GetItemCommand( sal_uInt16 nItemId ) const;
+ void SetItemCommand( ToolBoxItemId nItemId, const OUString& rCommand );
+ OUString GetItemCommand( ToolBoxItemId nItemId ) const;
using Window::SetQuickHelpText;
- void SetQuickHelpText( sal_uInt16 nItemId, const OUString& rText );
+ void SetQuickHelpText( ToolBoxItemId nItemId, const OUString& rText );
using Window::GetQuickHelpText;
- OUString GetQuickHelpText( sal_uInt16 nItemId ) const;
+ OUString GetQuickHelpText( ToolBoxItemId nItemId ) const;
- void SetHelpText( sal_uInt16 nItemId, const OUString& rText );
- const OUString& GetHelpText( sal_uInt16 nItemId ) const;
+ void SetHelpText( ToolBoxItemId nItemId, const OUString& rText );
+ const OUString& GetHelpText( ToolBoxItemId nItemId ) const;
- void SetHelpId( sal_uInt16 nItemId, const OString& rHelpId );
+ void SetHelpId( ToolBoxItemId nItemId, const OString& rHelpId );
// window size according to current alignment, floating state and number of lines
Size CalcWindowSizePixel();
@@ -487,10 +497,10 @@ public:
// returns the bounding box for the character at index nIndex
// where nIndex is relative to the starting index of the item
// with id nItemId (in coordinates of the displaying window)
- tools::Rectangle GetCharacterBounds( sal_uInt16 nItemId, tools::Long nIndex );
+ tools::Rectangle GetCharacterBounds( ToolBoxItemId nItemId, tools::Long nIndex );
// -1 is returned if no character is at that point
// if an index is found the corresponding item id is filled in (else 0)
- tools::Long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID );
+ tools::Long GetIndexForPoint( const Point& rPoint, ToolBoxItemId& rItemID );
static Size GetDefaultImageSize(ToolBoxButtonSize eToolBoxButtonSize);
Size GetDefaultImageSize() const;
@@ -507,12 +517,12 @@ public:
virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
};
-inline void ToolBox::CheckItem( sal_uInt16 nItemId, bool bCheck )
+inline void ToolBox::CheckItem( ToolBoxItemId nItemId, bool bCheck )
{
SetItemState( nItemId, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE );
}
-inline bool ToolBox::IsItemChecked( sal_uInt16 nItemId ) const
+inline bool ToolBox::IsItemChecked( ToolBoxItemId nItemId ) const
{
return (GetItemState( nItemId ) == TRISTATE_TRUE);
}