[Libreoffice-commits] core.git: include/sfx2 include/svl sc/inc sc/source sd/inc sd/qa sd/source sfx2/source svl/qa svl/source svx/source sw/inc sw/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Apr 19 06:37:00 UTC 2018


 include/sfx2/mgetempl.hxx                     |    2 
 include/sfx2/styfitem.hxx                     |    6 
 include/sfx2/tplpitem.hxx                     |    2 
 include/svl/style.hxx                         |   70 +++++----
 sc/inc/scstyles.hrc                           |   22 +-
 sc/inc/stlpool.hxx                            |    4 
 sc/inc/stlsheet.hxx                           |    4 
 sc/source/core/data/attarray.cxx              |    2 
 sc/source/core/data/documen8.cxx              |    2 
 sc/source/core/data/dpoutput.cxx              |    2 
 sc/source/core/data/patattr.cxx               |    4 
 sc/source/core/data/stlpool.cxx               |   16 +-
 sc/source/core/data/stlsheet.cxx              |    4 
 sc/source/filter/excel/xistyle.cxx            |    2 
 sc/source/filter/ftools/ftools.cxx            |    2 
 sc/source/filter/oox/stylesbuffer.cxx         |    2 
 sc/source/filter/xml/xmlfonte.cxx             |    2 
 sc/source/ui/undo/undostyl.cxx                |    2 
 sc/source/ui/unoobj/styleuno.cxx              |    2 
 sc/source/ui/view/formatsh.cxx                |    8 -
 sd/inc/family.hrc                             |   20 +-
 sd/inc/stlpool.hxx                            |    2 
 sd/inc/stlsheet.hxx                           |    2 
 sd/qa/unit/misc-tests.cxx                     |    4 
 sd/source/core/drawdoc4.cxx                   |    6 
 sd/source/core/stlpool.cxx                    |    6 
 sd/source/core/stlsheet.cxx                   |    8 -
 sd/source/ui/func/futempl.cxx                 |   14 -
 sfx2/source/dialog/mgetempl.cxx               |   16 +-
 sfx2/source/dialog/styfitem.cxx               |    4 
 sfx2/source/dialog/templdlg.cxx               |   76 +++++-----
 sfx2/source/dialog/tplpitem.cxx               |    6 
 sfx2/source/inc/templdgi.hxx                  |    4 
 svl/qa/unit/items/test_IndexedStyleSheets.cxx |    2 
 svl/source/items/style.cxx                    |   58 +++----
 svx/source/tbxctrls/tbcontrl.cxx              |    4 
 sw/inc/app.hrc                                |   89 +++++------
 sw/inc/docsh.hxx                              |    4 
 sw/inc/docstyle.hxx                           |   11 -
 sw/inc/swstyle.h                              |   34 ----
 sw/source/core/unocore/unostyle.cxx           |   38 ++---
 sw/source/ui/chrdlg/swuiccoll.cxx             |    8 -
 sw/source/ui/misc/docfnote.cxx                |    3 
 sw/source/uibase/app/docst.cxx                |   54 +++----
 sw/source/uibase/app/docstyle.cxx             |  195 +++++++++++++-------------
 45 files changed, 406 insertions(+), 422 deletions(-)

New commits:
commit 0035573ee7798cdf54ef44a54306a0515eeb90a7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Apr 18 12:14:37 2018 +0200

    convert SFXSTYLEBIT to scoped enum
    
    drop SFXSTYLEBIT_HIERARCHY because it has no overlap with these values,
    it's used an extra bit in
    SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter
    
    Change-Id: I8ee5ecb9b5f8d2087d8eedd1f5526260ec1e4018
    Reviewed-on: https://gerrit.libreoffice.org/53089
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx
index c9c1ec6549f8..641af7abff96 100644
--- a/include/sfx2/mgetempl.hxx
+++ b/include/sfx2/mgetempl.hxx
@@ -64,7 +64,7 @@ class SfxManageStyleSheetPage final : public SfxTabPage
     OUString aName;
     OUString aFollow;
     OUString aParent;
-    sal_uInt16 nFlags;
+    SfxStyleSearchBits nFlags;
 
 friend class SfxStyleDialog;
 
diff --git a/include/sfx2/styfitem.hxx b/include/sfx2/styfitem.hxx
index 5f59f6e55b07..1c72f4dffa94 100644
--- a/include/sfx2/styfitem.hxx
+++ b/include/sfx2/styfitem.hxx
@@ -30,8 +30,8 @@
 struct SFX2_DLLPUBLIC SfxFilterTupel
 {
     OUString aName;
-    sal_uInt16 nFlags;
-    SfxFilterTupel(const OUString& rName, sal_uInt16 nArg)
+    SfxStyleSearchBits nFlags;
+    SfxFilterTupel(const OUString& rName, SfxStyleSearchBits nArg)
         : aName(rName)
         , nFlags(nArg)
     {
@@ -48,7 +48,7 @@ class SFX2_DLLPUBLIC SfxStyleFamilyItem
     SfxStyleFilter  aFilterList;
 
 public:
-    SfxStyleFamilyItem(SfxStyleFamily nFamily, const OUString &rName, const Image& rImage, const std::pair<const char*, int>* pStringArray, const std::locale& rLocale);
+    SfxStyleFamilyItem(SfxStyleFamily nFamily, const OUString &rName, const Image& rImage, const std::pair<const char*, SfxStyleSearchBits>* pStringArray, const std::locale& rLocale);
 
     const OUString& GetText() const { return aText; }
     SfxStyleFamily  GetFamily() const { return nFamily; }
diff --git a/include/sfx2/tplpitem.hxx b/include/sfx2/tplpitem.hxx
index f607466c4780..728e087135d7 100644
--- a/include/sfx2/tplpitem.hxx
+++ b/include/sfx2/tplpitem.hxx
@@ -41,6 +41,8 @@ public:
     virtual sal_uInt8       GetFlagCount() const override;
     virtual bool            QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool            PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+    SfxStyleSearchBits      GetValue() const { return static_cast<SfxStyleSearchBits>(SfxFlagItem::GetValue()); }
+    void                    SetValue(SfxStyleSearchBits n) { SfxFlagItem::SetValue(static_cast<sal_uInt16>(n)); }
 };
 
 #endif
diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index 40e673463386..955cd99a34ef 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -32,6 +32,7 @@
 #include <svl/poolitem.hxx>
 #include <svl/SfxBroadcaster.hxx>
 #include <svl/stylesheetuser.hxx>
+#include <o3tl/typed_flags_set.hxx>
 
 #include <memory>
 
@@ -49,14 +50,31 @@ enum class SfxStyleFamily {
     All     = 0x7fff
 };
 
-#define SFXSTYLEBIT_AUTO        0x0000 ///< automatic: flags from application
-#define SFXSTYLEBIT_HIDDEN      0x0200 ///< hidden styles (search mask)
-#define SFXSTYLEBIT_HIERARCHY   0x1000 ///< hierarchical view - just for dialog
-#define SFXSTYLEBIT_READONLY    0x2000 ///< readonly styles (search mask)
-#define SFXSTYLEBIT_USED        0x4000 ///< used styles (search mask)
-#define SFXSTYLEBIT_USERDEF     0x8000 ///< user defined styles (search mask)
-#define SFXSTYLEBIT_ALL_VISIBLE 0xFDFF ///< all styles
-#define SFXSTYLEBIT_ALL         0xFFFF ///< all styles
+enum class SfxStyleSearchBits {
+    // sc/calc styles
+    ScStandard  = 0x0001,
+
+    // sw/writer styles
+    SwText      = 0x0001,
+    SwChapter   = 0x0002,
+    SwList      = 0x0004,
+    SwIndex     = 0x0008,
+    SwExtra     = 0x0010,
+    SwHtml      = 0x0020,
+    SwCondColl  = 0x0040,
+
+    Auto        = 0x0000, ///< automatic: flags from application
+    Hidden      = 0x0200, ///< hidden styles (search mask)
+    ReadOnly    = 0x2000, ///< readonly styles (search mask)
+    Used        = 0x4000, ///< used styles (search mask)
+    UserDefined = 0x8000, ///< user defined styles (search mask)
+    AllVisible  = 0xFDFF, ///< all styles
+    All         = 0xFFFF, ///< all styles
+};
+namespace o3tl {
+    template<> struct typed_flags<SfxStyleSearchBits> : is_typed_flags<SfxStyleSearchBits, 0xffff> {};
+}
+
 
 class SfxItemSet;
 class SfxItemPool;
@@ -104,14 +122,14 @@ protected:
     OUString                aName, aParent, aFollow;
     OUString                aHelpFile;      // name of the help file
     SfxItemSet*             pSet;           // ItemSet
-    sal_uInt16              nMask;          // Flags
+    SfxStyleSearchBits      nMask;          // Flags
 
     sal_uLong               nHelpId;        // help ID
 
     bool                    bMySet;         // sal_True: delete Set in dtor
     bool                    bHidden;
 
-    SfxStyleSheetBase( const OUString&, SfxStyleSheetBasePool*, SfxStyleFamily eFam, sal_uInt16 mask );
+    SfxStyleSheetBase( const OUString&, SfxStyleSheetBasePool*, SfxStyleFamily eFam, SfxStyleSearchBits mask );
     SfxStyleSheetBase( const SfxStyleSheetBase& );
     virtual ~SfxStyleSheetBase() override;
     virtual void Load( SvStream&, sal_uInt16 );
@@ -141,10 +159,10 @@ public:
 
     SfxStyleSheetBasePool* GetPool() { return m_pPool; }
     SfxStyleFamily GetFamily() const     { return nFamily; }
-    sal_uInt16   GetMask() const     { return nMask; }
-    void     SetMask( sal_uInt16 mask) { nMask = mask; }
+    SfxStyleSearchBits   GetMask() const     { return nMask; }
+    void     SetMask( SfxStyleSearchBits mask) { nMask = mask; }
     bool     IsUserDefined() const
-           { return ( nMask & SFXSTYLEBIT_USERDEF) != 0; }
+           { return bool( nMask & SfxStyleSearchBits::UserDefined); }
 
     virtual bool IsHidden() const { return bHidden; }
     virtual void SetHidden( bool bValue );
@@ -168,8 +186,8 @@ public:
      * The iterator will only iterate over style sheets which have the family \p eFam
      */
     SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase,
-                          SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
-    sal_uInt16 GetSearchMask() const;
+                          SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All );
+    SfxStyleSearchBits GetSearchMask() const;
     SfxStyleFamily GetSearchFamily() const;
     virtual sal_uInt16 Count();
     virtual SfxStyleSheetBase *operator[](sal_uInt16 nIdx);
@@ -184,7 +202,7 @@ protected:
 
     SfxStyleSheetBasePool*  pBasePool;
     SfxStyleFamily          nSearchFamily;
-    sal_uInt16              nMask;
+    SfxStyleSearchBits      nMask;
 
 
 private:
@@ -211,10 +229,10 @@ protected:
 
     SfxItemPool&                rPool;
     SfxStyleFamily              nSearchFamily;
-    sal_uInt16                  nMask;
+    SfxStyleSearchBits          nMask;
 
     void                        ChangeParent( const OUString&, const OUString&, bool bVirtual = true );
-    virtual SfxStyleSheetBase*  Create( const OUString&, SfxStyleFamily, sal_uInt16 );
+    virtual SfxStyleSheetBase*  Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits );
     virtual SfxStyleSheetBase*  Create( const SfxStyleSheetBase& );
 
     virtual                     ~SfxStyleSheetBasePool() override;
@@ -235,13 +253,13 @@ public:
     SfxItemPool&                GetPool() { return rPool;}
     const SfxItemPool&          GetPool() const { return rPool;}
 
-    virtual std::shared_ptr<SfxStyleSheetIterator> CreateIterator(SfxStyleFamily, sal_uInt16 nMask);
+    virtual std::shared_ptr<SfxStyleSheetIterator> CreateIterator(SfxStyleFamily, SfxStyleSearchBits nMask);
     sal_uInt16              Count();
     SfxStyleSheetBase*  operator[](sal_uInt16 nIdx);
 
     virtual SfxStyleSheetBase&  Make(const OUString&,
                                      SfxStyleFamily eFam,
-                                     sal_uInt16 nMask = SFXSTYLEBIT_ALL);
+                                     SfxStyleSearchBits nMask = SfxStyleSearchBits::All);
 
     virtual void                Remove( SfxStyleSheetBase* );
     void                Insert( SfxStyleSheetBase* );
@@ -253,7 +271,7 @@ public:
 
     SfxStyleSheetBase*  First();
     SfxStyleSheetBase*  Next();
