[Libreoffice-commits] core.git: basctl/source include/sfx2 include/svx sfx2/source svx/source sw/inc sw/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Wed Sep 14 20:06:23 UTC 2016


 basctl/source/basicide/basides1.cxx  |    5 +-
 basctl/source/basicide/basidesh.cxx  |    2 -
 basctl/source/inc/basidesh.hxx       |    5 --
 include/sfx2/objface.hxx             |    8 ++--
 include/sfx2/shell.hxx               |   32 ++++++++++++++++++
 include/svx/fmshell.hxx              |    2 -
 sfx2/source/control/dispatch.cxx     |    8 ++--
 sfx2/source/control/objface.cxx      |   20 +++++------
 sfx2/source/control/shell.cxx        |    2 -
 svx/source/form/fmshell.cxx          |   59 ++++++++++++++---------------------
 sw/inc/view.hxx                      |    7 +---
 sw/source/uibase/uiview/view0.cxx    |    4 +-
 sw/source/uibase/uiview/viewstat.cxx |   13 ++++---
 13 files changed, 92 insertions(+), 75 deletions(-)

New commits:
commit 0f33526ec27a3abcfa1ca9348a46238b1432e5e4
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Wed Sep 14 19:33:42 2016 +0200

    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 <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index 4546873..5f41f79 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -952,11 +952,12 @@ void Shell::GetState(SfxItemSet &rSet)
         pCurWin->GetState( rSet );
 }
 
-bool Shell::HasUIFeature( sal_uInt32 nFeature )
+bool Shell::HasUIFeature(SfxShellFeature nFeature) const
 {
+    assert((nFeature & ~SfxShellFeature::BasicMask) == SfxShellFeature::NONE);
     bool bResult = false;
 
-    if ( (nFeature & BASICIDE_UI_FEATURE_SHOW_BROWSER) == BASICIDE_UI_FEATURE_SHOW_BROWSER )
+    if (nFeature & SfxShellFeature::BasicShowBrowser)
     {
         // fade out (in) property browser in module (dialog) windows
         if (dynamic_cast<DialogWindow*>(pCurWin.get()) && !pCurWin->IsReadOnly())
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index e48d820..75a75c0 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -136,7 +136,7 @@ SFX_IMPL_INTERFACE(basctl_Shell, SfxViewShell)
 void basctl_Shell::InitInterface_Impl()
 {
     GetStaticInterface()->RegisterChildWindow(SID_SEARCH_DLG);
-    GetStaticInterface()->RegisterChildWindow(SID_SHOW_PROPERTYBROWSER, false, BASICIDE_UI_FEATURE_SHOW_BROWSER);
+    GetStaticInterface()->RegisterChildWindow(SID_SHOW_PROPERTYBROWSER, false, SfxShellFeature::BasicShowBrowser);
     GetStaticInterface()->RegisterChildWindow(SfxInfoBarContainerChild::GetChildWindowId());
 
     GetStaticInterface()->RegisterPopupMenu("dialog");
diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index 763ca12..e756caa 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/basctl/source/inc/basidesh.hxx
@@ -39,9 +39,6 @@ class StarBASIC;
 
 namespace basctl
 {
-
-const sal_uLong BASICIDE_UI_FEATURE_SHOW_BROWSER = 0x00000001;
-
 class Layout;
 class ModulWindow;
 class ModulWindowLayout;
@@ -180,7 +177,7 @@ public:
     void                ExecuteBasic( SfxRequest& rReq );
     void                ExecuteDialog( SfxRequest& rReq );
 
-    virtual bool        HasUIFeature( sal_uInt32 nFeature ) override;
+    virtual bool        HasUIFeature(SfxShellFeature nFeature) const override;
 
     bool                CallBasicErrorHdl( StarBASIC* pBasic );
     long                CallBasicBreakHdl( StarBASIC* pBasic );
diff --git a/include/sfx2/objface.hxx b/include/sfx2/objface.hxx
index babbc9f..a0dfc16 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 ffb6d27..a337aed 100644
--- a/include/sfx2/shell.hxx
+++ b/include/sfx2/shell.hxx
@@ -26,6 +26,7 @@
 #include <sfx2/dllapi.h>
 #include <sfx2/sfxuno.hxx>
 #include <svl/SfxBroadcaster.hxx>
+#include <o3tl/typed_flags_set.hxx>
 
 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<SfxShellFeature> : is_typed_flags<SfxShellFeature, 0x3fff> {};
+}
 
 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 82a2897..05def09 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& );
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index a83c6cb..7357d79 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -1397,8 +1397,8 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne
                 continue;
 
             // check whether toolbar needs activation of a special feature
-            sal_uInt32 nFeature = pIFace->GetObjectBarFeature(nNo);
-            if ( nFeature && !pShell->HasUIFeature( nFeature ) )
+            SfxShellFeature nFeature = pIFace->GetObjectBarFeature(nNo);
+            if ((nFeature != SfxShellFeature::NONE) && !pShell->HasUIFeature(nFeature))
                 continue;
 
             // check for toolboxes that are exclusively for a viewer
@@ -1443,8 +1443,8 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne
                     continue;
             }
 
-            sal_uInt32 nFeature = pIFace->GetChildWindowFeature(nNo);
-            if ( nFeature && !pShell->HasUIFeature( nFeature ) )
+            SfxShellFeature nFeature = pIFace->GetChildWindowFeature(nNo);
+            if ((nFeature != SfxShellFeature::NONE) && !pShell->HasUIFeature(nFeature))
                 continue;
 
             // slot decides whether a ChildWindow is shown when document is OLE server or OLE client
diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx
index 49983e4..495374b 100644
--- a/sfx2/source/control/objface.cxx
+++ b/sfx2/source/control/objface.cxx
@@ -56,9 +56,9 @@ struct SfxObjectUI_Impl
     sal_uInt16  nPos;
     sal_uInt32  nResId;
     bool        bContext;
-    sal_uInt32  nFeature;
+    SfxShellFeature nFeature;
 
-    SfxObjectUI_Impl(sal_uInt16 n, sal_uInt32 nId, sal_uInt32 nFeat) :
+    SfxObjectUI_Impl(sal_uInt16 n, sal_uInt32 nId, SfxShellFeature nFeat) :
         nPos(n),
         nResId(nId),
         bContext(false),
@@ -95,7 +95,7 @@ struct SfxInterface_Impl
     }
 };
 
