From 0f33526ec27a3abcfa1ca9348a46238b1432e5e4 Mon Sep 17 00:00:00 2001 From: Jochen Nitschke Date: Wed, 14 Sep 2016 19:33:42 +0200 Subject: put all SfxShell feature flags in one typed_flags class make values unique across modules. check if flag used in correct module. Change-Id: I656ffd3d527dd895777e14e1cc933c8b9b3f6e46 Reviewed-on: https://gerrit.libreoffice.org/28906 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- include/sfx2/objface.hxx | 8 ++++---- include/sfx2/shell.hxx | 32 +++++++++++++++++++++++++++++++- include/svx/fmshell.hxx | 2 +- 3 files changed, 36 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/sfx2/objface.hxx b/include/sfx2/objface.hxx index babbc9f0464a..a0dfc169b744 100644 --- a/include/sfx2/objface.hxx +++ b/include/sfx2/objface.hxx @@ -65,16 +65,16 @@ public: const SfxInterface* GetGenoType() const { return pGenoType; } void RegisterObjectBar(sal_uInt16, sal_uInt32 nResId); - void RegisterObjectBar(sal_uInt16, sal_uInt32 nResId, sal_uInt32 nFeature); + void RegisterObjectBar(sal_uInt16, sal_uInt32 nResId, SfxShellFeature nFeature); void RegisterChildWindow(sal_uInt16, bool bContext = false); - void RegisterChildWindow(sal_uInt16, bool bContext, sal_uInt32 nFeature); + void RegisterChildWindow(sal_uInt16, bool bContext, SfxShellFeature nFeature); void RegisterStatusBar(sal_uInt32 nResId); sal_uInt32 GetObjectBarId(sal_uInt16 nNo) const; sal_uInt16 GetObjectBarPos( sal_uInt16 nNo ) const; - sal_uInt32 GetObjectBarFeature( sal_uInt16 nNo ) const; + SfxShellFeature GetObjectBarFeature(sal_uInt16 nNo) const; sal_uInt16 GetObjectBarCount() const; bool IsObjectBarVisible( sal_uInt16 nNo) const; - sal_uInt32 GetChildWindowFeature( sal_uInt16 nNo ) const; + SfxShellFeature GetChildWindowFeature(sal_uInt16 nNo) const; sal_uInt32 GetChildWindowId( sal_uInt16 nNo ) const; sal_uInt16 GetChildWindowCount() const; void RegisterPopupMenu( const OUString& ); diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx index ffb6d27c70d9..a337aed0289d 100644 --- a/include/sfx2/shell.hxx +++ b/include/sfx2/shell.hxx @@ -26,6 +26,7 @@ #include #include #include +#include class ResMgr; namespace vcl { class Window; } @@ -93,6 +94,35 @@ enum SfxInterfaceId SFX_INTERFACE_APP = SFX_INTERFACE_SW_START, }; +enum class SfxShellFeature +{ + NONE = 0x0000, + // Writer only, class SwView + SwChildWindowLabel = 0x0001, + SwChildWindowMailmerge = 0x0002, + // Basic only, class Shell + BasicShowBrowser = 0x0004, + // Forms only, class FmFormShell + FormShowDatabaseBar = 0x0008, + FormShowField = 0x0010, + FormShowProperies = 0x0020, + FormShowExplorer = 0x0040, + FormShowFilterBar = 0x0080, + FormShowFilterNavigator = 0x0100, + FormShowTextControlBar = 0x0200, + FormTBControls = 0x0400, + FormTBMoreControls = 0x0800, + FormTBDesign = 0x1000, + FormShowDataNavigator = 0x2000, + // masks to make sure modules don't use flags from an other + SwMask = 0x0003, + BasicMask = 0x0004, + FormMask = 0x3ff8 +}; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} typedef void (*SfxExecFunc)(SfxShell *, SfxRequest &rReq); typedef void (*SfxStateFunc)(SfxShell *, SfxItemSet &rSet); @@ -380,7 +410,7 @@ public: */ SfxViewFrame* GetFrame() const; - virtual bool HasUIFeature( sal_uInt32 nFeature ); + virtual bool HasUIFeature(SfxShellFeature nFeature) const; void UIFeatureChanged(); // Items diff --git a/include/svx/fmshell.hxx b/include/svx/fmshell.hxx index 82a289757456..05def09f75c4 100644 --- a/include/svx/fmshell.hxx +++ b/include/svx/fmshell.hxx @@ -100,7 +100,7 @@ public: void Execute( SfxRequest& ); void GetState( SfxItemSet& ); - virtual bool HasUIFeature( sal_uInt32 nFeature ) override; + virtual bool HasUIFeature(SfxShellFeature nFeature) const override; void ExecuteTextAttribute( SfxRequest& ); void GetTextAttributeState( SfxItemSet& ); -- cgit