[Libreoffice-commits] core.git: sw/inc sw/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Nov 29 11:29:45 UTC 2016


 sw/inc/tox.hxx                    |   33 ++++++++++--------
 sw/source/core/doc/doctxm.cxx     |   22 ++++++------
 sw/source/core/fields/authfld.cxx |    2 -
 sw/source/core/inc/txmsrt.hxx     |   16 ++++-----
 sw/source/core/tox/tox.cxx        |    2 -
 sw/source/core/tox/txmsrt.cxx     |   22 ++++++------
 sw/source/core/unocore/unoidx.cxx |   67 ++++++++++++++------------------------
 sw/source/filter/ww8/ww8atr.cxx   |    2 -
 sw/source/filter/ww8/ww8par5.cxx  |    4 +-
 sw/source/ui/index/cntex.cxx      |   18 +++++-----
 sw/source/ui/index/cnttab.cxx     |   34 +++++++++----------
 sw/source/uibase/inc/toxmgr.hxx   |    8 ++--
 12 files changed, 108 insertions(+), 122 deletions(-)

New commits:
commit ef0e1c05c32a5a69502e0f0d1d97789c125345a2
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Nov 29 11:56:00 2016 +0200

    convert SwTOIOptions to o3tl::typed_flags
    
    Change-Id: I8f2996c0f0e40778877cddc4368c80f8a7f52a95
    Reviewed-on: https://gerrit.libreoffice.org/31352
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 0c6f6be..27e84de 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -349,16 +349,19 @@ namespace o3tl {
     template<> struct typed_flags<SwTOXElement> : is_typed_flags<SwTOXElement, 0x3fff> {};
 }
 
-typedef sal_uInt16 SwTOIOptions;
-namespace nsSwTOIOptions
-{
-    const SwTOIOptions TOI_SAME_ENTRY       = 1;
-    const SwTOIOptions TOI_FF               = 2;
-    const SwTOIOptions TOI_CASE_SENSITIVE   = 4;
-    const SwTOIOptions TOI_KEY_AS_ENTRY     = 8;
-    const SwTOIOptions TOI_ALPHA_DELIMITTER = 16;
-    const SwTOIOptions TOI_DASH             = 32;
-    const SwTOIOptions TOI_INITIAL_CAPS     = 64;
+enum class SwTOIOptions : sal_uInt16
+{
+    NONE            = 0x00,
+    SameEntry       = 0x01,
+    FF              = 0x02,
+    CaseSensitive   = 0x04,
+    KeyAsEntry      = 0x08,
+    AlphaDelimiter  = 0x10,
+    Dash            = 0x20,
+    InitialCaps     = 0x40,
+};
+namespace o3tl {
+    template<> struct typed_flags<SwTOIOptions> : is_typed_flags<SwTOIOptions, 0x7f> {};
 }
 
 //which part of the caption is to be displayed
@@ -400,7 +403,7 @@ class SW_DLLPUBLIC SwTOXBase : public SwClient
 
     union {
         sal_uInt16      nLevel;             // consider outline levels
-        sal_uInt16      nOptions;           // options of alphabetical index
+        SwTOIOptions    nOptions;           // options of alphabetical index
     } m_aData;
 
     SwTOXElement    m_nCreateType;        // sources to create the index from
@@ -467,8 +470,8 @@ public:
     inline sal_uInt16       GetLevel() const;
 
     // alphabetical index only
-    inline sal_uInt16       GetOptions() const;                 // alphabetical index options
-    inline void             SetOptions(sal_uInt16 nOpt);
+    inline SwTOIOptions     GetOptions() const;                 // alphabetical index options
+    inline void             SetOptions(SwTOIOptions nOpt);
 
     // index of objects
     sal_uInt16      GetOLEOptions() const {return m_nOLEOptions;}
@@ -709,13 +712,13 @@ inline sal_uInt16 SwTOXBase::GetLevel() const
     return m_aData.nLevel;
 }
 
-inline sal_uInt16 SwTOXBase::GetOptions() const
+inline SwTOIOptions SwTOXBase::GetOptions() const
 {
     SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
     return m_aData.nOptions;
 }
 
-inline void SwTOXBase::SetOptions(sal_uInt16 nOpt)
+inline void SwTOXBase::SetOptions(SwTOIOptions nOpt)
 {
     SAL_WARN_IF(GetTOXType()->GetType() != TOX_INDEX, "sw", "Wrong type");
     m_aData.nOptions = nOpt;
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 18bc169..75f1168 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -818,7 +818,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
     // get current Language
     SwTOXInternational aIntl(  GetLanguage(),
                                TOX_INDEX == GetTOXType()->GetType() ?
-                               GetOptions() : 0,
+                               GetOptions() : SwTOIOptions::NONE,
                                GetSortAlgorithm() );
 
     for (SwTOXSortTabBases::const_iterator it = aSortArr.begin(); it != aSortArr.end(); ++it)
@@ -925,7 +925,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
 
     // Insert AlphaDelimitters if needed (just for keywords)
     if( TOX_INDEX == SwTOXBase::GetType() &&
-        ( GetOptions() & nsSwTOIOptions::TOI_ALPHA_DELIMITTER ) )
+        ( GetOptions() & SwTOIOptions::AlphaDelimiter ) )
         InsertAlphaDelimitter( aIntl );
 
     // Sort the List of all TOC Marks and TOC Sections
