summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2016-11-23 09:18:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-11-23 09:19:09 +0200
commitaebf05f324661a07f4124a4c48b6fc889d4bfbf6 (patch)
tree48755a6404db06c5f8df8762723d5fc129b35b5e
parentloplugin field-can-be-private in include/vcl..xmlscript (diff)
downloadcore-aebf05f324661a07f4124a4c48b6fc889d4bfbf6.tar.gz
core-aebf05f324661a07f4124a4c48b6fc889d4bfbf6.zip
convert ATTRSPECIAL to scoped enum
Change-Id: I8abf09dc5f17343945b909887c580e9016a79ac5
-rw-r--r--editeng/source/editeng/editeng.cxx2
-rw-r--r--editeng/source/editeng/editundo.cxx2
-rw-r--r--editeng/source/editeng/editundo.hxx10
-rw-r--r--editeng/source/editeng/editview.cxx2
-rw-r--r--editeng/source/editeng/edtspell.cxx2
-rw-r--r--editeng/source/editeng/impedit.hxx5
-rw-r--r--editeng/source/editeng/impedit5.cxx6
-rw-r--r--include/editeng/editeng.hxx6
8 files changed, 18 insertions, 17 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index bde286a10b72..c151c679dda2 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -907,7 +907,7 @@ void EditEngine::SetParaAttribsOnly(sal_Int32 nPara, const SfxItemSet& rSet)
pImpEditEngine->SetParaAttribs(nPara, rSet);
}
-void EditEngine::SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, sal_uInt8 nSpecial)
+void EditEngine::SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, SetAttribsMode nSpecial)
{
pImpEditEngine->SetAttribs(rSel, rSet, nSpecial);
}
diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx
index 90ea9ba1c788..c96174feb7dc 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -505,7 +505,7 @@ EditUndoSetAttribs::EditUndoSetAttribs(EditEngine* pEE, const ESelection& rESel,
bSetIsRemove = false;
bRemoveParaAttribs = false;
nRemoveWhich = 0;
- nSpecial = 0;
+ nSpecial = SetAttribsMode::NONE;
}
namespace {
diff --git a/editeng/source/editeng/editundo.hxx b/editeng/source/editeng/editundo.hxx
index 1364b0c1db35..f85ee12d5b7d 100644
--- a/editeng/source/editeng/editundo.hxx
+++ b/editeng/source/editeng/editundo.hxx
@@ -28,7 +28,7 @@
class EditEngine;
class EditView;
-
+enum class SetAttribsMode;
// EditUndoDelContent
@@ -216,10 +216,10 @@ private:
SfxItemSet aNewAttribs;
InfoArrayType aPrevAttribs;
- sal_uInt8 nSpecial;
+ SetAttribsMode nSpecial;
bool bSetIsRemove;
bool bRemoveParaAttribs;
- sal_uInt16 nRemoveWhich;
+ sal_uInt16 nRemoveWhich;
void ImpSetSelection( EditView* pView );
@@ -230,10 +230,10 @@ public:
SfxItemSet& GetNewAttribs() { return aNewAttribs; }
- void SetSpecial( sal_uInt8 n ) { nSpecial = n; }
+ void SetSpecial( SetAttribsMode n ) { nSpecial = n; }
void SetRemoveAttribs( bool b ) { bSetIsRemove = b; }
void SetRemoveParaAttribs( bool b ) { bRemoveParaAttribs = b; }
- void SetRemoveWhich( sal_uInt16 n ) { nRemoveWhich = n; }
+ void SetRemoveWhich( sal_uInt16 n ) { nRemoveWhich = n; }
virtual void Undo() override;
virtual void Redo() override;
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 32450049235e..2d0ace84e1b9 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -481,7 +481,7 @@ void EditView::SetAttribs( const SfxItemSet& rSet )
DBG_ASSERT( !pImpEditView->aEditSelection.IsInvalid(), "Blind Selection in ...." );
pImpEditView->DrawSelection();
- pImpEditView->pEditEngine->SetAttribs( pImpEditView->GetEditSelection(), rSet, ATTRSPECIAL_WHOLEWORD );
+ pImpEditView->pEditEngine->SetAttribs( pImpEditView->GetEditSelection(), rSet, SetAttribsMode::WholeWord );
pImpEditView->pEditEngine->FormatAndUpdate( this );
}
diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx
index 4077ae5fcd63..887e8141bcc4 100644
--- a/editeng/source/editeng/edtspell.cxx
+++ b/editeng/source/editeng/edtspell.cxx
@@ -624,7 +624,7 @@ void EdtAutoCorrDoc::SetAttr(sal_Int32 nStt, sal_Int32 nEnd,
EditSelection aSel( EditPaM( pCurNode, nStt ), EditPaM( pCurNode, nEnd ) );
aSel.Max().SetIndex( nEnd ); // ???
- mpEditEngine->SetAttribs( aSel, aSet, ATTRSPECIAL_EDGE );
+ mpEditEngine->SetAttribs( aSel, aSet, SetAttribsMode::Edge );
bAllowUndoAction = false;
}
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index b76fa58b749b..5cb4febd90a1 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -66,9 +66,6 @@
#define CURSOR_BIDILEVEL_DONTKNOW 0xFFFF
#define MAXCHARSINPARA 0x3FFF-CHARPOSGROW // Max 16K, because WYSIWYG array
-#define ATTRSPECIAL_WHOLEWORD 1
-#define ATTRSPECIAL_EDGE 2
-
#define GETCRSR_TXTONLY 0x0001
#define GETCRSR_STARTOFLINE 0x0002
#define GETCRSR_ENDOFLINE 0x0004
@@ -821,7 +818,7 @@ public:
SfxItemSet GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int32 nEnd, GetAttribsFlags nFlags = GetAttribsFlags::ALL ) const;
SfxItemSet GetAttribs( EditSelection aSel, EditEngineAttribs nOnlyHardAttrib = EditEngineAttribs_All );
- void SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0 );
+ void SetAttribs( EditSelection aSel, const SfxItemSet& rSet, SetAttribsMode nSpecial = SetAttribsMode::NONE );
void RemoveCharAttribs( EditSelection aSel, bool bRemoveParaAttribs, sal_uInt16 nWhich );
void RemoveCharAttribs( sal_Int32 nPara, sal_uInt16 nWhich = 0, bool bRemoveFeatures = false );
void SetFlatMode( bool bFlat );
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index e091a142cec2..1b3c5b382b0d 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -490,13 +490,13 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int
}
-void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_uInt8 nSpecial )
+void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, SetAttribsMode nSpecial )
{
aSel.Adjust( aEditDoc );
// When no selection => use the Attribute on the word.
// ( the RTF-parser should actually never call the Method without a Range )
- if ( ( nSpecial == ATTRSPECIAL_WHOLEWORD ) && !aSel.HasRange() )
+ if ( nSpecial == SetAttribsMode::WholeWord && !aSel.HasRange() )
aSel = SelectWord( aSel, css::i18n::WordType::ANYWORD_IGNOREWHITESPACES, false );
sal_Int32 nStartNode = aEditDoc.GetPos( aSel.Min().GetNode() );
@@ -547,7 +547,7 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_
{
aEditDoc.InsertAttrib( pNode, nStartPos, nEndPos, rItem );
bCharAttribFound = true;
- if ( nSpecial == ATTRSPECIAL_EDGE )
+ if ( nSpecial == SetAttribsMode::Edge )
{
CharAttribList::AttribsType& rAttribs = pNode->GetCharAttribs().GetAttribs();
for (std::unique_ptr<EditCharAttrib> & rAttrib : rAttribs)
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index d8be7c663eed..2b4f23663193 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -140,6 +140,10 @@ template<class T> bool checkSvxFieldData(const SvxFieldData* pData)
return dynamic_cast<const T*>(pData) != nullptr;
}
+enum class SetAttribsMode {
+ NONE, WholeWord, Edge
+};
+
class SdrObject;
class EDITENG_DLLPUBLIC EditEngine
{
@@ -570,7 +574,7 @@ public:
const SfxItemSet& GetBaseParaAttribs(sal_Int32 nPara) const;
void SetParaAttribsOnly(sal_Int32 nPara, const SfxItemSet& rSet);
- void SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0);
+ void SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, SetAttribsMode nSpecial = SetAttribsMode::NONE);
OUString GetSelected(const EditSelection& rSel) const;
EditPaM DeleteSelected(const EditSelection& rSel);