[Libreoffice-commits] core.git: compilerplugins/clang include/o3tl include/sfx2 include/svx sc/inc sc/source sd/inc sd/source sfx2/source starmath/inc starmath/qa starmath/source sw/inc sw/source

Noel Grandin noelgrandin at gmail.com
Mon Mar 27 09:44:19 UTC 2017


 compilerplugins/clang/passstuffbyref.cxx        |   11 +++-
 include/o3tl/strong_int.hxx                     |    2 
 include/sfx2/docfac.hxx                         |    2 
 include/sfx2/frame.hxx                          |    3 -
 include/sfx2/shell.hxx                          |   59 ++++++++-------------
 include/sfx2/viewfac.hxx                        |    9 +--
 include/sfx2/viewfrm.hxx                        |   16 ++---
 include/sfx2/viewsh.hxx                         |    4 -
 include/svx/ifaceids.hxx                        |   10 +--
 sc/inc/shellids.hxx                             |   36 ++++++-------
 sc/source/ui/app/scdll.cxx                      |    4 -
 sd/inc/FactoryIds.hxx                           |   15 ++---
 sd/inc/glob.hxx                                 |   36 ++++++-------
 sd/source/ui/inc/ViewShellImplementation.hxx    |    2 
 sd/source/ui/view/GraphicViewShellBase.cxx      |    2 
 sd/source/ui/view/ImpressViewShellBase.cxx      |    2 
 sd/source/ui/view/OutlineViewShellBase.cxx      |    2 
 sd/source/ui/view/PresentationViewShellBase.cxx |    2 
 sd/source/ui/view/SlideSorterViewShellBase.cxx  |    2 
 sd/source/ui/view/ViewShellImplementation.cxx   |    2 
 sd/source/ui/view/viewshe2.cxx                  |    6 --
 sfx2/source/appl/appdata.cxx                    |    2 
 sfx2/source/appl/appinit.cxx                    |    3 -
 sfx2/source/appl/appquit.cxx                    |    3 -
 sfx2/source/control/objface.cxx                 |    2 
 sfx2/source/doc/docfac.cxx                      |    4 -
 sfx2/source/inc/appdata.hxx                     |    3 -
 sfx2/source/view/frame.cxx                      |    2 
 sfx2/source/view/frame2.cxx                     |    6 +-
 sfx2/source/view/frmload.cxx                    |   15 ++---
 sfx2/source/view/impviewframe.hxx               |   18 +++---
 sfx2/source/view/viewfac.cxx                    |    9 +--
 sfx2/source/view/viewfrm.cxx                    |   32 +++++------
 starmath/inc/document.hxx                       |    2 
 starmath/inc/smmod.hxx                          |    2 
 starmath/inc/view.hxx                           |    2 
 starmath/qa/cppunit/test_starmath.cxx           |    2 
 starmath/source/smdll.cxx                       |    2 
 sw/inc/shellid.hxx                              |   66 ++++++++++++------------
 sw/source/core/doc/docglbl.cxx                  |    2 
 sw/source/filter/html/htmlform.cxx              |    2 
 sw/source/ui/dbui/mmresultdialogs.cxx           |    4 -
 sw/source/uibase/app/appenv.cxx                 |    2 
 sw/source/uibase/app/docsh2.cxx                 |    2 
 sw/source/uibase/app/swmodule.cxx               |    8 +-
 sw/source/uibase/dbui/dbmgr.cxx                 |    2 
 sw/source/uibase/misc/glshell.cxx               |    4 -
 sw/source/uibase/uno/unomailmerge.cxx           |    2 
 sw/source/uibase/uno/unotxdoc.cxx               |    4 -
 sw/source/uibase/uno/unotxvw.cxx                |    2 
 50 files changed, 208 insertions(+), 228 deletions(-)

New commits:
commit d615af618cc6a7152c76a49b3cd09db38eaa9e07
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Thu Mar 23 20:14:15 2017 +0200

    create SfxInterfaceId o3tl::strong_int
    
    Change-Id: Ie52f63382a9fb36f9a472801be012b140bfb51f6
    Reviewed-on: https://gerrit.libreoffice.org/35722
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx
index 8b60b5c353e7..12c13d1b6c89 100644
--- a/compilerplugins/clang/passstuffbyref.cxx
+++ b/compilerplugins/clang/passstuffbyref.cxx
@@ -252,6 +252,10 @@ void PassStuffByRef::checkParams(const FunctionDecl * functionDecl) {
     }
 }
 