-    virtual SfxStyleSheetBase*  Find( const OUString&, SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
+    virtual SfxStyleSheetBase*  Find( const OUString&, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All );
 
     virtual bool                SetParent(SfxStyleFamily eFam,
                                           const OUString &rStyle,
@@ -262,8 +280,8 @@ public:
     SfxStyleSheetBase*          Find(const OUString& rStr)
                                 { return Find(rStr, nSearchFamily, nMask); }
 
-    void                        SetSearchMask(SfxStyleFamily eFam, sal_uInt16 n=SFXSTYLEBIT_ALL );
-    sal_uInt16                      GetSearchMask() const { return nMask;}
+    void                        SetSearchMask(SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All );
+    SfxStyleSearchBits          GetSearchMask() const { return nMask;}
     SfxStyleFamily              GetSearchFamily() const  { return nSearchFamily; }
 
     void                        Reindex();
@@ -278,7 +296,7 @@ class SVL_DLLPUBLIC SfxStyleSheet: public SfxStyleSheetBase,
 {
 public:
 
-                        SfxStyleSheet( const OUString&, const SfxStyleSheetBasePool&, SfxStyleFamily, sal_uInt16 );
+                        SfxStyleSheet( const OUString&, const SfxStyleSheetBasePool&, SfxStyleFamily, SfxStyleSearchBits );
                         SfxStyleSheet( const SfxStyleSheet& );
 
     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
@@ -295,7 +313,7 @@ class SVL_DLLPUBLIC SfxStyleSheetPool: public SfxStyleSheetBasePool
 {
 protected:
     using SfxStyleSheetBasePool::Create;
-    virtual SfxStyleSheetBase* Create(const OUString&, SfxStyleFamily, sal_uInt16 mask) override;
+    virtual SfxStyleSheetBase* Create(const OUString&, SfxStyleFamily, SfxStyleSearchBits mask) override;
 
 public:
     SfxStyleSheetPool( SfxItemPool const& );
@@ -331,7 +349,7 @@ public:
 class SVL_DLLPUBLIC SfxUnoStyleSheet : public cppu::ImplInheritanceHelper<SfxStyleSheet, css::style::XStyle, css::lang::XUnoTunnel>
 {
 public:
-    SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, sal_uInt16 _nMaske );
+    SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, SfxStyleSearchBits _nMask );
 
     static SfxUnoStyleSheet* getUnoStyleSheet( const css::uno::Reference< css::style::XStyle >& xStyle );
 
diff --git a/sc/inc/scstyles.hrc b/sc/inc/scstyles.hrc
index 08919cfbc44f..fcc78b9258de 100644
--- a/sc/inc/scstyles.hrc
+++ b/sc/inc/scstyles.hrc
@@ -24,21 +24,21 @@
 
 #define NC_(Context, String) (Context "\004" u8##String)
 
-const std::pair<const char*, int> RID_CELLSTYLEFAMILY[] =
+const std::pair<const char*, SfxStyleSearchBits> RID_CELLSTYLEFAMILY[] =
 {
-    { NC_("RID_CELLSTYLEFAMILY", "All Styles") , SFXSTYLEBIT_ALL_VISIBLE },
-    { NC_("RID_CELLSTYLEFAMILY", "Hidden Styles") , SFXSTYLEBIT_HIDDEN },
-    { NC_("RID_CELLSTYLEFAMILY", "Applied Styles") , SFXSTYLEBIT_USED },
-    { NC_("RID_CELLSTYLEFAMILY", "Custom Styles") , SFXSTYLEBIT_USERDEF },
-    { nullptr, 0 }
+    { NC_("RID_CELLSTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible },
+    { NC_("RID_CELLSTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden },
+    { NC_("RID_CELLSTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used },
+    { NC_("RID_CELLSTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined },
+    { nullptr, SfxStyleSearchBits::Auto }
 };
 
-const std::pair<const char*, int> RID_PAGESTYLEFAMILY[] =
+const std::pair<const char*, SfxStyleSearchBits> RID_PAGESTYLEFAMILY[] =
 {
-    { NC_("RID_PAGESTYLEFAMILY", "All Styles") , SFXSTYLEBIT_ALL },
-    { NC_("RID_PAGESTYLEFAMILY", "Hidden Styles") , SFXSTYLEBIT_HIDDEN },
-    { NC_("RID_PAGESTYLEFAMILY", "Custom Styles") , SFXSTYLEBIT_USERDEF },
-    { nullptr, 0 }
+    { NC_("RID_PAGESTYLEFAMILY", "All Styles") , SfxStyleSearchBits::All },
+    { NC_("RID_PAGESTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden },
+    { NC_("RID_PAGESTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined },
+    { nullptr, SfxStyleSearchBits::Auto }
 };
 
 #endif
diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx
index 1c5d40d5f542..b9c00aaa049c 100644
--- a/sc/inc/stlpool.hxx
+++ b/sc/inc/stlpool.hxx
@@ -54,7 +54,7 @@ public:
     ScStyleSheet*       FindCaseIns( const OUString& rName, SfxStyleFamily eFam );
 
     virtual SfxStyleSheetBase& Make( const OUString&, SfxStyleFamily eFam,
-                                     sal_uInt16 nMask = SFXSTYLEBIT_ALL) override;
+                                     SfxStyleSearchBits nMask = SfxStyleSearchBits::All) override;
 
     void setAllStandard();
 
@@ -65,7 +65,7 @@ protected:
 
     virtual SfxStyleSheetBase* Create( const OUString&  rName,
                                        SfxStyleFamily   eFamily,
-                                       sal_uInt16       nMask) override;
+                                       SfxStyleSearchBits     nMask) override;
     virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& rStyle ) override;
 
 private:
diff --git a/sc/inc/stlsheet.hxx b/sc/inc/stlsheet.hxx
index cab2e9759702..a30efdc7a19d 100644
--- a/sc/inc/stlsheet.hxx
+++ b/sc/inc/stlsheet.hxx
@@ -24,8 +24,6 @@
 
 #include "scdllapi.h"
 
-#define SCSTYLEBIT_STANDARD     0x0001
-
 class ScStyleSheetPool;
 
 class ScStyleSheet final : public SfxStyleSheet
@@ -61,7 +59,7 @@ private:
                 ScStyleSheet( const OUString&   rName,
                               const ScStyleSheetPool& rPool,
                               SfxStyleFamily    eFamily,
-                              sal_uInt16        nMask );
+                              SfxStyleSearchBits nMask );
 
     virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
 
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 83f101e53750..c66fa7e8aa5e 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1811,7 +1811,7 @@ void ScAttrArray::FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBo
                     pDocument->GetStyleSheetPool()->
                         Find( ScGlobal::GetRscString(STR_STYLENAME_STANDARD),
                               SfxStyleFamily::Para,
-                              SFXSTYLEBIT_AUTO | SCSTYLEBIT_STANDARD ) ) );
+                              SfxStyleSearchBits::Auto | SfxStyleSearchBits::ScStandard ) ) );
                 mvData[nPos].pPattern = static_cast<const ScPatternAttr*>(
                                             &pDocument->GetPool()->Put(*pNewPattern));
                 pNewPattern.reset();
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index a379c04d108e..eca15e8b9c32 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -485,7 +485,7 @@ class IdleCalcTextWidthScope
     MapMode maOldMapMode;
     sal_uInt64 mnStartTime;
     ScStyleSheetPool* mpStylePool;
-    sal_uInt16 mnOldSearchMask;
+    SfxStyleSearchBits mnOldSearchMask;
     SfxStyleFamily meOldFamily;
     bool mbNeedMore;
     bool mbProgress;
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index 5c584944e20f..ee3f6d227aae 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -297,7 +297,7 @@ void lcl_SetStyleById(ScDocument* pDoc, SCTAB nTab,
         //  create new style (was in ScPivot::SetStyle)
 
         pStyle = static_cast<ScStyleSheet*>( &pStlPool->Make( aStyleName, SfxStyleFamily::Para,
-                                                    SFXSTYLEBIT_USERDEF ) );
+                                                    SfxStyleSearchBits::UserDefined ) );
         pStyle->SetParent( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) );
         SfxItemSet& rSet = pStyle->GetItemSet();
         if (strcmp(pStrId, STR_PIVOT_STYLENAME_RESULT) == 0 || strcmp(pStrId, STR_PIVOT_STYLENAME_TITLE) == 0){
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index c3bbe97a772c..d8989b6245f7 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -958,7 +958,7 @@ static SfxStyleSheetBase* lcl_CopyStyleToPool
         const OUString   aStrParent = pSrcStyle->GetParent();
         const SfxItemSet& rSrcSet = pSrcStyle->GetItemSet();
 
-        pDestStyle = &pDestPool->Make( aStrSrcStyle, eFamily, SFXSTYLEBIT_USERDEF );
+        pDestStyle = &pDestPool->Make( aStrSrcStyle, eFamily, SfxStyleSearchBits::UserDefined );
         SfxItemSet& rDestSet = pDestStyle->GetItemSet();
         rDestSet.Put( rSrcSet );
 
@@ -1172,7 +1172,7 @@ void ScPatternAttr::UpdateStyleSheet(const ScDocument* pDoc)
         //  Assumes that "Standard" is always the 1st entry!
         if (!pStyle)
         {
-            std::shared_ptr<SfxStyleSheetIterator> pIter = pDoc->GetStyleSheetPool()->CreateIterator( SfxStyleFamily::Para, SFXSTYLEBIT_ALL );
+            std::shared_ptr<SfxStyleSheetIterator> pIter = pDoc->GetStyleSheetPool()->CreateIterator( SfxStyleFamily::Para, SfxStyleSearchBits::All );
             pStyle = dynamic_cast< ScStyleSheet* >(pIter->First());
         }
 
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 6075f553ef79..586ecbad9276 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -76,7 +76,7 @@ void ScStyleSheetPool::SetDocument( ScDocument* pDocument )
 }
 
 SfxStyleSheetBase& ScStyleSheetPool::Make( const OUString& rName,
-                                           SfxStyleFamily eFam, sal_uInt16 mask)
+                                           SfxStyleFamily eFam, SfxStyleSearchBits mask)
 {
     //  When updating styles from a template, Office 5.1 sometimes created
     //  files with multiple default styles.
@@ -101,7 +101,7 @@ SfxStyleSheetBase& ScStyleSheetPool::Make( const OUString& rName,
 
 SfxStyleSheetBase* ScStyleSheetPool::Create( const OUString&   rName,
                                              SfxStyleFamily  eFamily,
-                                             sal_uInt16          nMaskP )
+                                             SfxStyleSearchBits nMaskP )
 {
     ScStyleSheet* pSheet = new ScStyleSheet( rName, *this, eFamily, nMaskP );
     if ( eFamily == SfxStyleFamily::Para && ScGlobal::GetRscString(STR_STYLENAME_STANDARD) != rName )
@@ -120,8 +120,8 @@ void ScStyleSheetPool::Remove( SfxStyleSheetBase* pStyle )
 {
     if ( pStyle )
     {
-        OSL_ENSURE( IS_SET( SFXSTYLEBIT_USERDEF, pStyle->GetMask() ),
-                    "SFXSTYLEBIT_USERDEF not set!" );
+        OSL_ENSURE( IS_SET( SfxStyleSearchBits::UserDefined, pStyle->GetMask() ),
+                    "SfxStyleSearchBits::UserDefined not set!" );
 
         static_cast<ScDocumentPool&>(rPool).StyleDeleted(static_cast<ScStyleSheet*>(pStyle));
         SfxStyleSheetPool::Remove(pStyle);
@@ -238,7 +238,7 @@ void ScStyleSheetPool::CreateStandardStyles()
 
     // 1. Standard
 
-    pSheet = static_cast<ScStyleSheet*>( &Make( aStrStandard, SfxStyleFamily::Para, SCSTYLEBIT_STANDARD ) );
+    pSheet = static_cast<ScStyleSheet*>( &Make( aStrStandard, SfxStyleFamily::Para, SfxStyleSearchBits::ScStandard ) );
     pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_CELL_STD );
 
     //  if default fonts for the document's languages are different from the pool default,
@@ -274,7 +274,7 @@ void ScStyleSheetPool::CreateStandardStyles()
 
     pSheet = static_cast<ScStyleSheet*>( &Make( aStrStandard,
                                     SfxStyleFamily::Page,
-                                    SCSTYLEBIT_STANDARD ) );
+                                    SfxStyleSearchBits::ScStandard ) );
 
     pSet = &pSheet->GetItemSet();
     pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_PAGE_STD );
@@ -315,7 +315,7 @@ void ScStyleSheetPool::CreateStandardStyles()
 
     pSheet = static_cast<ScStyleSheet*>( &Make( SCSTR( STR_STYLENAME_REPORT ),
                                     SfxStyleFamily::Page,
-                                    SCSTYLEBIT_STANDARD ) );
+                                    SfxStyleSearchBits::ScStandard ) );
     pSet = &pSheet->GetItemSet();
     pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_PAGE_REP );
 
@@ -439,7 +439,7 @@ void ScStyleSheetPool::setAllStandard()
     SfxStyleSheetBase* pSheet = First();
     while (pSheet)
     {
-        pSheet->SetMask(SCSTYLEBIT_STANDARD);
+        pSheet->SetMask(SfxStyleSearchBits::ScStandard);
         pSheet = Next();
     }
 }
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx
index 52888c5557c6..a7b12c444878 100644
--- a/sc/source/core/data/stlsheet.cxx
+++ b/sc/source/core/data/stlsheet.cxx
@@ -50,7 +50,7 @@
 ScStyleSheet::ScStyleSheet( const OUString&     rName,
                             const ScStyleSheetPool& rPoolP,
                             SfxStyleFamily      eFamily,
-                            sal_uInt16          nMaskP )
+                            SfxStyleSearchBits  nMaskP )
 
     : SfxStyleSheet   ( rName, rPoolP, eFamily, nMaskP )
     , eUsage( UNKNOWN )
@@ -96,7 +96,7 @@ bool ScStyleSheet::SetParent( const OUString& rParentName )
     SfxStyleSheetBase* pStyle = m_pPool->Find( aEffName, nFamily );
     if (!pStyle)
     {
-        std::shared_ptr<SfxStyleSheetIterator> pIter = m_pPool->CreateIterator( nFamily, SFXSTYLEBIT_ALL );
+        std::shared_ptr<SfxStyleSheetIterator> pIter = m_pPool->CreateIterator( nFamily, SfxStyleSearchBits::All );
         pStyle = pIter->First();
         if (pStyle)
             aEffName = pStyle->GetName();
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 75100c81b557..6e357267e12a 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1525,7 +1525,7 @@ ScStyleSheet* XclImpStyle::CreateStyleSheet()
             mpStyleSheet = static_cast< ScStyleSheet* >( GetStyleSheetPool().Find( maFinalName, SfxStyleFamily::Para ) );
             if( !mpStyleSheet )
             {
-                mpStyleSheet = &static_cast< ScStyleSheet& >( GetStyleSheetPool().Make( maFinalName, SfxStyleFamily::Para, SFXSTYLEBIT_USERDEF ) );
+                mpStyleSheet = &static_cast< ScStyleSheet& >( GetStyleSheetPool().Make( maFinalName, SfxStyleFamily::Para, SfxStyleSearchBits::UserDefined ) );
                 bCreatePattern = true;
             }
         }
diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx
index 196f293aa097..1a2da9949a0d 100644
--- a/sc/source/filter/ftools/ftools.cxx
+++ b/sc/source/filter/ftools/ftools.cxx
@@ -248,7 +248,7 @@ ScStyleSheet& lclMakeStyleSheet( ScStyleSheetPool& rPool, const OUString& rStyle
     }
 
     // create new style sheet
