[Libreoffice-commits] core.git: 13 commits - compilerplugins/clang cui/source editeng/source include/editeng include/svl include/svx sc/inc sc/qa sc/source sd/source svl/source svx/source sw/inc sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Feb 13 06:18:44 UTC 2017
compilerplugins/clang/unusedenumconstants.py | 3
cui/source/options/optasian.cxx | 17
editeng/source/editeng/editeng.cxx | 2
editeng/source/editeng/impedit.hxx | 6
editeng/source/editeng/impedit2.cxx | 3
editeng/source/editeng/impedit3.cxx | 7
editeng/source/editeng/impedit4.cxx | 2
editeng/source/outliner/outlin2.cxx | 2
include/editeng/editeng.hxx | 3
include/editeng/outliner.hxx | 3
include/svl/asiancfg.hxx | 14
include/svx/svdmodel.hxx | 7
sc/inc/document.hxx | 14
sc/qa/unit/ucalc.cxx | 3
sc/source/core/data/documen2.cxx | 3
sc/source/core/data/documen9.cxx | 11
sc/source/ui/docshell/docsh2.cxx | 2
sc/source/ui/unoobj/confuno.cxx | 2
sd/source/ui/unoidl/UnoDocumentSettings.cxx | 8
svl/source/config/asiancfg.cxx | 8
svx/source/svdraw/svdmodel.cxx | 7
sw/inc/IDocumentSettingAccess.hxx | 6
sw/inc/ccoll.hxx | 4
sw/inc/chcmprse.hxx | 28 -
sw/inc/crsrsh.hxx | 52 +-
sw/inc/dbmgr.hxx | 18
sw/inc/doc.hxx | 4
sw/inc/editsh.hxx | 2
sw/inc/fesh.hxx | 27 -
sw/inc/fmtcol.hxx | 46 -
sw/inc/pagedesc.hxx | 6
sw/inc/section.hxx | 4
sw/inc/swabstdlg.hxx | 3
sw/inc/tblenum.hxx | 12
sw/inc/view.hxx | 37 -
sw/source/core/crsr/crstrvl.cxx | 78 +--
sw/source/core/doc/DocumentSettingManager.cxx | 9
sw/source/core/doc/doctxm.cxx | 2
sw/source/core/doc/fmtcol.cxx | 67 --
sw/source/core/doc/tblrwcl.cxx | 4
sw/source/core/docnode/ndtbl.cxx | 18
sw/source/core/docnode/node.cxx | 30 -
sw/source/core/docnode/section.cxx | 14
sw/source/core/draw/drawdoc.cxx | 3
sw/source/core/edit/edtab.cxx | 2
sw/source/core/frmedt/fetab.cxx | 6
sw/source/core/frmedt/fews.cxx | 32 -
sw/source/core/inc/DocumentSettingManager.hxx | 6
sw/source/core/inc/UndoTable.hxx | 6
sw/source/core/inc/swblocks.hxx | 1
sw/source/core/inc/tblrwcl.hxx | 7
sw/source/core/layout/pagedesc.cxx | 4
sw/source/core/layout/paintfrm.cxx | 8
sw/source/core/swg/swblocks.cxx | 4
sw/source/core/text/porlay.cxx | 11
sw/source/core/undo/untbl.cxx | 18
sw/source/core/unocore/unoidx.cxx | 2
sw/source/core/unocore/unosect.cxx | 2
sw/source/filter/ww8/wrtww8.cxx | 2
sw/source/filter/ww8/ww8par.cxx | 2
sw/source/filter/ww8/ww8par.hxx | 2
sw/source/filter/ww8/ww8par3.cxx | 16
sw/source/filter/ww8/ww8par5.cxx | 92 +--
sw/source/filter/xml/xmlfmt.cxx | 43 -
sw/source/ui/chrdlg/pardlg.cxx | 2
sw/source/ui/dbui/dbinsdlg.cxx | 4
sw/source/ui/dbui/mmlayoutpage.cxx | 2
sw/source/ui/dialog/swdlgfact.cxx | 2
sw/source/ui/dialog/swdlgfact.hxx | 2
sw/source/ui/dialog/uiregionsw.cxx | 6
sw/source/ui/misc/num.cxx | 4
sw/source/ui/table/splittbl.cxx | 10
sw/source/ui/vba/vbaselection.cxx | 2
sw/source/uibase/app/docshini.cxx | 2
sw/source/uibase/chrdlg/ccoll.cxx | 56 +-
sw/source/uibase/dbui/dbmgr.cxx | 42 -
sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 89 +--
sw/source/uibase/dochdl/swdtflvr.cxx | 4
sw/source/uibase/docvw/AnchorOverlayObject.cxx | 14
sw/source/uibase/docvw/AnchorOverlayObject.hxx | 9
sw/source/uibase/docvw/SidebarTxtControl.cxx | 2
sw/source/uibase/docvw/SidebarWin.cxx | 20
sw/source/uibase/docvw/edtdd.cxx | 4
sw/source/uibase/docvw/edtwin.cxx | 471 ++++++++-----------
sw/source/uibase/docvw/edtwin2.cxx | 40 -
sw/source/uibase/docvw/romenu.cxx | 2
sw/source/uibase/inc/SwSpellDialogChildWindow.hxx | 2
sw/source/uibase/inc/splittbl.hxx | 7
sw/source/uibase/inc/uivwimp.hxx | 6
sw/source/uibase/shells/basesh.cxx | 22
sw/source/uibase/shells/frmsh.cxx | 8
sw/source/uibase/shells/grfsh.cxx | 12
sw/source/uibase/shells/tabsh.cxx | 18
sw/source/uibase/shells/textsh.cxx | 6
sw/source/uibase/uiview/swcli.cxx | 6
sw/source/uibase/uiview/uivwimp.cxx | 4
sw/source/uibase/uiview/view.cxx | 40 -
sw/source/uibase/uiview/view0.cxx | 2
sw/source/uibase/uiview/view2.cxx | 4
sw/source/uibase/uiview/viewmdi.cxx | 6
sw/source/uibase/uiview/viewport.cxx | 4
sw/source/uibase/uiview/viewtab.cxx | 74 +-
sw/source/uibase/uno/SwXDocumentSettings.cxx | 11
sw/source/uibase/uno/unodispatch.cxx | 20
sw/source/uibase/uno/unotxvw.cxx | 83 +--
sw/source/uibase/utlui/uitool.cxx | 4
sw/source/uibase/web/wview.cxx | 28 -
sw/source/uibase/wrtsh/wrtsh1.cxx | 14
108 files changed, 972 insertions(+), 1065 deletions(-)
New commits:
commit b8d977c0178f8ac4ee299722d50c1481a15b45c8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Feb 13 08:17:10 2017 +0200
convert CharCompressType to scoped enum
and move it to svl, where it belongs
Change-Id: Ic4d846419dfe2dd85de5ade8ed1a041867bbf1dc
diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx
index 71e5078..5509f0c 100644
--- a/cui/source/options/optasian.cxx
+++ b/cui/source/options/optasian.cxx
@@ -187,13 +187,14 @@ bool SvxAsianLayoutPage::FillItemSet( SfxItemSet* )
if(m_pNoCompressionRB->IsValueChangedFromSaved() ||
m_pPunctCompressionRB->IsValueChangedFromSaved())
{
- sal_Int16 nSet = m_pNoCompressionRB->IsChecked() ? 0 :
- m_pPunctCompressionRB->IsChecked() ? 1 : 2;
+ CharCompressType nSet = m_pNoCompressionRB->IsChecked() ? CharCompressType::NONE :
+ m_pPunctCompressionRB->IsChecked() ? CharCompressType::PunctuationOnly :
+ CharCompressType::PunctuationAndKana;
pImpl->aConfig.SetCharDistanceCompression(nSet);
OUString sCompress(cCharacterCompressionType);
if(pImpl->xPrSetInfo.is() && pImpl->xPrSetInfo->hasPropertyByName(sCompress))
{
- pImpl->xPrSet->setPropertyValue(sCompress, Any(nSet));
+ pImpl->xPrSet->setPropertyValue(sCompress, Any((sal_uInt16)nSet));
}
}
pImpl->aConfig.Commit();
@@ -238,7 +239,7 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* )
pImpl->xPrSetInfo = pImpl->xPrSet->getPropertySetInfo();
OUString sForbidden("ForbiddenCharacters");
bool bKernWesternText = pImpl->aConfig.IsKerningWesternTextOnly();
- sal_Int16 nCompress = pImpl->aConfig.GetCharDistanceCompression();
+ CharCompressType nCompress = pImpl->aConfig.GetCharDistanceCompression();
if(pImpl->xPrSetInfo.is())
{
if(pImpl->xPrSetInfo->hasPropertyByName(sForbidden))
@@ -250,7 +251,9 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* )
if(pImpl->xPrSetInfo->hasPropertyByName(sCompress))
{
Any aVal = pImpl->xPrSet->getPropertyValue(sCompress);
- aVal >>= nCompress;
+ sal_uInt16 nTmp;
+ if (aVal >>= nTmp)
+ nCompress = (CharCompressType)nTmp;
}
OUString sPunct(cIsKernAsianPunctuation);
if(pImpl->xPrSetInfo->hasPropertyByName(sPunct))
@@ -276,8 +279,8 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* )
m_pCharPunctKerningRB->Check();
switch(nCompress)
{
- case 0 : m_pNoCompressionRB->Check(); break;
- case 1 : m_pPunctCompressionRB->Check(); break;
+ case CharCompressType::NONE : m_pNoCompressionRB->Check(); break;
+ case CharCompressType::PunctuationOnly : m_pPunctCompressionRB->Check(); break;
default: m_pPunctKanaCompressionRB->Check();
}
m_pCharKerningRB->SaveValue();
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 6619f6e..d3bf03f 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -482,7 +482,7 @@ EditSelection EditEngine::TransliterateText(const EditSelection& rSelection, sal
return pImpEditEngine->TransliterateText(rSelection, nTransliterationMode);
}
-void EditEngine::SetAsianCompressionMode( sal_uInt16 n )
+void EditEngine::SetAsianCompressionMode( CharCompressType n )
{
pImpEditEngine->SetAsianCompressionMode( n );
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index ffcda87..bc42f55 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -444,7 +444,7 @@ private:
sal_uInt16 nStretchX;
sal_uInt16 nStretchY;
- sal_uInt16 nAsianCompressionMode;
+ CharCompressType nAsianCompressionMode;
EEHorizontalTextDirection eDefaultHorizontalTextDirection;
@@ -998,8 +998,8 @@ public:
EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode );
short ReplaceTextOnly( ContentNode* pNode, sal_Int32 nCurrentStart, sal_Int32 nLen, const OUString& rText, const css::uno::Sequence< sal_Int32 >& rOffsets );
- void SetAsianCompressionMode( sal_uInt16 n );
- sal_uInt16 GetAsianCompressionMode() const { return nAsianCompressionMode; }
+ void SetAsianCompressionMode( CharCompressType n );
+ CharCompressType GetAsianCompressionMode() const { return nAsianCompressionMode; }
void SetKernAsianPunctuation( bool b );
bool IsKernAsianPunctuation() const { return bKernAsianPunctuation; }
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 0a6a0bd..20e2f9b 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -61,6 +61,7 @@
#include <sot/exchange.hxx>
#include <sot/formats.hxx>
+#include <svl/asiancfg.hxx>
#include <o3tl/make_unique.hxx>
#include <comphelper/lok.hxx>
@@ -131,7 +132,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
eDefLanguage = LANGUAGE_DONTKNOW;
maBackgroundColor = COL_AUTO;
- nAsianCompressionMode = text::CharacterCompressionType::NONE;
+ nAsianCompressionMode = CharCompressType::NONE;
eDefaultHorizontalTextDirection = EE_HTEXTDIR_DEFAULT;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index c6f4e4d..9247b1a 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -52,6 +52,7 @@
#include <svtools/colorcfg.hxx>
#include <svl/ctloptions.hxx>
+#include <svl/asiancfg.hxx>
#include <editeng/forbiddencharacterstable.hxx>
@@ -1140,7 +1141,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
}
// And now check for Compression:
- if ( !bContinueLastPortion && nPortionLen && GetAsianCompressionMode() )
+ if ( !bContinueLastPortion && nPortionLen && GetAsianCompressionMode() != CharCompressType::NONE )
{
EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray();
long* pDXArray = rArray.data() + nTmpPos - pLine->GetStart();
@@ -4315,7 +4316,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode,
long* pDXArray, sal_uInt16 n100thPercentFromMax,
bool bManipulateDXArray)
{
- DBG_ASSERT( GetAsianCompressionMode(), "ImplCalcAsianCompression - Why?" );
+ DBG_ASSERT( GetAsianCompressionMode() != CharCompressType::NONE, "ImplCalcAsianCompression - Why?" );
DBG_ASSERT( pTextPortion->GetLen(), "ImplCalcAsianCompression - Empty Portion?" );
// Percent is 1/100 Percent...
@@ -4333,7 +4334,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode,
AsianCompressionFlags nType = GetCharTypeForCompression( pNode->GetChar( n+nStartPos ) );
bool bCompressPunctuation = ( nType == AsianCompressionFlags::PunctuationLeft ) || ( nType == AsianCompressionFlags::PunctuationRight );
- bool bCompressKana = ( nType == AsianCompressionFlags::Kana ) && ( GetAsianCompressionMode() == text::CharacterCompressionType::PUNCTUATION_AND_KANA );
+ bool bCompressKana = ( nType == AsianCompressionFlags::Kana ) && ( GetAsianCompressionMode() == CharCompressType::PunctuationAndKana );
// create Extra infos only if needed...
if ( bCompressPunctuation || bCompressKana )
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index dde54ad..55e175c 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -3064,7 +3064,7 @@ short ImpEditEngine::ReplaceTextOnly(
}
-void ImpEditEngine::SetAsianCompressionMode( sal_uInt16 n )
+void ImpEditEngine::SetAsianCompressionMode( CharCompressType n )
{
if ( n != nAsianCompressionMode )
{
diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx
index 3248ba3..2f6d8a3 100644
--- a/editeng/source/outliner/outlin2.cxx
+++ b/editeng/source/outliner/outlin2.cxx
@@ -283,7 +283,7 @@ EEControlBits Outliner::GetControlWord() const
return pEditEngine->GetControlWord();
}
-void Outliner::SetAsianCompressionMode( sal_uInt16 n )
+void Outliner::SetAsianCompressionMode( CharCompressType n )
{
pEditEngine->SetAsianCompressionMode( n );
}
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index 38dbad1..4742a60 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -109,6 +109,7 @@ class Range;
struct EPaM;
class DeletedNodeInfo;
class ParaPortionList;
+enum class CharCompressType;
/** values for:
@@ -256,7 +257,7 @@ public:
void TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode );
EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode );
- void SetAsianCompressionMode( sal_uInt16 nCompression );
+ void SetAsianCompressionMode( CharCompressType nCompression );
void SetKernAsianPunctuation( bool bEnabled );
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index ef1540e..2c1f781 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -83,6 +83,7 @@ class SvxForbiddenCharactersTable;
class OverflowingText;
class NonOverflowingText;
class OutlinerViewShell;
+enum class CharCompressType;
namespace svl
{
@@ -694,7 +695,7 @@ public:
LanguageType GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const;
- void SetAsianCompressionMode( sal_uInt16 nCompressionMode );
+ void SetAsianCompressionMode( CharCompressType nCompressionMode );
void SetKernAsianPunctuation( bool bEnabled );
diff --git a/include/svl/asiancfg.hxx b/include/svl/asiancfg.hxx
index 71662c4..cef6361 100644
--- a/include/svl/asiancfg.hxx
+++ b/include/svl/asiancfg.hxx
@@ -31,6 +31,16 @@ namespace com { namespace sun { namespace star { namespace lang {
struct Locale;
} } } }
+/// These constants define character compression in Asian text.
+/// Must match the values in com::sun::star::text::CharacterCompressionType.
+/// For bonus points, also appears to be directly stored in the ww8 file format.
+enum class CharCompressType {
+ NONE, /// No Compression
+ PunctuationOnly, /// Only punctuation is compressed
+ PunctuationAndKana, /// Punctuation and Japanese Kana are compressed.
+ Invalid = 0xff /// only used in SC
+};
+
class SVL_DLLPUBLIC SvxAsianConfig {
public:
SvxAsianConfig();
@@ -44,9 +54,9 @@ public:
void SetKerningWesternTextOnly(bool value);
- sal_Int16 GetCharDistanceCompression() const;
+ CharCompressType GetCharDistanceCompression() const;
- void SetCharDistanceCompression(sal_Int16 value);
+ void SetCharDistanceCompression(CharCompressType value);
css::uno::Sequence< css::lang::Locale > GetStartEndCharLocales() const;
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 4cad2a4..d2b4ef8 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -78,6 +78,7 @@ class SdrOutlinerCache;
class SdrUndoFactory;
class ImageMap;
class TextChain;
+enum class CharCompressType;
namespace comphelper
{
class IEmbeddedHelper;
@@ -203,7 +204,7 @@ public:
//get a vector of all the SdrOutliner belonging to the model
std::vector<SdrOutliner*> GetActiveOutliners() const;
std::unique_ptr<SdrModelImpl> mpImpl;
- sal_uInt16 mnCharCompressType;
+ CharCompressType mnCharCompressType;
sal_uInt16 mnHandoutPageCount;
bool mbModelLocked;
bool mbKernAsianPunctuation;
@@ -532,8 +533,8 @@ public:
void SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharactersTable>& xForbiddenChars );
const rtl::Reference<SvxForbiddenCharactersTable>& GetForbiddenCharsTable() const { return mpForbiddenCharactersTable;}
- void SetCharCompressType( sal_uInt16 nType );
- sal_uInt16 GetCharCompressType() const { return mnCharCompressType; }
+ void SetCharCompressType( CharCompressType nType );
+ CharCompressType GetCharCompressType() const { return mnCharCompressType; }
void SetKernAsianPunctuation( bool bEnabled );
bool IsKernAsianPunctuation() const { return mbKernAsianPunctuation; }
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index da2a982..e93e882 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -50,6 +50,7 @@
enum class SvtScriptType;
enum class ScMF;
enum class FormulaError : sal_uInt16;
+enum class CharCompressType;
namespace editeng { class SvxBorderLine; }
namespace formula { struct VectorRefArray; }
namespace svl {
@@ -228,7 +229,6 @@ namespace com { namespace sun { namespace star {
#define SC_MACROCALL_ALLOWED 0
-#define SC_ASIANCOMPRESSION_INVALID 0xff
#define SC_ASIANKERNING_INVALID 0xff
enum ScDocumentMode
@@ -452,12 +452,12 @@ private:
bool bHasMacroFunc; // valid only after loading
- sal_uInt8 nAsianCompression;
- sal_uInt8 nAsianKerning;
+ CharCompressType nAsianCompression;
+ sal_uInt8 nAsianKerning;
bool bPastingDrawFromOtherDoc;
- sal_uInt8 nInDdeLinkUpdate; // originating DDE links (stacked bool)
+ sal_uInt8 nInDdeLinkUpdate; // originating DDE links (stacked bool)
bool bInUnoBroadcast;
bool bInUnoListenerCall;
@@ -1964,16 +1964,16 @@ public:
const rtl::Reference<SvxForbiddenCharactersTable>& GetForbiddenCharacters();
void SetForbiddenCharacters(const rtl::Reference<SvxForbiddenCharactersTable>& rNew);
- sal_uInt8 GetAsianCompression() const; // CharacterCompressionType values
+ CharCompressType GetAsianCompression() const;
bool IsValidAsianCompression() const;
- void SetAsianCompression(sal_uInt8 nNew);
+ void SetAsianCompression(CharCompressType nNew);
bool GetAsianKerning() const;
bool IsValidAsianKerning() const;
void SetAsianKerning(bool bNew);
void ApplyAsianEditSettings(ScEditEngineDefaulter& rEngine);
- sal_uInt8 GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values
+ sal_uInt8 GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values
SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;}
void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;}
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 884ae3f..cc7a9c3 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -14,6 +14,7 @@
#include <rtl/strbuf.hxx>
#include <osl/file.hxx>
#include <osl/time.h>
+#include <svl/asiancfg.hxx>
#include "scdll.hxx"
#include "formulacell.hxx"
@@ -6364,7 +6365,7 @@ void Test::testEmptyCalcDocDefaults()
CPPUNIT_ASSERT_EQUAL( (sal_uLong) 0, m_pDoc->GetCellCount() );
CPPUNIT_ASSERT_EQUAL( (sal_uLong) 0, m_pDoc->GetFormulaGroupCount() );
CPPUNIT_ASSERT_EQUAL( (sal_uLong) 0, m_pDoc->GetCodeCount() );
- CPPUNIT_ASSERT_EQUAL( (sal_uInt8) 0, m_pDoc->GetAsianCompression() );
+ CPPUNIT_ASSERT_EQUAL( (int)CharCompressType::NONE, (int)m_pDoc->GetAsianCompression() );
CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasPrintRange() );
CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsInVBAMode() );
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 92d2c4a..9554306 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -31,6 +31,7 @@
#include <sfx2/objsh.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/printer.hxx>
+#include <svl/asiancfg.hxx>
#include <svl/zforlist.hxx>
#include <svl/zformat.hxx>
#include <vcl/virdev.hxx>
@@ -201,7 +202,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
bExpandRefs( false ),
bDetectiveDirty( false ),
bHasMacroFunc( false ),
- nAsianCompression(SC_ASIANCOMPRESSION_INVALID),
+ nAsianCompression(CharCompressType::Invalid),
nAsianKerning(SC_ASIANKERNING_INVALID),
bPastingDrawFromOtherDoc( false ),
nInDdeLinkUpdate( 0 ),
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 96fd241..339c75b 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -26,6 +26,7 @@
#include <editeng/forbiddencharacterstable.hxx>
#include <editeng/langitem.hxx>
#include <osl/thread.h>
+#include <svl/asiancfg.hxx>
#include <svx/svdetc.hxx>
#include <svx/svditer.hxx>
#include <svx/svdocapt.hxx>
@@ -641,18 +642,18 @@ void ScDocument::SetForbiddenCharacters(const rtl::Reference<SvxForbiddenCharact
bool ScDocument::IsValidAsianCompression() const
{
- return ( nAsianCompression != SC_ASIANCOMPRESSION_INVALID );
+ return nAsianCompression != CharCompressType::Invalid;
}
-sal_uInt8 ScDocument::GetAsianCompression() const
+CharCompressType ScDocument::GetAsianCompression() const
{
- if ( nAsianCompression == SC_ASIANCOMPRESSION_INVALID )
- return 0;
+ if ( nAsianCompression == CharCompressType::Invalid )
+ return CharCompressType::NONE;
else
return nAsianCompression;
}
-void ScDocument::SetAsianCompression(sal_uInt8 nNew)
+void ScDocument::SetAsianCompression(CharCompressType nNew)
{
nAsianCompression = nNew;
if ( pEditEngine )
diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx
index f9b006c..4aaa39a 100644
--- a/sc/source/ui/docshell/docsh2.cxx
+++ b/sc/source/ui/docshell/docsh2.cxx
@@ -144,7 +144,7 @@ void ScDocShell::InitItems()
if ( !aDocument.IsValidAsianCompression() )
{
// set compression mode from configuration if not already set (e.g. XML import)
- aDocument.SetAsianCompression( sal::static_int_cast<sal_uInt8>( aAsian.GetCharDistanceCompression() ) );
+ aDocument.SetAsianCompression( aAsian.GetCharDistanceCompression() );
}
if ( !aDocument.IsValidAsianKerning() )
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index 796494e..2918c86 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -256,7 +256,7 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
{
// Int16 contains CharacterCompressionType values
sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue );
- rDoc.SetAsianCompression( (sal_uInt8) nUno );
+ rDoc.SetAsianCompression( (CharCompressType) nUno );
bUpdateHeights = true;
}
else if ( aPropertyName == SC_UNO_ASIANKERN )
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 3326132..aacfa2b 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -812,19 +812,19 @@ DocumentSettings::_setPropertyValues(const PropertyMapEntry** ppEntries,
{
bOk = true;
- pDoc->SetCharCompressType( (sal_uInt16)nCharCompressType );
+ pDoc->SetCharCompressType( (CharCompressType)nCharCompressType );
SdDrawDocument* pDocument = pDocSh->GetDoc();
SdrOutliner& rOutl = pDocument->GetDrawOutliner();
- rOutl.SetAsianCompressionMode( (sal_uInt16)nCharCompressType );
+ rOutl.SetAsianCompressionMode( (CharCompressType)nCharCompressType );
SdOutliner* pOutl = pDocument->GetOutliner( false );
if( pOutl )
{
- pOutl->SetAsianCompressionMode( (sal_uInt16)nCharCompressType );
+ pOutl->SetAsianCompressionMode( (CharCompressType)nCharCompressType );
}
pOutl = pDocument->GetInternalOutliner( false );
if( pOutl )
{
- pOutl->SetAsianCompressionMode( (sal_uInt16)nCharCompressType );
+ pOutl->SetAsianCompressionMode( (CharCompressType)nCharCompressType );
}
}
break;
diff --git a/svl/source/config/asiancfg.cxx b/svl/source/config/asiancfg.cxx
index 209771a..3e77bc6 100644
--- a/svl/source/config/asiancfg.cxx
+++ b/svl/source/config/asiancfg.cxx
@@ -87,15 +87,15 @@ void SvxAsianConfig::SetKerningWesternTextOnly(bool value) {
value, impl_->batch);
}
-sal_Int16 SvxAsianConfig::GetCharDistanceCompression() const {
- return
+CharCompressType SvxAsianConfig::GetCharDistanceCompression() const {
+ return (CharCompressType)
officecfg::Office::Common::AsianLayout::CompressCharacterDistance::get(
impl_->context);
}
-void SvxAsianConfig::SetCharDistanceCompression(sal_Int16 value) {
+void SvxAsianConfig::SetCharDistanceCompression(CharCompressType value) {
officecfg::Office::Common::AsianLayout::CompressCharacterDistance::set(
- value, impl_->batch);
+ (sal_uInt16)value, impl_->batch);
}
css::uno::Sequence< css::lang::Locale > SvxAsianConfig::GetStartEndCharLocales()
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index cb3ed86..c95c018 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -35,6 +35,7 @@
#include <unotools/configmgr.hxx>
#include <svl/whiter.hxx>
+#include <svl/asiancfg.hxx>
#include <svx/xit.hxx>
#include <svx/xbtmpit.hxx>
#include <svx/xlndsit.hxx>
@@ -165,11 +166,11 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe
mbDisableTextEditUsesCommonUndoManager = false;
if (!utl::ConfigManager::IsAvoidConfig())
- mnCharCompressType =
+ mnCharCompressType = (CharCompressType)
officecfg::Office::Common::AsianLayout::CompressCharacterDistance::
get();
else
- mnCharCompressType = 0;
+ mnCharCompressType = CharCompressType::NONE;
#ifdef OSL_LITENDIAN
nStreamNumberFormat=SvStreamEndian::LITTLE;
@@ -1865,7 +1866,7 @@ void SdrModel::SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharacte
}
-void SdrModel::SetCharCompressType( sal_uInt16 nType )
+void SdrModel::SetCharCompressType( CharCompressType nType )
{
if( nType != mnCharCompressType )
{
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index ed7da12..cc0466b 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -22,11 +22,11 @@
#include <tools/solar.h>
#include <rtl/ref.hxx>
-#include <chcmprse.hxx>
#include <fldupde.hxx>
class SvxForbiddenCharactersTable;
namespace com { namespace sun { namespace star { namespace i18n { struct ForbiddenCharacters; } } } }
+enum class CharCompressType;
enum class DocumentSettingId
{
@@ -204,14 +204,14 @@ enum class DocumentSettingId
@returns
the current character compression mode.
*/
- virtual SwCharCompressType getCharacterCompressionType() const = 0;
+ virtual CharCompressType getCharacterCompressionType() const = 0;
/** Set the character compression type for Asian characters.
@param nMode
[in] the new character compression type.
*/
- virtual void setCharacterCompressionType( /*[in]*/SwCharCompressType nType ) = 0;
+ virtual void setCharacterCompressionType( /*[in]*/CharCompressType nType ) = 0;
/** Get the n32DummyCompatabilityOptions1
*/
diff --git a/sw/inc/chcmprse.hxx b/sw/inc/chcmprse.hxx
deleted file mode 100644
index 37574b3..0000000
--- a/sw/inc/chcmprse.hxx
+++ /dev/null
@@ -1,28 +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_CHCMPRSE_HXX
-#define INCLUDED_SW_INC_CHCMPRSE_HXX
-
-enum SwCharCompressType{ CHARCOMPRESS_NONE,
- CHARCOMPRESS_PUNCTUATION,
- CHARCOMPRESS_PUNCTUATION_KANA };
-
-#endif
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index d8c2ba3..458d3bd 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -35,7 +35,6 @@
#include <flypos.hxx>
#include <itabenum.hxx>
#include <swdbdata.hxx>
-#include <chcmprse.hxx>
#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
#include <sfx2/objsh.hxx>
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index ec0eb82..1103cf4 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -25,6 +25,7 @@
#include <comphelper/processfactory.hxx>
#include <editeng/forbiddencharacterstable.hxx>
#include <svx/svdmodel.hxx>
+#include <svl/asiancfg.hxx>
#include <unotools/compatibility.hxx>
#include <unotools/configmgr.hxx>
#include <drawdoc.hxx>
@@ -41,7 +42,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
:m_rDoc(rDoc),
mnLinkUpdMode( GLOBALSETTING ),
meFieldUpdMode( AUTOUPD_GLOBALSETTING ),
- meChrCmprType( CHARCOMPRESS_NONE ),
+ meChrCmprType( CharCompressType::NONE ),
mn32DummyCompatibilityOptions1(0),
mn32DummyCompatibilityOptions2(0),
mbHTMLMode(false),
@@ -495,12 +496,12 @@ void sw::DocumentSettingManager::setFieldUpdateFlags(/*[in]*/SwFieldUpdateFlags
meFieldUpdMode = eMode;
}
-SwCharCompressType sw::DocumentSettingManager::getCharacterCompressionType() const
+CharCompressType sw::DocumentSettingManager::getCharacterCompressionType() const
{
return meChrCmprType;
}
-void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/SwCharCompressType n )
+void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/CharCompressType n )
{
if( meChrCmprType != n )
{
@@ -509,7 +510,7 @@ void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/SwCharComp
SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel();
if( pDrawModel )
{
- pDrawModel->SetCharCompressType( static_cast<sal_uInt16>(n) );
+ pDrawModel->SetCharCompressType( n );
if( !m_rDoc.IsInReading() )
pDrawModel->ReformatAllTextObjects();
}
diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx
index 53ea2ab..b1dd50b 100644
--- a/sw/source/core/draw/drawdoc.cxx
+++ b/sw/source/core/draw/drawdoc.cxx
@@ -96,8 +96,7 @@ SwDrawModel::SwDrawModel(SwDoc *const pDoc)
SetForbiddenCharsTable(m_pDoc->GetDocumentSettingManager().getForbiddenCharacterTable());
// Implementation for asian compression
- SetCharCompressType( static_cast<sal_uInt16>(
- m_pDoc->GetDocumentSettingManager().getCharacterCompressionType()));
+ SetCharCompressType( m_pDoc->GetDocumentSettingManager().getCharacterCompressionType() );
}
// Destructor
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index ae835d7..a71966d 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -32,7 +32,7 @@ class DocumentSettingManager :
sal_uInt16 mnLinkUpdMode; //< UpdateMode for links.
SwFieldUpdateFlags meFieldUpdMode;//< Automatically Update Mode for fields/charts.
- SwCharCompressType meChrCmprType;//< for ASIAN: compress punctuation/kana
+ CharCompressType meChrCmprType;//< for ASIAN: compress punctuation/kana
sal_uInt32 mn32DummyCompatibilityOptions1;
sal_uInt32 mn32DummyCompatibilityOptions2;
@@ -171,8 +171,8 @@ public:
virtual void setLinkUpdateMode( /*[in]*/ sal_uInt16 nMode ) override;
virtual SwFieldUpdateFlags getFieldUpdateFlags( /*[in]*/bool bGlobalSettings ) const override;
virtual void setFieldUpdateFlags( /*[in]*/ SwFieldUpdateFlags eMode ) override;
- virtual SwCharCompressType getCharacterCompressionType() const override;
- virtual void setCharacterCompressionType( /*[in]*/SwCharCompressType nType ) override;
+ virtual CharCompressType getCharacterCompressionType() const override;
+ virtual void setCharacterCompressionType( /*[in]*/CharCompressType nType ) override;
// Replace all compatibility options with those from rSource.
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index f2a3247e..c37319d 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -38,6 +38,7 @@
#include <editeng/scripttypeitem.hxx>
#include <editeng/charhiddenitem.hxx>
#include <vcl/outdev.hxx>
+#include <svl/asiancfg.hxx>
#include <editeng/blinkitem.hxx>
#include <tools/multisel.hxx>
#include <unotools/charclass.hxx>
@@ -739,7 +740,7 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL )
sal_Int16 nScript = i18n::ScriptType::LATIN;
// compression type
- const SwCharCompressType aCompEnum = rNode.getIDocumentSettingAccess()->getCharacterCompressionType();
+ const CharCompressType aCompEnum = rNode.getIDocumentSettingAccess()->getCharacterCompressionType();
// justification type
const bool bAdjustBlock = SVX_ADJUST_BLOCK ==
@@ -763,7 +764,7 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL )
break;
}
}
- if( CHARCOMPRESS_NONE != aCompEnum )
+ if( CharCompressType::NONE != aCompEnum )
{
while( nCntComp < CountCompChg() )
{
@@ -926,7 +927,7 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL )
// if current script is asian, we search for compressable characters
// in this range
- if ( CHARCOMPRESS_NONE != aCompEnum &&
+ if ( CharCompressType::NONE != aCompEnum &&
i18n::ScriptType::ASIAN == nScript )
{
CompType ePrevState = NONE;
@@ -966,7 +967,7 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL )
if ( ePrevState != NONE )
{
// insert start and type
- if ( CHARCOMPRESS_PUNCTUATION_KANA == aCompEnum ||
+ if ( CharCompressType::PunctuationAndKana == aCompEnum ||
ePrevState != KANA )
{
aCompressionChanges.push_back( CompressionChangeInfo(nPrevChg, nLastCompression - nPrevChg, ePrevState) );
@@ -984,7 +985,7 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL )
if ( ePrevState != NONE )
{
// insert start and type
- if ( CHARCOMPRESS_PUNCTUATION_KANA == aCompEnum ||
+ if ( CharCompressType::PunctuationAndKana == aCompEnum ||
ePrevState != KANA )
{
aCompressionChanges.push_back( CompressionChangeInfo(nPrevChg, nLastCompression - nPrevChg, ePrevState) );
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 7994b3d..11115fa 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -763,7 +763,7 @@ void WW8Export::ExportDopTypography(WW8DopTypography &rTypo)
const IDocumentSettingAccess& rIDocumentSettingAccess = GetWriter().getIDocumentSettingAccess();
rTypo.fKerningPunct = sal_uInt16(rIDocumentSettingAccess.get(DocumentSettingId::KERN_ASIAN_PUNCTUATION));
- rTypo.iJustification = m_pDoc->getIDocumentSettingAccess().getCharacterCompressionType();
+ rTypo.iJustification = sal_uInt16(m_pDoc->getIDocumentSettingAccess().getCharacterCompressionType());
}
// It can only be found something with this method, if it is used within
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 6bec800..29c0a35 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2030,7 +2030,7 @@ void SwWW8ImplReader::ImportDopTypography(const WW8DopTypography &rTypo)
}
m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::KERN_ASIAN_PUNCTUATION, rTypo.fKerningPunct);
- m_rDoc.getIDocumentSettingAccess().setCharacterCompressionType(static_cast<SwCharCompressType>(rTypo.iJustification));
+ m_rDoc.getIDocumentSettingAccess().setCharacterCompressionType((CharCompressType)rTypo.iJustification);
}
/**
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index 23361fc..a547c94 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -138,7 +138,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
}
m_pDoc->getIDocumentSettingAccess().set(DocumentSettingId::KERN_ASIAN_PUNCTUATION,
!aAsian.IsKerningWesternTextOnly());
- m_pDoc->getIDocumentSettingAccess().setCharacterCompressionType(static_cast<SwCharCompressType>(aAsian.GetCharDistanceCompression()));
+ m_pDoc->getIDocumentSettingAccess().setCharacterCompressionType(aAsian.GetCharDistanceCompression());
m_pDoc->getIDocumentDeviceAccess().setPrintData(*SW_MOD()->GetPrtOptions(bWeb));
}
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index f207b3a..660046d 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -44,6 +44,7 @@
#include <sfx2/zoomitem.hxx>
#include <unomod.hxx>
#include <vcl/svapp.hxx>
+#include <svl/asiancfg.hxx>
#include <comphelper/servicehelper.hxx>
#include "swmodule.hxx"
@@ -449,16 +450,16 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
{
sal_Int16 nMode = 0;
rValue >>= nMode;
- switch (nMode)
+ switch ((CharCompressType)nMode)
{
- case CHARCOMPRESS_NONE:
- case CHARCOMPRESS_PUNCTUATION:
- case CHARCOMPRESS_PUNCTUATION_KANA:
+ case CharCompressType::NONE:
+ case CharCompressType::PunctuationOnly:
+ case CharCompressType::PunctuationAndKana:
break;
default:
throw IllegalArgumentException();
}
- mpDoc->getIDocumentSettingAccess().setCharacterCompressionType(static_cast < SwCharCompressType > (nMode) );
+ mpDoc->getIDocumentSettingAccess().setCharacterCompressionType((CharCompressType)nMode);
}
break;
case HANDLE_APPLY_USER_DATA:
commit 80d2fa87fdaf67615d7b8128f3c05b239a1f1c05
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Feb 10 15:36:48 2017 +0200
convert IsAttrAtPos to scoped o3tl::typed_flags
Change-Id: Ie3a361a96201cb1a0ab446bcf77b7c0e79e05e89
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 6671885..bcb9eb4 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -24,6 +24,7 @@
#include <rtl/ustring.hxx>
#include <tools/link.hxx>
#include <vcl/keycod.hxx>
+#include <o3tl/typed_flags_set.hxx>
#include <IShellCursorSupplier.hxx>
#include "swdllapi.h"
@@ -80,29 +81,34 @@ namespace com { namespace sun { namespace star { namespace container {
// enum and struct to get information via the Doc-Position
-struct SwContentAtPos
+enum class IsAttrAtPos
{
- enum IsAttrAtPos
- {
- SW_NOTHING = 0x0000,
- SW_FIELD = 0x0001,
- SW_CLICKFIELD = 0x0002,
- SW_FTN = 0x0004,
- SW_INETATTR = 0x0008,
- SW_TABLEBOXFML = 0x0010,
- SW_REDLINE = 0x0020,
- SW_OUTLINE = 0x0040,
- SW_TOXMARK = 0x0080,
- SW_REFMARK = 0x0100,
- SW_NUMLABEL = 0x0200,
- SW_CONTENT_CHECK = 0x0400,
- SW_SMARTTAG = 0x0800,
- SW_FORMCTRL = 0x1000
+ NONE = 0x0000,
+ Field = 0x0001,
+ ClickField = 0x0002,
+ Ftn = 0x0004,
+ InetAttr = 0x0008,
+ TableBoxFml = 0x0010,
+ Redline = 0x0020,
+ Outline = 0x0040,
+ ToxMark = 0x0080,
+ RefMark = 0x0100,
+ NumLabel = 0x0200,
+ ContentCheck = 0x0400,
+ SmartTag = 0x0800,
+ FormControl = 0x1000
#ifdef DBG_UTIL
- ,SW_CURR_ATTRS = 0x4000 ///< only for debugging
- ,SW_TABLEBOXVALUE = 0x8000 ///< only for debugging
+ ,CurrAttrs = 0x2000 ///< only for debugging
+ ,TableBoxValue = 0x4000 ///< only for debugging
#endif
- } eContentAtPos;
+};
+namespace o3tl {
+ template<> struct typed_flags<IsAttrAtPos> : is_typed_flags<IsAttrAtPos, 0x7fff> {};
+}
+
+struct SwContentAtPos
+{
+ IsAttrAtPos eContentAtPos;
union {
const SwField* pField;
@@ -117,8 +123,8 @@ struct SwContentAtPos
OUString sStr;
const SwTextAttr* pFndTextAttr;
- SwContentAtPos( int eGetAtPos )
- : eContentAtPos( (IsAttrAtPos)eGetAtPos )
+ SwContentAtPos( IsAttrAtPos eGetAtPos )
+ : eContentAtPos( eGetAtPos )
{
aFnd.pField = nullptr;
pFndTextAttr = nullptr;
@@ -126,7 +132,7 @@ struct SwContentAtPos
}
bool IsInProtectSect() const;
- bool IsInRTLText()const;
+ bool IsInRTLText() const;
};
// return values of SetCursor (can be combined via ||)
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 4424cf4..a9858e1 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1132,12 +1132,12 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
SwTextAttr* pTextAttr;
SwCursorMoveState aTmpState;
aTmpState.m_bFieldInfo = true;
- aTmpState.m_bExactOnly = !( SwContentAtPos::SW_OUTLINE & rContentAtPos.eContentAtPos );
- aTmpState.m_bContentCheck = (SwContentAtPos::SW_CONTENT_CHECK & rContentAtPos.eContentAtPos) != 0;
+ aTmpState.m_bExactOnly = !( IsAttrAtPos::Outline & rContentAtPos.eContentAtPos );
+ aTmpState.m_bContentCheck = bool(IsAttrAtPos::ContentCheck & rContentAtPos.eContentAtPos);
aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
SwSpecialPos aSpecialPos;
- aTmpState.m_pSpecialPos = ( SwContentAtPos::SW_SMARTTAG & rContentAtPos.eContentAtPos ) ?
+ aTmpState.m_pSpecialPos = ( IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos ) ?
&aSpecialPos : nullptr;
const bool bCursorFoundExact = GetLayout()->GetCursorOfst( &aPos, aPt, &aTmpState );
@@ -1145,24 +1145,24 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
const SwNodes& rNds = GetDoc()->GetNodes();
if( pTextNd
- && SwContentAtPos::SW_OUTLINE & rContentAtPos.eContentAtPos
+ && IsAttrAtPos::Outline & rContentAtPos.eContentAtPos
&& !rNds.GetOutLineNds().empty() )
{
const SwTextNode* pONd = pTextNd->FindOutlineNodeOfLevel( MAXLEVEL-1);
if( pONd )
{
- rContentAtPos.eContentAtPos = SwContentAtPos::SW_OUTLINE;
+ rContentAtPos.eContentAtPos = IsAttrAtPos::Outline;
rContentAtPos.sStr = pONd->GetExpandText( 0, -1, true, true );
bRet = true;
}
}
- else if ( SwContentAtPos::SW_CONTENT_CHECK & rContentAtPos.eContentAtPos
+ else if ( IsAttrAtPos::ContentCheck & rContentAtPos.eContentAtPos
&& bCursorFoundExact )
{
bRet = true;
}
else if( pTextNd
- && SwContentAtPos::SW_NUMLABEL & rContentAtPos.eContentAtPos)
+ && IsAttrAtPos::NumLabel & rContentAtPos.eContentAtPos)
{
bRet = aTmpState.m_bInNumPortion;
rContentAtPos.aFnd.pNode = pTextNd;
@@ -1176,7 +1176,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
if( !aTmpState.m_bPosCorr )
{
if ( !bRet
- && SwContentAtPos::SW_SMARTTAG & rContentAtPos.eContentAtPos
+ && IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos
&& !aTmpState.m_bFootnoteNoInfo )
{
const SwWrongList* pSmartTagList = pTextNd->GetSmartTags();
@@ -1211,7 +1211,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
}
if( bRet )
{
- rContentAtPos.eContentAtPos = SwContentAtPos::SW_SMARTTAG;
+ rContentAtPos.eContentAtPos = IsAttrAtPos::SmartTag;
if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) )
pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState );
@@ -1220,14 +1220,14 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
}
if ( !bRet
- && ( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_CLICKFIELD ) & rContentAtPos.eContentAtPos
+ && ( IsAttrAtPos::Field | IsAttrAtPos::ClickField ) & rContentAtPos.eContentAtPos
&& !aTmpState.m_bFootnoteNoInfo )
{
pTextAttr = pTextNd->GetFieldTextAttrAt( aPos.nContent.GetIndex() );
const SwField* pField = pTextAttr != nullptr
? pTextAttr->GetFormatField().GetField()
: nullptr;
- if ( SwContentAtPos::SW_CLICKFIELD & rContentAtPos.eContentAtPos
+ if ( IsAttrAtPos::ClickField & rContentAtPos.eContentAtPos
&& pField && !pField->HasClickHdl() )
{
pField = nullptr;
@@ -1248,7 +1248,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
{
// allow click fields in protected sections
// only placeholder is not possible
- if( SwContentAtPos::SW_FIELD & rContentAtPos.eContentAtPos
+ if( IsAttrAtPos::Field & rContentAtPos.eContentAtPos
|| RES_JUMPEDITFLD == pField->Which() )
pField = nullptr;
}
@@ -1270,23 +1270,23 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
{
rContentAtPos.aFnd.pField = pField;
rContentAtPos.pFndTextAttr = pTextAttr;
- rContentAtPos.eContentAtPos = SwContentAtPos::SW_FIELD;
+ rContentAtPos.eContentAtPos = IsAttrAtPos::Field;
bRet = true;
}
}
- if( !bRet && SwContentAtPos::SW_FORMCTRL & rContentAtPos.eContentAtPos )
+ if( !bRet && IsAttrAtPos::FormControl & rContentAtPos.eContentAtPos )
{
IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
sw::mark::IFieldmark* pFieldBookmark = pMarksAccess->getFieldmarkFor( aPos );
if( bCursorFoundExact && pTextNd && pFieldBookmark) {
- rContentAtPos.eContentAtPos = SwContentAtPos::SW_FORMCTRL;
+ rContentAtPos.eContentAtPos = IsAttrAtPos::FormControl;
rContentAtPos.aFnd.pFieldmark = pFieldBookmark;
bRet=true;
}
}
- if( !bRet && SwContentAtPos::SW_FTN & rContentAtPos.eContentAtPos )
+ if( !bRet && IsAttrAtPos::Ftn & rContentAtPos.eContentAtPos )
{
if( aTmpState.m_bFootnoteNoInfo )
{
@@ -1299,7 +1299,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
bRet = false;
}
if( bRet )
- rContentAtPos.eContentAtPos = SwContentAtPos::SW_FTN;
+ rContentAtPos.eContentAtPos = IsAttrAtPos::Ftn;
}
else if ( nullptr != ( pTextAttr = pTextNd->GetTextAttrForCharAt(
aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
@@ -1329,7 +1329,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
if( bRet )
{
- rContentAtPos.eContentAtPos = SwContentAtPos::SW_FTN;
+ rContentAtPos.eContentAtPos = IsAttrAtPos::Ftn;
rContentAtPos.pFndTextAttr = pTextAttr;
rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
@@ -1340,11 +1340,11 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
}
if( !bRet
- && ( SwContentAtPos::SW_TOXMARK | SwContentAtPos::SW_REFMARK ) & rContentAtPos.eContentAtPos
+ && ( IsAttrAtPos::ToxMark | IsAttrAtPos::RefMark ) & rContentAtPos.eContentAtPos
&& !aTmpState.m_bFootnoteNoInfo )
{
pTextAttr = nullptr;
- if( SwContentAtPos::SW_TOXMARK & rContentAtPos.eContentAtPos )
+ if( IsAttrAtPos::ToxMark & rContentAtPos.eContentAtPos )
{
std::vector<SwTextAttr *> const marks(
pTextNd->GetTextAttrsAt(
@@ -1356,7 +1356,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
}
if( !pTextAttr &&
- SwContentAtPos::SW_REFMARK & rContentAtPos.eContentAtPos )
+ IsAttrAtPos::RefMark & rContentAtPos.eContentAtPos )
{
std::vector<SwTextAttr *> const marks(
pTextNd->GetTextAttrsAt(
@@ -1394,8 +1394,8 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
rContentAtPos.eContentAtPos =
RES_TXTATR_TOXMARK == pTextAttr->Which()
- ? SwContentAtPos::SW_TOXMARK
- : SwContentAtPos::SW_REFMARK;
+ ? IsAttrAtPos::ToxMark
+ : IsAttrAtPos::RefMark;
rContentAtPos.pFndTextAttr = pTextAttr;
rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
@@ -1406,7 +1406,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
}
if ( !bRet
- && SwContentAtPos::SW_INETATTR & rContentAtPos.eContentAtPos
+ && IsAttrAtPos::InetAttr & rContentAtPos.eContentAtPos
&& !aTmpState.m_bFootnoteNoInfo )
{
pTextAttr = pTextNd->GetTextAttrAt(
@@ -1435,7 +1435,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
rContentAtPos.sStr = pTextNd->GetExpandText(nSt, nEnd-nSt);
rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr();
- rContentAtPos.eContentAtPos = SwContentAtPos::SW_INETATTR;
+ rContentAtPos.eContentAtPos = IsAttrAtPos::InetAttr;
rContentAtPos.pFndTextAttr = pTextAttr;
if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) )
@@ -1452,13 +1452,13 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
}
}
- if( !bRet && SwContentAtPos::SW_REDLINE & rContentAtPos.eContentAtPos )
+ if( !bRet && IsAttrAtPos::Redline & rContentAtPos.eContentAtPos )
{
const SwRangeRedline* pRedl = GetDoc()->getIDocumentRedlineAccess().GetRedline(aPos, nullptr);
if( pRedl )
{
rContentAtPos.aFnd.pRedl = pRedl;
- rContentAtPos.eContentAtPos = SwContentAtPos::SW_REDLINE;
+ rContentAtPos.eContentAtPos = IsAttrAtPos::Redline;
rContentAtPos.pFndTextAttr = nullptr;
bRet = true;
@@ -1469,9 +1469,9 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
}
if( !bRet
- && ( SwContentAtPos::SW_TABLEBOXFML & rContentAtPos.eContentAtPos
+ && ( IsAttrAtPos::TableBoxFml & rContentAtPos.eContentAtPos
#ifdef DBG_UTIL
- || SwContentAtPos::SW_TABLEBOXVALUE & rContentAtPos.eContentAtPos
+ || IsAttrAtPos::TableBoxValue & rContentAtPos.eContentAtPos
#endif
) )
{
@@ -1514,10 +1514,10 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
{
// create from internal (for CORE) the external
// (for UI) formula
- rContentAtPos.eContentAtPos = SwContentAtPos::SW_TABLEBOXFML;
+ rContentAtPos.eContentAtPos = IsAttrAtPos::TableBoxFml;
#ifdef DBG_UTIL
if( RES_BOXATR_VALUE == pItem->Which() )
- rContentAtPos.eContentAtPos = SwContentAtPos::SW_TABLEBOXVALUE;
+ rContentAtPos.eContentAtPos = IsAttrAtPos::TableBoxValue;
else
#endif
const_cast<SwTableBoxFormula*>(static_cast<const SwTableBoxFormula*>(pItem))->PtrToBoxNm( &pTableNd->GetTable() );
@@ -1550,7 +1550,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
}
#ifdef DBG_UTIL
- if( !bRet && SwContentAtPos::SW_CURR_ATTRS & rContentAtPos.eContentAtPos )
+ if( !bRet && IsAttrAtPos::CurrAttrs & rContentAtPos.eContentAtPos )
{
const sal_Int32 n = aPos.nContent.GetIndex();
SfxItemSet aSet( GetDoc()->GetAttrPool(), POOLATTR_BEGIN,
@@ -1627,7 +1627,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
}
}
bRet = true;
- rContentAtPos.eContentAtPos = SwContentAtPos::SW_CURR_ATTRS;
+ rContentAtPos.eContentAtPos = IsAttrAtPos::CurrAttrs;
}
#endif
}
@@ -1635,7 +1635,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
if( !bRet )
{
- rContentAtPos.eContentAtPos = SwContentAtPos::SW_NOTHING;
+ rContentAtPos.eContentAtPos = IsAttrAtPos::NONE;
rContentAtPos.aFnd.pField = nullptr;
}
return bRet;
@@ -1672,16 +1672,16 @@ bool SwContentAtPos::IsInProtectSect() const
{
switch( eContentAtPos )
{
- case SW_FIELD:
- case SW_CLICKFIELD:
+ case IsAttrAtPos::Field:
+ case IsAttrAtPos::ClickField:
pNd = static_txtattr_cast<SwTextField const*>(pFndTextAttr)->GetpTextNode();
break;
- case SW_FTN:
+ case IsAttrAtPos::Ftn:
pNd = &static_cast<const SwTextFootnote*>(pFndTextAttr)->GetTextNode();
break;
- case SW_INETATTR:
+ case IsAttrAtPos::InetAttr:
pNd = static_txtattr_cast<SwTextINetFormat const*>(pFndTextAttr)->GetpTextNode();
break;
@@ -1700,7 +1700,7 @@ bool SwContentAtPos::IsInRTLText()const
{
bool bRet = false;
const SwTextNode* pNd = nullptr;
- if (pFndTextAttr && (eContentAtPos == SW_FTN))
+ if (pFndTextAttr && (eContentAtPos == IsAttrAtPos::Ftn))
{
const SwTextFootnote* pTextFootnote = static_cast<const SwTextFootnote*>(pFndTextAttr);
if(pTextFootnote->GetStartNode())
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index c795569..094a8fe 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1987,8 +1987,7 @@ SwTextNode * SwFEShell::GetNumRuleNodeAtPos( const Point &rPt)
{
SwTextNode * pResult = nullptr;
- SwContentAtPos aContentAtPos
- (SwContentAtPos::SW_NUMLABEL);
+ SwContentAtPos aContentAtPos(IsAttrAtPos::NumLabel);
if( GetContentAtPos(rPt, aContentAtPos) && aContentAtPos.aFnd.pNode)
pResult = aContentAtPos.aFnd.pNode->GetTextNode();
@@ -2000,8 +1999,7 @@ bool SwFEShell::IsNumLabel( const Point &rPt, int nMaxOffset )
{
bool bResult = false;
- SwContentAtPos aContentAtPos
- (SwContentAtPos::SW_NUMLABEL);
+ SwContentAtPos aContentAtPos(IsAttrAtPos::NumLabel);
if( GetContentAtPos(rPt, aContentAtPos))
{
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 8ddf144..190afa6 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -453,7 +453,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo
if( nSelectionType & nsSelectionType::SEL_TXT && !m_pWrtShell->HasMark() )
{
- SwContentAtPos aContentAtPos( SwContentAtPos::SW_INETATTR );
+ SwContentAtPos aContentAtPos( IsAttrAtPos::InetAttr );
Point aPos( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY());
@@ -3115,7 +3115,7 @@ void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos )
else if( nSelection & nsSelectionType::SEL_TXT && !m_pWrtShell->HasMark() )
{
// is only one field - selected?
- SwContentAtPos aContentAtPos( SwContentAtPos::SW_INETATTR );
+ SwContentAtPos aContentAtPos( IsAttrAtPos::InetAttr );
Point aPos( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY());
if( m_pWrtShell->GetContentAtPos( aPos, aContentAtPos ) )
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index efdd971..5180568 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -119,7 +119,7 @@ void SidebarTextControl::RequestHelp(const HelpEvent &rEvt)
default: nResId = 0;
}
- SwContentAtPos aContentAtPos( SwContentAtPos::SW_REDLINE );
+ SwContentAtPos aContentAtPos( IsAttrAtPos::Redline );
if ( nResId &&
mrDocView.GetWrtShell().GetContentAtPos( mrSidebarWin.GetAnchorPos(), aContentAtPos ) )
{
diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx
index f4d8f7c..fa6c3ca 100644
--- a/sw/source/uibase/docvw/edtdd.cxx
+++ b/sw/source/uibase/docvw/edtdd.cxx
@@ -103,7 +103,7 @@ void SwEditWin::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel )
}
else
{
- SwContentAtPos aSwContentAtPos( SwContentAtPos::SW_INETATTR );
+ SwContentAtPos aSwContentAtPos( IsAttrAtPos::InetAttr );
bStart = rSh.GetContentAtPos( aDocPos,
aSwContentAtPos );
}
@@ -446,7 +446,7 @@ sal_Int8 SwEditWin::AcceptDrop( const AcceptDropEvent& rEvt )
SotExchangeDest::SWDOC_FREE_AREA == m_nDropDestination )
{
CleanupDropUserMarker();
- SwContentAtPos aCont( SwContentAtPos::SW_CONTENT_CHECK );
+ SwContentAtPos aCont( IsAttrAtPos::ContentCheck );
if(rSh.GetContentAtPos(aDocPt, aCont))
rSh.SwCursorShell::SetVisibleCursor( aDocPt );
}
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index a5a350f..1ac0c29 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -560,19 +560,19 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
else
{
// Even if we already have something, prefer URLs if possible.
- SwContentAtPos aUrlPos(SwContentAtPos::SW_INETATTR);
+ SwContentAtPos aUrlPos(IsAttrAtPos::InetAttr);
if (bCntAtPos || rSh.GetContentAtPos(rLPt, aUrlPos))
{
SwContentAtPos aSwContentAtPos(
- SwContentAtPos::SW_FIELD |
- SwContentAtPos::SW_CLICKFIELD |
- SwContentAtPos::SW_INETATTR |
- SwContentAtPos::SW_FTN |
- SwContentAtPos::SW_SMARTTAG );
+ IsAttrAtPos::Field |
+ IsAttrAtPos::ClickField |
+ IsAttrAtPos::InetAttr |
+ IsAttrAtPos::Ftn |
+ IsAttrAtPos::SmartTag );
if( rSh.GetContentAtPos( rLPt, aSwContentAtPos) )
{
// Is edit inline input field
- if (SwContentAtPos::SW_FIELD == aSwContentAtPos.eContentAtPos)
+ if (IsAttrAtPos::Field == aSwContentAtPos.eContentAtPos)
{
if ( aSwContentAtPos.pFndTextAttr != nullptr
&& aSwContentAtPos.pFndTextAttr->Which() == RES_TXTATR_INPUTFIELD)
@@ -584,11 +584,11 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
}
else
{
- const bool bClickToFollow = SwContentAtPos::SW_INETATTR == aSwContentAtPos.eContentAtPos ||
- SwContentAtPos::SW_SMARTTAG == aSwContentAtPos.eContentAtPos;
+ const bool bClickToFollow = IsAttrAtPos::InetAttr == aSwContentAtPos.eContentAtPos ||
+ IsAttrAtPos::SmartTag == aSwContentAtPos.eContentAtPos;
if( !bClickToFollow ||
- (SwContentAtPos::SW_INETATTR == aSwContentAtPos.eContentAtPos && bExecHyperlinks) ||
- (SwContentAtPos::SW_SMARTTAG == aSwContentAtPos.eContentAtPos && bExecSmarttags) )
+ (IsAttrAtPos::InetAttr == aSwContentAtPos.eContentAtPos && bExecHyperlinks) ||
+ (IsAttrAtPos::SmartTag == aSwContentAtPos.eContentAtPos && bExecSmarttags) )
eStyle = PointerStyle::RefHand;
}
}
@@ -2736,7 +2736,7 @@ void SwEditWin::RstMBDownFlags()
*/
static bool lcl_urlOverBackground(SwWrtShell& rSh, const Point& rDocPos)
{
- SwContentAtPos aSwContentAtPos(SwContentAtPos::SW_INETATTR);
+ SwContentAtPos aSwContentAtPos(IsAttrAtPos::InetAttr);
SdrObject* pSelectableObj = rSh.GetObjAt(rDocPos);
return rSh.GetContentAtPos(rDocPos, aSwContentAtPos) && pSelectableObj->GetLayer() == rSh.GetDoc()->getIDocumentDrawModelAccess().GetHellId();
@@ -3598,8 +3598,8 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
if( bExecHyperlinks )
{
SwContentAtPos aContentAtPos(
- SwContentAtPos::SW_FTN |
- SwContentAtPos::SW_INETATTR );
+ IsAttrAtPos::Ftn |
+ IsAttrAtPos::InetAttr );
if( rSh.GetContentAtPos( aDocPos, aContentAtPos ) )
{
@@ -3625,8 +3625,8 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
default:
if( !rSh.IsViewLocked() )
{
- SwContentAtPos aContentAtPos( SwContentAtPos::SW_CLICKFIELD |
- SwContentAtPos::SW_INETATTR );
+ SwContentAtPos aContentAtPos( IsAttrAtPos::ClickField |
+ IsAttrAtPos::InetAttr );
if( rSh.GetContentAtPos( aDocPos, aContentAtPos ) &&
!rSh.IsReadOnlyAvailable() &&
aContentAtPos.IsInProtectSect() )
@@ -3640,7 +3640,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
rSh.ClearGCAttr();
}
- SwContentAtPos aFieldAtPos(SwContentAtPos::SW_FIELD);
+ SwContentAtPos aFieldAtPos(IsAttrAtPos::Field);
bool bEditableFieldClicked = false;
// Are we clicking on a field?
@@ -3717,7 +3717,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
&& static_cast< sal_uInt8 >(rMEvt.GetClicks() % 4) == 1
&& !rSh.TestCurrPam( aDocPos ) )
{
- SwContentAtPos aFieldAtPos(SwContentAtPos::SW_FIELD);
+ SwContentAtPos aFieldAtPos(IsAttrAtPos::Field);
// Are we clicking on a field?
if (g_bValidCursorPos
@@ -4163,9 +4163,9 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
break;
}
// change ui if mouse is over SwPostItField
- // TODO: do the same thing for redlines SW_REDLINE
+ // TODO: do the same thing for redlines IsAttrAtPos::Redline
SwRect aFieldRect;
- SwContentAtPos aContentAtPos( SwContentAtPos::SW_FIELD);
+ SwContentAtPos aContentAtPos( IsAttrAtPos::Field);
if( rSh.GetContentAtPos( aDocPt, aContentAtPos, false, &aFieldRect ) )
{
const SwField* pField = aContentAtPos.aFnd.pField;
@@ -4191,7 +4191,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt)
const SwFrameFormat* pFormat = nullptr;
const SwFormatINetFormat* pINet = nullptr;
- SwContentAtPos aContentAtPos( SwContentAtPos::SW_INETATTR );
+ SwContentAtPos aContentAtPos( IsAttrAtPos::InetAttr );
if( rSh.GetContentAtPos( aDocPt, aContentAtPos ) )
pINet = static_cast<const SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr);
@@ -4556,7 +4556,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
}
else
{
- SwContentAtPos aFieldAtPos ( SwContentAtPos::SW_FIELD );
+ SwContentAtPos aFieldAtPos ( IsAttrAtPos::Field );
if ( !rSh.IsInSelect() && rSh.TestCurrPam( aDocPt ) &&
!rSh.GetContentAtPos( aDocPt, aFieldAtPos ) )
{
@@ -4598,15 +4598,15 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
if(m_pApplyTempl)
bExecHyperlinks = false;
- SwContentAtPos aContentAtPos( SwContentAtPos::SW_FIELD |
- SwContentAtPos::SW_INETATTR |
- SwContentAtPos::SW_SMARTTAG | SwContentAtPos::SW_FORMCTRL);
+ SwContentAtPos aContentAtPos( IsAttrAtPos::Field |
+ IsAttrAtPos::InetAttr |
+ IsAttrAtPos::SmartTag | IsAttrAtPos::FormControl);
if( rSh.GetContentAtPos( aDocPt, aContentAtPos ) )
{
// Do it again if we're not on a field/hyperlink to update the cursor accordingly
- if ( SwContentAtPos::SW_FIELD != aContentAtPos.eContentAtPos
- && SwContentAtPos::SW_INETATTR != aContentAtPos.eContentAtPos )
+ if ( IsAttrAtPos::Field != aContentAtPos.eContentAtPos
+ && IsAttrAtPos::InetAttr != aContentAtPos.eContentAtPos )
rSh.GetContentAtPos( aDocPt, aContentAtPos, true );
bool bViewLocked = rSh.IsViewLocked();
@@ -4616,7 +4616,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
ReleaseMouse();
- if( SwContentAtPos::SW_FIELD == aContentAtPos.eContentAtPos )
+ if( IsAttrAtPos::Field == aContentAtPos.eContentAtPos )
{
bool bAddMode(false);
// AdditionalMode if applicable
@@ -4655,13 +4655,13 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
rSh.LeaveAddMode();
}
}
- else if ( SwContentAtPos::SW_SMARTTAG == aContentAtPos.eContentAtPos )
+ else if ( IsAttrAtPos::SmartTag == aContentAtPos.eContentAtPos )
{
// execute smarttag menu
if ( bExecSmarttags && SwSmartTagMgr::Get().IsSmartTagsEnabled() )
m_rView.ExecSmartTagPopup( aDocPt );
}
- else if ( SwContentAtPos::SW_FORMCTRL == aContentAtPos.eContentAtPos )
+ else if ( IsAttrAtPos::FormControl == aContentAtPos.eContentAtPos )
{
OSL_ENSURE( aContentAtPos.aFnd.pFieldmark != nullptr, "where is my field ptr???");
if ( aContentAtPos.aFnd.pFieldmark != nullptr)
@@ -4682,7 +4682,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
}
}
}
- else if ( SwContentAtPos::SW_INETATTR == aContentAtPos.eContentAtPos )
+ else if ( IsAttrAtPos::InetAttr == aContentAtPos.eContentAtPos )
{
if ( bExecHyperlinks && aContentAtPos.aFnd.pAttr )
rSh.ClickToINetAttr( *static_cast<const SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr), nFilter );
@@ -4693,7 +4693,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
}
else
{
- aContentAtPos = SwContentAtPos( SwContentAtPos::SW_FTN );
+ aContentAtPos = SwContentAtPos( IsAttrAtPos::Ftn );
if( !rSh.GetContentAtPos( aDocPt, aContentAtPos, true ) && bExecHyperlinks )
{
SdrViewEvent aVEvt;
diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx
index 14e031b..5d17318 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -129,42 +129,42 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
if( bContinue && bQuickBalloon)
{
SwRect aFieldRect;
- SwContentAtPos aContentAtPos( SwContentAtPos::SW_FIELD |
- SwContentAtPos::SW_INETATTR |
- SwContentAtPos::SW_FTN |
- SwContentAtPos::SW_REDLINE |
- SwContentAtPos::SW_TOXMARK |
- SwContentAtPos::SW_REFMARK |
- SwContentAtPos::SW_SMARTTAG |
+ SwContentAtPos aContentAtPos( IsAttrAtPos::Field |
+ IsAttrAtPos::InetAttr |
+ IsAttrAtPos::Ftn |
+ IsAttrAtPos::Redline |
+ IsAttrAtPos::ToxMark |
+ IsAttrAtPos::RefMark |
+ IsAttrAtPos::SmartTag |
#ifdef DBG_UTIL
- SwContentAtPos::SW_TABLEBOXVALUE |
- ( bBalloon ? SwContentAtPos::SW_CURR_ATTRS : 0) |
+ IsAttrAtPos::TableBoxValue |
+ ( bBalloon ? IsAttrAtPos::CurrAttrs : IsAttrAtPos::NONE) |
#endif
- SwContentAtPos::SW_TABLEBOXFML );
+ IsAttrAtPos::TableBoxFml );
if( rSh.GetContentAtPos( aPos, aContentAtPos, false, &aFieldRect ) )
{
QuickHelpFlags nStyle = QuickHelpFlags::NONE; // style of quick help
switch( aContentAtPos.eContentAtPos )
{
- case SwContentAtPos::SW_TABLEBOXFML:
+ case IsAttrAtPos::TableBoxFml:
sText = "= ";
sText += static_cast<const SwTableBoxFormula*>(aContentAtPos.aFnd.pAttr)->GetFormula();
break;
#ifdef DBG_UTIL
- case SwContentAtPos::SW_TABLEBOXVALUE:
+ case IsAttrAtPos::TableBoxValue:
{
sText = OStringToOUString(OString::number(
static_cast<const SwTableBoxValue*>(aContentAtPos.aFnd.pAttr)->GetValue()),
osl_getThreadTextEncoding());
}
break;
- case SwContentAtPos::SW_CURR_ATTRS:
+ case IsAttrAtPos::CurrAttrs:
sText = aContentAtPos.sStr;
break;
#endif
- case SwContentAtPos::SW_INETATTR:
+ case IsAttrAtPos::InetAttr:
{
sText = static_cast<const SfxStringItem*>(aContentAtPos.aFnd.pAttr)->GetValue();
sText = URIHelper::removePassword( sText,
@@ -230,7 +230,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
}
break;
}
- case SwContentAtPos::SW_SMARTTAG:
+ case IsAttrAtPos::SmartTag:
{
vcl::KeyCode aCode( KEY_SPACE );
vcl::KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 );
@@ -241,7 +241,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
}
break;
- case SwContentAtPos::SW_FTN:
+ case IsAttrAtPos::Ftn:
if( aContentAtPos.pFndTextAttr && aContentAtPos.aFnd.pAttr )
{
const SwFormatFootnote* pFootnote = static_cast<const SwFormatFootnote*>(aContentAtPos.aFnd.pAttr);
@@ -255,11 +255,11 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
}
break;
- case SwContentAtPos::SW_REDLINE:
+ case IsAttrAtPos::Redline:
sText = lcl_GetRedlineHelp(*aContentAtPos.aFnd.pRedl, bBalloon);
break;
- case SwContentAtPos::SW_TOXMARK:
+ case IsAttrAtPos::ToxMark:
sText = aContentAtPos.sStr;
if( !sText.isEmpty() && aContentAtPos.pFndTextAttr )
{
@@ -272,7 +272,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
}
}
break;
- case SwContentAtPos::SW_REFMARK:
+ case IsAttrAtPos::RefMark:
if(aContentAtPos.aFnd.pAttr)
{
sText = SW_RESSTR(STR_CONTENT_TYPE_SINGLE_REFERENCE);
@@ -356,7 +356,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
if( sText.isEmpty() )
{
- aContentAtPos.eContentAtPos = SwContentAtPos::SW_REDLINE;
+ aContentAtPos.eContentAtPos = IsAttrAtPos::Redline;
if( rSh.GetContentAtPos( aPos, aContentAtPos, false, &aFieldRect ) )
sText = lcl_GetRedlineHelp(*aContentAtPos.aFnd.pRedl, bBalloon);
}
diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx
index 3e48e06..3f494bd 100644
--- a/sw/source/uibase/docvw/romenu.cxx
+++ b/sw/source/uibase/docvw/romenu.cxx
@@ -97,7 +97,7 @@ SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) :
rSh.IsURLGrfAtPos( rDocPos, &sURL, &sTargetFrameName, &sDescription );
if ( sURL.isEmpty() )
{
- SwContentAtPos aContentAtPos( SwContentAtPos::SW_INETATTR );
+ SwContentAtPos aContentAtPos( IsAttrAtPos::InetAttr );
if( rSh.GetContentAtPos( rDocPos, aContentAtPos))
{
const SwFormatINetFormat &rIItem = *static_cast<const SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr);
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 0c8e7df..477ce1f 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -721,7 +721,7 @@ IMPL_LINK( SwView, ScrollHdl, ScrollBar *, p, void )
aRect.Bottom() = aRect.Top();
OUString sPageStr( GetPageStr( nPhNum, nVirtNum, sDisplay ));
- SwContentAtPos aCnt( SwContentAtPos::SW_OUTLINE );
+ SwContentAtPos aCnt( IsAttrAtPos::Outline );
bool bSuccess = m_pWrtShell->GetContentAtPos(aPos, aCnt);
if (bSuccess && !aCnt.sStr.isEmpty())
{
commit f0c57266709509ae24cfb1615d136263fb1e8d60
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Feb 10 15:08:55 2017 +0200
convert DBConnURIType to scoped enum
and drop unused enumerators
DBCONN_MSJET
DBCONN_MSACE
Change-Id: I4036b8f98488bac8e38094320281aa41f42e9787
diff --git a/sw/inc/dbmgr.hxx b/sw/inc/dbmgr.hxx
index e1ad5f7..cc9c0b9 100644
--- a/sw/inc/dbmgr.hxx
+++ b/sw/inc/dbmgr.hxx
@@ -285,14 +285,12 @@ public:
SwDBManager(SwDoc* pDoc);
~SwDBManager();
- enum DBConnURITypes {
- DBCONN_UNKNOWN = 0,
- DBCONN_ODB,
- DBCONN_CALC,
- DBCONN_DBASE,
- DBCONN_FLAT,
- DBCONN_MSJET,
- DBCONN_MSACE
+ enum class DBConnURIType {
+ Unknown,
+ Odb,
+ Calc,
+ Dbase,
+ Flat
};
/// MailMergeEvent source
@@ -397,7 +395,7 @@ public:
static css::uno::Sequence<OUString> GetExistingDatabaseNames();
- static DBConnURITypes GetDBunoURI(const OUString &rURI, css::uno::Any &aURLAny);
+ static DBConnURIType GetDBunoURI(const OUString &rURI, css::uno::Any &aURLAny);
/**
Loads a data source from file and registers it.
@@ -414,7 +412,7 @@ public:
In case of success it returns the registered name, otherwise an empty string.
Optionally add a prefix to the registered DB name.
*/
- static OUString LoadAndRegisterDataSource(const DBConnURITypes type, const css::uno::Any &rUnoURI,
+ static OUString LoadAndRegisterDataSource(const DBConnURIType type, const css::uno::Any &rUnoURI,
const css::uno::Reference < css::beans::XPropertySet > *pSettings,
const OUString &rURI, const OUString *pPrefix, const OUString *pDestDir,
SwDocShell* pDocShell = nullptr);
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 59eff0e..e62aec5 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -2598,29 +2598,29 @@ OUString SwDBManager::LoadAndRegisterDataSource(SwDocShell* pDocShell)
uno::Any aURLAny;
uno::Reference< beans::XPropertySet > aSettings;
const OUString aURI( xFP->getSelectedFiles().getConstArray()[0] );
- const DBConnURITypes type = GetDBunoURI( aURI, aURLAny );
+ const DBConnURIType type = GetDBunoURI( aURI, aURLAny );
- if( DBCONN_FLAT == type )
+ if( DBConnURIType::Flat == type )
{
uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
uno::Reference < sdb::XTextConnectionSettings > xSettingsDlg = sdb::TextConnectionSettings::create(xContext);
if( xSettingsDlg->execute() )
aSettings.set( uno::Reference < beans::XPropertySet >( xSettingsDlg, uno::UNO_QUERY_THROW ) );
}
- sFind = LoadAndRegisterDataSource( type, aURLAny, DBCONN_FLAT == type ? &aSettings : nullptr, aURI, nullptr, nullptr, pDocShell );
+ sFind = LoadAndRegisterDataSource( type, aURLAny, DBConnURIType::Flat == type ? &aSettings : nullptr, aURI, nullptr, nullptr, pDocShell );
}
return sFind;
}
-SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, uno::Any &aURLAny)
+SwDBManager::DBConnURIType SwDBManager::GetDBunoURI(const OUString &rURI, uno::Any &aURLAny)
{
INetURLObject aURL( rURI );
OUString sExt( aURL.GetExtension() );
- DBConnURITypes type = DBCONN_UNKNOWN;
+ DBConnURIType type = DBConnURIType::Unknown;
if(sExt == "odb")
{
- type = DBCONN_ODB;
+ type = DBConnURIType::Odb;
}
else if(sExt.equalsIgnoreAsciiCase("sxc")
|| sExt.equalsIgnoreAsciiCase("ods")
@@ -2629,7 +2629,7 @@ SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, uno::
OUString sDBURL("sdbc:calc:");
sDBURL += aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
aURLAny <<= sDBURL;
- type = DBCONN_CALC;
+ type = DBConnURIType::Calc;
}
else if(sExt.equalsIgnoreAsciiCase("dbf"))
{
@@ -2638,7 +2638,7 @@ SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, uno::
OUString sDBURL("sdbc:dbase:");
sDBURL += aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
aURLAny <<= sDBURL;
- type = DBCONN_DBASE;
+ type = DBConnURIType::Dbase;
}
else if(sExt.equalsIgnoreAsciiCase("csv") || sExt.equalsIgnoreAsciiCase("txt"))
{
@@ -2648,7 +2648,7 @@ SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, uno::
//only the 'path' has to be added
sDBURL += aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE);
aURLAny <<= sDBURL;
- type = DBCONN_FLAT;
+ type = DBConnURIType::Flat;
}
#ifdef _WIN32
else if (sExt.equalsIgnoreAsciiCase("mdb") || sExt.equalsIgnoreAsciiCase("mde"))
@@ -2656,14 +2656,14 @@ SwDBManager::DBConnURITypes SwDBManager::GetDBunoURI(const OUString &rURI, uno::
OUString sDBURL("sdbc:ado:access:PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=");
sDBURL += aURL.PathToFileName();
aURLAny <<= sDBURL;
- type = DBCONN_MSJET;
+ type = DBConnURIType::MsJet;
}
else if (sExt.equalsIgnoreAsciiCase("accdb") || sExt.equalsIgnoreAsciiCase("accde"))
{
OUString sDBURL("sdbc:ado:PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=");
sDBURL += aURL.PathToFileName();
aURLAny <<= sDBURL;
- type = DBCONN_MSACE;
+ type = DBConnURIType::MsAce;
}
#endif
return type;
@@ -2682,7 +2682,7 @@ OUString lcl_getOwnURL(SwDocShell* pDocShell)
return aRet;
}
-OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const uno::Any &aURLAny, const uno::Reference< beans::XPropertySet > *pSettings,
+OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURIType type, const uno::Any &aURLAny, const uno::Reference< beans::XPropertySet > *pSettings,
const OUString &rURI, const OUString *pPrefix, const OUString *pDestDir, SwDocShell* pDocShell)
{
INetURLObject aURL( rURI );
@@ -2695,22 +2695,18 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const
uno::Sequence<OUString> aFilters(1);
switch (type) {
- case DBCONN_UNKNOWN:
- case DBCONN_CALC:
+ case DBConnURIType::Unknown:
+ case DBConnURIType::Calc:
break;
- case DBCONN_ODB:
+ case DBConnURIType::Odb:
bStore = false;
break;
- case DBCONN_FLAT:
- case DBCONN_DBASE:
+ case DBConnURIType::Flat:
+ case DBConnURIType::Dbase:
//set the filter to the file name without extension
aFilters[0] = aURL.getBase();
aTableFilterAny <<= aFilters;
break;
- case DBCONN_MSJET:
- case DBCONN_MSACE:
- aSuppressVersionsAny = uno::makeAny(true);
- break;
}
try
@@ -2755,7 +2751,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(const DBConnURITypes type, const
if(aInfoAny.hasValue())
xDataProperties->setPropertyValue("Info", aInfoAny);
- if( DBCONN_FLAT == type && pSettings )
+ if( DBConnURIType::Flat == type && pSettings )
{
uno::Any aSettings = xDataProperties->getPropertyValue( "Settings" );
uno::Reference < beans::XPropertySet > xDSSettings;
@@ -2824,7 +2820,7 @@ OUString SwDBManager::LoadAndRegisterDataSource(const OUString &rURI, const OUSt
const uno::Reference< beans::XPropertySet > *pSettings)
{
uno::Any aURLAny;
- DBConnURITypes type = GetDBunoURI( rURI, aURLAny );
+ DBConnURIType type = GetDBunoURI( rURI, aURLAny );
return LoadAndRegisterDataSource( type, aURLAny, pSettings, rURI, pPrefix, pDestDir );
}
commit b5c2f9dee910d26a07d3f796c882e6292ef5e8db
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Fri Feb 10 15:03:22 2017 +0200
convert CurRectType to scoped enum
and drop read-only enumerators
RECT_OUTTABSECTION_PRT
RECT_HEADERFOOTER_PRT
Change-Id: I2d7d159cf5f1a2022c015e37df4aa71cae1e266c
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 4b5af60..d3f2db3 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -135,22 +135,19 @@ enum ObjCntType
};
//For GetAnyCurRect
-enum CurRectType
+enum class CurRectType
{
- RECT_PAGE, ///< Rect of current page.
- RECT_PAGE_CALC, ///< ... page will be formatted if required.
- RECT_PAGE_PRT, ///< Rect of current PrtArea of page.
- RECT_FRM, ///< Rect of current frame.
- RECT_FLY_EMBEDDED, ///< Rect of current FlyFrame.
- RECT_FLY_PRT_EMBEDDED, ///< Rect of PrtArea of FlyFrame
- RECT_SECTION, ///< Rect of current section.
- RECT_OUTTABSECTION, ///< Rect of current section but outside of table.
- RECT_SECTION_PRT, ///< Rect of current PrtArea of section.
- RECT_OUTTABSECTION_PRT, ///< Rect of current PrtArea of section but outside table.
- RECT_HEADERFOOTER, ///< Rect of current header/footer
- RECT_HEADERFOOTER_PRT, ///< Rect of PrtArea of current headers/footers
-
- RECT_PAGES_AREA ///< Rect covering the pages area
+ Page, ///< Rect of current page.
+ PageCalc, ///< ... page will be formatted if required.
+ PagePrt, ///< Rect of current PrtArea of page.
+ Frame, ///< Rect of current frame.
+ FlyEmbedded, ///< Rect of current FlyFrame.
+ FlyEmbeddedPrt, ///< Rect of PrtArea of FlyFrame
+ Section, ///< Rect of current section.
+ SectionOutsideTable, ///< Rect of current section but outside of table.
+ SectionPrt, ///< Rect of current PrtArea of section.
+ HeaderFooter, ///< Rect of current header/footer
+ PagesArea ///< Rect covering the pages area
};
struct SwGetCurColNumPara
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 3f596e2..3c31570 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -111,50 +111,52 @@ const SwRect& SwFEShell::GetAnyCurRect( CurRectType eType, const Point* pPt,
bool bFrame = true;
switch ( eType )
{
- case RECT_PAGE_PRT: bFrame = false;
+ case CurRectType::PagePrt: bFrame = false;
SAL_FALLTHROUGH;
- case RECT_PAGE : pFrame = pFrame->FindPageFrame();
+ case CurRectType::Page : pFrame = pFrame->FindPageFrame();
break;
- case RECT_PAGE_CALC: pFrame->Calc(Imp()->GetShell()->GetOut());
+ case CurRectType::PageCalc:pFrame->Calc(Imp()->GetShell()->GetOut());
pFrame = pFrame->FindPageFrame();
pFrame->Calc(Imp()->GetShell()->GetOut());
break;
- case RECT_FLY_PRT_EMBEDDED: bFrame = false;
+ case CurRectType::FlyEmbeddedPrt:
+ bFrame = false;
SAL_FALLTHROUGH;
- case RECT_FLY_EMBEDDED: pFrame = xObj.is() ? FindFlyFrame( xObj )
+ case CurRectType::FlyEmbedded:
+ pFrame = xObj.is() ? FindFlyFrame( xObj )
: pFrame->IsFlyFrame()
? pFrame
: pFrame->FindFlyFrame();
break;
- case RECT_OUTTABSECTION_PRT:
- case RECT_OUTTABSECTION : if( pFrame->IsInTab() )
+ case CurRectType::SectionOutsideTable :
+ if( pFrame->IsInTab() )
pFrame = pFrame->FindTabFrame();
else {
OSL_FAIL( "Missing Table" );
}
SAL_FALLTHROUGH;
- case RECT_SECTION_PRT:
- case RECT_SECTION: if( pFrame->IsInSct() )
+ case CurRectType::SectionPrt:
+ case CurRectType::Section:
+ if( pFrame->IsInSct() )
pFrame = pFrame->FindSctFrame();
else {
OSL_FAIL( "Missing section" );
}
- if( RECT_OUTTABSECTION_PRT == eType ||
- RECT_SECTION_PRT == eType )
+ if( CurRectType::SectionPrt == eType )
bFrame = false;
break;
- case RECT_HEADERFOOTER_PRT: bFrame = false;
- SAL_FALLTHROUGH;
- case RECT_HEADERFOOTER: if( nullptr == (pFrame = pFrame->FindFooterOrHeader()) )
+ case CurRectType::HeaderFooter:
+ if( nullptr == (pFrame = pFrame->FindFooterOrHeader()) )
return GetLayout()->Frame();
break;
- case RECT_PAGES_AREA: return GetLayout()->GetPagesArea();
+ case CurRectType::PagesArea:
+ return GetLayout()->GetPagesArea();
default: break;
}
diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx
index 7e1428d..6fe5dde 100644
--- a/sw/source/ui/chrdlg/pardlg.cxx
+++ b/sw/source/ui/chrdlg/pardlg.cxx
@@ -186,7 +186,7 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
else if( nId == m_nParaStd )
{
aSet.Put(SfxUInt16Item(SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,
- static_cast< sal_uInt16 >(rSh.GetAnyCurRect(RECT_PAGE_PRT).Width()) ));
+ static_cast< sal_uInt16 >(rSh.GetAnyCurRect(CurRectType::PagePrt).Width()) ));
if (!bDrawParaDlg)
{
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index b448759..8a0a68a 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -719,8 +719,8 @@ IMPL_LINK( SwInsertDBColAutoPilot, TableFormatHdl, Button*, pButton, void )
else
nWidth = rSh.GetAnyCurRect(
(FrameTypeFlags::FLY_ANY & rSh.GetFrameType( nullptr, true ))
- ? RECT_FLY_PRT_EMBEDDED
- : RECT_PAGE_PRT ).Width();
+ ? CurRectType::FlyEmbeddedPrt
+ : CurRectType::PagePrt ).Width();
SwTabCols aTabCols;
aTabCols.SetRight( nWidth );
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx
index f2f9ff4..8e8a203 100644
--- a/sw/source/ui/dbui/mmlayoutpage.cxx
+++ b/sw/source/ui/dbui/mmlayoutpage.cxx
@@ -420,7 +420,7 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
{
//set the cursor to the desired position - if no text content is here then
//new paragraphs are inserted
- const SwRect& rPageRect = rShell.GetAnyCurRect(RECT_PAGE);
+ const SwRect& rPageRect = rShell.GetAnyCurRect(CurRectType::Page);
const Point aGreetingPos( DEFAULT_LEFT_DISTANCE + rPageRect.Left(), GREETING_TOP_DISTANCE );
const bool bRet = rShell.SetShadowCursorPos( aGreetingPos, FILL_SPACE );
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index f1f8842..7c1569b 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -2191,7 +2191,7 @@ void SwSectionIndentTabPage::SetWrtShell(SwWrtShell& rSh)
//set sensible values at the preview
m_pPreviewWin->SetAdjust(SVX_ADJUST_BLOCK);
m_pPreviewWin->SetLastLine(SVX_ADJUST_BLOCK);
- const SwRect& rPageRect = rSh.GetAnyCurRect( RECT_PAGE );
+ const SwRect& rPageRect = rSh.GetAnyCurRect( CurRectType::Page );
Size aPageSize(rPageRect.Width(), rPageRect.Height());
m_pPreviewWin->SetSize(aPageSize);
}
diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index 60a11be..757b2d7 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -552,7 +552,7 @@ void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh)
{
pWrtSh = pSh;
- const SwTwips nWidth = pWrtSh->GetAnyCurRect(RECT_FRM).Width();
+ const SwTwips nWidth = pWrtSh->GetAnyCurRect(CurRectType::Frame).Width();
m_pDistBorderMF->SetMax(m_pDistBorderMF->Normalize( nWidth ), FUNIT_TWIP );
m_pDistNumMF->SetMax(m_pDistNumMF->Normalize( nWidth ), FUNIT_TWIP);
@@ -568,7 +568,7 @@ void SwNumPositionTabPage::SetWrtShell(SwWrtShell* pSh)
m_pAlignedAtMF->SetLast(m_pAlignedAtMF->Normalize( nLast2 ), FUNIT_TWIP );
m_pIndentAtMF->SetLast(m_pIndentAtMF->Normalize( nLast2 ), FUNIT_TWIP );
- const SwRect& rPrtRect = pWrtSh->GetAnyCurRect(RECT_PAGE);
+ const SwRect& rPrtRect = pWrtSh->GetAnyCurRect(CurRectType::Page);
m_pPreviewWIN->SetPageWidth(rPrtRect.Width());
FieldUnit eMetric = ::GetDfltMetric( dynamic_cast<SwWebView*>( &pWrtSh->GetView()) != nullptr );
if(eMetric == FUNIT_MM)
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 4631e6c..68c1e15 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -430,12 +430,12 @@ void SwFrameShell::Execute(SfxRequest &rReq)
aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
}
- const SwRect &rPg = rSh.GetAnyCurRect(RECT_PAGE);
+ const SwRect &rPg = rSh.GetAnyCurRect(CurRectType::Page);
SwFormatFrameSize aFrameSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height());
aFrameSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
aSet.Put(aFrameSize);
- const SwRect &rPr = rSh.GetAnyCurRect(RECT_PAGE_PRT);
+ const SwRect &rPr = rSh.GetAnyCurRect(CurRectType::PagePrt);
SwFormatFrameSize aPrtSize(ATT_VAR_SIZE, rPr.Width(), rPr.Height());
aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA));
aSet.Put(aPrtSize);
@@ -446,9 +446,9 @@ void SwFrameShell::Execute(SfxRequest &rReq)
// On % values initialize size
SwFormatFrameSize& rSize = const_cast<SwFormatFrameSize&>(static_cast<const SwFormatFrameSize&>(aSet.Get(RES_FRM_SIZE)));
if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != SwFormatFrameSize::SYNCED)
- rSize.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width());
+ rSize.SetWidth(rSh.GetAnyCurRect(CurRectType::FlyEmbedded).Width());
if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != SwFormatFrameSize::SYNCED)
- rSize.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height());
+ rSize.SetHeight(rSh.GetAnyCurRect(CurRectType::FlyEmbedded).Height());
// disable vertical positioning for Math Objects anchored 'as char' if baseline alignment is activated
aSet.Put( SfxBoolItem( FN_MATH_BASELINE_ALIGNMENT,
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index ecbf507..5a21c5e 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -149,8 +149,8 @@ void SwGrfShell::Execute(SfxRequest &rReq)
if( pGraphic )
{
Size aSize (
- convertTwipToMm100(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width()),
- convertTwipToMm100(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height()));
+ convertTwipToMm100(rSh.GetAnyCurRect(CurRectType::FlyEmbedded).Width()),
+ convertTwipToMm100(rSh.GetAnyCurRect(CurRectType::FlyEmbedded).Height()));
SfxItemSet aSet( rSh.GetAttrPool(), RES_GRFATR_MIRRORGRF, RES_GRFATR_CROPGRF );
rSh.GetCurAttr( aSet );
@@ -262,7 +262,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
FieldUnit eMetric = ::GetDfltMetric((0 != (nHtmlMode&HTMLMODE_ON)));
SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
- const SwRect* pRect = &rSh.GetAnyCurRect(RECT_PAGE);
+ const SwRect* pRect = &rSh.GetAnyCurRect(CurRectType::Page);
SwFormatFrameSize aFrameSize( ATT_VAR_SIZE, pRect->Width(), pRect->Height());
aFrameSize.SetWhich( GetPool().GetWhich( SID_ATTR_PAGE_SIZE ) );
aSet.Put( aFrameSize );
@@ -274,7 +274,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
}
- pRect = &rSh.GetAnyCurRect(RECT_PAGE_PRT);
+ pRect = &rSh.GetAnyCurRect(CurRectType::PagePrt);
aFrameSize.SetWidth( pRect->Width() );
aFrameSize.SetHeight( pRect->Height() );
aFrameSize.SetWhich( GetPool().GetWhich(FN_GET_PRINT_AREA) );
@@ -286,9 +286,9 @@ void SwGrfShell::Execute(SfxRequest &rReq)
// At percentage values initialize size
SwFormatFrameSize aSizeCopy = static_cast<const SwFormatFrameSize&>(aSet.Get(RES_FRM_SIZE));
if (aSizeCopy.GetWidthPercent() && aSizeCopy.GetWidthPercent() != SwFormatFrameSize::SYNCED)
- aSizeCopy.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width());
+ aSizeCopy.SetWidth(rSh.GetAnyCurRect(CurRectType::FlyEmbedded).Width());
if (aSizeCopy.GetHeightPercent() && aSizeCopy.GetHeightPercent() != SwFormatFrameSize::SYNCED)
- aSizeCopy.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height());
+ aSizeCopy.SetHeight(rSh.GetAnyCurRect(CurRectType::FlyEmbedded).Height());
// and now set the size for "external" tabpages
{
SvxSizeItem aSzItm( SID_ATTR_GRAF_FRMSIZE, aSizeCopy.GetSize() );
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 3835467..01083d1 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -984,7 +984,7 @@ void SwTableShell::Execute(SfxRequest &rReq)
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
if( pFact )
{
- const long nMaxVert = rSh.GetAnyCurRect( RECT_FRM ).Width() / MINLAY;
+ const long nMaxVert = rSh.GetAnyCurRect( CurRectType::Frame ).Width() / MINLAY;
ScopedVclPtr<SvxAbstractSplittTableDialog> pDlg(pFact->CreateSvxSplittTableDialog( GetView().GetWindow(), rSh.IsTableVertical(), nMaxVert ));
if( pDlg && (pDlg->Execute() == RET_OK) )
{
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index d12e0c6..d7b7dc1 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -442,7 +442,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
if(pArgs)
{
Size aSize(aMgr.GetSize());
- aSize.Width() = GetShell().GetAnyCurRect(RECT_PAGE_PRT).Width();
+ aSize.Width() = GetShell().GetAnyCurRect(CurRectType::PagePrt).Width();
Point aPos = aMgr.GetPos();
RndStdIds eAnchor = FLY_AT_PARA;
if(pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET)
@@ -861,12 +861,12 @@ SfxItemSet SwTextShell::CreateInsertFrameItemSet(SwFlyFrameAttrMgr& rMgr)
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list