+static bool startswith(const std::string& rStr, const char* pSubStr) {
+    return rStr.compare(0, strlen(pSubStr), pSubStr) == 0;
+}
+
 void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const CXXMethodDecl * methodDecl) {
 
     if (methodDecl && (methodDecl->isVirtual() || methodDecl->hasAttr<OverrideAttr>())) {
@@ -303,6 +307,9 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
         .GlobalNamespace()) {
         return;
     }
+    if (startswith(type.getAsString(), "struct o3tl::strong_int")) {
+        return;
+    }
     mbInsideFunctionDecl = true;
     mbFoundDisqualifier = false;
     TraverseStmt(functionDecl->getBody());
@@ -313,9 +320,9 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
 
     report(
             DiagnosticsEngine::Warning,
-            "rather return %0 from function %1 %2 by const& than by value, to avoid unnecessary copying",
+            "rather return %0 from function %1 by const& than by value, to avoid unnecessary copying",
             functionDecl->getSourceRange().getBegin())
-        << type.getAsString() << functionDecl->getQualifiedNameAsString() << type->getTypeClassName() << functionDecl->getSourceRange();
+        << type.getAsString() << functionDecl->getQualifiedNameAsString() << functionDecl->getSourceRange();
 
     // display the location of the class member declaration so I don't have to search for it by hand
     if (functionDecl->getSourceRange().getBegin() != functionDecl->getCanonicalDecl()->getSourceRange().getBegin())
diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx
index 30322b3efe6a..588cab8e5472 100644
--- a/include/o3tl/strong_int.hxx
+++ b/include/o3tl/strong_int.hxx
@@ -40,7 +40,7 @@ template <typename UNDERLYING_TYPE, typename PHANTOM_TYPE>
 struct strong_int
 {
 public:
-    explicit strong_int(UNDERLYING_TYPE value) : m_value(value) {}
+    explicit constexpr strong_int(UNDERLYING_TYPE value) : m_value(value) {}
     strong_int() : m_value(0) {}
 
     explicit operator UNDERLYING_TYPE() const { return m_value; }
diff --git a/include/sfx2/docfac.hxx b/include/sfx2/docfac.hxx
index 6cd70b86f586..c9fc6c880805 100644
--- a/include/sfx2/docfac.hxx
+++ b/include/sfx2/docfac.hxx
@@ -78,7 +78,7 @@ public:
     SfxModule*      GetModule() const;
 
     SAL_DLLPRIVATE void SetModule_Impl( SfxModule* );
-    SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const;
+    SAL_DLLPRIVATE sal_uInt16 GetViewNo_Impl( const SfxInterfaceId i_nViewId, const sal_uInt16 i_nFallback ) const;
 
 private:
     SfxObjectFactory(const SfxObjectFactory&) = delete;
diff --git a/include/sfx2/frame.hxx b/include/sfx2/frame.hxx
index a46fd2616cec..b8afc7f9b26d 100644
--- a/include/sfx2/frame.hxx
+++ b/include/sfx2/frame.hxx
@@ -21,6 +21,7 @@
 
 #include <sal/config.h>
 #include <sfx2/dllapi.h>
+#include <sfx2/shell.hxx>
 #include <sal/types.h>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/Any.hxx>
@@ -109,7 +110,7 @@ public:
     static SfxFrame*    Create( const css::uno::Reference< css::frame::XFrame >& xFrame );
     static css::uno::Reference< css::frame::XFrame >
                         CreateBlankFrame();
-    static SfxFrame*    Create( SfxObjectShell& rDoc, vcl::Window& rWindow, sal_uInt16 nViewId, bool bHidden );
+    static SfxFrame*    Create( SfxObjectShell& rDoc, vcl::Window& rWindow, SfxInterfaceId nViewId, bool bHidden );
 
     vcl::Window&        GetWindow() const { return *pWindow;}
     void                CancelTransfers();
diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx
index d3368ff1dea8..2e1106591115 100644
--- a/include/sfx2/shell.hxx
+++ b/include/sfx2/shell.hxx
@@ -27,6 +27,7 @@
 #include <sfx2/sfxuno.hxx>
 #include <svl/SfxBroadcaster.hxx>
 #include <o3tl/typed_flags_set.hxx>
+#include <o3tl/strong_int.hxx>
 
 class ResMgr;
 namespace vcl { class Window; }
@@ -64,35 +65,21 @@ namespace svl
     Id for <SfxInterface>s, gives a quasi-static access to the interface
     through an array to <SfxApplication>.
 */
-enum SfxInterfaceId
-{
-    SFX_INTERFACE_NONE,
-    SFX_INTERFACE_SFXAPP,
-    SFX_INTERFACE_SFXDOCSH,
-    SFX_INTERFACE_SFXVIEWSH,
-    SFX_INTERFACE_SFXVIEWFRM,
-    SFX_INTERFACE_SFXMODULE,
-    SFX_INTERFACE_OFA_START         =  100,
-    SFX_INTERFACE_OFA_END           =  100,
-    SFX_INTERFACE_SC_START          =  150,
-    SFX_INTERFACE_SC_END            =  199,
-    SFX_INTERFACE_SD_START          =  200,
-    SFX_INTERFACE_SD_END            =  249,
-    SFX_INTERFACE_SW_START          =  250,
-    SFX_INTERFACE_SW_END            =  299,
-    SFX_INTERFACE_SIM_START         =  300,
-    SFX_INTERFACE_SIM_END           =  319,
-    SFX_INTERFACE_SCH_START         =  320,
-    SFX_INTERFACE_SCH_END           =  339,
-    SFX_INTERFACE_SMA_START         =  340,
-    SFX_INTERFACE_SMA_END           =  359,
-    SFX_INTERFACE_SBA_START         =  360,
-    SFX_INTERFACE_SBA_END           =  399,
-    SFX_INTERFACE_IDE_START         =  400,
-    SFX_INTERFACE_IDE_END           =  409,
-    //-if one is still needed
-    SFX_INTERFACE_APP               =  SFX_INTERFACE_SW_START,
-};
+struct SfxInterfaceIdTag {};
+typedef o3tl::strong_int<sal_uInt16, SfxInterfaceIdTag> SfxInterfaceId;
+
+constexpr auto SFX_INTERFACE_NONE         = SfxInterfaceId(0);
+constexpr auto SFX_INTERFACE_SFXAPP       = SfxInterfaceId(1);
+constexpr auto SFX_INTERFACE_SFXDOCSH     = SfxInterfaceId(2);
+constexpr auto SFX_INTERFACE_SFXVIEWSH    = SfxInterfaceId(3);
+constexpr auto SFX_INTERFACE_SFXVIEWFRM   = SfxInterfaceId(4);
+constexpr auto SFX_INTERFACE_SFXMODULE    = SfxInterfaceId(5);
+constexpr auto SFX_INTERFACE_SC_START     = SfxInterfaceId(150);
+constexpr auto SFX_INTERFACE_SD_START     = SfxInterfaceId(200);
+constexpr auto SFX_INTERFACE_SW_START     = SfxInterfaceId(250);
+constexpr auto SFX_INTERFACE_SMA_START    = SfxInterfaceId(340);
+constexpr auto SFX_INTERFACE_IDE_START    = SfxInterfaceId(400);
+constexpr auto SFX_INTERFACE_IDE_END      = SfxInterfaceId(409);
 
 enum class SfxShellFeature
 {
@@ -547,16 +534,16 @@ inline void SfxShell::SetPool
     pPool = pNewPool;
 }
 
-#define SFX_DECL_INTERFACE(nId)                                             \
-            static SfxInterface*                pInterface;                 \
-            static SfxInterface*                GetStaticInterface();       \
-            static SfxInterfaceId               GetInterfaceId() {return SfxInterfaceId(nId);} \
-            static void                         RegisterInterface(SfxModule* pMod=nullptr); \
-            virtual SfxInterface*       GetInterface() const override;
+#define SFX_DECL_INTERFACE(nId)                                  \
+            static SfxInterface*     pInterface;                 \
+            static SfxInterface*     GetStaticInterface();       \
+            static SfxInterfaceId    GetInterfaceId() {return nId;} \
+            static void              RegisterInterface(SfxModule* pMod=nullptr); \
+            virtual SfxInterface*    GetInterface() const override;
 
 #define SFX_TMPL_INTERFACE(Class,SuperClass,Abstract)                       \
                                                                             \
-    SfxInterface* Class::pInterface = nullptr;                                    \
+    SfxInterface* Class::pInterface = nullptr;                              \
     SfxInterface* Class::GetStaticInterface()                               \
     {                                                                       \
         if ( !pInterface )                                                  \
diff --git a/include/sfx2/viewfac.hxx b/include/sfx2/viewfac.hxx
index 2bff0da82258..e9bef0f6cc76 100644
--- a/include/sfx2/viewfac.hxx
+++ b/include/sfx2/viewfac.hxx
@@ -22,6 +22,7 @@
 #include <rtl/ustring.hxx>
 #include <sal/config.h>
 #include <sfx2/dllapi.h>
+#include <sfx2/shell.hxx>
 
 class SfxViewFrame;
 class SfxViewShell;
@@ -34,10 +35,10 @@ class SFX2_DLLPUBLIC SfxViewFactory
 {
 public:
     SfxViewFactory( SfxViewCtor fnC,
-                    sal_uInt16 nOrdinal, const sal_Char* asciiViewName );
+                    SfxInterfaceId nOrdinal, const sal_Char* asciiViewName );
 
-    SfxViewShell *CreateInstance(SfxViewFrame *pViewFrame, SfxViewShell *pOldSh);
-    sal_uInt16    GetOrdinal() const { return nOrd; }
+    SfxViewShell*  CreateInstance(SfxViewFrame *pViewFrame, SfxViewShell *pOldSh);
+    SfxInterfaceId GetOrdinal() const { return nOrd; }
 
     /// returns a legacy view name. This is "view" with an appended ordinal/ID.
     OUString      GetLegacyViewName() const;
@@ -51,7 +52,7 @@ public:
 
 private:
     SfxViewCtor     fnCreate;
-    sal_uInt16      nOrd;
+    SfxInterfaceId  nOrd;
     const OUString  m_sViewName;
 };
 
diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx
index 2b6093ef3679..83928d364170 100644
--- a/include/sfx2/viewfrm.hxx
+++ b/include/sfx2/viewfrm.hxx
@@ -97,9 +97,9 @@ public:
 
     static void             SetViewFrame( SfxViewFrame* );
 
-    static SfxViewFrame*    LoadHiddenDocument( SfxObjectShell& i_rDoc, const sal_uInt16 i_nViewId );
-    static SfxViewFrame*    LoadDocument( SfxObjectShell& i_rDoc, const sal_uInt16 i_nViewId );
-    static SfxViewFrame*    LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const sal_uInt16 i_nViewId );
+    static SfxViewFrame*    LoadHiddenDocument( SfxObjectShell& i_rDoc, SfxInterfaceId i_nViewId );
+    static SfxViewFrame*    LoadDocument( SfxObjectShell& i_rDoc, SfxInterfaceId i_nViewId );
+    static SfxViewFrame*    LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, SfxInterfaceId i_nViewId );
     static SfxViewFrame*    LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const css::uno::Reference< css::frame::XFrame >& i_rFrameItem );
     static SfxViewFrame*    DisplayNewDocument( SfxObjectShell& i_rDoc, const SfxRequest& i_rCreateDocRequest );
 
@@ -143,7 +143,7 @@ public:
     SAL_DLLPRIVATE void InvalidateBorderImpl( const SfxViewShell *pSh );
 
     virtual SfxObjectShell* GetObjectShell() override;
-    sal_uInt16              GetCurViewId() const;
+    SfxInterfaceId          GetCurViewId() const;
     SfxFrame&               GetFrame() const;
     SfxViewFrame*           GetTopViewFrame() const;
 
@@ -206,12 +206,12 @@ public:
     SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &);
     SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &);
 
-    SAL_DLLPRIVATE void SetCurViewId_Impl( const sal_uInt16 i_nID );
+    SAL_DLLPRIVATE void SetCurViewId_Impl( const SfxInterfaceId i_nID );
 
 private:
     SAL_DLLPRIVATE bool SwitchToViewShell_Impl( sal_uInt16 nNo, bool bIsIndex = false );
     SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell );
-    SAL_DLLPRIVATE void SaveCurrentViewData_Impl( const sal_uInt16 i_nNewViewId );
+    SAL_DLLPRIVATE void SaveCurrentViewData_Impl( const SfxInterfaceId i_nNewViewId );
 
     /** loads the given existing document into the given frame
 
@@ -234,7 +234,7 @@ private:
                             const SfxObjectShell& i_rDoc,
                             const css::uno::Reference< css::frame::XFrame >& i_rFrame,
                             const css::uno::Sequence< css::beans::PropertyValue >& i_rLoadArgs,
-                            const sal_uInt16 i_nViewId,
+                            const SfxInterfaceId i_nViewId,
                             const bool i_bHidden
                         );
 
@@ -256,7 +256,7 @@ private:
     SAL_DLLPRIVATE static SfxViewFrame* LoadViewIntoFrame_Impl_NoThrow(
                             const SfxObjectShell& i_rDoc,
                             const css::uno::Reference< css::frame::XFrame >& i_rFrame,
-                            const sal_uInt16 i_nViewId,
+                            const SfxInterfaceId i_nViewId,
                             const bool i_bHidden
                         );
 };
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index e8aef57c7c50..52792c3d2f7b 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -118,7 +118,7 @@ private: \
     static SfxViewFactory *pFactory; \
 public: \
     static SfxViewShell  *CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView); \
-    static void           RegisterFactory( sal_uInt16 nPrio = USHRT_MAX ); \
+    static void           RegisterFactory( SfxInterfaceId nPrio ); \
     static SfxViewFactory*Factory() { return pFactory; } \
     static void           InitFactory()
 
@@ -126,7 +126,7 @@ public: \
     SfxViewFactory* Class::pFactory; \
     SfxViewShell* Class::CreateInstance(SfxViewFrame *pFrame, SfxViewShell *pOldView) \
     { return new Class(pFrame, pOldView); } \
-    void Class::RegisterFactory( sal_uInt16 nPrio ) \
+    void Class::RegisterFactory( SfxInterfaceId nPrio ) \
     { \
         pFactory = new SfxViewFactory(&CreateInstance,nPrio,AsciiViewName);\
         InitFactory(); \
diff --git a/include/svx/ifaceids.hxx b/include/svx/ifaceids.hxx
index fe7cebae0710..f9942e3f1601 100644
--- a/include/svx/ifaceids.hxx
+++ b/include/svx/ifaceids.hxx
@@ -22,13 +22,13 @@
 
 #include <sfx2/shell.hxx>
 
-#define SVX_INTERFACE_BASIDE_DOCSH      (SFX_INTERFACE_IDE_START+ 0)
-#define SVX_INTERFACE_BASIDE_VIEWSH     (SFX_INTERFACE_IDE_START+ 1)
-#define SVX_INTERFACE_EXTRUSION_BAR     (SFX_INTERFACE_IDE_START+ 2)
-#define SVX_INTERFACE_FONTWORK_BAR      (SFX_INTERFACE_IDE_START+ 3)
+#define SVX_INTERFACE_BASIDE_DOCSH      (SFX_INTERFACE_IDE_START)
+#define SVX_INTERFACE_BASIDE_VIEWSH     (SFX_INTERFACE_IDE_START + SfxInterfaceId(1))
+#define SVX_INTERFACE_EXTRUSION_BAR     (SFX_INTERFACE_IDE_START + SfxInterfaceId(2))
+#define SVX_INTERFACE_FONTWORK_BAR      (SFX_INTERFACE_IDE_START + SfxInterfaceId(3))
 
 
-#define SVX_INTERFACE_FORM_SH           (SFX_INTERFACE_IDE_END+ 1)
+#define SVX_INTERFACE_FORM_SH           (SFX_INTERFACE_IDE_END + SfxInterfaceId(1))
 
 #endif
 
diff --git a/sc/inc/shellids.hxx b/sc/inc/shellids.hxx
index 80e2bf70f0d8..642d0d633d00 100644
--- a/sc/inc/shellids.hxx
+++ b/sc/inc/shellids.hxx
@@ -21,25 +21,25 @@
 #define INCLUDED_SC_INC_SHELLIDS_HXX
 
 // Sfx Interface-IDs
-#define SCID_APP                (SFX_INTERFACE_SC_START+0)
-#define SCID_DOC_SHELL          (SFX_INTERFACE_SC_START+1)
-#define SCID_TABVIEW_SHELL      (SFX_INTERFACE_SC_START+2)
-#define SCID_TABPOP_SHELL       (SFX_INTERFACE_SC_START+3)
-#define SCID_EDIT_SHELL         (SFX_INTERFACE_SC_START+4)
-#define SCID_DRAW_SHELL         (SFX_INTERFACE_SC_START+5)
-#define SCID_DRAW_TEXT_SHELL    (SFX_INTERFACE_SC_START+6)
-#define SCID_PREVIEW_SHELL      (SFX_INTERFACE_SC_START+7)
-#define SCID_PIVOT_SHELL        (SFX_INTERFACE_SC_START+8)
-#define SCID_AUDITING_SHELL     (SFX_INTERFACE_SC_START+9)
-#define SCID_FORM_SHELL         (SFX_INTERFACE_SC_START+10)
+#define SCID_APP                (SFX_INTERFACE_SC_START+SfxInterfaceId(0))
+#define SCID_DOC_SHELL          (SFX_INTERFACE_SC_START+SfxInterfaceId(1))
+#define SCID_TABVIEW_SHELL      (SFX_INTERFACE_SC_START+SfxInterfaceId(2))
+#define SCID_TABPOP_SHELL       (SFX_INTERFACE_SC_START+SfxInterfaceId(3))
+#define SCID_EDIT_SHELL         (SFX_INTERFACE_SC_START+SfxInterfaceId(4))
+#define SCID_DRAW_SHELL         (SFX_INTERFACE_SC_START+SfxInterfaceId(5))
+#define SCID_DRAW_TEXT_SHELL    (SFX_INTERFACE_SC_START+SfxInterfaceId(6))
+#define SCID_PREVIEW_SHELL      (SFX_INTERFACE_SC_START+SfxInterfaceId(7))
+#define SCID_PIVOT_SHELL        (SFX_INTERFACE_SC_START+SfxInterfaceId(8))
+#define SCID_AUDITING_SHELL     (SFX_INTERFACE_SC_START+SfxInterfaceId(9))
+#define SCID_FORM_SHELL         (SFX_INTERFACE_SC_START+SfxInterfaceId(10))
 
-#define SCID_FORMAT_SHELL       (SFX_INTERFACE_SC_START+11)
-#define SCID_CELL_SHELL         (SFX_INTERFACE_SC_START+12)
-#define SCID_OLEOBJECT_SHELL    (SFX_INTERFACE_SC_START+13)
-#define SCID_CHART_SHELL        (SFX_INTERFACE_SC_START+14)
-#define SCID_GRAPHIC_SHELL      (SFX_INTERFACE_SC_START+15)
-#define SCID_PAGEBREAK_SHELL    (SFX_INTERFACE_SC_START+16)
-#define SCID_MEDIA_SHELL        (SFX_INTERFACE_SC_START+17)
+#define SCID_FORMAT_SHELL       (SFX_INTERFACE_SC_START+SfxInterfaceId(11))
+#define SCID_CELL_SHELL         (SFX_INTERFACE_SC_START+SfxInterfaceId(12))
+#define SCID_OLEOBJECT_SHELL    (SFX_INTERFACE_SC_START+SfxInterfaceId(13))
+#define SCID_CHART_SHELL        (SFX_INTERFACE_SC_START+SfxInterfaceId(14))
+#define SCID_GRAPHIC_SHELL      (SFX_INTERFACE_SC_START+SfxInterfaceId(15))
+#define SCID_PAGEBREAK_SHELL    (SFX_INTERFACE_SC_START+SfxInterfaceId(16))
+#define SCID_MEDIA_SHELL        (SFX_INTERFACE_SC_START+SfxInterfaceId(17))
 
 #endif
 
diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx
index 0d9df6592b08..18ec897177fa 100644
--- a/sc/source/ui/app/scdll.cxx
+++ b/sc/source/ui/app/scdll.cxx
@@ -129,8 +129,8 @@ void ScDLL::Init()
     ScGlobal::Init();
 
     // register your view-factories here
-    ScTabViewShell      ::RegisterFactory(1);
-    ScPreviewShell      ::RegisterFactory(2);
+    ScTabViewShell      ::RegisterFactory(SFX_INTERFACE_SFXAPP);
+    ScPreviewShell      ::RegisterFactory(SFX_INTERFACE_SFXDOCSH);
 
     // register your shell-interfaces here
     ScModule            ::RegisterInterface(pMod);
diff --git a/sd/inc/FactoryIds.hxx b/sd/inc/FactoryIds.hxx
index 61f276c01388..b6a5284b479c 100644
--- a/sd/inc/FactoryIds.hxx
+++ b/sd/inc/FactoryIds.hxx
@@ -20,6 +20,8 @@
 #ifndef INCLUDED_SD_INC_FACTORYIDS_HXX
 #define INCLUDED_SD_INC_FACTORYIDS_HXX
 
+#include <sfx2/shell.hxx>
+
 namespace sd {
 
 /** This are ids used by SfxTopFrame::Create() or CreateViewFrame() to
@@ -28,14 +30,11 @@ namespace sd {
     with a certain view instead of first create a default view and
     then switch to the desired view.
 */
-enum ViewShellFactoryIds
-{
-    IMPRESS_FACTORY_ID = 1,
-    DRAW_FACTORY_ID = 1,
-    SLIDE_SORTER_FACTORY_ID = 2,
-    OUTLINE_FACTORY_ID = 3,
-    PRESENTATION_FACTORY_ID = 4
-};
+constexpr auto IMPRESS_FACTORY_ID         = SfxInterfaceId(1);
+constexpr auto DRAW_FACTORY_ID            = SfxInterfaceId(1);
+constexpr auto SLIDE_SORTER_FACTORY_ID    = SfxInterfaceId(2);
+constexpr auto OUTLINE_FACTORY_ID         = SfxInterfaceId(3);
+constexpr auto PRESENTATION_FACTORY_ID     = SfxInterfaceId(4);
 
 } // end of namespace sd
 
diff --git a/sd/inc/glob.hxx b/sd/inc/glob.hxx
index f5c5ebc59dba..6df60e38889e 100644
--- a/sd/inc/glob.hxx
+++ b/sd/inc/glob.hxx
@@ -23,24 +23,24 @@
 #include <rsc/rscsfx.hxx>
 #include <sal/types.h>
 