-static SfxObjectUI_Impl* CreateObjectBarUI_Impl(sal_uInt16 nPos, sal_uInt32 nResId, sal_uInt32 nFeature);
+static SfxObjectUI_Impl* CreateObjectBarUI_Impl(sal_uInt16 nPos, sal_uInt32 nResId, SfxShellFeature nFeature);
 
 // constuctor, registeres a new unit
 SfxInterface::SfxInterface( const char *pClassName,
@@ -362,17 +362,17 @@ void SfxInterface::RegisterPopupMenu( const OUString& rResourceName )
 
 void SfxInterface::RegisterObjectBar(sal_uInt16 nPos, sal_uInt32 nResId)
 {
-    RegisterObjectBar(nPos, nResId, 0UL);
+    RegisterObjectBar(nPos, nResId, SfxShellFeature::NONE);
 }
 
-void SfxInterface::RegisterObjectBar(sal_uInt16 nPos, sal_uInt32 nResId, sal_uInt32 nFeature)
+void SfxInterface::RegisterObjectBar(sal_uInt16 nPos, sal_uInt32 nResId, SfxShellFeature nFeature)
 {
     SfxObjectUI_Impl* pUI = CreateObjectBarUI_Impl(nPos, nResId, nFeature);
     if ( pUI )
         pImplData->aObjectBars.push_back(pUI);
 }
 
-SfxObjectUI_Impl* CreateObjectBarUI_Impl(sal_uInt16 nPos, sal_uInt32 nResId, sal_uInt32 nFeature)
+SfxObjectUI_Impl* CreateObjectBarUI_Impl(sal_uInt16 nPos, sal_uInt32 nResId, SfxShellFeature nFeature)
 {
     if ((nPos & SFX_VISIBILITY_MASK) == 0)
         nPos |= SFX_VISIBILITY_STANDARD;
@@ -428,10 +428,10 @@ sal_uInt16 SfxInterface::GetObjectBarCount() const
 
 void SfxInterface::RegisterChildWindow(sal_uInt16 nId, bool bContext)
 {
-    RegisterChildWindow(nId, bContext, 0UL);
+    RegisterChildWindow(nId, bContext, SfxShellFeature::NONE);
 }
 
-void SfxInterface::RegisterChildWindow(sal_uInt16 nId, bool bContext, sal_uInt32 nFeature)
+void SfxInterface::RegisterChildWindow(sal_uInt16 nId, bool bContext, SfxShellFeature nFeature)
 {
     SfxObjectUI_Impl* pUI = new SfxObjectUI_Impl(0, nId, nFeature);
     pUI->bContext = bContext;
@@ -464,7 +464,7 @@ sal_uInt32 SfxInterface::GetChildWindowId (sal_uInt16 nNo) const
     return nRet;
 }
 
-sal_uInt32 SfxInterface::GetChildWindowFeature (sal_uInt16 nNo) const
+SfxShellFeature SfxInterface::GetChildWindowFeature (sal_uInt16 nNo) const
 {
     if ( pGenoType )
     {
@@ -504,7 +504,7 @@ sal_uInt32 SfxInterface::GetStatusBarId() const
         return pImplData->nStatBarResId;
 }
 
-sal_uInt32 SfxInterface::GetObjectBarFeature ( sal_uInt16 nNo ) const
+SfxShellFeature SfxInterface::GetObjectBarFeature ( sal_uInt16 nNo ) const
 {
     bool bGenoType = (pGenoType != nullptr && pGenoType->UseAsSuperClass());
     if ( bGenoType )
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index c2b903f..4703f79 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -657,7 +657,7 @@ SfxObjectShell* SfxShell::GetObjectShell()
         return nullptr;
 }
 
-bool SfxShell::HasUIFeature( sal_uInt32 )
+bool SfxShell::HasUIFeature(SfxShellFeature) const
 {
     return false;
 }
diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
index 8825467..a28f98f 100644
--- a/svx/source/form/fmshell.cxx
+++ b/svx/source/form/fmshell.cxx
@@ -154,51 +154,39 @@ FmDesignModeChangedHint::~FmDesignModeChangedHint()
 {
 }
 
-const sal_uInt32 FM_UI_FEATURE_SHOW_DATABASEBAR         = 0x00000001;
-const sal_uInt32 FM_UI_FEATURE_SHOW_FIELD               = 0x00000002;
-const sal_uInt32 FM_UI_FEATURE_SHOW_PROPERTIES          = 0x00000004;
-const sal_uInt32 FM_UI_FEATURE_SHOW_EXPLORER            = 0x00000008;
-const sal_uInt32 FM_UI_FEATURE_SHOW_FILTERBAR           = 0x00000010;
-const sal_uInt32 FM_UI_FEATURE_SHOW_FILTERNAVIGATOR     = 0x00000020;
-const sal_uInt32 FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR    = 0x00000040;
-const sal_uInt32 FM_UI_FEATURE_TB_CONTROLS              = 0x00000080;
-const sal_uInt32 FM_UI_FEATURE_TB_MORECONTROLS          = 0x00000100;
-const sal_uInt32 FM_UI_FEATURE_TB_FORMDESIGN            = 0x00000200;
-const sal_uInt32 FM_UI_FEATURE_SHOW_DATANAVIGATOR       = 0x00000400;
-
 SFX_IMPL_INTERFACE(FmFormShell, SfxShell)
 
 void FmFormShell::InitInterface_Impl()
 {
     GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_NAVIGATION|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_READONLYDOC,
                                             RID_SVXTBX_FORM_NAVIGATION,
-                                            FM_UI_FEATURE_SHOW_DATABASEBAR);
+                                            SfxShellFeature::FormShowDatabaseBar);
 
     GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_NAVIGATION|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_READONLYDOC,
                                             RID_SVXTBX_FORM_FILTER,
-                                            FM_UI_FEATURE_SHOW_FILTERBAR);
+                                            SfxShellFeature::FormShowFilterBar);
 
     GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD | SFX_VISIBILITY_READONLYDOC,
                                             RID_SVXTBX_TEXT_CONTROL_ATTRIBUTES,
