include/editeng/svxenum.hxx        |    7 -------
 sw/inc/modcfg.hxx                  |   13 ++++++++++---
 sw/inc/swmodule.hxx                |    6 +++---
 sw/source/core/doc/doccomp.cxx     |   11 ++++++-----
 sw/source/ui/config/optpage.cxx    |   18 +++++++++---------
 sw/source/uibase/app/swmodul1.cxx  |    2 +-
 sw/source/uibase/config/modcfg.cxx |    4 ++--
 7 files changed, 31 insertions(+), 30 deletions(-)

New commits:
commit ea2604180089ec749086f868a17ffef7cbcbbc47
Author: Noel Grandin <n...@peralex.com>
Date:   Mon Aug 15 13:04:50 2016 +0200

    convert SvxCompareMode to scoped enum
    
    and move it to SW since it is only used there
    
    Change-Id: I9cc7869564e24a8ce733f30ef453751a854cf7e0

diff --git a/include/editeng/svxenum.hxx b/include/editeng/svxenum.hxx
index d1a7978..9dd15ec 100644
--- a/include/editeng/svxenum.hxx
+++ b/include/editeng/svxenum.hxx
@@ -206,13 +206,6 @@ enum SvxExtNumType
     SVX_NUM_IROHA_HALFWIDTH_JA
 };
 
-enum SvxCompareMode
-{
-    SVX_CMP_AUTO = 0,
-    SVX_CMP_BY_WORD,
-    SVX_CMP_BY_CHAR
-};
-
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index 543e6af..8cec996 100644
--- a/sw/inc/modcfg.hxx
+++ b/sw/inc/modcfg.hxx
@@ -88,11 +88,18 @@ public:
     void                    SetModified(){ConfigItem::SetModified();}
 };
 