@@ -1158,7 +1158,7 @@ void SwTOXBaseSection::UpdateMarks( const SwTOXInternational& rIntl,
                     pBase = new SwTOXIndex( *pTOXSrc, pTextMark,
                                             GetOptions(), FORM_ENTRY, rIntl, aLocale );
                     InsertSorted(pBase);
-                    if(GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY &&
+                    if(GetOptions() & SwTOIOptions::KeyAsEntry &&
                         !pTextMark->GetTOXMark().GetPrimaryKey().isEmpty())
                     {
                         pBase = new SwTOXIndex( *pTOXSrc, pTextMark,
@@ -1538,7 +1538,7 @@ void SwTOXBaseSection::UpdatePageNum()
 
     SwTOXInternational aIntl( GetLanguage(),
                               TOX_INDEX == GetTOXType()->GetType() ?
-                              GetOptions() : 0,
+                              GetOptions() : SwTOIOptions::NONE,
                               GetSortAlgorithm() );
 
     for( SwTOXSortTabBases::size_type nCnt = 0; nCnt < aSortArr.size(); ++nCnt )
@@ -1715,12 +1715,12 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd,
                     != lcl_HasMainEntry(pMainEntryNums, rNums[i]);
 
             if(nOld == rNums[i]-1 && !bMainEntryChanges &&
-                0 != (GetOptions() & (nsSwTOIOptions::TOI_FF|nsSwTOIOptions::TOI_DASH)))
+                (GetOptions() & (SwTOIOptions::FF|SwTOIOptions::Dash)))
                 nCount++;
             else
             {
                 // Flush for the following old values
-                if(GetOptions() & nsSwTOIOptions::TOI_FF)
+                if(GetOptions() & SwTOIOptions::FF)
                 {
                     if ( nCount >= 1 )
                         aNumStr += rIntl.GetFollowingText( nCount > 1 );
@@ -1758,7 +1758,7 @@ void SwTOXBaseSection::UpdatePageNum_( SwTextNode* pNd,
     // Flush when ending and the following old values
     if( TOX_INDEX == SwTOXBase::GetType() )
     {
-        if(GetOptions() & nsSwTOIOptions::TOI_FF)
+        if(GetOptions() & SwTOIOptions::FF)
         {
             if( nCount >= 1 )
                 aNumStr += rIntl.GetFollowingText( nCount > 1 );
@@ -1820,7 +1820,7 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew)
         const SwTOXMark& rMark = pNew->pTextMark->GetTOXMark();
         // Evaluate Key
         // Calculate the range where to insert
-        if( 0 == (GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY) &&
+        if( !(GetOptions() & SwTOIOptions::KeyAsEntry) &&
             !rMark.GetPrimaryKey().isEmpty() )
         {
             aRange = GetKeyRange( rMark.GetPrimaryKey(),
@@ -1870,10 +1870,10 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew)
             {
                 // Own entry for double entries or keywords
                 if( pOld->GetType() == TOX_SORT_CUSTOM &&
-                    SwTOXSortTabBase::GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY)
+                    SwTOXSortTabBase::GetOptions() & SwTOIOptions::KeyAsEntry)
                     continue;
 
-                if(!(SwTOXSortTabBase::GetOptions() & nsSwTOIOptions::TOI_SAME_ENTRY))
+                if(!(SwTOXSortTabBase::GetOptions() & SwTOIOptions::SameEntry))
                 {   // Own entry
                     aSortArr.insert(aSortArr.begin() + i, pNew);
                     return;
@@ -1909,7 +1909,7 @@ Range SwTOXBaseSection::GetKeyRange(const OUString& rStr, const OUString& rStrRe
     const SwTOXInternational& rIntl = *rNew.pTOXIntl;
     TextAndReading aToCompare(rStr, rStrReading);
 
-    if( 0 != (nsSwTOIOptions::TOI_INITIAL_CAPS & GetOptions()) )
+    if( SwTOIOptions::InitialCaps & GetOptions() )
     {
         aToCompare.sText = rIntl.ToUpper( aToCompare.sText, 0 )
                          + aToCompare.sText.copy(1);
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 76004cc..27fc7d3 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -246,7 +246,7 @@ sal_uInt16  SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle)
         SwTOXSortTabBases aSortArr;
         SwIterator<SwFormatField,SwFieldType> aIter( *this );
 
-        SwTOXInternational aIntl(m_eLanguage, 0, m_sSortAlgorithm);
+        SwTOXInternational aIntl(m_eLanguage, SwTOIOptions::NONE, m_sSortAlgorithm);
 
         for( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() )
         {
diff --git a/sw/source/core/inc/txmsrt.hxx b/sw/source/core/inc/txmsrt.hxx
index 3da2ead..24716cc 100644
--- a/sw/source/core/inc/txmsrt.hxx
+++ b/sw/source/core/inc/txmsrt.hxx
@@ -70,15 +70,15 @@ struct TextAndReading
 class SwTOXInternational
 {
     IndexEntrySupplierWrapper* pIndexWrapper;
-    CharClass* pCharClass;
-    LanguageType eLang;
-    OUString sSortAlgorithm;
-    sal_uInt16 nOptions;
+    CharClass*                 pCharClass;
+    LanguageType               eLang;
+    OUString                   sSortAlgorithm;
+    SwTOIOptions               nOptions;
 
     void Init();
 
 public:
-    SwTOXInternational( LanguageType nLang, sal_uInt16 nOptions,
+    SwTOXInternational( LanguageType nLang, SwTOIOptions nOptions,
                         const OUString& rSortAlgorithm );
     SwTOXInternational( const SwTOXInternational& );
     ~SwTOXInternational();
@@ -126,7 +126,7 @@ struct SwTOXSortTabBase
     sal_uLong nPos;
     sal_Int32 nCntPos;
     sal_uInt16 nType;
-    static sal_uInt16 nOpt;
+    static SwTOIOptions nOpt;
 
     SwTOXSortTabBase( TOXSortType nType,
                       const SwContentNode* pTOXSrc,
@@ -136,7 +136,7 @@ struct SwTOXSortTabBase
     virtual ~SwTOXSortTabBase() {}
 
     sal_uInt16  GetType() const         { return nType; }
-    static sal_uInt16  GetOptions()     { return nOpt; }
+    static SwTOIOptions  GetOptions()   { return nOpt; }
 
     virtual void    FillText( SwTextNode& rNd, const SwIndex& rInsPos, sal_uInt16 nAuthField ) const;
     virtual sal_uInt16  GetLevel()  const = 0;
@@ -177,7 +177,7 @@ inline const css::lang::Locale& SwTOXSortTabBase::GetLocale() const
  */
 struct SwTOXIndex : public SwTOXSortTabBase
 {
-    SwTOXIndex( const SwTextNode&, const SwTextTOXMark*, sal_uInt16 nOptions, sal_uInt8 nKeyLevel,
+    SwTOXIndex( const SwTextNode&, const SwTextTOXMark*, SwTOIOptions nOptions, sal_uInt8 nKeyLevel,
                 const SwTOXInternational& rIntl,
                 const css::lang::Locale& rLocale );
     virtual ~SwTOXIndex() override {}
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 5bb3064..b1d2fdf 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -438,7 +438,7 @@ SwTOXBase::SwTOXBase(const SwTOXType* pTyp, const SwForm& rForm,
     , maMSTOCExpression()
     , mbKeepExpression(true)
 {
-    m_aData.nOptions = 0;
+    m_aData.nOptions = SwTOIOptions::NONE;
 }
 
 SwTOXBase::SwTOXBase( const SwTOXBase& rSource, SwDoc* pDoc )
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index 32d8f70..c8f1a359 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -48,9 +48,9 @@ using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
 // Initialize strings
-sal_uInt16 SwTOXSortTabBase::nOpt = 0;
+SwTOIOptions SwTOXSortTabBase::nOpt = SwTOIOptions::NONE;
 
-SwTOXInternational::SwTOXInternational( LanguageType nLang, sal_uInt16 nOpt,
+SwTOXInternational::SwTOXInternational( LanguageType nLang, SwTOIOptions nOpt,
                                         const OUString& rSortAlgorithm ) :
     eLang( nLang ),
     sSortAlgorithm(rSortAlgorithm),
@@ -81,7 +81,7 @@ void SwTOXInternational::Init()
             sSortAlgorithm = aSeq.getConstArray()[0];
     }
 
-    if ( nOptions & nsSwTOIOptions::TOI_CASE_SENSITIVE )
+    if ( nOptions & SwTOIOptions::CaseSensitive )
         pIndexWrapper->LoadAlgorithm( aLcl, sSortAlgorithm, 0 );
     else
         pIndexWrapper->LoadAlgorithm( aLcl, sSortAlgorithm, SW_COLLATOR_IGNORES );
@@ -265,7 +265,7 @@ bool SwTOXSortTabBase::operator<( const SwTOXSortTabBase& rCmp )
 
 // Sorted keyword entry
 SwTOXIndex::SwTOXIndex( const SwTextNode& rNd,
-                        const SwTextTOXMark* pMark, sal_uInt16 nOptions,
+                        const SwTextTOXMark* pMark, SwTOIOptions nOptions,
                         sal_uInt8 nKyLevel,
                         const SwTOXInternational& rIntl,
                         const lang::Locale& rLocale )
@@ -292,7 +292,7 @@ bool SwTOXIndex::operator==( const SwTOXSortTabBase& rCmpBase )
                                    rCmp.GetText(), rCmp.GetLocale() );
 
     // If we don't summarize we need to evaluate the Pos
-    if(bRet && !(GetOptions() & nsSwTOIOptions::TOI_SAME_ENTRY))
+    if(bRet && !(GetOptions() & SwTOIOptions::SameEntry))
         bRet = nPos == rCmp.nPos;
 
     return bRet;
@@ -314,7 +314,7 @@ bool SwTOXIndex::operator<( const SwTOXSortTabBase& rCmpBase )
                                   aOtherTaR, rCmp.GetLocale() );
 
     // If we don't summarize we need to evaluate the Pos
-    if( !bRet && !(GetOptions() & nsSwTOIOptions::TOI_SAME_ENTRY) )
+    if( !bRet && !(GetOptions() & SwTOIOptions::SameEntry) )
     {
         bRet = pTOXIntl->IsEqual( aMyTaR, GetLocale(),
                                   aOtherTaR, rCmp.GetLocale() ) &&
@@ -353,8 +353,8 @@ TextAndReading SwTOXIndex::GetText_Impl() const
         }
         break;
     }
-    // if TOI_INITIAL_CAPS is set, first character is to be capitalized
-    if( nsSwTOIOptions::TOI_INITIAL_CAPS & nOpt && pTOXIntl && !aRet.sText.isEmpty())
+    // if SwTOIOptions::InitialCaps is set, first character is to be capitalized
+    if( SwTOIOptions::InitialCaps & nOpt && pTOXIntl && !aRet.sText.isEmpty())
     {
         aRet.sText = pTOXIntl->ToUpper( aRet.sText, 0 ) + aRet.sText.copy(1);
     }
@@ -368,12 +368,12 @@ void SwTOXIndex::FillText( SwTextNode& rNd, const SwIndex& rInsPos, sal_uInt16 )
 
     TextAndReading aRet;
     if( pEnd && !pTextMark->GetTOXMark().IsAlternativeText() &&
-            0 == (GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY))
+            !(GetOptions() & SwTOIOptions::KeyAsEntry))
     {
         aRet.sText = static_cast<const SwTextNode*>(aTOXSources[0].pNd)->GetExpandText(
                             pTextMark->GetStart(),
                             *pEnd - pTextMark->GetStart());
-        if(nsSwTOIOptions::TOI_INITIAL_CAPS & nOpt && pTOXIntl && !aRet.sText.isEmpty())
+        if(SwTOIOptions::InitialCaps & nOpt && pTOXIntl && !aRet.sText.isEmpty())
         {
             aRet.sText = pTOXIntl->ToUpper( aRet.sText, 0 ) + aRet.sText.copy(1);
         }
@@ -390,7 +390,7 @@ sal_uInt16 SwTOXIndex::GetLevel() const
 
     sal_uInt16 nForm = FORM_PRIMARY_KEY;
 
-    if( 0 == (GetOptions() & nsSwTOIOptions::TOI_KEY_AS_ENTRY)&&
+    if( !(GetOptions() & SwTOIOptions::KeyAsEntry)&&
         !pTextMark->GetTOXMark().GetPrimaryKey().isEmpty() )
     {
         nForm = FORM_SECONDARY_KEY;
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index c842f96..0d5aae9 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -98,19 +98,9 @@ lcl_AnyToBool(uno::Any const& rVal) throw (lang::IllegalArgumentException)
     return bRet;
 }
 
-static void
-lcl_AnyToBitMask(uno::Any const& rValue,
-        sal_uInt16 & rBitMask, const sal_uInt16 nBit)
-throw (lang::IllegalArgumentException)
-{
-    rBitMask = lcl_AnyToBool(rValue)
-        ? (rBitMask |  nBit)
-        : (rBitMask & ~nBit);
-}
-
-static void
-lcl_AnyToBitMask(uno::Any const& rValue,
-        SwTOXElement & rBitMask, const SwTOXElement nBit)
+template<typename T>
+void lcl_AnyToBitMask(uno::Any const& rValue,
+        T & rBitMask, const T nBit)
 throw (lang::IllegalArgumentException)
 {
     rBitMask = lcl_AnyToBool(rValue)
@@ -118,22 +108,15 @@ throw (lang::IllegalArgumentException)
         : (rBitMask & ~nBit);
 }
 
-static void
-lcl_BitMaskToAny(uno::Any & o_rValue,
-        const sal_uInt16 nBitMask, const sal_uInt16 nBit)
+template<typename T>
+void lcl_BitMaskToAny(uno::Any & o_rValue,
+        const T nBitMask, const T nBit)
 {
-    const bool bRet = 0 != (nBitMask & nBit);
+    const bool bRet(nBitMask & nBit);
     o_rValue <<= bRet;
 }
 
 static void
-lcl_BitMaskToAny(uno::Any & o_rValue,
-        const SwTOXElement nBitMask, const SwTOXElement nBit)
-{
-    o_rValue <<= bool(nBitMask & nBit);
-}
-
-static void
 lcl_ReAssignTOXType(SwDoc* pDoc, SwTOXBase& rTOXBase, const OUString& rNewName)
 {
     const sal_uInt16 nUserCount = pDoc->GetTOXTypeCount( TOX_USER );
@@ -596,8 +579,8 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
     SwTOXElement nCreate = rTOXBase.GetCreateType();
     sal_uInt16 nOLEOptions = rTOXBase.GetOLEOptions();
     const TOXTypes eTxBaseType = rTOXBase.GetTOXType()->GetType();
-    sal_uInt16 nTOIOptions = (eTxBaseType == TOX_INDEX)
-        ? rTOXBase.GetOptions() : 0;
+    SwTOIOptions nTOIOptions = (eTxBaseType == TOX_INDEX)
+        ? rTOXBase.GetOptions() : SwTOIOptions::NONE;
     SwForm  aForm(rTOXBase.GetTOXForm());
     bool bForm = false;
     switch (pEntry->nWID)
@@ -723,29 +706,29 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
         break;
         case WID_USE_ALPHABETICAL_SEPARATORS:
             lcl_AnyToBitMask(rValue, nTOIOptions,
-                    nsSwTOIOptions::TOI_ALPHA_DELIMITTER);
+                    SwTOIOptions::AlphaDelimiter);
         break;
         case WID_USE_KEY_AS_ENTRY:
             lcl_AnyToBitMask(rValue, nTOIOptions,
-                    nsSwTOIOptions::TOI_KEY_AS_ENTRY);
+                    SwTOIOptions::KeyAsEntry);
         break;
         case WID_USE_COMBINED_ENTRIES:
             lcl_AnyToBitMask(rValue, nTOIOptions,
-                    nsSwTOIOptions::TOI_SAME_ENTRY);
+                    SwTOIOptions::SameEntry);
         break;
         case WID_IS_CASE_SENSITIVE:
             lcl_AnyToBitMask(rValue, nTOIOptions,
-                    nsSwTOIOptions::TOI_CASE_SENSITIVE);
+                    SwTOIOptions::CaseSensitive);
         break;
         case WID_USE_P_P:
-            lcl_AnyToBitMask(rValue, nTOIOptions, nsSwTOIOptions::TOI_FF);
+            lcl_AnyToBitMask(rValue, nTOIOptions, SwTOIOptions::FF);
         break;
         case WID_USE_DASH:
-            lcl_AnyToBitMask(rValue, nTOIOptions, nsSwTOIOptions::TOI_DASH);
+            lcl_AnyToBitMask(rValue, nTOIOptions, SwTOIOptions::Dash);
         break;
         case WID_USE_UPPER_CASE:
             lcl_AnyToBitMask(rValue, nTOIOptions,
-                    nsSwTOIOptions::TOI_INITIAL_CAPS);
+                    SwTOIOptions::InitialCaps);
         break;
         case WID_IS_COMMA_SEPARATED:
             bForm = true;
@@ -933,10 +916,10 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
     {
         const SwTOXElement nCreate = pTOXBase->GetCreateType();
         const sal_uInt16 nOLEOptions = pTOXBase->GetOLEOptions();
-        const sal_uInt16 nTOIOptions =
+        const SwTOIOptions nTOIOptions =
             (pTOXBase->GetTOXType()->GetType() == TOX_INDEX)
             ? pTOXBase->GetOptions()
-            : 0U;
+            : SwTOIOptions::NONE;
         const SwForm& rForm = pTOXBase->GetTOXForm();
         switch(pEntry->nWID)
         {
@@ -1026,29 +1009,29 @@ throw (beans::UnknownPropertyException, lang::WrappedTargetException,
             break;
             case WID_USE_ALPHABETICAL_SEPARATORS:
                 lcl_BitMaskToAny(aRet, nTOIOptions,
-                        nsSwTOIOptions::TOI_ALPHA_DELIMITTER);
+                        SwTOIOptions::AlphaDelimiter);
             break;
             case WID_USE_KEY_AS_ENTRY:
                 lcl_BitMaskToAny(aRet, nTOIOptions,
-                        nsSwTOIOptions::TOI_KEY_AS_ENTRY);
+                        SwTOIOptions::KeyAsEntry);
             break;
             case WID_USE_COMBINED_ENTRIES:
                 lcl_BitMaskToAny(aRet, nTOIOptions,
-                        nsSwTOIOptions::TOI_SAME_ENTRY);
+                        SwTOIOptions::SameEntry);
             break;
             case WID_IS_CASE_SENSITIVE:
                 lcl_BitMaskToAny(aRet, nTOIOptions,
-                        nsSwTOIOptions::TOI_CASE_SENSITIVE);
+                        SwTOIOptions::CaseSensitive);
             break;
             case WID_USE_P_P:
-                lcl_BitMaskToAny(aRet, nTOIOptions, nsSwTOIOptions::TOI_FF);
+                lcl_BitMaskToAny(aRet, nTOIOptions, SwTOIOptions::FF);
             break;
             case WID_USE_DASH:
-                lcl_BitMaskToAny(aRet, nTOIOptions, nsSwTOIOptions::TOI_DASH);
+                lcl_BitMaskToAny(aRet, nTOIOptions, SwTOIOptions::Dash);
             break;
             case WID_USE_UPPER_CASE:
                 lcl_BitMaskToAny(aRet, nTOIOptions,
-                        nsSwTOIOptions::TOI_INITIAL_CAPS);
+                        SwTOIOptions::InitialCaps);
             break;
             case WID_IS_COMMA_SEPARATED:
             {
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 6b900ee..5d3c726 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1961,7 +1961,7 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect )
                 if (pTOX->GetTOXForm().IsCommaSeparated())
                     sStr += "\\r ";
 
-                if (nsSwTOIOptions::TOI_ALPHA_DELIMITTER & pTOX->GetOptions())
+                if (SwTOIOptions::AlphaDelimiter & pTOX->GetOptions())
                     sStr += "\\h \"A\" ";
 
                 if(SwTOXElement::IndexEntryType & pTOX->GetCreateType())
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 2f761c5..1e1fa78 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2942,7 +2942,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr )
     switch( eTox ){
     case TOX_INDEX:
         {
-            sal_uInt16 eOptions = nsSwTOIOptions::TOI_SAME_ENTRY | nsSwTOIOptions::TOI_CASE_SENSITIVE;
+            SwTOIOptions eOptions = SwTOIOptions::SameEntry | SwTOIOptions::CaseSensitive;
 
             // SwTOXElement::OutlineLevel setzen wir genau dann, wenn
             // die Parameter \o in 1 bis 9 liegen
@@ -3028,7 +3028,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr )
                     break;
                 case 'h':
                     {
-                        eOptions |= nsSwTOIOptions::TOI_ALPHA_DELIMITTER;
+                        eOptions |= SwTOIOptions::AlphaDelimiter;
                     }
                     break;
                 }
diff --git a/sw/source/ui/index/cntex.cxx b/sw/source/ui/index/cntex.cxx
index 4794db8..81b027d 100644
--- a/sw/source/ui/index/cntex.cxx
+++ b/sw/source/ui/index/cntex.cxx
@@ -195,7 +195,7 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample(
          uno::Reference< beans::XPropertySet >  xIdxProps(pxIndexSectionsArr[nTOXIndex]->xDocumentIndex, uno::UNO_QUERY);
          uno::Reference< beans::XPropertySetInfo >  xInfo = xIdxProps->getPropertySetInfo();
          SwTOXDescription& rDesc = GetTOXDescription(eCurrentTOXType);
-         sal_uInt16 nIdxOptions = rDesc.GetIndexOptions();
+         SwTOIOptions nIdxOptions = rDesc.GetIndexOptions();
          if(bInitialCreate || !nPage || nPage == TOX_PAGE_SELECT)
          {
             //title
@@ -242,13 +242,13 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample(
             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_CREATE_FROM_CHAPTER, rDesc.IsFromChapter());
             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_PROTECTED, rDesc.IsReadonly());
 
-            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_COMBINED_ENTRIES,        0 != (nIdxOptions&nsSwTOIOptions::TOI_SAME_ENTRY        ));
-            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_P_P,                     0 != (nIdxOptions&nsSwTOIOptions::TOI_FF                   ));
-            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_CASE_SENSITIVE,           0 != (nIdxOptions&nsSwTOIOptions::TOI_CASE_SENSITIVE     ));
-            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_KEY_AS_ENTRY,            0 != (nIdxOptions&nsSwTOIOptions::TOI_KEY_AS_ENTRY     ));
-            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
-            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_DASH,                    0 != (nIdxOptions&nsSwTOIOptions::TOI_DASH             ));
-            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_UPPER_CASE,              0 != (nIdxOptions&nsSwTOIOptions::TOI_INITIAL_CAPS     ));
+            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_COMBINED_ENTRIES,        bool(nIdxOptions & SwTOIOptions::SameEntry        ));
+            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_P_P,                     bool(nIdxOptions & SwTOIOptions::FF                   ));
+            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_CASE_SENSITIVE,           bool(nIdxOptions & SwTOIOptions::CaseSensitive     ));
+            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_KEY_AS_ENTRY,            bool(nIdxOptions & SwTOIOptions::KeyAsEntry     ));
+            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, bool(nIdxOptions & SwTOIOptions::AlphaDelimiter));
+            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_DASH,                    bool(nIdxOptions & SwTOIOptions::Dash             ));
+            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_UPPER_CASE,              bool(nIdxOptions & SwTOIOptions::InitialCaps     ));
 
             OUString aTmpName( SwStyleNameMapper::GetSpecialExtraProgName( rDesc.GetSequenceName() ) );
             lcl_SetProp(xInfo, xIdxProps, UNO_NAME_LABEL_CATEGORY, aTmpName );