-    return static_cast< ScStyleSheet& >( rPool.Make( aNewName, eFamily, SFXSTYLEBIT_USERDEF ) );
+    return static_cast< ScStyleSheet& >( rPool.Make( aNewName, eFamily, SfxStyleSearchBits::UserDefined ) );
 }
 
 } // namespace
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index 910594768171..6f3314bec1b8 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -2485,7 +2485,7 @@ void CellStyle::createCellStyle()
             mpStyleSheet = static_cast< ScStyleSheet* >( rDoc.GetStyleSheetPool()->Find( maFinalName, SfxStyleFamily::Para ) );
             if( !mpStyleSheet )
             {
-                mpStyleSheet = &static_cast< ScStyleSheet& >( rDoc.GetStyleSheetPool()->Make( maFinalName, SfxStyleFamily::Para, SFXSTYLEBIT_USERDEF ) );
+                mpStyleSheet = &static_cast< ScStyleSheet& >( rDoc.GetStyleSheetPool()->Make( maFinalName, SfxStyleFamily::Para, SfxStyleSearchBits::UserDefined ) );
                 bCreatePattern = true;
             }
         }
diff --git a/sc/source/filter/xml/xmlfonte.cxx b/sc/source/filter/xml/xmlfonte.cxx
index dff130e33925..b8446e40606c 100644
--- a/sc/source/filter/xml/xmlfonte.cxx
+++ b/sc/source/filter/xml/xmlfonte.cxx
@@ -86,7 +86,7 @@ ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl(ScXMLExport& rExportP,
     const SfxItemPool* pEditPool(rExportP.GetDocument()->GetEditPool());
     AddFontItems(aEditWhichIds, 3, pEditPool, false);
 
-    std::shared_ptr<SfxStyleSheetIterator> pItr = rExportP.GetDocument()->GetStyleSheetPool()->CreateIterator(SfxStyleFamily::Page, 0xFFFF);
+    std::shared_ptr<SfxStyleSheetIterator> pItr = rExportP.GetDocument()->GetStyleSheetPool()->CreateIterator(SfxStyleFamily::Page, SfxStyleSearchBits::All);
 
     if(pItr)
     {
diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx
index 5a0e602dbca5..4235136fadb7 100644
--- a/sc/source/ui/undo/undostyl.cxx
+++ b/sc/source/ui/undo/undostyl.cxx
@@ -127,7 +127,7 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName,
     else if ( !bDelete )
     {
         // create style (with new name)
-        pStyle = &pStlPool->Make( aNewName, eStyleFamily, SFXSTYLEBIT_USERDEF );
+        pStyle = &pStlPool->Make( aNewName, eStyleFamily, SfxStyleSearchBits::UserDefined );
 
         if ( eStyleFamily == SfxStyleFamily::Para )
             rDoc.GetPool()->CellStyleCreated( aNewName, &rDoc );
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 1dc1c7b7136c..8f262ddd9d9d 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -671,7 +671,7 @@ void SAL_CALL ScStyleFamilyObj::insertByName( const OUString& aName, const uno::
             if ( pStylePool->Find( aNameStr, eFamily ) )   // not available yet
                 throw container::ElementExistException();
 
-            (void)pStylePool->Make( aNameStr, eFamily, SFXSTYLEBIT_USERDEF );
+            (void)pStylePool->Make( aNameStr, eFamily, SfxStyleSearchBits::UserDefined );
 
             if ( eFamily == SfxStyleFamily::Para && !rDoc.IsImportingXML() )
                 rDoc.GetPool()->CellStyleCreated( aNameStr, &rDoc );
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 94076643c7cf..0d8de3db99be 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -388,7 +388,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
                     }
 
                     pStyleSheet = &(pStylePool->Make( aStyleName, eFamily,
-                                                      SFXSTYLEBIT_USERDEF ) );
+                                                      SfxStyleSearchBits::UserDefined ) );
 
                     if ( pStyleSheet && pStyleSheet->HasParentSupport() )
                         pStyleSheet->SetParent(aRefName);
@@ -598,7 +598,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
 
                             // ...and create new
                             pStyleSheet = &pStylePool->Make( aStyleName, eFamily,
-                                                             SFXSTYLEBIT_USERDEF );
+                                                             SfxStyleSearchBits::UserDefined );
 
                             // when a style is present, then this will become
                             // the parent of the new style:
@@ -743,7 +743,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
 
                             // ...and create new
                             pStyleSheet = &pStylePool->Make( aStyleName, eFamily,
-                                                             SFXSTYLEBIT_USERDEF );
+                                                             SfxStyleSearchBits::UserDefined );
 
                             // Adopt attribute
                             pStyleSheet->GetItemSet().Put( aAttrSet );