-#define SD_IF_SDAPP                     SFX_INTERFACE_SD_START + 0
-#define SD_IF_SDDRAWDOCSHELL            SFX_INTERFACE_SD_START + 1
-#define SD_IF_SDDRAWVIEWSHELL           SFX_INTERFACE_SD_START + 3
-#define SD_IF_SDOUTLINEVIEWSHELL        SFX_INTERFACE_SD_START + 5
-#define SD_IF_SDDRAWTEXTOBJECTBAR       SFX_INTERFACE_SD_START + 7
-#define SD_IF_SDDRAWBEZIEROBJECTBAR     SFX_INTERFACE_SD_START + 8
-#define SD_IF_SDGRAPHICDOCSHELL         SFX_INTERFACE_SD_START + 10
-#define SD_IF_SDGRAPHICVIEWSHELL        SFX_INTERFACE_SD_START + 11
-#define SD_IF_SDDRAWGRAFOBJECTBAR       SFX_INTERFACE_SD_START + 13
-#define SD_IF_SDPRESVIEWSHELL           SFX_INTERFACE_SD_START + 14
-#define SD_IF_SDVIEWSHELLBASE           SFX_INTERFACE_SD_START + 16
-#define SD_IF_SDSLIDESORTERVIEWSHELL    SFX_INTERFACE_SD_START + 19
-#define SD_IF_SDDRAWMEDIAOBJECTBAR      SFX_INTERFACE_SD_START + 23
-#define SD_IF_SDLEFTIMPRESSPANESHELL    SFX_INTERFACE_SD_START + 24
-#define SD_IF_SDLEFTDRAWPANESHELL       SFX_INTERFACE_SD_START + 25
-#define SD_IF_SDDRAWTABLEOBJECTBAR      SFX_INTERFACE_SD_START + 27
-#define SD_IF_SDTOOLPANELPANESHELL      SFX_INTERFACE_SD_START + 29
-#define SD_IF_SDTOOLPANELSHELL          SFX_INTERFACE_SD_START + 30
+#define SD_IF_SDAPP                     SFX_INTERFACE_SD_START + SfxInterfaceId(0)
+#define SD_IF_SDDRAWDOCSHELL            SFX_INTERFACE_SD_START + SfxInterfaceId(1)
+#define SD_IF_SDDRAWVIEWSHELL           SFX_INTERFACE_SD_START + SfxInterfaceId(3)
+#define SD_IF_SDOUTLINEVIEWSHELL        SFX_INTERFACE_SD_START + SfxInterfaceId(5)
+#define SD_IF_SDDRAWTEXTOBJECTBAR       SFX_INTERFACE_SD_START + SfxInterfaceId(7)
+#define SD_IF_SDDRAWBEZIEROBJECTBAR     SFX_INTERFACE_SD_START + SfxInterfaceId(8)
+#define SD_IF_SDGRAPHICDOCSHELL         SFX_INTERFACE_SD_START + SfxInterfaceId(10)
+#define SD_IF_SDGRAPHICVIEWSHELL        SFX_INTERFACE_SD_START + SfxInterfaceId(11)
+#define SD_IF_SDDRAWGRAFOBJECTBAR       SFX_INTERFACE_SD_START + SfxInterfaceId(13)
+#define SD_IF_SDPRESVIEWSHELL           SFX_INTERFACE_SD_START + SfxInterfaceId(14)
+#define SD_IF_SDVIEWSHELLBASE           SFX_INTERFACE_SD_START + SfxInterfaceId(16)
+#define SD_IF_SDSLIDESORTERVIEWSHELL    SFX_INTERFACE_SD_START + SfxInterfaceId(19)
+#define SD_IF_SDDRAWMEDIAOBJECTBAR      SFX_INTERFACE_SD_START + SfxInterfaceId(23)
+#define SD_IF_SDLEFTIMPRESSPANESHELL    SFX_INTERFACE_SD_START + SfxInterfaceId(24)
+#define SD_IF_SDLEFTDRAWPANESHELL       SFX_INTERFACE_SD_START + SfxInterfaceId(25)
+#define SD_IF_SDDRAWTABLEOBJECTBAR      SFX_INTERFACE_SD_START + SfxInterfaceId(27)
+#define SD_IF_SDTOOLPANELPANESHELL      SFX_INTERFACE_SD_START + SfxInterfaceId(29)
+#define SD_IF_SDTOOLPANELSHELL          SFX_INTERFACE_SD_START + SfxInterfaceId(30)
 
 
 // Object-Ids for StarDraw UserData
diff --git a/sd/source/ui/inc/ViewShellImplementation.hxx b/sd/source/ui/inc/ViewShellImplementation.hxx
index cdcf95bf6444..4a8ba8d9f73a 100644
--- a/sd/source/ui/inc/ViewShellImplementation.hxx
+++ b/sd/source/ui/inc/ViewShellImplementation.hxx
@@ -134,7 +134,7 @@ public:
         configuration that has in the center pane a view shell of the same
         type as mrViewShell.
     */