@@ -274,7 +274,7 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample(
          if(bInitialCreate || !nPage || nPage == TOX_PAGE_ENTRY)
          {
             lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_IS_COMMA_SEPARATED, pForm->IsCommaSeparated());
-            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, 0 != (nIdxOptions&nsSwTOIOptions::TOI_ALPHA_DELIMITTER));
+            lcl_SetBOOLProp(xInfo, xIdxProps, UNO_NAME_USE_ALPHABETICAL_SEPARATORS, bool(nIdxOptions&SwTOIOptions::AlphaDelimiter));
             const bool bUseCurrent = nCurrentLevel < pForm->GetFormMax();
             const sal_uInt16 nStartLevel = bUseCurrent ? nCurrentLevel : 0;
             const sal_uInt16 nEndLevel = bUseCurrent ? nCurrentLevel : pForm->GetFormMax() - 1;
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index a8c3ef3..1ba8da3 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -1082,18 +1082,18 @@ void SwTOXSelectTabPage::ApplyTOXDescription()
     //index only
     else if(TOX_INDEX == aCurType.eType)
     {
-        const sal_uInt16 nIndexOptions = rDesc.GetIndexOptions();
-        m_pCollectSameCB->     Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_SAME_ENTRY) );
-        m_pUseFFCB->           Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_FF) );
-        m_pUseDashCB->         Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_DASH) );
+        const SwTOIOptions nIndexOptions = rDesc.GetIndexOptions();
+        m_pCollectSameCB->     Check( bool(nIndexOptions & SwTOIOptions::SameEntry) );
+        m_pUseFFCB->           Check( bool(nIndexOptions & SwTOIOptions::FF) );
+        m_pUseDashCB->         Check( bool(nIndexOptions & SwTOIOptions::Dash) );
         if(m_pUseFFCB->IsChecked())
             m_pUseDashCB->Enable(false);
         else if(m_pUseDashCB->IsChecked())
             m_pUseFFCB->Enable(false);
 