@@ -870,7 +870,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
 
                     if ( pOutSet )
                     {
-                        nRetMask = pStyleSheet->GetMask();
+                        nRetMask = sal_uInt16(pStyleSheet->GetMask());
 
                         // Attribute comparisons (earlier in ModifyStyleSheet) now here
                         // with the old values (the style is already changed)
diff --git a/sd/inc/family.hrc b/sd/inc/family.hrc
index b89c241af0a6..2d10e42b7305 100644
--- a/sd/inc/family.hrc
+++ b/sd/inc/family.hrc
@@ -24,20 +24,20 @@
 
 #define NC_(Context, String) (Context "\004" u8##String)
 
-const std::pair<const char*, int> RID_GRAPHICSTYLEFAMILY[] =
+const std::pair<const char*, SfxStyleSearchBits> RID_GRAPHICSTYLEFAMILY[] =
 {
-    { NC_("RID_GRAPHICSTYLEFAMILY", "All Styles") , SFXSTYLEBIT_ALL_VISIBLE },
-    { NC_("RID_GRAPHICSTYLEFAMILY", "Hidden Styles") , SFXSTYLEBIT_HIDDEN },
-    { NC_("RID_GRAPHICSTYLEFAMILY", "Applied Styles") , SFXSTYLEBIT_USED },
-    { NC_("RID_GRAPHICSTYLEFAMILY", "Custom Styles") , SFXSTYLEBIT_USERDEF },
-    { nullptr, 0 }
+    { NC_("RID_GRAPHICSTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible },
+    { NC_("RID_GRAPHICSTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden },
+    { NC_("RID_GRAPHICSTYLEFAMILY", "Applied Styles") , SfxStyleSearchBits::Used },
+    { NC_("RID_GRAPHICSTYLEFAMILY", "Custom Styles") , SfxStyleSearchBits::UserDefined },
+    { nullptr, SfxStyleSearchBits::Auto }
 };
 
-const std::pair<const char*, int> RID_PRESENTATIONSTYLEFAMILY[] =
+const std::pair<const char*, SfxStyleSearchBits> RID_PRESENTATIONSTYLEFAMILY[] =
 {
-    { NC_("RID_PRESENTATIONSTYLEFAMILY", "All Styles") , SFXSTYLEBIT_ALL_VISIBLE },
-    { NC_("RID_PRESENTATIONSTYLEFAMILY", "Hidden Styles") , SFXSTYLEBIT_HIDDEN },
-    { nullptr, 0 }
+    { NC_("RID_PRESENTATIONSTYLEFAMILY", "All Styles") , SfxStyleSearchBits::AllVisible },
+    { NC_("RID_PRESENTATIONSTYLEFAMILY", "Hidden Styles") , SfxStyleSearchBits::Hidden },
+    { nullptr, SfxStyleSearchBits::Auto }
 };
 
 #endif
diff --git a/sd/inc/stlpool.hxx b/sd/inc/stlpool.hxx
index b46748615b90..506d4d47eb11 100644
--- a/sd/inc/stlpool.hxx
+++ b/sd/inc/stlpool.hxx
@@ -126,7 +126,7 @@ private:
     void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets );
     void CopySheets(SdStyleSheetPool& rSourcePool, SfxStyleFamily eFamily, SdStyleSheetVector& rCreatedSheets, const OUString &rRenameSuffix );
 
-    virtual SfxStyleSheetBase* Create(const OUString& rName, SfxStyleFamily eFamily, sal_uInt16 nMask) override;
+    virtual SfxStyleSheetBase* Create(const OUString& rName, SfxStyleFamily eFamily, SfxStyleSearchBits nMask) override;
 
     using  SfxStyleSheetPool::Create;
     virtual ~SdStyleSheetPool() override;
diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx
index 314818a21b3e..b6b1d599a71c 100644
--- a/sd/inc/stlsheet.hxx
+++ b/sd/inc/stlsheet.hxx
@@ -53,7 +53,7 @@ typedef cppu::ImplInheritanceHelper< SfxUnoStyleSheet,
 class SdStyleSheet final : public SdStyleSheetBase, private ::cppu::BaseMutex
 {
 public:
-    SdStyleSheet( const OUString& rDisplayName, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily, sal_uInt16 nMask );
+    SdStyleSheet( const OUString& rDisplayName, SfxStyleSheetBasePool& rPool, SfxStyleFamily eFamily, SfxStyleSearchBits nMask );
 
     virtual bool        SetParent (const OUString& rParentName) override;
     virtual SfxItemSet& GetItemSet() override;
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 1e2645cd05a8..9125f2306bad 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -309,11 +309,11 @@ void SdMiscTest::testTdf44774()
     SfxStyleSheetBasePool* pSSPool = xDocShRef->GetStyleSheetPool();
 
     // Create a new style with an empty name, like what happens in UI when creating a new style
-    SfxStyleSheetBase& rStyleA = pSSPool->Make("", SfxStyleFamily::Para, SFXSTYLEBIT_USERDEF);
+    SfxStyleSheetBase& rStyleA = pSSPool->Make("", SfxStyleFamily::Para, SfxStyleSearchBits::UserDefined);
     // Assign a new name, which does not yet set its ApiName
     rStyleA.SetName("StyleA");
     // Create another style
-    SfxStyleSheetBase& rStyleB = pSSPool->Make("StyleB", SfxStyleFamily::Para, SFXSTYLEBIT_USERDEF);
+    SfxStyleSheetBase& rStyleB = pSSPool->Make("StyleB", SfxStyleFamily::Para, SfxStyleSearchBits::UserDefined);
     // ... and set its parent to the first one
     rStyleB.SetParent("StyleA");
 
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 72109415af6d..6f6e7ada56ac 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -130,7 +130,7 @@ void SdDrawDocument::CreateLayoutTemplates()
 
     // Default style
 
-    sal_uInt16 nMask = SFXSTYLEBIT_AUTO;
+    SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto;
 
     OUString aName(aStdName);
     pSheet = &(pSSPool->Make(aName, SfxStyleFamily::Para, nMask));
@@ -492,7 +492,7 @@ void SdDrawDocument::CreateLayoutTemplates()
 
 static Any implMakeSolidCellStyle( SdStyleSheetPool* pSSPool, const OUString& rName, const OUString& rParent, const Color& rColor )
 {
-    SfxStyleSheetBase* pSheet = &(pSSPool->Make(rName, SfxStyleFamily::Frame, SFXSTYLEBIT_AUTO));
+    SfxStyleSheetBase* pSheet = &(pSSPool->Make(rName, SfxStyleFamily::Frame, SfxStyleSearchBits::Auto));
     pSheet->SetParent(rParent);
     SfxItemSet* pISet = &pSheet->GetItemSet();
     pISet->Put(XFillStyleItem(drawing::FillStyle_SOLID));
@@ -537,7 +537,7 @@ void SdDrawDocument::CreateDefaultCellStyles()
 
     OUString aDefaultCellStyleName( "default" );
 
-    pSheet = &(pSSPool->Make(aDefaultCellStyleName, SfxStyleFamily::Frame, SFXSTYLEBIT_AUTO));
+    pSheet = &(pSSPool->Make(aDefaultCellStyleName, SfxStyleFamily::Frame, SfxStyleSearchBits::Auto));
     pSheet->SetHelpId( OUString(), HID_SD_CELL_STYLE_DEFAULT );
     SfxItemSet& rISet = pSheet->GetItemSet();
 
diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx
index 6a25bb423751..8580b10f82ee 100644
--- a/sd/source/core/stlpool.cxx
+++ b/sd/source/core/stlpool.cxx
@@ -135,7 +135,7 @@ SdStyleSheetPool::~SdStyleSheetPool()
     DBG_ASSERT( mpDoc == nullptr, "sd::SdStyleSheetPool::~SdStyleSheetPool(), dispose me first!" );
 }
 
-SfxStyleSheetBase* SdStyleSheetPool::Create(const OUString& rName, SfxStyleFamily eFamily, sal_uInt16 _nMask )
+SfxStyleSheetBase* SdStyleSheetPool::Create(const OUString& rName, SfxStyleFamily eFamily, SfxStyleSearchBits _nMask )
 {
     return new SdStyleSheet(rName, *this, eFamily, _nMask);
 }
@@ -180,7 +180,7 @@ void SdStyleSheetPool::CreateOutlineSheetList (const OUString& rLayoutName, std:
 
 void SdStyleSheetPool::CreateLayoutStyleSheets(const OUString& rLayoutName, bool bCheck /*= sal_False*/ )
 {
-    const sal_uInt16 nUsedMask = SFXSTYLEBIT_ALL & ~SFXSTYLEBIT_USERDEF;
+    const SfxStyleSearchBits nUsedMask = SfxStyleSearchBits::All & ~SfxStyleSearchBits::UserDefined;
 
     bool bCreated = false;
 
@@ -840,7 +840,7 @@ void SdStyleSheetPool::CreatePseudosIfNecessary()
     SfxStyleSheetBase* pSheet = nullptr;
     SfxStyleSheetBase* pParent = nullptr;
 
-    sal_uInt16 nUsedMask = SFXSTYLEBIT_USED;
+    SfxStyleSearchBits nUsedMask = SfxStyleSearchBits::Used;
 
     aName = SdResId(STR_PSEUDOSHEET_TITLE);
     if( (pSheet = Find(aName, SfxStyleFamily::Pseudo)) == nullptr )
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 012546b6b7e2..428f70b1c952 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -129,7 +129,7 @@ void ModifyListenerForewarder::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*
         mpStyleSheet->notifyModifyListener();
 }
 
-SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool& _rPool, SfxStyleFamily eFamily, sal_uInt16 _nMask)
+SdStyleSheet::SdStyleSheet(const OUString& rDisplayName, SfxStyleSheetBasePool& _rPool, SfxStyleFamily eFamily, SfxStyleSearchBits _nMask)
 : SdStyleSheetBase( rDisplayName, _rPool, eFamily, _nMask)
 , ::cppu::BaseMutex()
 , msApiName( rDisplayName )
@@ -162,10 +162,10 @@ void SdStyleSheet::Load (SvStream& rIn, sal_uInt16 nVersion)
     SfxStyleSheetBase::Load(rIn, nVersion);
 
     /* previously, the default mask was 0xAFFE. The needed flags were masked
-       from this mask. Now the flag SFXSTYLEBIT_READONLY was introduced and with
+       from this mask. Now the flag SfxStyleSearchBits::ReadOnly was introduced and with
        this, all style sheets are read only. Since no style sheet should be read
        only in Draw, we reset the flag here.  */
-    nMask &= ~SFXSTYLEBIT_READONLY;
+    nMask &= ~SfxStyleSearchBits::ReadOnly;
 }
 
 bool SdStyleSheet::SetParent(const OUString& rParentName)
@@ -661,7 +661,7 @@ SdStyleSheet* SdStyleSheet::CreateEmptyUserStyle( SfxStyleSheetBasePool& rPool,
     }
     while( rPool.Find( aName, eFamily ) != nullptr );
 
-    return new SdStyleSheet(aName, rPool, eFamily, SFXSTYLEBIT_USERDEF);
+    return new SdStyleSheet(aName, rPool, eFamily, SfxStyleSearchBits::UserDefined);
 }
 
 // XInterface
diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx
index 4264391a78e6..7402a939c813 100644
--- a/sd/source/ui/func/futempl.cxx
+++ b/sd/source/ui/func/futempl.cxx
@@ -119,7 +119,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
     }
 
     OUString aStyleName;
-    sal_uInt16 nRetMask = SFXSTYLEBIT_ALL;
+    sal_uInt16 nRetMask = static_cast<sal_uInt16>(SfxStyleSearchBits::All);
 
     switch( nSId )
     {
@@ -167,7 +167,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
                 pSSPool->Remove(p);
                 p = nullptr;
             }
-            pStyleSheet = &pSSPool->Make( aStyleName, nFamily, SFXSTYLEBIT_USERDEF );
+            pStyleSheet = &pSSPool->Make( aStyleName, nFamily, SfxStyleSearchBits::UserDefined );
 
             if (pArgs && pArgs->GetItemState(SID_STYLE_REFERENCE) == SfxItemState::SET)
             {
@@ -190,7 +190,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
                 pSSPool->Remove(p);
                 p = nullptr;
             }
-            pStyleSheet = &pSSPool->Make( aStyleName, nFamily, SFXSTYLEBIT_USERDEF );
+            pStyleSheet = &pSSPool->Make( aStyleName, nFamily, SfxStyleSearchBits::UserDefined );
             pStyleSheet->SetParent(SdResId(STR_STANDARD_STYLESHEET_NAME));
         }
         break;
@@ -382,7 +382,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
                 {
                     case RET_OK:
                     {
-                        nRetMask = pStyleSheet->GetMask();
+                        nRetMask = static_cast<sal_uInt16>(pStyleSheet->GetMask());
 
                         if (eFamily == SfxStyleFamily::Pseudo)
                         {
@@ -568,7 +568,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
         {
             if( pStyleSheet )
             {
-                nRetMask = pStyleSheet->GetMask();
+                nRetMask = static_cast<sal_uInt16>(pStyleSheet->GetMask());
                 SfxItemSet aCoreSet( mpDoc->GetPool() );
                 mpView->GetAttributes( aCoreSet, true );
 
@@ -612,7 +612,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
 
                 if( pStyleSheet )
                 {
-                    nRetMask = pStyleSheet->GetMask();
+                    nRetMask = static_cast<sal_uInt16>(pStyleSheet->GetMask());
                     SfxItemSet aCoreSet( mpDoc->GetPool() );
                     mpView->GetAttributes( aCoreSet );
 
@@ -630,7 +630,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
         break;
 
     }
-    if( nRetMask != SFXSTYLEBIT_ALL )
+    if( nRetMask != static_cast<sal_uInt16>(SfxStyleSearchBits::All) )
         rReq.SetReturnValue( SfxUInt16Item( nSId, nRetMask ) );
 }
 
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index f7f29f4e0010..77eed3e403e7 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -189,19 +189,19 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx
         const SfxStyleFilter& rList = pItem->GetFilterList();
         nCount = rList.size();
         sal_uInt16 nIdx = 0;
-        sal_uInt16 nMask = pStyle->GetMask() & ~SFXSTYLEBIT_USERDEF;
+        SfxStyleSearchBits nMask = pStyle->GetMask() & ~SfxStyleSearchBits::UserDefined;
 
-        if ( !nMask )   // User Template?
+        if ( nMask == SfxStyleSearchBits::Auto )   // User Template?
             nMask = pStyle->GetMask();
 
         for ( i = 0; i < nCount; ++i )
         {
             const SfxFilterTupel& rTupel = rList[ i ];
 
-            if ( rTupel.nFlags != SFXSTYLEBIT_AUTO     &&
-                 rTupel.nFlags != SFXSTYLEBIT_USED     &&
-                 rTupel.nFlags != SFXSTYLEBIT_ALL_VISIBLE &&
-                 rTupel.nFlags != SFXSTYLEBIT_ALL )
+            if ( rTupel.nFlags != SfxStyleSearchBits::Auto     &&
+                 rTupel.nFlags != SfxStyleSearchBits::Used     &&
+                 rTupel.nFlags != SfxStyleSearchBits::AllVisible &&
+                 rTupel.nFlags != SfxStyleSearchBits::All )
             {
                 m_pFilterLb->InsertEntry( rTupel.aName, nIdx );
                 m_pFilterLb->SetEntryData(nIdx, reinterpret_cast<void*>(i));
@@ -453,7 +453,7 @@ bool SfxManageStyleSheetPage::FillItemSet( SfxItemSet* rSet )
         bModified = true;
         OSL_ENSURE( pItem, "No Item" );
         // is only possibly for user templates
-        sal_uInt16 nMask = pItem->GetFilterList()[ reinterpret_cast<size_t>(m_pFilterLb->GetEntryData( nFilterIdx )) ].nFlags | SFXSTYLEBIT_USERDEF;
+        SfxStyleSearchBits nMask = pItem->GetFilterList()[ reinterpret_cast<size_t>(m_pFilterLb->GetEntryData( nFilterIdx )) ].nFlags | SfxStyleSearchBits::UserDefined;
         pStyle->SetMask( nMask );
     }
     if(m_pAutoCB->IsVisible() &&
@@ -525,7 +525,7 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet* /*rAttrSet*/ )
 
     if ( m_pFilterLb->IsEnabled() )
     {
-        sal_uInt16 nCmp = pStyle->GetMask();
+        SfxStyleSearchBits nCmp = pStyle->GetMask();
 
         if ( nCmp != nFlags )
             pStyle->SetMask( nFlags );
diff --git a/sfx2/source/dialog/styfitem.cxx b/sfx2/source/dialog/styfitem.cxx
index 40d02cbeb480..33b731691596 100644
--- a/sfx2/source/dialog/styfitem.cxx
+++ b/sfx2/source/dialog/styfitem.cxx
@@ -20,12 +20,12 @@
 #include <sfx2/styfitem.hxx>
 #include <unotools/resmgr.hxx>
 
-SfxStyleFamilyItem::SfxStyleFamilyItem(SfxStyleFamily nFamily_, const OUString &rName, const Image& rImage, const std::pair<const char*, int>* pStringArray, const std::locale& rResLocale)
+SfxStyleFamilyItem::SfxStyleFamilyItem(SfxStyleFamily nFamily_, const OUString &rName, const Image& rImage, const std::pair<const char*, SfxStyleSearchBits>* pStringArray, const std::locale& rResLocale)
     : nFamily(nFamily_)
     , aText(rName)
     , aImage(rImage)
 {
-    for (const std::pair<const char*, int>* pItem = pStringArray; pItem->first; ++pItem)
+    for (const std::pair<const char*, SfxStyleSearchBits>* pItem = pStringArray; pItem->first; ++pItem)
         aFilterList.emplace_back(Translate::get(pItem->first, rResLocale), pItem->second);
 }
 
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 79f4970b98d0..31ffd4cdbc5c 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -650,7 +650,7 @@ SfxCommonTemplateDialog_Impl::SfxCommonTemplateDialog_Impl( SfxBindings* pB, vcl
 
     , nActFamily(0xffff)
     , nActFilter(0)
-    , nAppFilter(0)
+    , nAppFilter(SfxStyleSearchBits::Auto)
 
     , bDontUpdate(false)
     , bIsWater(false)
@@ -711,9 +711,13 @@ void SfxCommonTemplateDialog_Impl::ReadResource()
     if (!pStyleFamilies)
         pStyleFamilies = new SfxStyleFamilies;
 
-    nActFilter = pCurObjShell ? static_cast< sal_uInt16 >( LoadFactoryStyleFilter( pCurObjShell ) ) : SFXSTYLEBIT_ALL;
-    if ( pCurObjShell && SFXSTYLEBIT_ALL == nActFilter )
-        nActFilter = pCurObjShell->GetAutoStyleFilterIndex();
+    nActFilter = 0xffff;
+    if (pCurObjShell)
+    {
+        nActFilter = static_cast< sal_uInt16 >( LoadFactoryStyleFilter( pCurObjShell ) );
+        if ( 0xffff == nActFilter )
+            nActFilter = pCurObjShell->GetAutoStyleFilterIndex();
+    }
 
     // Paste in the toolbox
     // reverse order, since always inserted at the head
@@ -911,7 +915,7 @@ void SfxCommonTemplateDialog_Impl::SelectStyle(const OUString &rStr)
     SfxStyleSheetBase* pStyle = pStyleSheetPool->Find( rStr, eFam );
     if( pStyle )
     {
-        bool bReadWrite = !(pStyle->GetMask() & SFXSTYLEBIT_READONLY);
+        bool bReadWrite = !(pStyle->GetMask() & SfxStyleSearchBits::ReadOnly);
         EnableEdit( bReadWrite );
         EnableHide( bReadWrite && !pStyle->IsHidden( ) && !pStyle->IsUsed( ) );
         EnableShow( bReadWrite && pStyle->IsHidden( ) );
@@ -1017,7 +1021,7 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox()
         const SfxStyleFamilyItem* pItem = GetFamilyItem_Impl();
         if (!pItem)
             return;
-        pStyleSheetPool->SetSearchMask(pItem->GetFamily(), SFXSTYLEBIT_ALL_VISIBLE);
+        pStyleSheetPool->SetSearchMask(pItem->GetFamily(), SfxStyleSearchBits::AllVisible);
         StyleTreeArr_Impl aArr;
         SfxStyleSheetBase* pStyle = pStyleSheetPool->First();
 
@@ -1101,8 +1105,8 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(StyleFlags nFlags)
 
     const SfxStyleFamily eFam = pItem->GetFamily();
 
-    sal_uInt16 nFilter (nActFilter < pItem->GetFilterList().size() ? pItem->GetFilterList()[nActFilter].nFlags : 0);
-    if(!nFilter)   // automatic
+    SfxStyleSearchBits nFilter (nActFilter < pItem->GetFilterList().size() ? pItem->GetFilterList()[nActFilter].nFlags : SfxStyleSearchBits::Auto);
+    if(nFilter == SfxStyleSearchBits::Auto)   // automatic
         nFilter = nAppFilter;
 
     OSL_ENSURE(pStyleSheetPool, "no StyleSheetPool");
@@ -1117,11 +1121,11 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(StyleFlags nFlags)
             aFilterLb->Clear();
             //insert hierarchical at the beginning
             sal_Int32 nPos = aFilterLb->InsertEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL), 0);
-            aFilterLb->SetEntryData( nPos, reinterpret_cast<void*>(SFXSTYLEBIT_ALL) );
+            aFilterLb->SetEntryData( nPos, reinterpret_cast<void*>(SfxStyleSearchBits::All) );
             const SfxStyleFilter& rFilter = pItem->GetFilterList();
             for(const SfxFilterTupel& i : rFilter)
             {
-                sal_uIntPtr nFilterFlags = i.nFlags;
+                SfxStyleSearchBits nFilterFlags = i.nFlags;
                 nPos = aFilterLb->InsertEntry( i.aName );
                 aFilterLb->SetEntryData( nPos, reinterpret_cast<void*>(nFilterFlags) );
             }
@@ -1131,7 +1135,7 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(StyleFlags nFlags)
             {
                 nActFilter = 0;
                 aFilterLb->SelectEntryPos(1);
-                sal_uInt16 nFilterFlags = (nActFilter < rFilter.size()) ? rFilter[nActFilter].nFlags : 0;
+                SfxStyleSearchBits nFilterFlags = (nActFilter < rFilter.size()) ? rFilter[nActFilter].nFlags : SfxStyleSearchBits::Auto;
                 pStyleSheetPool->SetSearchMask(eFam, nFilterFlags);
             }
 
@@ -1345,7 +1349,7 @@ void SfxCommonTemplateDialog_Impl::Update_Impl()
          // other DocShell -> all new
          CheckItem( nActFamily );
          nActFilter = static_cast< sal_uInt16 >( LoadFactoryStyleFilter( pDocShell ) );
-         if ( SFXSTYLEBIT_ALL == nActFilter )
+         if ( 0xffff == nActFilter )
             nActFilter = pDocShell->GetAutoStyleFilterIndex();
 
          nAppFilter = pItem->GetValue();
@@ -1361,7 +1365,7 @@ void SfxCommonTemplateDialog_Impl::Update_Impl()
          // other filters for automatic
          CheckItem( nActFamily );
          const SfxStyleFamilyItem *pStyleItem =  GetFamilyItem_Impl();
-         if ( pStyleItem && 0 == pStyleItem->GetFilterList()[nActFilter].nFlags
+         if ( pStyleItem && SfxStyleSearchBits::Auto == pStyleItem->GetFilterList()[nActFilter].nFlags
             && nAppFilter != pItem->GetValue())
          {
              nAppFilter = pItem->GetValue();
@@ -1442,7 +1446,7 @@ void SfxCommonTemplateDialog_Impl::Notify(SfxBroadcaster& /*rBC*/, const SfxHint
                         SfxStyleSheetBase *pStyle = pStyleSheetPool->Find( aStr, eFam );
                         if( pStyle )
                         {
-                            bool bReadWrite = !(pStyle->GetMask() & SFXSTYLEBIT_READONLY);
+                            bool bReadWrite = !(pStyle->GetMask() & SfxStyleSearchBits::ReadOnly);
                             EnableEdit( bReadWrite );
                             EnableHide( bReadWrite && !pStyle->IsUsed( ) && !pStyle->IsHidden( ) );
                             EnableShow( bReadWrite && pStyle->IsHidden( ) );
@@ -1521,12 +1525,12 @@ void SfxCommonTemplateDialog_Impl::FilterSelect(
 // Internal: Perform functions through the Dispatcher
 bool SfxCommonTemplateDialog_Impl::Execute_Impl(
     sal_uInt16 nId, const OUString &rStr, const OUString& rRefStr, sal_uInt16 nFamily,
-    sal_uInt16 nMask, sal_uInt16 *pIdx, const sal_uInt16* pModifier)
+    SfxStyleSearchBits nMask, sal_uInt16 *pIdx, const sal_uInt16* pModifier)
 {
     SfxDispatcher &rDispatcher = *SfxGetpApp()->GetDispatcher_Impl();
     SfxStringItem aItem(nId, rStr);
     SfxUInt16Item aFamily(SID_STYLE_FAMILY, nFamily);
-    SfxUInt16Item aMask( SID_STYLE_MASK, nMask );
+    SfxUInt16Item aMask( SID_STYLE_MASK, static_cast<sal_uInt16>(nMask) );
     SfxStringItem aUpdName(SID_STYLE_UPD_BY_EX_NAME, rStr);
     SfxStringItem aRefName( SID_STYLE_REFERENCE, rRefStr );
     const SfxPoolItem* pItems[ 6 ];
@@ -1534,7 +1538,7 @@ bool SfxCommonTemplateDialog_Impl::Execute_Impl(
     if( !rStr.isEmpty() )
         pItems[ nCount++ ] = &aItem;
     pItems[ nCount++ ] = &aFamily;
-    if( nMask )
+    if( nMask != SfxStyleSearchBits::Auto )
         pItems[ nCount++ ] = &aMask;
     if(SID_STYLE_UPDATE_BY_EXAMPLE == nId)
     {
@@ -1564,9 +1568,9 @@ bool SfxCommonTemplateDialog_Impl::Execute_Impl(
     {
         const SfxUInt16Item *pFilterItem = dynamic_cast< const SfxUInt16Item* >(pItem);
         OSL_ENSURE(pFilterItem, "SfxUINT16Item expected");
-        sal_uInt16 nFilterFlags = pFilterItem->GetValue() & ~SFXSTYLEBIT_USERDEF;
-        if(!nFilterFlags)       // User Template?
-            nFilterFlags = pFilterItem->GetValue();
+        SfxStyleSearchBits nFilterFlags = static_cast<SfxStyleSearchBits>(pFilterItem->GetValue()) & ~SfxStyleSearchBits::UserDefined;
+        if(nFilterFlags == SfxStyleSearchBits::Auto)       // User Template?
+            nFilterFlags = static_cast<SfxStyleSearchBits>(pFilterItem->GetValue());
         const SfxStyleFamilyItem *pFamilyItem = GetFamilyItem_Impl();
         const size_t nFilterCount = pFamilyItem->GetFilterList().size();
 
@@ -1694,16 +1698,16 @@ void SfxCommonTemplateDialog_Impl::ActionSelect(sal_uInt16 nEntry)
             {
                 const SfxStyleFamily eFam=GetFamilyItem_Impl()->GetFamily();
                 const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl();
-                sal_uInt16 nFilter;
-                if( pItem && nActFilter != SFXSTYLEBIT_ALL )
+                SfxStyleSearchBits nFilter;
+                if( pItem && nActFilter != 0xffff )
                 {
                     nFilter = pItem->GetFilterList()[nActFilter].nFlags;
-                    if(!nFilter)    // automatisch
+                    if(nFilter == SfxStyleSearchBits::Auto)    // automatic
                         nFilter = nAppFilter;
                 }
                 else
                     nFilter=pStyleSheetPool->GetSearchMask();
-                pStyleSheetPool->SetSearchMask( eFam, SFXSTYLEBIT_USERDEF );
+                pStyleSheetPool->SetSearchMask( eFam, SfxStyleSearchBits::UserDefined );
 
                 ScopedVclPtrInstance< SfxNewStyleDlg > pDlg(pWindow, *pStyleSheetPool);
                 // why? : FloatingWindow must not be parent of a modal dialog
@@ -1765,9 +1769,8 @@ sal_Int32 SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter( SfxObjectShell c
         xModuleManager->getByName( getModuleIdentifier( xModuleManager, i_pObjSh ) ) );
     sal_Int32 nFilter = aFactoryProps.getUnpackedValueOrDefault( "ooSetupFactoryStyleFilter", sal_Int32(-1) );
 
-    m_bWantHierarchical =
-        (nFilter & SFXSTYLEBIT_HIERARCHY) != 0;
-    nFilter &= ~SFXSTYLEBIT_HIERARCHY; // clear it
+    m_bWantHierarchical = (nFilter & 0x1000) != 0;
+    nFilter &= ~0x1000; // clear it
 
     return nFilter;
 }
@@ -1777,8 +1780,7 @@ void SfxCommonTemplateDialog_Impl::SaveFactoryStyleFilter( SfxObjectShell const
     OSL_ENSURE( i_pObjSh, "SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter(): no ObjectShell" );
     Sequence< PropertyValue > lProps(1);
     lProps[0].Name = "ooSetupFactoryStyleFilter";
-    lProps[0].Value <<=
-            i_nFilter | (m_bWantHierarchical ? SFXSTYLEBIT_HIERARCHY : 0);
+    lProps[0].Value <<= i_nFilter | (m_bWantHierarchical ? 0x1000 : 0);
     xModuleManager->replaceByName( getModuleIdentifier( xModuleManager, i_pObjSh ), makeAny( lProps ) );
 }
 
@@ -1811,11 +1813,11 @@ void SfxCommonTemplateDialog_Impl::NewHdl()
     {
         const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl();
         const SfxStyleFamily eFam=pItem->GetFamily();
-        sal_uInt16 nMask;
-        if( nActFilter != SFXSTYLEBIT_ALL )
+        SfxStyleSearchBits nMask;
+        if( nActFilter != 0xffff )
         {
             nMask = pItem->GetFilterList()[nActFilter].nFlags;
-            if(!nMask)    // automatic
+            if(nMask == SfxStyleSearchBits::Auto)    // automatic
                 nMask = nAppFilter;
         }
         else
@@ -1839,7 +1841,7 @@ void SfxCommonTemplateDialog_Impl::EditHdl()
         OUString aTemplName(GetSelectedEntry());
         GetSelectedStyle(); // -Wall required??
         Execute_Impl( SID_STYLE_EDIT, aTemplName, OUString(),
-                          static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()), 0, &nFilter );
+                          static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()), SfxStyleSearchBits::Auto, &nFilter );
     }
 }
 
@@ -1954,13 +1956,13 @@ void SfxCommonTemplateDialog_Impl::EnableDelete()
         const OUString aTemplName(GetSelectedEntry());
         const SfxStyleFamilyItem *pItem = GetFamilyItem_Impl();
         const SfxStyleFamily eFam = pItem->GetFamily();
-        sal_uInt16 nFilter = 0;
+        SfxStyleSearchBits nFilter = SfxStyleSearchBits::Auto;
         if (pItem->GetFilterList().size() > nActFilter)
             nFilter = pItem->GetFilterList()[nActFilter].nFlags;
-        if(!nFilter)    // automatic
+        if(nFilter == SfxStyleSearchBits::Auto)    // automatic
             nFilter = nAppFilter;
         const SfxStyleSheetBase *pStyle =
-            pStyleSheetPool->Find(aTemplName,eFam, pTreeBox? SFXSTYLEBIT_ALL : nFilter);
+            pStyleSheetPool->Find(aTemplName,eFam, pTreeBox? SfxStyleSearchBits::All : nFilter);
 
         OSL_ENSURE(pStyle, "Style not found");
         if(pStyle && pStyle->IsUserDefined())
@@ -1995,7 +1997,7 @@ IMPL_LINK_NOARG( SfxCommonTemplateDialog_Impl, ApplyHdl, LinkParamNone*, void )
         Execute_Impl(SID_STYLE_APPLY,
                      GetSelectedEntry(), OUString(),
                      static_cast<sal_uInt16>(GetFamilyItem_Impl()->GetFamily()),
-                     0, nullptr, &nModifier );
+                     SfxStyleSearchBits::Auto, nullptr, &nModifier );
     }
     // After selecting a focused item if possible again on the app window
     if ( dynamic_cast< const SfxTemplateDialog_Impl* >(this) !=  nullptr )
diff --git a/sfx2/source/dialog/tplpitem.cxx b/sfx2/source/dialog/tplpitem.cxx
index 154f7688575b..60156ad6d4f3 100644
--- a/sfx2/source/dialog/tplpitem.cxx
+++ b/sfx2/source/dialog/tplpitem.cxx
@@ -32,7 +32,7 @@ SfxTemplateItem::SfxTemplateItem
 (
     sal_uInt16 nWhichId,      // Slot-ID
     const OUString& rStyle    // Name of the current Styles
-) : SfxFlagItem( nWhichId, SFXSTYLEBIT_ALL ),
+) : SfxFlagItem( nWhichId, static_cast<sal_uInt16>(SfxStyleSearchBits::All) ),
     aStyle( rStyle )
 {
 }
@@ -56,7 +56,7 @@ bool SfxTemplateItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
 {
     css::frame::status::Template aTemplate;
 
-    aTemplate.Value = GetValue();
+    aTemplate.Value = static_cast<sal_uInt16>(GetValue());
     aTemplate.StyleName = aStyle;
     rVal <<= aTemplate;
 
@@ -70,7 +70,7 @@ bool SfxTemplateItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId
 
     if ( rVal >>= aTemplate )
     {
-        SetValue( sal::static_int_cast< sal_uInt16 >( aTemplate.Value ) );
+        SetValue( static_cast<SfxStyleSearchBits>(aTemplate.Value) );
         aStyle = aTemplate.StyleName;
         return true;
     }
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 5263a8b74b16..6bf1bde8852f 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -193,7 +193,7 @@ protected:
 
     sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
     sal_uInt16 nActFilter; // FilterIdx
-    sal_uInt16 nAppFilter; // Filter, which has set the application (for automatic)
+    SfxStyleSearchBits nAppFilter; // Filter, which has set the application (for automatic)
 
     bool bDontUpdate :1;
     bool bIsWater :1;
@@ -244,7 +244,7 @@ protected:
     void ShowHdl();
 
     bool Execute_Impl(sal_uInt16 nId, const OUString& rStr, const OUString& rRefStr,
-                      sal_uInt16 nFamily, sal_uInt16 nMask = 0,
+                      sal_uInt16 nFamily, SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto,
                       sal_uInt16* pIdx = nullptr, const sal_uInt16* pModifier = nullptr );
 
     void UpdateStyles_Impl(StyleFlags nFlags);
diff --git a/svl/qa/unit/items/test_IndexedStyleSheets.cxx b/svl/qa/unit/items/test_IndexedStyleSheets.cxx
index 4cf9a9621bf0..3e083892d43f 100644
--- a/svl/qa/unit/items/test_IndexedStyleSheets.cxx
+++ b/svl/qa/unit/items/test_IndexedStyleSheets.cxx
@@ -24,7 +24,7 @@ class MockedStyleSheet : public SfxStyleSheetBase
 {
     public:
     MockedStyleSheet(const rtl::OUString& name, SfxStyleFamily fam = SfxStyleFamily::Char)
-    : SfxStyleSheetBase(name, nullptr, fam, 0)
+    : SfxStyleSheetBase(name, nullptr, fam, SfxStyleSearchBits::Auto)
     {}
 
 };
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 6ff9e7642297..9ffd2aa57062 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -100,7 +100,7 @@ public:
 };
 
 
-SfxStyleSheetBase::SfxStyleSheetBase( const OUString& rName, SfxStyleSheetBasePool* p, SfxStyleFamily eFam, sal_uInt16 mask )
+SfxStyleSheetBase::SfxStyleSheetBase( const OUString& rName, SfxStyleSheetBasePool* p, SfxStyleFamily eFam, SfxStyleSearchBits mask )
     : m_pPool( p )
     , nFamily( eFam )
     , aName( rName )
@@ -171,7 +171,7 @@ bool SfxStyleSheetBase::SetName(const OUString& rName, bool bReIndexNow)
             return false;
 
         SfxStyleFamily eTmpFam = m_pPool->GetSearchFamily();
-        sal_uInt16 nTmpMask = m_pPool->GetSearchMask();
+        SfxStyleSearchBits nTmpMask = m_pPool->GetSearchMask();
 
         m_pPool->SetSearchMask(nFamily);
 
@@ -357,7 +357,7 @@ SfxStyleFamily SfxStyleSheetIterator::GetSearchFamily() const
 
 inline bool SfxStyleSheetIterator::IsTrivialSearch() const
 {
-    return (( nMask & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE) &&
+    return (( nMask & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible) &&
         (GetSearchFamily() == SfxStyleFamily::All);
 }
 
@@ -376,14 +376,14 @@ struct DoesStyleMatchStyleSheetPredicate final : public svl::StyleSheetPredicate
 
         bool bUsed = mIterator->SearchUsed() && styleSheet.IsUsed( );
 
-        bool bSearchHidden = ( mIterator->GetSearchMask() & SFXSTYLEBIT_HIDDEN );
+        bool bSearchHidden( mIterator->GetSearchMask() & SfxStyleSearchBits::Hidden );
         bool bMatchVisibility = !( !bSearchHidden && styleSheet.IsHidden() && !bUsed );
-        bool bOnlyHidden = mIterator->GetSearchMask( ) == SFXSTYLEBIT_HIDDEN && styleSheet.IsHidden( );
+        bool bOnlyHidden = mIterator->GetSearchMask( ) == SfxStyleSearchBits::Hidden && styleSheet.IsHidden( );
 
         bool bMatches = bMatchFamily && bMatchVisibility
-            && (( styleSheet.GetMask() & ( mIterator->GetSearchMask() & ~SFXSTYLEBIT_USED )) ||
+            && (( styleSheet.GetMask() & ( mIterator->GetSearchMask() & ~SfxStyleSearchBits::Used )) ||
                 bUsed || bOnlyHidden ||
-                ( mIterator->GetSearchMask() & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE );
+                ( mIterator->GetSearchMask() & SfxStyleSearchBits::AllVisible ) == SfxStyleSearchBits::AllVisible );
         return bMatches;
     }
 
@@ -393,18 +393,18 @@ struct DoesStyleMatchStyleSheetPredicate final : public svl::StyleSheetPredicate
 }
 
 SfxStyleSheetIterator::SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase,
-                                             SfxStyleFamily eFam, sal_uInt16 n)
+                                             SfxStyleFamily eFam, SfxStyleSearchBits n)
     : pCurrentStyle(nullptr)
     , nCurrentPosition(0)
 {
     pBasePool=pBase;
     nSearchFamily=eFam;
     bSearchUsed=false;
-        if( (( n & SFXSTYLEBIT_ALL_VISIBLE ) != SFXSTYLEBIT_ALL_VISIBLE )
-                && ((n & SFXSTYLEBIT_USED) == SFXSTYLEBIT_USED))
+        if( (( n & SfxStyleSearchBits::AllVisible ) != SfxStyleSearchBits::AllVisible )
+                && ((n & SfxStyleSearchBits::Used) == SfxStyleSearchBits::Used))
     {
         bSearchUsed = true;
-        n &= ~SFXSTYLEBIT_USED;
+        n &= ~SfxStyleSearchBits::Used;
     }
     nMask=n;
 }
@@ -420,7 +420,7 @@ sal_uInt16 SfxStyleSheetIterator::Count()
     {
         n = static_cast<sal_uInt16>(pBasePool->pImpl->mxIndexedStyleSheets->GetNumberOfStyleSheets());
     }
-    else if(nMask == SFXSTYLEBIT_ALL)
+    else if(nMask == SfxStyleSearchBits::All)
     {
         n = static_cast<sal_uInt16>(pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetPositionsByFamily(nSearchFamily).size());
     }
@@ -440,7 +440,7 @@ SfxStyleSheetBase* SfxStyleSheetIterator::operator[](sal_uInt16 nIdx)
         retval = pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition(nIdx).get();
         nCurrentPosition = nIdx;
     }
-    else if(nMask == SFXSTYLEBIT_ALL)
+    else if(nMask == SfxStyleSearchBits::All)
     {
         rtl::Reference< SfxStyleSheetBase > ref =
         pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition(
@@ -494,7 +494,7 @@ SfxStyleSheetBase* SfxStyleSheetIterator::Next()
             retval = pBasePool->pImpl->mxIndexedStyleSheets->GetStyleSheetByPosition(nCurrentPosition).get();
         }
     }
-    else if(nMask == SFXSTYLEBIT_ALL)
+    else if(nMask == SfxStyleSearchBits::All)
     {
         unsigned newPosition = nCurrentPosition +1;
         const std::vector<unsigned>& familyVector =
@@ -539,12 +539,12 @@ SfxStyleSheetBase* SfxStyleSheetIterator::Find(const OUString& rStr)
     return pCurrentStyle;
 }
 
-sal_uInt16 SfxStyleSheetIterator::GetSearchMask() const
+SfxStyleSearchBits SfxStyleSheetIterator::GetSearchMask() const
 {
-    sal_uInt16 mask = nMask;
+    SfxStyleSearchBits mask = nMask;
 
     if ( bSearchUsed )
-        mask |= SFXSTYLEBIT_USED;
+        mask |= SfxStyleSearchBits::Used;
     return mask;
 }
 
@@ -563,7 +563,7 @@ SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& r ) :
     pImpl(new SfxStyleSheetBasePool_Impl),
     rPool(r),
     nSearchFamily(SfxStyleFamily::Para),
-    nMask(SFXSTYLEBIT_ALL)
+    nMask(SfxStyleSearchBits::All)
 {
 #ifdef DBG_UTIL
     aDbgStyleSheetReferences.mnPools++;
@@ -597,7 +597,7 @@ SfxStyleSheetBasePool::~SfxStyleSheetBasePool()
 
 bool SfxStyleSheetBasePool::SetParent(SfxStyleFamily eFam, const OUString& rStyle, const OUString& rParent)
 {
-    SfxStyleSheetIterator aIter(this,eFam,SFXSTYLEBIT_ALL);
+    SfxStyleSheetIterator aIter(this,eFam,SfxStyleSearchBits::All);
     SfxStyleSheetBase *pStyle = aIter.Find(rStyle);
     OSL_ENSURE(pStyle, "Template not found. Writer with solar <2541?");
     if(pStyle)
@@ -607,7 +607,7 @@ bool SfxStyleSheetBasePool::SetParent(SfxStyleFamily eFam, const OUString& rStyl
 }
 
 
-void SfxStyleSheetBasePool::SetSearchMask(SfxStyleFamily eFam, sal_uInt16 n)
+void SfxStyleSheetBasePool::SetSearchMask(SfxStyleFamily eFam, SfxStyleSearchBits n)
 {
     nSearchFamily = eFam; nMask = n;
 }
@@ -616,7 +616,7 @@ void SfxStyleSheetBasePool::SetSearchMask(SfxStyleFamily eFam, sal_uInt16 n)
 std::shared_ptr<SfxStyleSheetIterator> SfxStyleSheetBasePool::CreateIterator
 (
  SfxStyleFamily eFam,
- sal_uInt16 mask
+ SfxStyleSearchBits mask
 )
 {
     return std::make_shared<SfxStyleSheetIterator>(this,eFam,mask);
@@ -626,7 +626,7 @@ SfxStyleSheetBase* SfxStyleSheetBasePool::Create
 (
     const OUString& rName,
     SfxStyleFamily eFam,
-    sal_uInt16 mask
+    SfxStyleSearchBits mask
 )
 {
     return new SfxStyleSheetBase( rName, this, eFam, mask );
@@ -637,7 +637,7 @@ SfxStyleSheetBase* SfxStyleSheetBasePool::Create( const SfxStyleSheetBase& r )
     return new SfxStyleSheetBase( r );
 }
 
-SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const OUString& rName, SfxStyleFamily eFam, sal_uInt16 mask)
+SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const OUString& rName, SfxStyleFamily eFam, SfxStyleSearchBits mask)
 {
     OSL_ENSURE( eFam != SfxStyleFamily::All, "svl::SfxStyleSheetBasePool::Make(), FamilyAll is not a allowed Familie" );
 
@@ -717,7 +717,7 @@ SfxStyleSheetBase *SfxStyleSheetBasePool::operator[](sal_uInt16 nIdx)
 
 SfxStyleSheetBase* SfxStyleSheetBasePool::Find(const OUString& rName,
                                                SfxStyleFamily eFam,
-                                               sal_uInt16 mask)
+                                               SfxStyleSearchBits mask)
 {
     SfxStyleSheetIterator aIter(this,eFam,mask);
     return aIter.Find(rName);
@@ -819,7 +819,7 @@ void SfxStyleSheetBasePool::ChangeParent(const OUString& rOld,
                                          const OUString& rNew,
                                          bool bVirtual)
 {
-    const sal_uInt16 nTmpMask = GetSearchMask();
+    const SfxStyleSearchBits nTmpMask = GetSearchMask();
     SetSearchMask(GetSearchFamily());
     for( SfxStyleSheetBase* p = First(); p; p = Next() )
     {
@@ -841,7 +841,7 @@ void SfxStyleSheetBase::Load( SvStream&, sal_uInt16 )
 SfxStyleSheet::SfxStyleSheet(const OUString &rName,
                              const SfxStyleSheetBasePool& r_Pool,
                              SfxStyleFamily eFam,
-                             sal_uInt16 mask )
+                             SfxStyleSearchBits mask )
     : SfxStyleSheetBase(rName, const_cast< SfxStyleSheetBasePool* >( &r_Pool ), eFam, mask)
 {
 }
@@ -906,13 +906,13 @@ SfxStyleSheetPool::SfxStyleSheetPool( SfxItemPool const& rSet)
 }
 
 SfxStyleSheetBase* SfxStyleSheetPool::Create( const OUString& rName,
-                                              SfxStyleFamily eFam, sal_uInt16 mask )
+                                              SfxStyleFamily eFam, SfxStyleSearchBits mask )
 {
     return new SfxStyleSheet( rName, *this, eFam, mask );
 }
 
-SfxUnoStyleSheet::SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, sal_uInt16 _nMaske )
-: cppu::ImplInheritanceHelper<SfxStyleSheet, css::style::XStyle, css::lang::XUnoTunnel>(_rName, _rPool, _eFamily, _nMaske)
+SfxUnoStyleSheet::SfxUnoStyleSheet( const OUString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, SfxStyleSearchBits _nMask )
+: cppu::ImplInheritanceHelper<SfxStyleSheet, css::style::XStyle, css::lang::XUnoTunnel>(_rName, _rPool, _eFamily, _nMask)
 {
 }
 
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index abb6cb4fd225..bf283e4cb9ca 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2403,7 +2403,7 @@ void SvxStyleToolBoxControl::FillStyleBox()
         SfxStyleSheetBase*      pStyle      = nullptr;
         bool                    bDoFill     = false;
 
-        pStyleSheetPool->SetSearchMask( eFamily, SFXSTYLEBIT_USED );
+        pStyleSheetPool->SetSearchMask( eFamily, SfxStyleSearchBits::Used );
 
         // Check whether fill is necessary
         pStyle = pStyleSheetPool->First();
@@ -2619,7 +2619,7 @@ void SvxStyleToolBoxControl::StateChanged(
     switch ( eState )
     {
         case SfxItemState::DEFAULT:
-            eTri = static_cast<const SfxTemplateItem*>(pState)->GetValue()
+            eTri = static_cast<const SfxTemplateItem*>(pState)->GetValue() != SfxStyleSearchBits::Auto
                         ? TRISTATE_TRUE
                         : TRISTATE_FALSE;
             break;
diff --git a/sw/inc/app.hrc b/sw/inc/app.hrc
index 352bab8ecfbc..f92bdbfe1688 100644
--- a/sw/inc/app.hrc
+++ b/sw/inc/app.hrc
@@ -23,68 +23,67 @@
 #define NC_(Context, String) (Context "\004" u8##String)
 
 #include <svl/style.hxx>
-#include "swstyle.h"
 
-const std::pair<const char*, int> RID_PARAGRAPHSTYLEFAMILY[] =
+const std::pair<const char*, SfxStyleSearchBits> RID_PARAGRAPHSTYLEFAMILY[] =
 {
-    { NC_("RID_PARAGRAPHSTYLEFAMILY", "All Styles")          , SFXSTYLEBIT_ALL_VISIBLE },
-    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Hidden Styles")       , SFXSTYLEBIT_HIDDEN    },
-    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Applied Styles")      , SFXSTYLEBIT_USED      },
-    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Custom Styles")       , SFXSTYLEBIT_USERDEF   },
-    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Automatic")           , SFXSTYLEBIT_AUTO      },
-    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Text Styles")         , SWSTYLEBIT_TEXT       },
-    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Chapter Styles")      , SWSTYLEBIT_CHAPTER    },
-    { NC_("RID_PARAGRAPHSTYLEFAMILY", "List Styles")         , SWSTYLEBIT_LIST       },
-    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Index Styles")        , SWSTYLEBIT_IDX        },
-    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Special Styles")      , SWSTYLEBIT_EXTRA      },
-    { NC_("RID_PARAGRAPHSTYLEFAMILY", "HTML Styles")         , SWSTYLEBIT_HTML       },
-    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Conditional Styles")  , SWSTYLEBIT_CONDCOLL   },
-    { nullptr, 0 }
+    { NC_("RID_PARAGRAPHSTYLEFAMILY", "All Styles")          , SfxStyleSearchBits::AllVisible },
+    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Hidden Styles")       , SfxStyleSearchBits::Hidden    },
+    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Applied Styles")      , SfxStyleSearchBits::Used      },
+    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Custom Styles")       , SfxStyleSearchBits::UserDefined   },
+    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Automatic")           , SfxStyleSearchBits::Auto      },
+    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Text Styles")         , SfxStyleSearchBits::SwText       },
+    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Chapter Styles")      , SfxStyleSearchBits::SwChapter    },
+    { NC_("RID_PARAGRAPHSTYLEFAMILY", "List Styles")         , SfxStyleSearchBits::SwList       },
+    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Index Styles")        , SfxStyleSearchBits::SwIndex        },
+    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Special Styles")      , SfxStyleSearchBits::SwExtra      },
+    { NC_("RID_PARAGRAPHSTYLEFAMILY", "HTML Styles")         , SfxStyleSearchBits::SwHtml       },
+    { NC_("RID_PARAGRAPHSTYLEFAMILY", "Conditional Styles")  , SfxStyleSearchBits::SwCondColl   },
+    { nullptr, SfxStyleSearchBits::Auto }
 };
 
-const std::pair<const char*, int> RID_CHARACTERSTYLEFAMILY[] =
+const std::pair<const char*, SfxStyleSearchBits> RID_CHARACTERSTYLEFAMILY[] =
 {
-    { NC_("RID_CHARACTERSTYLEFAMILY", "All Styles")      , SFXSTYLEBIT_ALL_VISIBLE },
-    { NC_("RID_CHARACTERSTYLEFAMILY", "Hidden Styles")   , SFXSTYLEBIT_HIDDEN    },
-    { NC_("RID_CHARACTERSTYLEFAMILY", "Applied Styles")  , SFXSTYLEBIT_USED      },
-    { NC_("RID_CHARACTERSTYLEFAMILY", "Custom Styles")   , SFXSTYLEBIT_USERDEF   },
-    { nullptr, 0 }
+    { NC_("RID_CHARACTERSTYLEFAMILY", "All Styles")      , SfxStyleSearchBits::AllVisible },
+    { NC_("RID_CHARACTERSTYLEFAMILY", "Hidden Styles")   , SfxStyleSearchBits::Hidden    },
+    { NC_("RID_CHARACTERSTYLEFAMILY", "Applied Styles")  , SfxStyleSearchBits::Used      },
+    { NC_("RID_CHARACTERSTYLEFAMILY", "Custom Styles")   , SfxStyleSearchBits::UserDefined   },
+    { nullptr, SfxStyleSearchBits::Auto }
 };
 
-const std::pair<const char*, int> RID_FRAMESTYLEFAMILY[] =
+const std::pair<const char*, SfxStyleSearchBits> RID_FRAMESTYLEFAMILY[] =
 {
-    { NC_("RID_FRAMESTYLEFAMILY", "All Styles")      , SFXSTYLEBIT_ALL_VISIBLE },
-    { NC_("RID_FRAMESTYLEFAMILY", "Hidden Styles")   , SFXSTYLEBIT_HIDDEN    },
-    { NC_("RID_FRAMESTYLEFAMILY", "Applied Styles")  , SFXSTYLEBIT_USED      },
-    { NC_("RID_FRAMESTYLEFAMILY", "Custom Styles")   , SFXSTYLEBIT_USERDEF   },
-    { nullptr, 0 }
+    { NC_("RID_FRAMESTYLEFAMILY", "All Styles")      , SfxStyleSearchBits::AllVisible },
+    { NC_("RID_FRAMESTYLEFAMILY", "Hidden Styles")   , SfxStyleSearchBits::Hidden    },
+    { NC_("RID_FRAMESTYLEFAMILY", "Applied Styles")  , SfxStyleSearchBits::Used      },
+    { NC_("RID_FRAMESTYLEFAMILY", "Custom Styles")   , SfxStyleSearchBits::UserDefined   },
+    { nullptr, SfxStyleSearchBits::Auto }
 };
 
-const std::pair<const char*, int> RID_PAGESTYLEFAMILY[] =
+const std::pair<const char*, SfxStyleSearchBits> RID_PAGESTYLEFAMILY[] =
 {
-    { NC_("RID_PAGESTYLEFAMILY", "All Styles")      , SFXSTYLEBIT_ALL_VISIBLE },
-    { NC_("RID_PAGESTYLEFAMILY", "Hidden Styles")   , SFXSTYLEBIT_HIDDEN    },
-    { NC_("RID_PAGESTYLEFAMILY", "Applied Styles")  , SFXSTYLEBIT_USED      },
-    { NC_("RID_PAGESTYLEFAMILY", "Custom Styles")   , SFXSTYLEBIT_USERDEF   },
-    { nullptr, 0 }
+    { NC_("RID_PAGESTYLEFAMILY", "All Styles")      , SfxStyleSearchBits::AllVisible },
+    { NC_("RID_PAGESTYLEFAMILY", "Hidden Styles")   , SfxStyleSearchBits::Hidden    },
+    { NC_("RID_PAGESTYLEFAMILY", "Applied Styles")  , SfxStyleSearchBits::Used      },
+    { NC_("RID_PAGESTYLEFAMILY", "Custom Styles")   , SfxStyleSearchBits::UserDefined   },
+    { nullptr, SfxStyleSearchBits::Auto }
 };
 
-const std::pair<const char*, int> RID_LISTSTYLEFAMILY[] =
+const std::pair<const char*, SfxStyleSearchBits> RID_LISTSTYLEFAMILY[] =
 {
-    { NC_("RID_LISTSTYLEFAMILY", "All Styles")      , SFXSTYLEBIT_ALL_VISIBLE },
-    { NC_("RID_LISTSTYLEFAMILY", "Hidden Styles")   , SFXSTYLEBIT_HIDDEN    },
-    { NC_("RID_LISTSTYLEFAMILY", "Applied Styles")  , SFXSTYLEBIT_USED      },
-    { NC_("RID_LISTSTYLEFAMILY", "Custom Styles")   , SFXSTYLEBIT_USERDEF   },
-    { nullptr, 0 }
+    { NC_("RID_LISTSTYLEFAMILY", "All Styles")      , SfxStyleSearchBits::AllVisible },
+    { NC_("RID_LISTSTYLEFAMILY", "Hidden Styles")   , SfxStyleSearchBits::Hidden    },
+    { NC_("RID_LISTSTYLEFAMILY", "Applied Styles")  , SfxStyleSearchBits::Used      },
+    { NC_("RID_LISTSTYLEFAMILY", "Custom Styles")   , SfxStyleSearchBits::UserDefined   },
+    { nullptr, SfxStyleSearchBits::Auto }
 };
 
-const std::pair<const char*, int> RID_TABLESTYLEFAMILY[] =
+const std::pair<const char*, SfxStyleSearchBits> RID_TABLESTYLEFAMILY[] =
 {
-    { NC_("RID_TABLESTYLEFAMILY", "All Styles")      , SFXSTYLEBIT_ALL_VISIBLE },
-    { NC_("RID_TABLESTYLEFAMILY", "Hidden Styles")   , SFXSTYLEBIT_HIDDEN    },
-    { NC_("RID_TABLESTYLEFAMILY", "Applied Styles")  , SFXSTYLEBIT_USED      },
-    { NC_("RID_TABLESTYLEFAMILY", "Custom Styles")   , SFXSTYLEBIT_USERDEF   },
-    { nullptr, 0 }
+    { NC_("RID_TABLESTYLEFAMILY", "All Styles")      , SfxStyleSearchBits::AllVisible },
+    { NC_("RID_TABLESTYLEFAMILY", "Hidden Styles")   , SfxStyleSearchBits::Hidden    },
+    { NC_("RID_TABLESTYLEFAMILY", "Applied Styles")  , SfxStyleSearchBits::Used      },
+    { NC_("RID_TABLESTYLEFAMILY", "Custom Styles")   , SfxStyleSearchBits::UserDefined   },
+    { nullptr, SfxStyleSearchBits::Auto }
 };
 
 #endif
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 0dd2b669d0c9..ebd823291046 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -122,7 +122,7 @@ class SW_DLLPUBLIC SwDocShell
         const OUString &rName,
         const OUString& rParent,
         const SfxStyleFamily nFamily,
-        sal_uInt16 nMask,
+        SfxStyleSearchBits nMask,
         const bool bNew,
         const OString& sPageId,
         SwWrtShell* pActShell,
@@ -138,7 +138,7 @@ class SW_DLLPUBLIC SwDocShell
     SAL_DLLPRIVATE SfxStyleFamily        DoWaterCan( const OUString &rName, SfxStyleFamily nFamily);
     SAL_DLLPRIVATE void                  UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWrtShell* pShell);
     SAL_DLLPRIVATE void                  MakeByExample(const OUString &rName,
-                                               SfxStyleFamily nFamily, sal_uInt16 nMask, SwWrtShell* pShell);
+                                               SfxStyleFamily nFamily, SfxStyleSearchBits nMask, SwWrtShell* pShell);
 
     SAL_DLLPRIVATE void                  SubInitNew();   ///< for InitNew and HtmlSourceMode.
 
diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx
index 59dcfe9afa8a..85c7fa4ea558 100644
--- a/sw/inc/docstyle.hxx
+++ b/sw/inc/docstyle.hxx
@@ -84,7 +84,6 @@ public:
 
     void                    Reset();
 
-    void                    SetMask(sal_uInt16 nMsk)            { nMask = nMsk;     }
     void                    SetFamily(SfxStyleFamily eFam)  { nFamily = eFam;   }
 
     bool                    IsPhysical() const              { return bPhysical; }
@@ -176,7 +175,7 @@ class SwStyleSheetIterator : public SfxStyleSheetIterator, public SfxListener
 
 public:
     SwStyleSheetIterator( SwDocStyleSheetPool* pBase,
-                          SfxStyleFamily eFam, sal_uInt16 n );
+                          SfxStyleFamily eFam, SfxStyleSearchBits n );
     virtual ~SwStyleSheetIterator() override;
 
     virtual sal_uInt16 Count() override;
@@ -196,7 +195,7 @@ class SwDocStyleSheetPool : public SfxStyleSheetBasePool
     SwDoc&              rDoc;
     bool                bOrganizer : 1;     ///< Organizer
 
-    virtual SfxStyleSheetBase* Create( const OUString&, SfxStyleFamily, sal_uInt16 nMask) override;
+    virtual SfxStyleSheetBase* Create( const OUString&, SfxStyleFamily, SfxStyleSearchBits nMask) override;
     virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& ) override;
 
     using SfxStyleSheetBasePool::Find;
@@ -205,10 +204,10 @@ public:
     SwDocStyleSheetPool( SwDoc&, bool bOrganizer );
 
     virtual SfxStyleSheetBase& Make(const OUString&, SfxStyleFamily,
-            sal_uInt16 nMask = SFXSTYLEBIT_ALL) override;
+            SfxStyleSearchBits nMask = SfxStyleSearchBits::All) override;
 
     virtual SfxStyleSheetBase* Find( const OUString&, SfxStyleFamily eFam,
-                                    sal_uInt16 n=SFXSTYLEBIT_ALL ) override;
+                                    SfxStyleSearchBits n=SfxStyleSearchBits::All ) override;
 
     virtual bool SetParent( SfxStyleFamily eFam, const OUString &rStyle,
                             const OUString &rParent ) override;
@@ -217,7 +216,7 @@ public:
 
     bool    IsOrganizerMode() const         { return bOrganizer; }
 
-    virtual std::shared_ptr<SfxStyleSheetIterator> CreateIterator( SfxStyleFamily, sal_uInt16 nMask ) override;
+    virtual std::shared_ptr<SfxStyleSheetIterator> CreateIterator( SfxStyleFamily, SfxStyleSearchBits nMask ) override;
 
     SwDoc& GetDoc() const { return rDoc; }
 
diff --git a/sw/inc/swstyle.h b/sw/inc/swstyle.h
deleted file mode 100644
index 59e37e95a3f9..000000000000
--- a/sw/inc/swstyle.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#ifndef INCLUDED_SW_INC_SWSTYLE_H
-#define INCLUDED_SW_INC_SWSTYLE_H
-
-
-#define SWSTYLEBIT_TEXT           0x0001
-#define SWSTYLEBIT_CHAPTER        0x0002
-#define SWSTYLEBIT_LIST           0x0004
-#define SWSTYLEBIT_IDX            0x0008
-#define SWSTYLEBIT_EXTRA          0x0010
-#define SWSTYLEBIT_HTML           0x0020
-#define SWSTYLEBIT_CONDCOLL       0x0040
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index b7f60b5dcc7f..c1821f2b9a82 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -46,7 +46,6 @@
 #include <unostyle.hxx>
 #include <unosett.hxx>
 #include <docsh.hxx>
-#include <swstyle.h>
 #include <paratr.hxx>
 #include <unoprnms.hxx>
 #include <shellio.hxx>
@@ -145,14 +144,13 @@ namespace
     #define nPoolCollDocStackedStart      ( nPoolCollRegisterStackedStart + nPoolCollRegisterRange)
     #define nPoolCollHtmlStackedStart     ( nPoolCollDocStackedStart      + nPoolCollDocRange)
     using paragraphstyle_t = std::remove_const<decltype(style::ParagraphStyleCategory::TEXT)>::type;
-    using swstylebits_t = sal_uInt16;
     using collectionbits_t = sal_uInt16;
     struct ParagraphStyleCategoryEntry
     {
         paragraphstyle_t m_eCategory;
-        swstylebits_t m_nSwStyleBits;
+        SfxStyleSearchBits m_nSwStyleBits;
         collectionbits_t m_nCollectionBits;
-        ParagraphStyleCategoryEntry(paragraphstyle_t eCategory, swstylebits_t nSwStyleBits, collectionbits_t nCollectionBits)
+        ParagraphStyleCategoryEntry(paragraphstyle_t eCategory, SfxStyleSearchBits nSwStyleBits, collectionbits_t nCollectionBits)
                 : m_eCategory(eCategory)
                 , m_nSwStyleBits(nSwStyleBits)
                 , m_nCollectionBits(nCollectionBits)
@@ -861,7 +859,7 @@ uno::Sequence<OUString> XStyleFamily::getElementNames()
     if(!m_pBasePool)
         throw uno::RuntimeException();
     std::vector<OUString> vRet;
-    std::shared_ptr<SfxStyleSheetIterator> pIt = m_pBasePool->CreateIterator(m_rEntry.m_eFamily, SFXSTYLEBIT_ALL);
+    std::shared_ptr<SfxStyleSheetIterator> pIt = m_pBasePool->CreateIterator(m_rEntry.m_eFamily, SfxStyleSearchBits::All);
     for (SfxStyleSheetBase* pStyle = pIt->First(); pStyle; pStyle = pIt->Next())
     {
         OUString sName;
@@ -935,9 +933,9 @@ void XStyleFamily::insertByName(const OUString& rName, const uno::Any& rElement)
         if (!pNewStyle || !pNewStyle->IsDescriptor() || pNewStyle->GetFamily() != m_rEntry.m_eFamily)
             throw lang::IllegalArgumentException();
 
-        sal_uInt16 nMask = SFXSTYLEBIT_ALL;
+        SfxStyleSearchBits nMask = SfxStyleSearchBits::All;
         if(m_rEntry.m_eFamily == SfxStyleFamily::Para && !pNewStyle->IsConditional())
-            nMask &= ~SWSTYLEBIT_CONDCOLL;
+            nMask &= ~SfxStyleSearchBits::SwCondColl;
         m_pBasePool->Make(sStyleName, m_rEntry.m_eFamily, nMask);
         pNewStyle->SetDoc(m_pDocShell->GetDoc(), m_pBasePool);
         pNewStyle->SetStyleName(sStyleName);
@@ -1088,12 +1086,12 @@ static const std::vector<ParagraphStyleCategoryEntry>* lcl_GetParagraphStyleCate
     if(!our_pParagraphStyleCategoryEntries)
     {
         our_pParagraphStyleCategoryEntries = new std::vector<ParagraphStyleCategoryEntry>{
-            { style::ParagraphStyleCategory::TEXT,    SWSTYLEBIT_TEXT,    COLL_TEXT_BITS     },
-            { style::ParagraphStyleCategory::CHAPTER, SWSTYLEBIT_CHAPTER, COLL_DOC_BITS      },
-            { style::ParagraphStyleCategory::LIST,    SWSTYLEBIT_LIST,    COLL_LISTS_BITS    },
-            { style::ParagraphStyleCategory::INDEX,   SWSTYLEBIT_IDX,     COLL_REGISTER_BITS },
-            { style::ParagraphStyleCategory::EXTRA,   SWSTYLEBIT_EXTRA,   COLL_EXTRA_BITS    },
-            { style::ParagraphStyleCategory::HTML,    SWSTYLEBIT_HTML,    COLL_HTML_BITS     }
+            { style::ParagraphStyleCategory::TEXT,    SfxStyleSearchBits::SwText,    COLL_TEXT_BITS     },
+            { style::ParagraphStyleCategory::CHAPTER, SfxStyleSearchBits::SwChapter, COLL_DOC_BITS      },
+            { style::ParagraphStyleCategory::LIST,    SfxStyleSearchBits::SwList,    COLL_LISTS_BITS    },
+            { style::ParagraphStyleCategory::INDEX,   SfxStyleSearchBits::SwIndex,     COLL_REGISTER_BITS },
+            { style::ParagraphStyleCategory::EXTRA,   SfxStyleSearchBits::SwExtra,   COLL_EXTRA_BITS    },
+            { style::ParagraphStyleCategory::HTML,    SfxStyleSearchBits::SwHtml,    COLL_HTML_BITS     }
         };
     }
     return our_pParagraphStyleCategoryEntries;
@@ -1376,7 +1374,7 @@ sal_Bool SwXStyle::isInUse()
     SolarMutexGuard aGuard;
     if(!m_pBasePool)
         throw uno::RuntimeException();
-    m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, SFXSTYLEBIT_USED);
+    m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, SfxStyleSearchBits::Used);
     SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName);
     return pBase && pBase->IsUsed();
 }