-                                            FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR);
+                                            SfxShellFeature::FormShowTextControlBar);
 
-    GetStaticInterface()->RegisterChildWindow(SID_FM_ADD_FIELD, false, FM_UI_FEATURE_SHOW_FIELD);
-    GetStaticInterface()->RegisterChildWindow(SID_FM_SHOW_PROPERTIES, false, FM_UI_FEATURE_SHOW_PROPERTIES);
-    GetStaticInterface()->RegisterChildWindow(SID_FM_SHOW_FMEXPLORER, false, FM_UI_FEATURE_SHOW_EXPLORER);
-    GetStaticInterface()->RegisterChildWindow(SID_FM_FILTER_NAVIGATOR, false, FM_UI_FEATURE_SHOW_FILTERNAVIGATOR);
-    GetStaticInterface()->RegisterChildWindow(SID_FM_SHOW_DATANAVIGATOR, false, FM_UI_FEATURE_SHOW_DATANAVIGATOR);
+    GetStaticInterface()->RegisterChildWindow(SID_FM_ADD_FIELD, false, SfxShellFeature::FormShowField);
+    GetStaticInterface()->RegisterChildWindow(SID_FM_SHOW_PROPERTIES, false, SfxShellFeature::FormShowProperies);
+    GetStaticInterface()->RegisterChildWindow(SID_FM_SHOW_FMEXPLORER, false, SfxShellFeature::FormShowExplorer);
+    GetStaticInterface()->RegisterChildWindow(SID_FM_FILTER_NAVIGATOR, false, SfxShellFeature::FormShowFilterNavigator);
+    GetStaticInterface()->RegisterChildWindow(SID_FM_SHOW_DATANAVIGATOR, false, SfxShellFeature::FormShowDataNavigator);
 
     GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD,
                                             RID_SVXTBX_CONTROLS,