-        m_pCaseSensitiveCB->   Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_CASE_SENSITIVE) );
-        m_pInitialCapsCB->     Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_INITIAL_CAPS) );
-        m_pKeyAsEntryCB->      Check( 0 != (nIndexOptions & nsSwTOIOptions::TOI_KEY_AS_ENTRY) );
+        m_pCaseSensitiveCB->   Check( bool(nIndexOptions & SwTOIOptions::CaseSensitive) );
+        m_pInitialCapsCB->     Check( bool(nIndexOptions & SwTOIOptions::InitialCaps) );
+        m_pKeyAsEntryCB->      Check( bool(nIndexOptions & SwTOIOptions::KeyAsEntry) );
     }
     else if(TOX_ILLUSTRATIONS == aCurType.eType ||
         TOX_TABLES == aCurType.eType)
@@ -1153,7 +1153,7 @@ void SwTOXSelectTabPage::FillTOXDescription()
     if(m_pTOXMarksCB->IsVisible() && m_pTOXMarksCB->IsChecked())
         nContentOptions |= SwTOXElement::Mark;
 
-    sal_uInt16 nIndexOptions = rDesc.GetIndexOptions()&nsSwTOIOptions::TOI_ALPHA_DELIMITTER;
+    SwTOIOptions nIndexOptions = rDesc.GetIndexOptions()&SwTOIOptions::AlphaDelimiter;
     switch(rDesc.GetTOXType())
     {
         case TOX_CONTENT:
@@ -1179,17 +1179,17 @@ void SwTOXSelectTabPage::FillTOXDescription()
             nContentOptions = SwTOXElement::Mark;
 
             if(m_pCollectSameCB->IsChecked())
-                nIndexOptions |= nsSwTOIOptions::TOI_SAME_ENTRY;
+                nIndexOptions |= SwTOIOptions::SameEntry;
             if(m_pUseFFCB->IsChecked())
-                nIndexOptions |= nsSwTOIOptions::TOI_FF;
+                nIndexOptions |= SwTOIOptions::FF;
             if(m_pUseDashCB->IsChecked())
-                nIndexOptions |= nsSwTOIOptions::TOI_DASH;
+                nIndexOptions |= SwTOIOptions::Dash;
             if(m_pCaseSensitiveCB->IsChecked())
-                nIndexOptions |= nsSwTOIOptions::TOI_CASE_SENSITIVE;
+                nIndexOptions |= SwTOIOptions::CaseSensitive;
             if(m_pInitialCapsCB->IsChecked())
-                nIndexOptions |= nsSwTOIOptions::TOI_INITIAL_CAPS;
+                nIndexOptions |= SwTOIOptions::InitialCaps;
             if(m_pKeyAsEntryCB->IsChecked())
-                nIndexOptions |= nsSwTOIOptions::TOI_KEY_AS_ENTRY;
+                nIndexOptions |= SwTOIOptions::KeyAsEntry;
             if(m_pFromFileCB->IsChecked())
                 rDesc.SetAutoMarkURL(sAutoMarkURL);
             else
@@ -2056,7 +2056,7 @@ void SwTOXEntryTabPage::Reset( const SfxItemSet* )
         }
         else
             m_pMainEntryStyleLB->SelectEntry(sNoCharStyle);