@@ -1873,18 +1871,18 @@ void SwXStyle::SetPropertyValue<FN_UNO_CATEGORY>(const SfxItemPropertySimpleEntr
 {
     if(!o_rStyleBase.getNewBase()->IsUserDefined() || !rValue.has<paragraphstyle_t>())
         throw lang::IllegalArgumentException();
-    static std::unique_ptr<std::map<paragraphstyle_t, swstylebits_t>> pUnoToCore;
+    static std::unique_ptr<std::map<paragraphstyle_t, SfxStyleSearchBits>> pUnoToCore;
     if(!pUnoToCore)
     {
-        pUnoToCore.reset(new std::map<paragraphstyle_t, swstylebits_t>);
+        pUnoToCore.reset(new std::map<paragraphstyle_t, SfxStyleSearchBits>);
         auto pEntries = lcl_GetParagraphStyleCategoryEntries();
         std::transform(pEntries->begin(), pEntries->end(), std::inserter(*pUnoToCore, pUnoToCore->end()),
-            [] (const ParagraphStyleCategoryEntry& rEntry) { return std::pair<paragraphstyle_t, swstylebits_t>(rEntry.m_eCategory, rEntry.m_nSwStyleBits); });
+            [] (const ParagraphStyleCategoryEntry& rEntry) { return std::pair<paragraphstyle_t, SfxStyleSearchBits>(rEntry.m_eCategory, rEntry.m_nSwStyleBits); });
     }
     const auto pUnoToCoreIt(pUnoToCore->find(rValue.get<paragraphstyle_t>()));
     if(pUnoToCoreIt == pUnoToCore->end())
         throw lang::IllegalArgumentException();
-    o_rStyleBase.getNewBase()->SetMask( pUnoToCoreIt->second|SFXSTYLEBIT_USERDEF );
+    o_rStyleBase.getNewBase()->SetMask( pUnoToCoreIt->second|SfxStyleSearchBits::UserDefined );
 }
 template<>
 void SwXStyle::SetPropertyValue<SID_SWREGISTER_COLLECTION>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase)
