summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-08-15 13:04:50 +0200
committerNoel Grandin <noel@peralex.com>2016-08-15 13:05:31 +0200
commitea2604180089ec749086f868a17ffef7cbcbbc47 (patch)
treef1067b61361e2871cce004f956523aad79c9061f /sw
parent9e87c064408aa9549336d4ce463e2c2315d30001 (diff)
convert SvxCompareMode to scoped enum
and move it to SW since it is only used there Change-Id: I9cc7869564e24a8ce733f30ef453751a854cf7e0
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/modcfg.hxx13
-rw-r--r--sw/inc/swmodule.hxx6
-rw-r--r--sw/source/core/doc/doccomp.cxx11
-rw-r--r--sw/source/ui/config/optpage.cxx18
-rw-r--r--sw/source/uibase/app/swmodul1.cxx2
-rw-r--r--sw/source/uibase/config/modcfg.cxx4
6 files changed, 31 insertions, 23 deletions
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index 543e6afb95b6..8cec996dab2c 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 c749f9e3d9cc..8ecbc4676f43 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 c92b7331dc31..5274aba8576d 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 38b45687ccc6..dd75cbe9423b 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 c30b361db2a6..e3c080a91837 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 d3971bc82a5c..0d954ab60de7 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;