-        m_pAlphaDelimCB->Check( 0 != (rDesc.GetIndexOptions() & nsSwTOIOptions::TOI_ALPHA_DELIMITTER) );
+        m_pAlphaDelimCB->Check( bool(rDesc.GetIndexOptions() & SwTOIOptions::AlphaDelimiter) );
     }
     m_pRelToStyleCB->Check(m_pCurrentForm->IsRelTabPos());
     m_pCommaSeparatedCB->Check(m_pCurrentForm->IsCommaSeparated());
@@ -2178,9 +2178,9 @@ void SwTOXEntryTabPage::UpdateDescriptor()
     {
         const OUString sTemp(m_pMainEntryStyleLB->GetSelectEntry());
         rDesc.SetMainEntryCharStyle(sNoCharStyle == sTemp ? aEmptyOUStr : sTemp);
-        sal_uInt16 nIdxOptions = rDesc.GetIndexOptions() & ~nsSwTOIOptions::TOI_ALPHA_DELIMITTER;
+        SwTOIOptions nIdxOptions = rDesc.GetIndexOptions() & ~SwTOIOptions::AlphaDelimiter;
         if(m_pAlphaDelimCB->IsChecked())
-            nIdxOptions |= nsSwTOIOptions::TOI_ALPHA_DELIMITTER;
+            nIdxOptions |= SwTOIOptions::AlphaDelimiter;
         rDesc.SetIndexOptions(nIdxOptions);
     }
     else if(TOX_AUTHORITIES == aLastTOXType.eType)