@@ -2031,7 +2029,7 @@ void SwXStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNa
     SwStyleBase_Impl aBaseImpl(*m_pDoc, m_sStyleName, &GetDoc()->GetDfltTextFormatColl()->GetAttrSet()); // add pDfltTextFormatColl as parent
     if(m_pBasePool)
     {
-        const sal_uInt16 nSaveMask = m_pBasePool->GetSearchMask();
+        const SfxStyleSearchBits nSaveMask = m_pBasePool->GetSearchMask();
         m_pBasePool->SetSearchMask(m_rEntry.m_eFamily);
         SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName);
         m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, nSaveMask);
@@ -2084,7 +2082,7 @@ SfxStyleSheetBase* SwXStyle::GetStyleSheetBase()
 {
     if(!m_pBasePool)
         return nullptr;
-    const sal_uInt16 nSaveMask = m_pBasePool->GetSearchMask();
+    const SfxStyleSearchBits nSaveMask = m_pBasePool->GetSearchMask();
     m_pBasePool->SetSearchMask(m_rEntry.m_eFamily);
     SfxStyleSheetBase* pBase = m_pBasePool->Find(m_sStyleName);
     m_pBasePool->SetSearchMask(m_rEntry.m_eFamily, nSaveMask );
diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx
index 2e58a68dfccc..c3d9eb1535c1 100644
--- a/sw/source/ui/chrdlg/swuiccoll.cxx
+++ b/sw/source/ui/chrdlg/swuiccoll.cxx
@@ -107,8 +107,7 @@ SwCondCollPage::SwCondCollPage(vcl::Window *pParent, const SfxItemSet &rSet)
             for (size_t i = 0; i < rFilterList.size(); ++i)
             {
                 m_pFilterLB->InsertEntry(rFilterList[i].aName);
-                sal_uInt16* pFilter = new sal_uInt16(rFilterList[i].nFlags);
-                m_pFilterLB->SetEntryData(i, pFilter);
+                m_pFilterLB->SetEntryData(i, reinterpret_cast<void*>(sal_uInt16(rFilterList[i].nFlags)));
             }
             break;
         }