+enum class SwCompareMode
+{
+    Auto = 0,
+    ByWord,
+    ByChar
+};
+
 class SwCompareConfig : public utl::ConfigItem
 {
     friend class SwModuleOptions;
 
-    sal_uInt16      eCmpMode;       //Compare/CompareDocuments;
+    SwCompareMode  eCmpMode;       //Compare/CompareDocuments;
     bool            bUseRsid;       //Compare/Settings/Use RSID
     /// Compare/Settings/Store RSID
     bool            m_bStoreRsid;
@@ -349,8 +356,8 @@ public:
     bool    IsHideFieldTips() const {return bHideFieldTips;}
     void        SetHideFieldTips(bool bSet) {bHideFieldTips = bSet;}
 
-    SvxCompareMode  GetCompareMode() const { return 
(SvxCompareMode)aCompareConfig.eCmpMode; }
-    void            SetCompareMode( SvxCompareMode eMode ) { 
aCompareConfig.eCmpMode = eMode;
+    SwCompareMode  GetCompareMode() const { return aCompareConfig.eCmpMode; }
+    void            SetCompareMode( SwCompareMode eMode ) { 
aCompareConfig.eCmpMode = eMode;
                                                              
aCompareConfig.SetModified(); }
 
     bool    IsUseRsid() const { return aCompareConfig.bUseRsid; }
diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index c749f9e..8ecbc46 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -18,6 +18,7 @@
  */
 #ifndef INCLUDED_SW_INC_SWMODULE_HXX
 #define INCLUDED_SW_INC_SWMODULE_HXX
+
 #include <tools/fldunit.hxx>
 #include <svl/lstner.hxx>
 #include <unotools/options.hxx>
@@ -28,7 +29,6 @@
 #include <fldupde.hxx>
 #include <com/sun/star/linguistic2/XLinguServiceEventListener.hpp>
 #include <com/sun/star/linguistic2/XLanguageGuessing.hpp>
-#include <editeng/svxenum.hxx>
 
 class Color;
 class SfxItemSet;
@@ -51,7 +51,7 @@ namespace svtools{ class ColorConfig;}
 class SvtAccessibilityOptions;
 class SvtCTLOptions;
 class SvtUserOptions;
-
+enum class SwCompareMode;
 struct SwDBData;
 
 enum class SvViewOpt {
@@ -199,7 +199,7 @@ public:
     sal_uInt16              GetRedlineMarkPos();
     const Color&            GetRedlineMarkColor();
 
-    SvxCompareMode      GetCompareMode() const;
+    SwCompareMode      GetCompareMode() const;
     bool            IsUseRsid() const;
     bool            IsIgnorePieces() const;
     sal_uInt16          GetPieceLen() const;
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index c92b733..5274aba 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -39,6 +39,7 @@
 #include <tox.hxx>
 #include <docsh.hxx>
 #include <fmtcntnt.hxx>
+#include <modcfg.hxx>
 
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/document/XDocumentProperties.hpp>
@@ -313,7 +314,7 @@ public:
 /// Options set in Tools->Options->Writer->Comparison
 struct CmpOptionsContainer
 {
-    SvxCompareMode eCmpMode;
+    SwCompareMode eCmpMode;
     int nIgnoreLen;
     bool bUseRsid;
 } CmpOptions;
@@ -1308,7 +1309,7 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& 
rLine,
         std::vector<int> aLcsDst( nMinLen + 1 );
         std::vector<int> aLcsSrc( nMinLen + 1 );
 
-        if( CmpOptions.eCmpMode == SVX_CMP_BY_WORD )
+        if( CmpOptions.eCmpMode == SwCompareMode::ByWord )
         {
             std::vector<int> aTmpLcsDst( nMinLen + 1 );
             std::vector<int> aTmpLcsSrc( nMinLen + 1 );
@@ -1814,17 +1815,17 @@ long SwDoc::CompareDoc( const SwDoc& rDoc )
 
     // Get comparison options
     CmpOptions.eCmpMode = SW_MOD()->GetCompareMode();
-    if( CmpOptions.eCmpMode == SVX_CMP_AUTO )
+    if( CmpOptions.eCmpMode == SwCompareMode::Auto )
     {
         if( getRsidRoot() == rDoc.getRsidRoot() )
         {
-            CmpOptions.eCmpMode = SVX_CMP_BY_CHAR;
+            CmpOptions.eCmpMode = SwCompareMode::ByChar;
             CmpOptions.bUseRsid = true;
             CmpOptions.nIgnoreLen = 2;
         }
         else
         {
-            CmpOptions.eCmpMode = SVX_CMP_BY_WORD;
+            CmpOptions.eCmpMode = SwCompareMode::ByWord;
             CmpOptions.bUseRsid = false;
             CmpOptions.nIgnoreLen = 3;
         }
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 38b4568..dd75cbe 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -2335,11 +2335,11 @@ bool SwCompareOptionsTabPage::FillItemSet( SfxItemSet* )
         m_pWordRB->IsValueChangedFromSaved() ||
         m_pCharRB->IsValueChangedFromSaved() )
     {
-        SvxCompareMode eCmpMode = SVX_CMP_AUTO;
+        SwCompareMode eCmpMode = SwCompareMode::Auto;
 
-        if ( m_pAutoRB->IsChecked() ) eCmpMode = SVX_CMP_AUTO;
-        if ( m_pWordRB->IsChecked() ) eCmpMode = SVX_CMP_BY_WORD;
-        if ( m_pCharRB->IsChecked() ) eCmpMode = SVX_CMP_BY_CHAR;
+        if ( m_pAutoRB->IsChecked() ) eCmpMode = SwCompareMode::Auto;
+        if ( m_pWordRB->IsChecked() ) eCmpMode = SwCompareMode::ByWord;
+        if ( m_pCharRB->IsChecked() ) eCmpMode = SwCompareMode::ByChar;
 
         pOpt->SetCompareMode( eCmpMode );
         bRet = true;
@@ -2376,22 +2376,22 @@ void SwCompareOptionsTabPage::Reset( const SfxItemSet* )
 {
     SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig();
 
-    SvxCompareMode eCmpMode = pOpt->GetCompareMode();
-    if( eCmpMode == SVX_CMP_AUTO )
+    SwCompareMode eCmpMode = pOpt->GetCompareMode();
+    if( eCmpMode == SwCompareMode::Auto )
     {
         m_pAutoRB->Check();
         m_pRsidCB->Disable();
         m_pIgnoreCB->Disable();
         m_pLenNF->Disable();
     }
-    else if( eCmpMode == SVX_CMP_BY_WORD )
+    else if( eCmpMode == SwCompareMode::ByWord )
     {
         m_pWordRB->Check();
         m_pRsidCB->Enable();
         m_pIgnoreCB->Enable();
         m_pLenNF->Enable();
     }
-    else if( eCmpMode == SVX_CMP_BY_CHAR)
+    else if( eCmpMode == SwCompareMode::ByChar)
     {
         m_pCharRB->Check();
         m_pRsidCB->Enable();
@@ -2408,7 +2408,7 @@ void SwCompareOptionsTabPage::Reset( const SfxItemSet* )
     m_pIgnoreCB->Check( pOpt->IsIgnorePieces() );
     m_pIgnoreCB->SaveValue();
 
-    m_pLenNF->Enable( m_pIgnoreCB->IsChecked() && eCmpMode );
+    m_pLenNF->Enable( m_pIgnoreCB->IsChecked() && eCmpMode != 
SwCompareMode::Auto );
 
     m_pLenNF->SetValue( pOpt->GetPieceLen() );
     m_pLenNF->SaveValue();
diff --git a/sw/source/uibase/app/swmodul1.cxx 
b/sw/source/uibase/app/swmodul1.cxx
index c30b361..e3c080a 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -632,7 +632,7 @@ void SwModule::ApplyDefaultPageMode(bool bIsSquaredPageMode)
     m_pUsrPref->SetDefaultPageMode(bIsSquaredPageMode);
 }
 
-SvxCompareMode SwModule::GetCompareMode() const
+SwCompareMode SwModule::GetCompareMode() const
 {
     return m_pModuleConfig->GetCompareMode();
 }
diff --git a/sw/source/uibase/config/modcfg.cxx 
b/sw/source/uibase/config/modcfg.cxx
index d3971bc..0d954ab 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -1319,7 +1319,7 @@ SwCompareConfig::SwCompareConfig() :
         ConfigItemMode::DelayedUpdate|ConfigItemMode::ReleaseTree)
     ,m_bStoreRsid(true)
 {
-    eCmpMode = SVX_CMP_AUTO;
+    eCmpMode = SwCompareMode::Auto;
     bUseRsid = false;
     bIgnorePieces = false;
     nPieceLen = 1;
@@ -1361,7 +1361,7 @@ void SwCompareConfig::Load()
 
             switch(nProp)
             {
-                case 0 : eCmpMode = (SvxCompareMode) nVal; break;
+                case 0 : eCmpMode = (SwCompareMode) nVal; break;
                 case 1 : bUseRsid = *o3tl::doAccess<bool>(pValues[nProp]); 
break;
                 case 2 : bIgnorePieces = 
*o3tl::doAccess<bool>(pValues[nProp]); break;
                 case 3 : nPieceLen = nVal; break;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to