diff --git a/sw/source/uibase/inc/toxmgr.hxx b/sw/source/uibase/inc/toxmgr.hxx
index b73d395..61ae0f2 100644
--- a/sw/source/uibase/inc/toxmgr.hxx
+++ b/sw/source/uibase/inc/toxmgr.hxx
@@ -40,7 +40,7 @@ class SW_DLLPUBLIC SwTOXDescription
     OUString*           m_pTOUName;
     SwForm*             m_pForm;
     SwTOXElement        m_nContent;
-    sal_uInt16          m_nIndexOptions;
+    SwTOIOptions        m_nIndexOptions;
     sal_uInt16          m_nOLEOptions;
     LanguageType        m_eLanguage;
     OUString            m_sSortAlgorithm;
@@ -72,7 +72,7 @@ public:
         m_pTOUName(nullptr),
         m_pForm(nullptr),
         m_nContent(SwTOXElement::Mark | SwTOXElement::OutlineLevel),
-        m_nIndexOptions(nsSwTOIOptions::TOI_SAME_ENTRY|nsSwTOIOptions::TOI_FF|nsSwTOIOptions::TOI_CASE_SENSITIVE),
+        m_nIndexOptions(SwTOIOptions::SameEntry|SwTOIOptions::FF|SwTOIOptions::CaseSensitive),
         m_nOLEOptions(0),
         m_eLanguage((LanguageType)::GetAppLanguage()),
         m_eCaptionDisplay(CAPTION_COMPLETE),
@@ -113,8 +113,8 @@ public:
     void            SetContentOptions(SwTOXElement nSet) { m_nContent = nSet;}
     SwTOXElement    GetContentOptions() const { return m_nContent;}
 
-    void            SetIndexOptions(sal_uInt16 nSet) { m_nIndexOptions = nSet;}
-    sal_uInt16      GetIndexOptions() const { return m_nIndexOptions;}
+    void            SetIndexOptions(SwTOIOptions nSet) { m_nIndexOptions = nSet;}
+    SwTOIOptions    GetIndexOptions() const { return m_nIndexOptions;}
 
     const OUString& GetMainEntryCharStyle() const {return m_sMainEntryCharStyle;}
     void            SetMainEntryCharStyle(const OUString& rSet)  {m_sMainEntryCharStyle = rSet;}


More information about the Libreoffice-commits mailing list