@@ -127,9 +126,6 @@ SwCondCollPage::~SwCondCollPage()
 
 void SwCondCollPage::dispose()
 {
-    for(sal_Int32 i = 0; i < m_pFilterLB->GetEntryCount(); ++i)
-        delete static_cast<sal_uInt16*>(m_pFilterLB->GetEntryData(i));
-
     m_pConditionCB.clear();
     m_pContextFT.clear();
     m_pUsedFT.clear();
@@ -282,7 +278,7 @@ void SwCondCollPage::SelectHdl(void const * pBox)
     {
         m_pStyleLB->Clear();
         const sal_Int32 nSelPos = static_cast<ListBox const *>(pBox)->GetSelectedEntryPos();
-        const sal_uInt16 nSearchFlags = *static_cast<sal_uInt16*>(m_pFilterLB->GetEntryData(nSelPos));
+        const SfxStyleSearchBits nSearchFlags = static_cast<SfxStyleSearchBits>(reinterpret_cast<sal_IntPtr>(m_pFilterLB->GetEntryData(nSelPos)));
         SfxStyleSheetBasePool* pPool = m_rSh.GetView().GetDocShell()->GetStyleSheetPool();
         pPool->SetSearchMask(SfxStyleFamily::Para, nSearchFlags);
         const SfxStyleSheetBase* pBase = pPool->First();
diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx
index 62068137c7e2..302de1f7a6be 100644
--- a/sw/source/ui/misc/docfnote.cxx
+++ b/sw/source/ui/misc/docfnote.cxx
@@ -31,7 +31,6 @@
 #include <wdocsh.hxx>
 #include <uitool.hxx>
 #include <poolfmt.hxx>
-#include <swstyle.h>
 #include <SwStyleNameMapper.hxx>
 #include <memory>
 
@@ -195,7 +194,7 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet* )
         // styles   special regions
         // paragraph
     SfxStyleSheetBasePool* pStyleSheetPool = pSh->GetView().GetDocShell()->GetStyleSheetPool();
-    pStyleSheetPool->SetSearchMask(SfxStyleFamily::Para, SWSTYLEBIT_EXTRA);
+    pStyleSheetPool->SetSearchMask(SfxStyleFamily::Para, SfxStyleSearchBits::SwExtra);
     SfxStyleSheetBase *pStyle = pStyleSheetPool->First();
     while(pStyle)
     {
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 9b785bf31c9a..5ef0e4b295c0 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -68,7 +68,6 @@
 #include <IDocumentFieldsAccess.hxx>
 #include <IDocumentListsAccess.hxx>
 #include <IDocumentState.hxx>
-#include <swstyle.h>
 #include <frmfmt.hxx>
 #include <charfmt.hxx>
 #include <poolfmt.hxx>
@@ -164,23 +163,23 @@ void  SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
 
                     SfxTemplateItem aItem(nWhich, aName);
 
-                    sal_uInt16 nMask = 0;
+                    SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto;
                     if (m_xDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE))
-                        nMask = SWSTYLEBIT_HTML;
+                        nMask = SfxStyleSearchBits::SwHtml;
                     else
                     {
                         const FrameTypeFlags nSelection = pShell->GetFrameType(nullptr,true);
                         if(pShell->GetCurTOX())
-                            nMask = SWSTYLEBIT_IDX  ;
+                            nMask = SfxStyleSearchBits::SwIndex  ;
                         else if(nSelection & FrameTypeFlags::HEADER     ||
                                 nSelection & FrameTypeFlags::FOOTER     ||
                                 nSelection & FrameTypeFlags::TABLE      ||
                                 nSelection & FrameTypeFlags::FLY_ANY    ||
                                 nSelection & FrameTypeFlags::FOOTNOTE   ||
                                 nSelection & FrameTypeFlags::FTNPAGE)
-                            nMask = SWSTYLEBIT_EXTRA;
+                            nMask = SfxStyleSearchBits::SwExtra;
                         else
-                            nMask = SWSTYLEBIT_TEXT;
+                            nMask = SfxStyleSearchBits::SwText;
                     }
 
                     aItem.SetValue(nMask);
@@ -307,13 +306,13 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
             const SfxStyleFamily nFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
 
             OUString sName;
-            sal_uInt16 nMask = 0;
+            SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto;
             if( SfxItemState::SET == pArgs->GetItemState( SID_STYLE_NEW,
                 false, &pItem ))
                 sName = static_cast<const SfxStringItem*>(pItem)->GetValue();
             if( SfxItemState::SET == pArgs->GetItemState( SID_STYLE_MASK,
                 false, &pItem ))
-                nMask = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+                nMask = static_cast<SfxStyleSearchBits>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
             OUString sParent;
             if( SfxItemState::SET == pArgs->GetItemState( SID_STYLE_REFERENCE,
                 false, &pItem ))
@@ -371,7 +370,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
         {
             OUString aParam;
             SfxStyleFamily nFamily = SfxStyleFamily::Para;
-            sal_uInt16 nMask = 0;
+            SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto;
             SwWrtShell* pActShell = nullptr;
 
             if( !pArgs )
@@ -440,7 +439,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
 
                 if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_MASK,
                     false, &pItem ))