-                                            FM_UI_FEATURE_TB_CONTROLS);
+                                            SfxShellFeature::FormTBControls);
 
     GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD,
                                             RID_SVXTBX_MORECONTROLS,
-                                            FM_UI_FEATURE_TB_MORECONTROLS);
+                                            SfxShellFeature::FormTBMoreControls);
 
     GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_OBJECT | SFX_VISIBILITY_STANDARD,
                                             RID_SVXTBX_FORMDESIGN,
-                                            FM_UI_FEATURE_TB_FORMDESIGN);
+                                            SfxShellFeature::FormTBDesign);
 }
 
 
@@ -309,46 +297,47 @@ void FmFormShell::impl_setDesignMode(bool bDesign)
 }
 
 
-bool FmFormShell::HasUIFeature( sal_uInt32 nFeature )
+bool FmFormShell::HasUIFeature(SfxShellFeature nFeature) const
 {
+    assert((nFeature & ~SfxShellFeature::FormMask) == SfxShellFeature::NONE);
     bool bResult = false;
-    if ((nFeature & FM_UI_FEATURE_SHOW_DATABASEBAR) == FM_UI_FEATURE_SHOW_DATABASEBAR)
+    if (nFeature & SfxShellFeature::FormShowDatabaseBar)
     {
         // nur wenn auch formulare verfuegbar
         bResult = !m_bDesignMode && GetImpl()->hasDatabaseBar() && !GetImpl()->isInFilterMode();
     }
-    else if ((nFeature & FM_UI_FEATURE_SHOW_FILTERBAR) == FM_UI_FEATURE_SHOW_FILTERBAR)
+    else if (nFeature & SfxShellFeature::FormShowFilterBar)
     {
         // nur wenn auch formulare verfuegbar
         bResult = !m_bDesignMode && GetImpl()->hasDatabaseBar() && GetImpl()->isInFilterMode();
     }
-    else if ((nFeature & FM_UI_FEATURE_SHOW_FILTERNAVIGATOR) == FM_UI_FEATURE_SHOW_FILTERNAVIGATOR)
+    else if (nFeature & SfxShellFeature::FormShowFilterNavigator)
     {
         bResult = !m_bDesignMode && GetImpl()->hasDatabaseBar() && GetImpl()->isInFilterMode();
     }
-    else if ((nFeature & FM_UI_FEATURE_SHOW_FIELD) == FM_UI_FEATURE_SHOW_FIELD)
+    else if (nFeature & SfxShellFeature::FormShowField)
     {
         bResult = m_bDesignMode && m_pFormView && m_bHasForms;
     }
-    else if ((nFeature & FM_UI_FEATURE_SHOW_PROPERTIES) == FM_UI_FEATURE_SHOW_PROPERTIES)
+    else if (nFeature & SfxShellFeature::FormShowProperies)
     {
         bResult = m_bDesignMode && m_pFormView && m_bHasForms;
     }
-    else if ((nFeature & FM_UI_FEATURE_SHOW_EXPLORER) == FM_UI_FEATURE_SHOW_EXPLORER)
+    else if (nFeature & SfxShellFeature::FormShowExplorer)
     {
         bResult = m_bDesignMode; // OJ #101593# && m_pFormView && m_bHasForms;
     }
-    else if ( ( nFeature & FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR ) == FM_UI_FEATURE_SHOW_TEXT_CONTROL_BAR )
+    else if (nFeature & SfxShellFeature::FormShowTextControlBar)
     {
         bResult = !GetImpl()->IsReadonlyDoc() && m_pImpl->IsActiveControl( true );
     }
-    else if ((nFeature & FM_UI_FEATURE_SHOW_DATANAVIGATOR) == FM_UI_FEATURE_SHOW_DATANAVIGATOR)
+    else if (nFeature & SfxShellFeature::FormShowDataNavigator)
     {
         bResult = GetImpl()->isEnhancedForm();
     }
-    else if (  ( ( nFeature & FM_UI_FEATURE_TB_CONTROLS ) == FM_UI_FEATURE_TB_CONTROLS )
-            || ( ( nFeature & FM_UI_FEATURE_TB_MORECONTROLS ) == FM_UI_FEATURE_TB_MORECONTROLS )
-            || ( ( nFeature & FM_UI_FEATURE_TB_FORMDESIGN ) == FM_UI_FEATURE_TB_FORMDESIGN )
+    else if (  (nFeature & SfxShellFeature::FormTBControls)
+            || (nFeature & SfxShellFeature::FormTBMoreControls)
+            || (nFeature & SfxShellFeature::FormTBDesign)
             )
     {
         bResult = true;
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index 6222b6a..46ade15 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -95,9 +95,6 @@ const long nScrollY  =   30;
 
 #define MAX_MARKS 5
 
-#define CHILDWIN_LABEL      1
-#define CHILDWIN_MAILMERGE  2
-
 enum ShellModes
 {
     SHELL_MODE_TEXT,
@@ -378,7 +375,7 @@ public:
 
     void                    GotFocus() const;
     virtual SdrView*        GetDrawView() const override;
-    virtual bool            HasUIFeature( sal_uInt32 nFeature ) override;
+    virtual bool            HasUIFeature(SfxShellFeature nFeature) const override;
     virtual void            ShowCursor( bool bOn = true ) override;
     virtual ErrCode         DoVerb( long nVerb ) override;
 
@@ -613,7 +610,7 @@ public:
     // store MailMerge data while "Back to Mail Merge Wizard" FloatingWindow is active
     // or to support printing
     void SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem>& rConfigItem, sal_uInt16 nRestart);
-    std::shared_ptr<SwMailMergeConfigItem> GetMailMergeConfigItem();
+    std::shared_ptr<SwMailMergeConfigItem> GetMailMergeConfigItem() const;
     std::shared_ptr<SwMailMergeConfigItem> EnsureMailMergeConfigItem(const SfxItemSet* pArgs = nullptr, sal_uInt16 nWizardRestartPage = 0);
 
     void ExecFormatPaintbrush(SfxRequest &);
diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx
index bd4798e..93430e1 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -110,7 +110,7 @@ void SwView::InitInterface_Impl()
 #endif
     GetStaticInterface()->RegisterChildWindow(FN_INSERT_FIELD_DATA_ONLY);
 
-    GetStaticInterface()->RegisterChildWindow(FN_SYNC_LABELS, false, CHILDWIN_LABEL);
+    GetStaticInterface()->RegisterChildWindow(FN_SYNC_LABELS, false, SfxShellFeature::SwChildWindowLabel);
 
     GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_TOOLS|SFX_VISIBILITY_STANDARD|SFX_VISIBILITY_SERVER,
                                             RID_TOOLS_TOOLBOX);
@@ -146,7 +146,7 @@ void SwView::SetMailMergeConfigItem(std::shared_ptr<SwMailMergeConfigItem>& rCon
     UIFeatureChanged();
 }
 
-std::shared_ptr<SwMailMergeConfigItem> SwView::GetMailMergeConfigItem()
+std::shared_ptr<SwMailMergeConfigItem> SwView::GetMailMergeConfigItem() const
 {
     return m_pViewImpl->GetMailMergeConfigItem();
 }
diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx
index 39121e8..da999bd 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -555,17 +555,20 @@ void SwView::GetDrawState(SfxItemSet &rSet)
         }
 }
 
-bool SwView::HasUIFeature( sal_uInt32 nFeature )
+bool SwView::HasUIFeature(SfxShellFeature nFeature) const
 {
-    bool bRet = false;
+    assert((nFeature & ~SfxShellFeature::SwMask) == SfxShellFeature::NONE);
     switch(nFeature)
     {
-        case CHILDWIN_LABEL     : bRet = m_pWrtShell->IsLabelDoc(); break;
+    case SfxShellFeature::SwChildWindowLabel:
+        return m_pWrtShell->IsLabelDoc();
 #if HAVE_FEATURE_DBCONNECTIVITY
-        case CHILDWIN_MAILMERGE : bRet = nullptr != GetMailMergeConfigItem(); break;
+    case SfxShellFeature::SwChildWindowMailmerge:
+        return (nullptr != GetMailMergeConfigItem());
 #endif
+    default:
+        return false;
     }
-    return bRet;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list