-    sal_uInt16 GetViewId();
+    SfxInterfaceId GetViewId();
 
     /** Return a pointer to the image map dialog that is displayed in some
         child window.
diff --git a/sd/source/ui/view/GraphicViewShellBase.cxx b/sd/source/ui/view/GraphicViewShellBase.cxx
index a3926ddf3249..acbde9e978cc 100644
--- a/sd/source/ui/view/GraphicViewShellBase.cxx
+++ b/sd/source/ui/view/GraphicViewShellBase.cxx
@@ -43,7 +43,7 @@ SfxViewShell* GraphicViewShellBase::CreateInstance (
     pBase->LateInit(framework::FrameworkHelper::msDrawViewURL);
     return pBase;
 }
-void GraphicViewShellBase::RegisterFactory( sal_uInt16 nPrio )
+void GraphicViewShellBase::RegisterFactory( SfxInterfaceId nPrio )
 {
     pFactory = new SfxViewFactory(&CreateInstance,nPrio,"Default");
     InitFactory();
diff --git a/sd/source/ui/view/ImpressViewShellBase.cxx b/sd/source/ui/view/ImpressViewShellBase.cxx
index e74440f08010..50ac668def1e 100644
--- a/sd/source/ui/view/ImpressViewShellBase.cxx
+++ b/sd/source/ui/view/ImpressViewShellBase.cxx
@@ -44,7 +44,7 @@ SfxViewShell* ImpressViewShellBase::CreateInstance (
     pBase->LateInit("");
     return pBase;
 }
-void ImpressViewShellBase::RegisterFactory( sal_uInt16 nPrio )
+void ImpressViewShellBase::RegisterFactory( SfxInterfaceId nPrio )
 {
     pFactory = new SfxViewFactory(&CreateInstance,nPrio,"Default");
     InitFactory();
diff --git a/sd/source/ui/view/OutlineViewShellBase.cxx b/sd/source/ui/view/OutlineViewShellBase.cxx
index 8b8bd9a69bac..145e52cb4d07 100644
--- a/sd/source/ui/view/OutlineViewShellBase.cxx
+++ b/sd/source/ui/view/OutlineViewShellBase.cxx
@@ -41,7 +41,7 @@ SfxViewShell* OutlineViewShellBase::CreateInstance (
     pBase->LateInit(framework::FrameworkHelper::msOutlineViewURL);
     return pBase;
 }
-void OutlineViewShellBase::RegisterFactory( sal_uInt16 nPrio )
+void OutlineViewShellBase::RegisterFactory( SfxInterfaceId nPrio )
 {
     pFactory = new SfxViewFactory(&CreateInstance,nPrio,"Outline");
     InitFactory();
diff --git a/sd/source/ui/view/PresentationViewShellBase.cxx b/sd/source/ui/view/PresentationViewShellBase.cxx
index 14a134c3f1b8..4278ec5a011e 100644
--- a/sd/source/ui/view/PresentationViewShellBase.cxx
+++ b/sd/source/ui/view/PresentationViewShellBase.cxx
@@ -49,7 +49,7 @@ SfxViewShell* PresentationViewShellBase::CreateInstance (
     pBase->LateInit(framework::FrameworkHelper::msPresentationViewURL);
     return pBase;
 }
-void PresentationViewShellBase::RegisterFactory( sal_uInt16 nPrio )
+void PresentationViewShellBase::RegisterFactory( SfxInterfaceId nPrio )
 {
     pFactory = new SfxViewFactory(
         &CreateInstance,nPrio,"FullScreenPresentation");
diff --git a/sd/source/ui/view/SlideSorterViewShellBase.cxx b/sd/source/ui/view/SlideSorterViewShellBase.cxx
index 16842043fa58..732de03497fe 100644
--- a/sd/source/ui/view/SlideSorterViewShellBase.cxx
+++ b/sd/source/ui/view/SlideSorterViewShellBase.cxx
@@ -42,7 +42,7 @@ SfxViewShell* SlideSorterViewShellBase::CreateInstance (
     return pBase;
 }
 
-void SlideSorterViewShellBase::RegisterFactory( sal_uInt16 nPrio )
+void SlideSorterViewShellBase::RegisterFactory( SfxInterfaceId nPrio )
 {
     pFactory = new SfxViewFactory(&CreateInstance,nPrio,"SlideSorter");
     InitFactory();
diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx
index 582eb84d1f20..be79b7387cd9 100644
--- a/sd/source/ui/view/ViewShellImplementation.cxx
+++ b/sd/source/ui/view/ViewShellImplementation.cxx
@@ -280,7 +280,7 @@ void ViewShell::Implementation::AssignLayout ( SfxRequest& rRequest, PageKind eP
     }
 }
 
-sal_uInt16 ViewShell::Implementation::GetViewId()
+SfxInterfaceId ViewShell::Implementation::GetViewId()
 {
     switch (mrViewShell.GetShellType())
     {
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index ae3a19a6db17..e556e5ef2f2c 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -970,13 +970,11 @@ void ViewShell::WriteUserDataSequence ( css::uno::Sequence < css::beans::Propert
     // Get the view id from the view shell in the center pane.  This will
     // usually be the called view shell, but to be on the safe side we call
     // the main view shell explicitly.
-    sal_uInt16 nViewID (IMPRESS_FACTORY_ID);
+    SfxInterfaceId nViewID (IMPRESS_FACTORY_ID);
     if (GetViewShellBase().GetMainViewShell().get() != nullptr)
         nViewID = GetViewShellBase().GetMainViewShell()->mpImpl->GetViewId();
     rSequence[nIndex].Name = sUNO_View_ViewId;
-    OUStringBuffer sBuffer( "view" );
-    sBuffer.append( static_cast<sal_Int32>(nViewID));
-    rSequence[nIndex].Value <<= sBuffer.makeStringAndClear();
+    rSequence[nIndex].Value <<= "view" + OUString::number( static_cast<sal_uInt16>(nViewID));
 
     mpFrameView->WriteUserDataSequence( rSequence, bBrowse );
 }
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index b4a5ff441f4c..44f8843930fa 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -117,8 +117,6 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* )
     , pViewFrame( nullptr )
     , pSlotPool( nullptr )
     , pAppDispat( nullptr )
-    , pInterfaces( nullptr )
-    , nInterfaces( 0 )
     , bDowning( true )
     , bInQuit( false )
 
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 3be03707ff3b..971b0a6d79fc 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -241,9 +241,6 @@ void SfxApplication::Initialize_Impl()
     pImpl->pViewFrames = new SfxViewFrameArr_Impl;
     pImpl->pViewShells = new SfxViewShellArr_Impl;
     pImpl->pObjShells = new SfxObjectShellArr_Impl;
-    pImpl->nInterfaces = SFX_INTERFACE_APP+8;
-    pImpl->pInterfaces = new SfxInterface*[pImpl->nInterfaces];
-    memset( pImpl->pInterfaces, 0, sizeof(SfxInterface*) * pImpl->nInterfaces );
 
     Registrations_Impl();
 
diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx
index 67264060a298..b33eb7819964 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -100,9 +100,6 @@ void SfxApplication::Deinitialize()
 
     DBG_ASSERT( pImpl->pViewFrame == nullptr, "active foreign ViewFrame" );
 
-    delete[] pImpl->pInterfaces;
-    pImpl->pInterfaces = nullptr;
-
     // free administration managers
     DELETEZ(pImpl->pAppDispat);
     SfxResId::DeleteResMgr();
diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx
index 68d229dbd470..0bf304903c19 100644
--- a/sfx2/source/control/objface.cxx
+++ b/sfx2/source/control/objface.cxx
@@ -481,7 +481,7 @@ sal_uInt32 SfxInterface::GetChildWindowId (sal_uInt16 nNo) const
 
     sal_uInt32 nRet = pImplData->aChildWindows[nNo]->nResId;
     if ( pImplData->aChildWindows[nNo]->bContext )
-        nRet += sal_uInt32( nClassId ) << 16;
+        nRet += sal_uInt16( nClassId ) << 16;
     return nRet;
 }
 
diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx
index cfe4e5fdac7b..f5fa98958ad4 100644
--- a/sfx2/source/doc/docfac.cxx
+++ b/sfx2/source/doc/docfac.cxx
@@ -370,11 +370,11 @@ OUString SfxObjectFactory::GetModuleName() const
 }
 
 
-sal_uInt16 SfxObjectFactory::GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const
+sal_uInt16 SfxObjectFactory::GetViewNo_Impl( const SfxInterfaceId i_nViewId, const sal_uInt16 i_nFallback ) const
 {
     for ( sal_uInt16 curViewNo = 0; curViewNo < GetViewFactoryCount(); ++curViewNo )
     {
-        const sal_uInt16 curViewId = GetViewFactory( curViewNo ).GetOrdinal();
+        const SfxInterfaceId curViewId = GetViewFactory( curViewNo ).GetOrdinal();
         if ( i_nViewId == curViewId )
            return curViewNo;
     }
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 4adc6d6cfcb5..8e9392160086 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -118,11 +118,8 @@ public:
     SfxViewFrame*               pViewFrame;
     SfxSlotPool*                pSlotPool;
     SfxDispatcher*              pAppDispat;     // Dispatcher if no document
-    SfxInterface**              pInterfaces;
     ::rtl::Reference<sfx2::sidebar::Theme> m_pSidebarTheme;
 
-    sal_uInt16                  nInterfaces;
-
     bool                        bDowning:1;   // sal_True on Exit and afterwards
     bool                        bInQuit : 1;
 
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index b66cebd154dd..c9872924cb58 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -352,7 +352,7 @@ void SfxFrame::GetViewData_Impl()
         }
 
         if ( pViewFrame->GetCurViewId() )
-            pSet->Put( SfxUInt16Item( SID_VIEW_ID, pViewFrame->GetCurViewId() ) );
+            pSet->Put( SfxUInt16Item( SID_VIEW_ID, (sal_uInt16)pViewFrame->GetCurViewId() ) );
         if ( pChildArr )
         {
             // For Framesets also the data from the ChildViews have to be processed
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 0b6fb83f1e68..c48711c8fcf2 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -218,7 +218,7 @@ Reference < XFrame > SfxFrame::CreateBlankFrame()
     return xFrame;
 }
 
-SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, vcl::Window& rWindow, sal_uInt16 nViewId, bool bHidden )
+SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, vcl::Window& rWindow, SfxInterfaceId nViewId, bool bHidden )
 {
     SfxFrame* pFrame = nullptr;
     try
@@ -242,8 +242,8 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, vcl::Window& rWindow, sal_uInt
         ::comphelper::NamedValueCollection aArgs( aLoadArgs );
         aArgs.put( "Model", rDoc.GetModel() );
         aArgs.put( "Hidden", bHidden );
-        if ( nViewId )
-            aArgs.put( "ViewId", nViewId );
+        if ( nViewId != SfxInterfaceId(0) )
+            aArgs.put( "ViewId", (sal_uInt16)nViewId );
 
         aLoadArgs = aArgs.getPropertyValues();
 
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index 5efadcfd2b35..90c01dba7dc1 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -165,7 +165,7 @@ private:
                             ::comphelper::NamedValueCollection& io_rDescriptor
                         );
 
-    static sal_Int16   impl_determineEffectiveViewId_nothrow(
+    static SfxInterfaceId impl_determineEffectiveViewId_nothrow(
                             const SfxObjectShell& i_rDocument,
                             const ::comphelper::NamedValueCollection& i_rDescriptor
                         );
@@ -536,12 +536,13 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo
 }
 
 
-sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor )
+SfxInterfaceId SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor )
 {
-    sal_Int16 nViewId = i_rDescriptor.getOrDefault( "ViewId", sal_Int16( 0 ) );
+    SfxInterfaceId nViewId(i_rDescriptor.getOrDefault( "ViewId", sal_Int16( 0 ) ));
     try
     {
-        if ( nViewId == 0 ) do
+        if ( nViewId == SfxInterfaceId(0) )
+        do
         {
             Reference< XViewDataSupplier > xViewDataSupplier( i_rDocument.GetModel(), UNO_QUERY );
             Reference< XIndexAccess > xViewData;
@@ -567,7 +568,7 @@ sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxO
 
             SfxViewFactory* pViewFactory = i_rDocument.GetFactory().GetViewFactoryByViewName( sViewId );
             if ( pViewFactory )
-                nViewId = sal_Int16( pViewFactory->GetOrdinal() );
+                nViewId = pViewFactory->GetOrdinal();
         }
         while ( false );
     }
@@ -576,7 +577,7 @@ sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxO
         DBG_UNHANDLED_EXCEPTION();
     }
 
-    if ( nViewId == 0 )
+    if ( nViewId == SfxInterfaceId(0) )
         nViewId = i_rDocument.GetFactory().GetViewFactory().GetOrdinal();
     return nViewId;
 }
@@ -708,7 +709,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
         ENSURE_OR_THROW( xDoc.is(), "no SfxObjectShell for the given model" );
 
         // ensure the ID of the to-be-created view is in the descriptor, if possible
-        const sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor );
+        const SfxInterfaceId nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor );
         const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 );
         const OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetAPIViewName() );
 
diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx
index 5238f2a4f50e..1ef39b8b4a19 100644
--- a/sfx2/source/view/impviewframe.hxx
+++ b/sfx2/source/view/impviewframe.hxx
@@ -38,15 +38,15 @@ struct SfxViewFrame_Impl
     SfxViewFrame*       pActiveChild;
     VclPtr<vcl::Window> pFocusWin;
     sal_uInt16          nDocViewNo;
-    sal_uInt16          nCurViewId;
-    bool            bResizeInToOut:1;
-    bool            bObjLocked:1;
-    bool            bReloading:1;
-    bool            bIsDowning:1;
-    bool            bModal:1;
-    bool            bEnabled:1;
-    bool            bWindowWasEnabled:1;
-    bool            bActive;
+    SfxInterfaceId      nCurViewId;
+    bool                bResizeInToOut:1;
+    bool                bObjLocked:1;
+    bool                bReloading:1;
+    bool                bIsDowning:1;
+    bool                bModal:1;
+    bool                bEnabled:1;
+    bool                bWindowWasEnabled:1;
+    bool                bActive;
     OUString            aFactoryName;
 
     explicit SfxViewFrame_Impl(SfxFrame& i_rFrame)
diff --git a/sfx2/source/view/viewfac.cxx b/sfx2/source/view/viewfac.cxx
index 6e778c67ba9a..255a1536887f 100644
--- a/sfx2/source/view/viewfac.cxx
+++ b/sfx2/source/view/viewfac.cxx
@@ -30,10 +30,7 @@ SfxViewShell *SfxViewFactory::CreateInstance(SfxViewFrame *pFrame, SfxViewShell
 
 OUString SfxViewFactory::GetLegacyViewName() const
 {
-    OUStringBuffer aViewName;
-    aViewName.append( "view" );
-    aViewName.append( sal_Int32( GetOrdinal() ) );
-    return aViewName.makeStringAndClear();
+    return "view" + OUString::number( sal_uInt16( GetOrdinal() ) );
 }
 
 OUString SfxViewFactory::GetAPIViewName() const
@@ -41,7 +38,7 @@ OUString SfxViewFactory::GetAPIViewName() const
     if ( !m_sViewName.isEmpty() )
         return m_sViewName;
 
-    if ( GetOrdinal() == 0 )
+    if ( GetOrdinal() == SfxInterfaceId(0) )
         return OUString( "Default" );
 
     return GetLegacyViewName();
@@ -50,7 +47,7 @@ OUString SfxViewFactory::GetAPIViewName() const
 // CTOR / DTOR -----------------------------------------------------------
 
 SfxViewFactory::SfxViewFactory( SfxViewCtor fnC,
-                                sal_uInt16 nOrdinal, const sal_Char* asciiViewName ):
+                                SfxInterfaceId nOrdinal, const sal_Char* asciiViewName ):
     fnCreate(fnC),
     nOrd(nOrdinal),
     m_sViewName( OUString::createFromAscii( asciiViewName ) )
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index e1175e8cebc6..f7d3fe9bc749 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -563,7 +563,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                 // collect the views of the document
                 // TODO: when UNO ViewFactories are available for SFX-based documents, the below code should
                 // be UNOized, too
-                typedef ::std::pair< Reference< XFrame >, sal_uInt16 >  ViewDescriptor;
+                typedef ::std::pair< Reference< XFrame >, SfxInterfaceId >  ViewDescriptor;
                 ::std::list< ViewDescriptor > aViewFrames;
                 SfxViewFrame *pView = GetFirst( xOldObj );
                 while ( pView )
@@ -1325,7 +1325,7 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh )
     m_pImpl->bObjLocked = false;
     m_pImpl->pFocusWin = nullptr;
     m_pImpl->pActiveChild = nullptr;
-    m_pImpl->nCurViewId = 0;
+    m_pImpl->nCurViewId = SfxInterfaceId(0);
     m_pImpl->bReloading = false;
     m_pImpl->bIsDowning = false;
     m_pImpl->bModal = false;
@@ -1708,7 +1708,7 @@ SfxViewFrame* SfxViewFrame::GetActiveChildFrame_Impl() const
 }
 
 SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame,
-                                                   const sal_uInt16 i_nViewId, const bool i_bHidden )
+                                                   const SfxInterfaceId i_nViewId, const bool i_bHidden )
 {
     Reference< XFrame > xFrame( i_rFrame );
     bool bOwnFrame = false;
@@ -1778,7 +1778,7 @@ SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell
 }
 
 SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame,
-                                           const Sequence< PropertyValue >& i_rLoadArgs, const sal_uInt16 i_nViewId,
+                                           const Sequence< PropertyValue >& i_rLoadArgs, const SfxInterfaceId i_nViewId,
                                            const bool i_bHidden )
 {
     Reference< XModel > xDocument( i_rDoc.GetModel(), UNO_SET_THROW );
@@ -1786,7 +1786,7 @@ SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc
     ::comphelper::NamedValueCollection aTransformLoadArgs( i_rLoadArgs.getLength() ? i_rLoadArgs : xDocument->getArgs() );
     aTransformLoadArgs.put( "Model", xDocument );
     if ( i_nViewId )
-        aTransformLoadArgs.put( "ViewId", sal_Int16( i_nViewId ) );
+        aTransformLoadArgs.put( "ViewId", sal_uInt16( i_nViewId ) );
     if ( i_bHidden )
         aTransformLoadArgs.put( "Hidden", i_bHidden );
     else
@@ -1806,22 +1806,22 @@ SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc
     return pViewShell;
 }
 
-SfxViewFrame* SfxViewFrame::LoadHiddenDocument( SfxObjectShell& i_rDoc, const sal_uInt16 i_nViewId )
+SfxViewFrame* SfxViewFrame::LoadHiddenDocument( SfxObjectShell& i_rDoc, SfxInterfaceId i_nViewId )
 {
     return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, Reference< XFrame >(), i_nViewId, true );
 }
 
-SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, const sal_uInt16 i_nViewId )
+SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, SfxInterfaceId i_nViewId )
 {
     return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, Reference< XFrame >(), i_nViewId, false );
 }
 
 SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rTargetFrame )
 {
-    return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_rTargetFrame, 0, false );
+    return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_rTargetFrame, SfxInterfaceId(0), false );
 }
 
-SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const sal_uInt16 i_nViewId )
+SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, SfxInterfaceId i_nViewId )
 {
     return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_pFrameItem && i_pFrameItem->GetFrame() ? i_pFrameItem->GetFrame()->GetFrameInterface() : nullptr, i_nViewId, false );
 }
@@ -1834,7 +1834,7 @@ SfxViewFrame* SfxViewFrame::DisplayNewDocument( SfxObjectShell& i_rDoc, const Sf
     return LoadViewIntoFrame_Impl_NoThrow(
         i_rDoc,
         pFrameItem ? pFrameItem->GetFrame() : nullptr,
-        0,
+        SfxInterfaceId(0),
         pHiddenItem && pHiddenItem->GetValue()
     );
 }
@@ -1871,7 +1871,7 @@ SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, c
     return pViewFrame;
 }
 
-void SfxViewFrame::SaveCurrentViewData_Impl( const sal_uInt16 i_nNewViewId )
+void SfxViewFrame::SaveCurrentViewData_Impl( const SfxInterfaceId i_nNewViewId )
 {
     SfxViewShell* pCurrentShell = GetViewShell();
     ENSURE_OR_RETURN_VOID( pCurrentShell != nullptr, "SfxViewFrame::SaveCurrentViewData_Impl: no current view shell -> no current view data!" );
@@ -1990,7 +1990,7 @@ bool SfxViewFrame::SwitchToViewShell_Impl
 
         // ID of the new view
         SfxObjectFactory& rDocFact = GetObjectShell()->GetFactory();
-        const sal_uInt16 nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : nViewIdOrNo;
+        const SfxInterfaceId nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : SfxInterfaceId(nViewIdOrNo);
 
         // save the view data of the old view, so it can be restored later on (when needed)
         SaveCurrentViewData_Impl( nViewId );
@@ -2025,12 +2025,12 @@ bool SfxViewFrame::SwitchToViewShell_Impl
     return true;
 }
 
-void SfxViewFrame::SetCurViewId_Impl( const sal_uInt16 i_nID )
+void SfxViewFrame::SetCurViewId_Impl( const SfxInterfaceId i_nID )
 {
     m_pImpl->nCurViewId = i_nID;
 }
 
-sal_uInt16 SfxViewFrame::GetCurViewId() const
+SfxInterfaceId SfxViewFrame::GetCurViewId() const
 {
     return m_pImpl->nCurViewId;
 }
@@ -2104,7 +2104,7 @@ void SfxViewFrame::ExecView_Impl
 
             // the view ID (optional arg. TODO: this is currently not supported in the slot definition ...)
             const SfxUInt16Item* pViewIdItem = rReq.GetArg<SfxUInt16Item>(SID_VIEW_ID);
-            const sal_uInt16 nViewId = pViewIdItem ? pViewIdItem->GetValue() : GetCurViewId();
+            const SfxInterfaceId nViewId = pViewIdItem ? SfxInterfaceId(pViewIdItem->GetValue()) : GetCurViewId();
 
             Reference < XFrame > xFrame;
             // the frame (optional arg. TODO: this is currently not supported in the slot definition ...)
@@ -2216,7 +2216,7 @@ void SfxViewFrame::StateView_Impl
             {
                 case SID_VIEWSHELL:
                 {
-                    rSet.Put( SfxUInt16Item( nWhich, m_pImpl->nCurViewId ) );
+                    rSet.Put( SfxUInt16Item( nWhich, sal_uInt16(m_pImpl->nCurViewId )) );
                     break;
                 }
 
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index 83cda04329a6..0c72a33f50a1 100644
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -136,7 +136,7 @@ class SM_DLLPUBLIC SmDocShell : public SfxObjectShell, public SfxListener
     void                InvalidateCursor();
 
 public:
-    SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+1)
+    SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+SfxInterfaceId(1))
 
     SFX_DECL_OBJECTFACTORY();
 
diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx
index 15036a7f6792..3e35885b3af8 100644
--- a/starmath/inc/smmod.hxx
+++ b/starmath/inc/smmod.hxx
@@ -93,7 +93,7 @@ class SmModule : public SfxModule, public utl::ConfigurationListener
     static void ApplyColorConfigValues( const svtools::ColorConfig &rColorCfg );
 
 public:
-    SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + 0)
+    SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START + SfxInterfaceId(0))
 
 private:
     /// SfxInterface initializer.
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index b41f5a78caa9..83cf858ba36f 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -294,7 +294,7 @@ public:
     void        NextError();
     void        PrevError();
 
-    SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+2)
+    SFX_DECL_INTERFACE(SFX_INTERFACE_SMA_START+SfxInterfaceId(2))
     SFX_DECL_VIEWFACTORY(SmViewShell);
 
 private:
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index becdcc5f6ec0..8ec24004e9ad 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -108,7 +108,7 @@ void Test::setUp()
         SfxModelFlags::DISABLE_DOCUMENT_RECOVERY);
     m_xDocShRef->DoInitNew();
 
-    SfxViewFrame *pViewFrame = SfxViewFrame::LoadHiddenDocument(*m_xDocShRef, 0);
+    SfxViewFrame *pViewFrame = SfxViewFrame::LoadHiddenDocument(*m_xDocShRef, SFX_INTERFACE_NONE);
 
     CPPUNIT_ASSERT_MESSAGE("Should have a SfxViewFrame", pViewFrame);
 
diff --git a/starmath/source/smdll.cxx b/starmath/source/smdll.cxx
index 88d53c164fc8..162d26e915fd 100644
--- a/starmath/source/smdll.cxx
+++ b/starmath/source/smdll.cxx
@@ -65,7 +65,7 @@ namespace
         SmDocShell::RegisterInterface(pModule);
         SmViewShell::RegisterInterface(pModule);
 
-        SmViewShell::RegisterFactory(1);
+        SmViewShell::RegisterFactory(SFX_INTERFACE_SFXAPP);
 
         SvxZoomStatusBarControl::RegisterControl(SID_ATTR_ZOOM, pModule);
         SvxZoomSliderControl::RegisterControl(SID_ATTR_ZOOMSLIDER, pModule);
diff --git a/sw/inc/shellid.hxx b/sw/inc/shellid.hxx
index 33ff3581d847..d7bfe88d0c0e 100644
--- a/sw/inc/shellid.hxx
+++ b/sw/inc/shellid.hxx
@@ -23,44 +23,44 @@
 
 // Mapping for UI-parameters
 
-#define SW_BASESHELL            (SFX_INTERFACE_SW_START + 1)
-#define SW_TEXTSHELL            (SFX_INTERFACE_SW_START + 2)
-#define SW_LISTSHELL            (SFX_INTERFACE_SW_START + 3)
-#define SW_TABSHELL             (SFX_INTERFACE_SW_START + 4)
-#define SW_FRAMESHELL           (SFX_INTERFACE_SW_START + 5)
-#define SW_GRFSHELL             (SFX_INTERFACE_SW_START + 6)
-#define SW_OLESHELL             (SFX_INTERFACE_SW_START + 7)
-#define SW_DRAWSHELL            (SFX_INTERFACE_SW_START + 8)
-#define SW_DRWTXTSHELL          (SFX_INTERFACE_SW_START + 9)
+#define SW_BASESHELL            (SFX_INTERFACE_SW_START + SfxInterfaceId(1))
+#define SW_TEXTSHELL            (SFX_INTERFACE_SW_START + SfxInterfaceId(2))
+#define SW_LISTSHELL            (SFX_INTERFACE_SW_START + SfxInterfaceId(3))
+#define SW_TABSHELL             (SFX_INTERFACE_SW_START + SfxInterfaceId(4))
+#define SW_FRAMESHELL           (SFX_INTERFACE_SW_START + SfxInterfaceId(5))
+#define SW_GRFSHELL             (SFX_INTERFACE_SW_START + SfxInterfaceId(6))
+#define SW_OLESHELL             (SFX_INTERFACE_SW_START + SfxInterfaceId(7))
+#define SW_DRAWSHELL            (SFX_INTERFACE_SW_START + SfxInterfaceId(8))
+#define SW_DRWTXTSHELL          (SFX_INTERFACE_SW_START + SfxInterfaceId(9))
 
-#define SW_INTERFACE_MODULE     (SFX_INTERFACE_SW_START + 10)
-#define SW_DOCSHELL             (SFX_INTERFACE_SW_START + 11)
-#define SW_VIEWSHELL            (SFX_INTERFACE_SW_START + 12)
-#define SW_PAGEPREVIEW          (SFX_INTERFACE_SW_START + 13)
-#define SW_GLOSDOCSHELL         (SFX_INTERFACE_SW_START + 14)
-#define SW_SRC_VIEWSHELL        (SFX_INTERFACE_SW_START + 15)
+#define SW_INTERFACE_MODULE     (SFX_INTERFACE_SW_START + SfxInterfaceId(10))
+#define SW_DOCSHELL             (SFX_INTERFACE_SW_START + SfxInterfaceId(11))
+#define SW_VIEWSHELL            (SFX_INTERFACE_SW_START + SfxInterfaceId(12))
+#define SW_PAGEPREVIEW          (SFX_INTERFACE_SW_START + SfxInterfaceId(13))
+#define SW_GLOSDOCSHELL         (SFX_INTERFACE_SW_START + SfxInterfaceId(14))
+#define SW_SRC_VIEWSHELL        (SFX_INTERFACE_SW_START + SfxInterfaceId(15))
 
-#define SW_BEZIERSHELL          (SFX_INTERFACE_SW_START + 16)
-#define SW_DRAWBASESHELL        (SFX_INTERFACE_SW_START + 17)
-#define SW_DRAWFORMSHELL        (SFX_INTERFACE_SW_START + 18)
+#define SW_BEZIERSHELL          (SFX_INTERFACE_SW_START + SfxInterfaceId(16))
+#define SW_DRAWBASESHELL        (SFX_INTERFACE_SW_START + SfxInterfaceId(17))
+#define SW_DRAWFORMSHELL        (SFX_INTERFACE_SW_START + SfxInterfaceId(18))
 
-#define SW_WEBDOCSHELL          (SFX_INTERFACE_SW_START + 19)
-#define SW_WEBVIEWSHELL         (SFX_INTERFACE_SW_START + 20)
-#define SW_WEBBASESHELL         (SFX_INTERFACE_SW_START + 21)
-#define SW_WEBTEXTSHELL         (SFX_INTERFACE_SW_START + 22)
-#define SW_WEBFRAMESHELL        (SFX_INTERFACE_SW_START + 23)
-#define SW_WEBGLOSDOCSHELL      (SFX_INTERFACE_SW_START + 24)
-#define SW_WEBLISTSHELL         (SFX_INTERFACE_SW_START + 25)
-#define SW_WEBTABSHELL          (SFX_INTERFACE_SW_START + 26)
-#define SW_WEBGRFSHELL          (SFX_INTERFACE_SW_START + 27)
-#define SW_WEBOLESHELL          (SFX_INTERFACE_SW_START + 28)
-#define SW_WEBDRAWBASESHELL     (SFX_INTERFACE_SW_START + 29)
-#define SW_WEBDRAWFORMSHELL     (SFX_INTERFACE_SW_START + 30)
+#define SW_WEBDOCSHELL          (SFX_INTERFACE_SW_START + SfxInterfaceId(19))
+#define SW_WEBVIEWSHELL         (SFX_INTERFACE_SW_START + SfxInterfaceId(20))
+#define SW_WEBBASESHELL         (SFX_INTERFACE_SW_START + SfxInterfaceId(21))
+#define SW_WEBTEXTSHELL         (SFX_INTERFACE_SW_START + SfxInterfaceId(22))
+#define SW_WEBFRAMESHELL        (SFX_INTERFACE_SW_START + SfxInterfaceId(23))
+#define SW_WEBGLOSDOCSHELL      (SFX_INTERFACE_SW_START + SfxInterfaceId(24))
+#define SW_WEBLISTSHELL         (SFX_INTERFACE_SW_START + SfxInterfaceId(25))
+#define SW_WEBTABSHELL          (SFX_INTERFACE_SW_START + SfxInterfaceId(26))
+#define SW_WEBGRFSHELL          (SFX_INTERFACE_SW_START + SfxInterfaceId(27))
+#define SW_WEBOLESHELL          (SFX_INTERFACE_SW_START + SfxInterfaceId(28))
+#define SW_WEBDRAWBASESHELL     (SFX_INTERFACE_SW_START + SfxInterfaceId(29))
+#define SW_WEBDRAWFORMSHELL     (SFX_INTERFACE_SW_START + SfxInterfaceId(30))
 
-#define SW_MEDIASHELL           (SFX_INTERFACE_SW_START + 31)
-#define SW_ANNOTATIONSHELL      (SFX_INTERFACE_SW_START + 32)
+#define SW_MEDIASHELL           (SFX_INTERFACE_SW_START + SfxInterfaceId(31))
+#define SW_ANNOTATIONSHELL      (SFX_INTERFACE_SW_START + SfxInterfaceId(32))
 
-#define SW_NAVIGATIONSHELL      (SFX_INTERFACE_SW_START + 33)
+#define SW_NAVIGATIONSHELL      (SFX_INTERFACE_SW_START + SfxInterfaceId(33))
 #endif // _UIPARAM_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index f4b0afb0d8da..f1580189c70f 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -327,7 +327,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
                     if( SPLITDOC_TO_HTML == eDocType &&
                         !pDoc->GetSpzFrameFormats()->empty() )
                     {
-                            SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
+                            SfxViewFrame::LoadHiddenDocument( *xDocSh, SFX_INTERFACE_NONE );
                     }
                     xDocSh->DoSaveAs( *pTmpMed );
                     xDocSh->DoSaveCompleted( pTmpMed );
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index 67dc1883d838..c8dc6f681a69 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -647,7 +647,7 @@ void SwHTMLParser::SetControlSize( const uno::Reference< drawing::XShape >& rSha
                 m_bRemoveHidden = ( pHiddenItem == nullptr || !pHiddenItem->GetValue() );
             }
 
-            m_pTempViewFrame = SfxViewFrame::LoadHiddenDocument( *pDocSh, 0 );
+            m_pTempViewFrame = SfxViewFrame::LoadHiddenDocument( *pDocSh, SFX_INTERFACE_NONE );
             CallStartAction();
             pVSh = m_xDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
             // this ridiculous hack also enables Undo, so turn it off again
diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index a33cf9950900..a61fa90c0909 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -694,7 +694,7 @@ IMPL_LINK(SwMMResultSaveDialog, SaveOutputHdl_Impl, Button*, pButton, void)
             // the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here
             SfxObjectShellLock xTempDocShell( new SwDocShell( SfxObjectCreateMode::STANDARD ) );
             xTempDocShell->DoInitNew();
-            SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 );
+            SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, SFX_INTERFACE_NONE );
             SwView* pTempView = static_cast<SwView*>( pTempFrame->GetViewShell() );
             pTargetView->GetWrtShell().StartAction();
             SwgReaderOption aOpt;
@@ -1101,7 +1101,7 @@ IMPL_LINK(SwMMResultEmailDialog, SendDocumentsHdl_Impl, Button*, pButton, void)
         // the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here
         SfxObjectShellLock xTempDocShell( new SwDocShell( SfxObjectCreateMode::STANDARD ) );
         xTempDocShell->DoInitNew();
-        SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, 0 );
+        SfxViewFrame* pTempFrame = SfxViewFrame::LoadHiddenDocument( *xTempDocShell, SFX_INTERFACE_NONE );
         SwView* pTempView = static_cast<SwView*>( pTempFrame->GetViewShell() );
         pTargetView->GetWrtShell().StartAction();
         SwgReaderOption aOpt;
diff --git a/sw/source/uibase/app/appenv.cxx b/sw/source/uibase/app/appenv.cxx
index 93366b85d8c3..ec4bfc0a4187 100644
--- a/sw/source/uibase/app/appenv.cxx
+++ b/sw/source/uibase/app/appenv.cxx
@@ -160,7 +160,7 @@ void SwModule::InsertEnv( SfxRequest& rReq )
     // Create new document (don't show!)
     SfxObjectShellLock xDocSh( new SwDocShell( SfxObjectCreateMode::STANDARD ) );
     xDocSh->DoInitNew();
-    pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
+    pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, SFX_INTERFACE_NONE );
     pNewView = static_cast<SwView*>( pFrame->GetViewShell());
     pNewView->AttrChangedNotify( &pNewView->GetWrtShell() ); // so that SelectShell is being called
     pSh = pNewView->GetWrtShellPtr();
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 1fa82477ff77..9c4af8e901cd 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -746,7 +746,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
                 else
                 {
                     // Create new document
-                    SfxViewFrame *pFrame = SfxViewFrame::LoadDocument( *xDocSh, 0 );
+                    SfxViewFrame *pFrame = SfxViewFrame::LoadDocument( *xDocSh, SFX_INTERFACE_NONE );
                     SwView      *pCurrView = static_cast<SwView*>( pFrame->GetViewShell());
 
                     // Set document's title
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index e1d7db7bee15..88ef18e5cdb8 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -230,15 +230,15 @@ void SwDLL::RegisterFactories()
     // These Id's must not be changed. Through these Id's the View (resume Documentview)
     // is created by Sfx.
     if (!utl::ConfigManager::IsAvoidConfig() && SvtModuleOptions().IsWriter())
-        SwView::RegisterFactory         ( 2 );
+        SwView::RegisterFactory         ( SFX_INTERFACE_SFXDOCSH );
 
 #if HAVE_FEATURE_DESKTOP
-    SwWebView::RegisterFactory        ( 5 );
+    SwWebView::RegisterFactory        ( SFX_INTERFACE_SFXMODULE );
 
     if (!utl::ConfigManager::IsAvoidConfig() && SvtModuleOptions().IsWriter())
     {
-        SwSrcView::RegisterFactory      ( 6 );
-        SwPagePreview::RegisterFactory  ( 7 );
+        SwSrcView::RegisterFactory      ( SfxInterfaceId(6) );
+        SwPagePreview::RegisterFactory  ( SfxInterfaceId(7) );
     }
 #endif
 }
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 965ca0f05b60..f54a51d80f28 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -973,7 +973,7 @@ static SfxObjectShell* lcl_CreateWorkingDocument(
 {
     const SwDoc *pSourceDoc = rSourceWrtShell.GetDoc();
     SfxObjectShellRef xWorkObjectShell = pSourceDoc->CreateCopy( true, (aType == WorkingDocType::TARGET) );
-    SfxViewFrame* pWorkFrame = SfxViewFrame::LoadHiddenDocument( *xWorkObjectShell, 0 );
+    SfxViewFrame* pWorkFrame = SfxViewFrame::LoadHiddenDocument( *xWorkObjectShell, SFX_INTERFACE_NONE );
 
     if( pSourceWindow )
     {
diff --git a/sw/source/uibase/misc/glshell.cxx b/sw/source/uibase/misc/glshell.cxx
index 82fecf90b152..8dbf06f4d057 100644
--- a/sw/source/uibase/misc/glshell.cxx
+++ b/sw/source/uibase/misc/glshell.cxx
@@ -204,10 +204,10 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const OUString& rGroup, const OUString
     if (pGroup && pGroup->GetCount())
     {
         // query which view is registered. In WebWriter there is no normal view
-        sal_uInt16 nViewId = nullptr != SwView::Factory() ? 2 : 6;
+        SfxInterfaceId nViewId = nullptr != SwView::Factory() ? SFX_INTERFACE_SFXDOCSH : SfxInterfaceId(6);
         const OUString sLongName = pGroup->GetLongName(pGroup->GetIndex( rShortName ));
 
-        if( 6 == nViewId )
+        if( SfxInterfaceId(6) == nViewId )
         {
             SwWebGlosDocShell* pDocSh = new SwWebGlosDocShell();
             xDocSh = pDocSh;
diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx
index 6b9ae135da79..ed90741306d5 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -384,7 +384,7 @@ SwXMailMerge::SwXMailMerge() :
     // like in: SwModule::InsertEnv (appenv.cxx)
     m_xDocSh = new SwDocShell( SfxObjectCreateMode::STANDARD );
     m_xDocSh->DoInitNew();
-    SfxViewFrame *pFrame = SfxViewFrame::LoadHiddenDocument( *m_xDocSh, 0 );
+    SfxViewFrame *pFrame = SfxViewFrame::LoadHiddenDocument( *m_xDocSh, SFX_INTERFACE_NONE );
     SwView *pView = static_cast<SwView*>( pFrame->GetViewShell() );
     pView->AttrChangedNotify( &pView->GetWrtShell() ); //So that SelectShell is called.
     m_xModel = m_xDocSh->GetModel();
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index d23b31d7ed43..64b5dff73365 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -1152,7 +1152,7 @@ void SwXTextDocument::printPages(const Sequence< beans::PropertyValue >& xOption
     SolarMutexGuard aGuard;
     if(IsValid())
     {
-        SfxViewFrame* pFrame = SfxViewFrame::LoadHiddenDocument( *pDocShell, 7 );
+        SfxViewFrame* pFrame = SfxViewFrame::LoadHiddenDocument( *pDocShell, SfxInterfaceId(7) );
         SfxRequest aReq(FN_PRINT_PAGEPREVIEW, SfxCallMode::SYNCHRON,
                                     pDocShell->GetDoc()->GetAttrPool());
             aReq.AppendItem(SfxBoolItem(FN_PRINT_PAGEPREVIEW, true));
@@ -2482,7 +2482,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
             {
                 //create a hidden view to be able to export as PDF also in print preview
                 //pView and pSwView are not changed intentionally!
-                m_pHiddenViewFrame = SfxViewFrame::LoadHiddenDocument( *pRenderDocShell, 2 );
+                m_pHiddenViewFrame = SfxViewFrame::LoadHiddenDocument( *pRenderDocShell, SFX_INTERFACE_SFXDOCSH );
                 pViewShell = static_cast<SwView*>(m_pHiddenViewFrame->GetViewShell())->GetWrtShellPtr();
             }
             else
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index b6789ce3f6b2..67cf62bddb85 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -635,7 +635,7 @@ SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc()
     // #i103634#, #i112425#: do not expand numbering and fields on PDF export
     pTempDoc->SetClipBoard(true);
     rOldSh.FillPrtDoc(pTempDoc,  pPrt);
-    SfxViewFrame* pDocFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 );
+    SfxViewFrame* pDocFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, SFX_INTERFACE_NONE );
     SwView* pDocView = static_cast<SwView*>( pDocFrame->GetViewShell() );
     pDocView->AttrChangedNotify( &pDocView->GetWrtShell() );//So that SelectShell is called.
     SwWrtShell* pSh = pDocView->GetWrtShellPtr();


More information about the Libreoffice-commits mailing list