-                    nMask = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+                    nMask = static_cast<SfxStyleSearchBits>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
                 if( SfxItemState::SET == pArgs->GetItemState(FN_PARAM_WRTSHELL,
                     false, &pItem ))
                     pActShell = pShell = static_cast<SwWrtShell*>(static_cast<const SwPtrItem*>(pItem)->GetValue());
@@ -489,7 +488,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
             }
             if (!aParam.isEmpty() || nSlot == SID_STYLE_WATERCAN )
             {
-                sal_uInt16 nRet = SFXSTYLEBIT_ALL;
+                sal_uInt16 nRet = 0xffff;
                 bool bReturns = false;
 
                 switch(nSlot)
@@ -645,7 +644,7 @@ void SwDocShell::Edit(
     const OUString &rName,
     const OUString &rParent,
     const SfxStyleFamily nFamily,
-    sal_uInt16 nMask,
+    SfxStyleSearchBits nMask,
     const bool bNew,
     const OString& sPage,
     SwWrtShell* pActShell,
@@ -669,10 +668,10 @@ void SwDocShell::Edit(
             m_pWrtShell->StartUndo();
         }
 
-        if( SFXSTYLEBIT_ALL != nMask && SFXSTYLEBIT_ALL_VISIBLE != nMask && SFXSTYLEBIT_USED != nMask )
-            nMask |= SFXSTYLEBIT_USERDEF;
+        if( SfxStyleSearchBits::All != nMask && SfxStyleSearchBits::AllVisible != nMask && SfxStyleSearchBits::Used != nMask )
+            nMask |= SfxStyleSearchBits::UserDefined;
         else
-            nMask = SFXSTYLEBIT_USERDEF;
+            nMask = SfxStyleSearchBits::UserDefined;
 
         pStyle = &m_xBasePool->Make( rName, nFamily, nMask );
 
@@ -1147,7 +1146,7 @@ void SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFamily, SwWr
 
 // NewByExample
 void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily,
-                                    sal_uInt16 nMask, SwWrtShell* pShell )
+                                    SfxStyleSearchBits nMask, SwWrtShell* pShell )
 {
     SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell();
     SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>( m_xBasePool->Find(
@@ -1156,10 +1155,10 @@ void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily,
     {
         // preserve the current mask of PI, then the new one is
         // immediately merged with the viewable area
-        if( SFXSTYLEBIT_ALL == nMask || SFXSTYLEBIT_USED == nMask )
-            nMask = SFXSTYLEBIT_USERDEF;
+        if( SfxStyleSearchBits::All == nMask || SfxStyleSearchBits::Used == nMask )
+            nMask = SfxStyleSearchBits::UserDefined;
         else
-            nMask |= SFXSTYLEBIT_USERDEF;
+            nMask |= SfxStyleSearchBits::UserDefined;
 
         pStyle = static_cast<SwDocStyleSheet*>( &m_xBasePool->Make(rName,
                                 nFamily, nMask ) );
@@ -1179,26 +1178,27 @@ void SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily nFamily,
 
                     // set the mask at the Collection:
                 sal_uInt16 nId = pColl->GetPoolFormatId() & 0x87ff;
-                switch( nMask & 0x0fff )
+                switch( nMask & static_cast<SfxStyleSearchBits>(0x0fff) )
                 {
-                    case SWSTYLEBIT_TEXT:
+                    case SfxStyleSearchBits::SwText:
                         nId |= COLL_TEXT_BITS;
                         break;
-                    case SWSTYLEBIT_CHAPTER:
+                    case SfxStyleSearchBits::SwChapter:
                         nId |= COLL_DOC_BITS;
                         break;
-                    case SWSTYLEBIT_LIST:
+                    case SfxStyleSearchBits::SwList:
                         nId |= COLL_LISTS_BITS;
                         break;
-                    case SWSTYLEBIT_IDX:
+                    case SfxStyleSearchBits::SwIndex:
                         nId |= COLL_REGISTER_BITS;
                         break;
-                    case SWSTYLEBIT_EXTRA:
+                    case SfxStyleSearchBits::SwExtra:
                         nId |= COLL_EXTRA_BITS;
                         break;
-                    case SWSTYLEBIT_HTML:
+                    case SfxStyleSearchBits::SwHtml:
                         nId |= COLL_HTML_BITS;
                         break;
+                    default: break;
                 }
                 pColl->SetPoolFormatId(nId);
 
@@ -1375,7 +1375,7 @@ void SwDocShell::FormatPage(
     SwWrtShell& rActShell,
     SfxRequest* pRequest)
 {
-    Edit(rPage, aEmptyOUStr, SfxStyleFamily::Page, 0, false, rPageId, &rActShell, pRequest);

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list