[Libreoffice-commits] core.git: sw/inc sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Tue Feb 7 06:41:21 UTC 2017
sw/inc/unobaseclass.hxx | 25 ++----
sw/inc/unotext.hxx | 2
sw/inc/unotextcursor.hxx | 4
sw/source/core/unocore/unoframe.cxx | 10 +-
sw/source/core/unocore/unoftn.cxx | 10 +-
sw/source/core/unocore/unoobj.cxx | 100 ++++++++++++------------
sw/source/core/unocore/unoobj2.cxx | 24 ++---
sw/source/core/unocore/unoredline.cxx | 12 +-
sw/source/core/unocore/unorefmk.cxx | 6 -
sw/source/core/unocore/unotbl.cxx | 10 +-
sw/source/core/unocore/unotext.cxx | 52 ++++++------
sw/source/filter/xml/XMLRedlineImportHelper.cxx | 2
12 files changed, 128 insertions(+), 129 deletions(-)
New commits:
commit 77a7a92f855810695a11d4ea285f76ec08600493
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Feb 6 13:08:48 2017 +0200
convert CursorType to scoped enum
and drop unused CURSOR_INVALID constant
Change-Id: I190908a03317f93d247c0a9c806c70bb286b8ecb
Reviewed-on: https://gerrit.libreoffice.org/33964
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/inc/unobaseclass.hxx b/sw/inc/unobaseclass.hxx
index bb2cb2a..d8263b51 100644
--- a/sw/inc/unobaseclass.hxx
+++ b/sw/inc/unobaseclass.hxx
@@ -39,21 +39,20 @@ typedef ::cppu::WeakImplHelper
>
SwSimpleEnumeration_Base;
-enum CursorType
+enum class CursorType
{
- CURSOR_INVALID,
- CURSOR_BODY,
- CURSOR_FRAME,
- CURSOR_TBLTEXT,
- CURSOR_FOOTNOTE,
- CURSOR_HEADER,
- CURSOR_FOOTER,
- CURSOR_REDLINE,
- CURSOR_ALL, // for Search&Replace
- CURSOR_SELECTION, // create a paragraph enumeration from
+ Body,
+ Frame,
+ TableText,
+ Footnote,
+ Header,
+ Footer,
+ Redline,
+ All, // for Search&Replace
+ Selection, // create a paragraph enumeration from
// a text range or cursor
- CURSOR_SELECTION_IN_TABLE,
- CURSOR_META, // meta/meta-field
+ SelectionInTable,
+ Meta, // meta/meta-field
};
/*
diff --git a/sw/inc/unotext.hxx b/sw/inc/unotext.hxx
index 6bb0681..65a1ecc9 100644
--- a/sw/inc/unotext.hxx
+++ b/sw/inc/unotext.hxx
@@ -81,7 +81,7 @@ public: /*not protected because C++ is retarded*/
public:
- SwXText(SwDoc *const pDoc, const enum CursorType eType);
+ SwXText(SwDoc *const pDoc, const CursorType eType);
const SwDoc* GetDoc() const;
SwDoc* GetDoc();
diff --git a/sw/inc/unotextcursor.hxx b/sw/inc/unotextcursor.hxx
index 7f457fe..1bb2f9a 100644
--- a/sw/inc/unotextcursor.hxx
+++ b/sw/inc/unotextcursor.hxx
@@ -81,13 +81,13 @@ public:
SwXTextCursor(
SwDoc & rDoc,
css::uno::Reference< css::text::XText > const& xParent,
- const enum CursorType eType,
+ const CursorType eType,
SwPosition const& rPos,
SwPosition const*const pMark = nullptr);
SwXTextCursor(
css::uno::Reference< css::text::XText > const& xParent,
SwPaM const& rSourceCursor,
- const enum CursorType eType = CURSOR_ALL);
+ const CursorType eType = CursorType::All);
SwUnoCursor& GetCursor();
bool IsAtEndOfMeta() const;
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 317b807..4101171 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -3107,13 +3107,13 @@ OUString SwXFrame::getShapeType()
}
SwXTextFrame::SwXTextFrame( SwDoc *_pDoc ) :
- SwXText(nullptr, CURSOR_FRAME),
+ SwXText(nullptr, CursorType::Frame),
SwXFrame(FLYCNTTYPE_FRM, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_FRAME), _pDoc )
{
}
SwXTextFrame::SwXTextFrame(SwFrameFormat& rFormat) :
- SwXText(rFormat.GetDoc(), CURSOR_FRAME),
+ SwXText(rFormat.GetDoc(), CursorType::Frame),
SwXFrame(rFormat, FLYCNTTYPE_FRM, aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_FRAME))
{
@@ -3240,7 +3240,7 @@ uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursor()
}
SwXTextCursor *const pXCursor = new SwXTextCursor(
- *pFormat->GetDoc(), this, CURSOR_FRAME, *aPam.GetPoint());
+ *pFormat->GetDoc(), this, CursorType::Frame, *aPam.GetPoint());
aRef = static_cast<text::XWordCursor*>(pXCursor);
}
else
@@ -3260,7 +3260,7 @@ uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursorByRange(const
if(aPam.GetNode().FindFlyStartNode() == rNode.FindFlyStartNode())
{
aRef = static_cast<text::XWordCursor*>(
- new SwXTextCursor(*pFormat->GetDoc(), this, CURSOR_FRAME,
+ new SwXTextCursor(*pFormat->GetDoc(), this, CursorType::Frame,
*aPam.GetPoint(), aPam.GetMark()));
}
}
@@ -3278,7 +3278,7 @@ uno::Reference< container::XEnumeration > SwXTextFrame::createEnumeration()
SwPosition aPos(pFormat->GetContent().GetContentIdx()->GetNode());
auto pUnoCursor(GetDoc()->CreateUnoCursor(aPos));
pUnoCursor->Move(fnMoveForward, GoInNode);
- return SwXParagraphEnumeration::Create(this, pUnoCursor, CURSOR_FRAME);
+ return SwXParagraphEnumeration::Create(this, pUnoCursor, CursorType::Frame);
}
uno::Type SwXTextFrame::getElementType()
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index 97c7fdc..e248ae8 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -120,13 +120,13 @@ void SwXFootnote::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
}
SwXFootnote::SwXFootnote(const bool bEndnote)
- : SwXText(nullptr, CURSOR_FOOTNOTE)
+ : SwXText(nullptr, CursorType::Footnote)
, m_pImpl( new SwXFootnote::Impl(*this, nullptr, bEndnote) )
{
}
SwXFootnote::SwXFootnote(SwDoc & rDoc, SwFormatFootnote & rFormat)
- : SwXText(& rDoc, CURSOR_FOOTNOTE)
+ : SwXText(& rDoc, CursorType::Footnote)
, m_pImpl( new SwXFootnote::Impl(*this, &rFormat, rFormat.IsEndNote()) )
{
}
@@ -428,7 +428,7 @@ SwXFootnote::createTextCursor()
SwTextFootnote const*const pTextFootnote = rFormat.GetTextFootnote();
SwPosition aPos( *pTextFootnote->GetStartNode() );
SwXTextCursor *const pXCursor =
- new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE, aPos);
+ new SwXTextCursor(*GetDoc(), this, CursorType::Footnote, aPos);
auto& rUnoCursor(pXCursor->GetCursor());
rUnoCursor.Move(fnMoveForward, GoInNode);
const uno::Reference< text::XTextCursor > xRet =
@@ -461,7 +461,7 @@ SwXFootnote::createTextCursorByRange(
const uno::Reference< text::XTextCursor > xRet =
static_cast<text::XWordCursor*>(
- new SwXTextCursor(*GetDoc(), this, CURSOR_FOOTNOTE,
+ new SwXTextCursor(*GetDoc(), this, CursorType::Footnote,
*aPam.GetPoint(), aPam.GetMark()));
return xRet;
}
@@ -477,7 +477,7 @@ SwXFootnote::createEnumeration()
SwPosition aPos( *pTextFootnote->GetStartNode() );
auto pUnoCursor(GetDoc()->CreateUnoCursor(aPos));
pUnoCursor->Move(fnMoveForward, GoInNode);
- return SwXParagraphEnumeration::Create(this, pUnoCursor, CURSOR_FOOTNOTE);
+ return SwXParagraphEnumeration::Create(this, pUnoCursor, CursorType::Footnote);
}
uno::Type SAL_CALL SwXFootnote::getElementType()
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index ea5a821..43066ff 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -657,12 +657,12 @@ class SwXTextCursor::Impl
public:
const SfxItemPropertySet & m_rPropSet;
- const enum CursorType m_eType;
+ const CursorType m_eType;
const uno::Reference< text::XText > m_xParentText;
sw::UnoCursorPointer m_pUnoCursor;
Impl( SwDoc & rDoc,
- const enum CursorType eType,
+ const CursorType eType,
uno::Reference<text::XText> const & xParent,
SwPosition const& rPoint, SwPosition const*const pMark)
: m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR))
@@ -702,7 +702,7 @@ SwDoc* SwXTextCursor::GetDoc()
SwXTextCursor::SwXTextCursor(
SwDoc & rDoc,
uno::Reference< text::XText > const& xParent,
- const enum CursorType eType,
+ const CursorType eType,
const SwPosition& rPos,
SwPosition const*const pMark)
: m_pImpl( new Impl(rDoc, eType, xParent, rPos, pMark) )
@@ -710,7 +710,7 @@ SwXTextCursor::SwXTextCursor(
}
SwXTextCursor::SwXTextCursor(uno::Reference< text::XText > const& xParent,
- SwPaM const& rSourceCursor, const enum CursorType eType)
+ SwPaM const& rSourceCursor, const CursorType eType)
: m_pImpl( new Impl(*rSourceCursor.GetDoc(), eType,
xParent, *rSourceCursor.GetPoint(),
rSourceCursor.HasMark() ? rSourceCursor.GetMark() : nullptr) )
@@ -804,7 +804,7 @@ lcl_ForceIntoMeta(SwPaM & rCursor,
bool SwXTextCursor::IsAtEndOfMeta() const
{
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
auto pCursor( m_pImpl->m_pUnoCursor );
SwXMeta const*const pXMeta(
@@ -934,7 +934,7 @@ SwXTextCursor::goLeft(sal_Int16 nCount, sal_Bool Expand)
SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
bool bRet = rUnoCursor.Left( nCount);
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
META_CHECK_BOTH)
@@ -952,7 +952,7 @@ SwXTextCursor::goRight(sal_Int16 nCount, sal_Bool Expand)
SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
bool bRet = rUnoCursor.Right(nCount);
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
META_CHECK_BOTH)
@@ -969,7 +969,7 @@ SwXTextCursor::gotoStart(sal_Bool Expand)
SwUnoCursor & rUnoCursor( m_pImpl->GetCursorOrThrow() );
SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
- if (CURSOR_BODY == m_pImpl->m_eType)
+ if (CursorType::Body == m_pImpl->m_eType)
{
rUnoCursor.Move( fnMoveBackward, GoInDoc );
//check, that the cursor is not in a table
@@ -1002,16 +1002,16 @@ SwXTextCursor::gotoStart(sal_Bool Expand)
}
}
}
- else if ( (CURSOR_FRAME == m_pImpl->m_eType)
- || (CURSOR_TBLTEXT == m_pImpl->m_eType)
- || (CURSOR_HEADER == m_pImpl->m_eType)
- || (CURSOR_FOOTER == m_pImpl->m_eType)
- || (CURSOR_FOOTNOTE== m_pImpl->m_eType)
- || (CURSOR_REDLINE == m_pImpl->m_eType))
+ else if ( (CursorType::Frame == m_pImpl->m_eType)
+ || (CursorType::TableText == m_pImpl->m_eType)
+ || (CursorType::Header == m_pImpl->m_eType)
+ || (CursorType::Footer == m_pImpl->m_eType)
+ || (CursorType::Footnote== m_pImpl->m_eType)
+ || (CursorType::Redline == m_pImpl->m_eType))
{
rUnoCursor.MoveSection(GoCurrSection, fnSectionStart);
}
- else if (CURSOR_META == m_pImpl->m_eType)
+ else if (CursorType::Meta == m_pImpl->m_eType)
{
lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText, META_INIT_START);
}
@@ -1025,20 +1025,20 @@ SwXTextCursor::gotoEnd(sal_Bool Expand)
SwUnoCursor & rUnoCursor( m_pImpl->GetCursorOrThrow() );
SwUnoCursorHelper::SelectPam(rUnoCursor, Expand);
- if (CURSOR_BODY == m_pImpl->m_eType)
+ if (CursorType::Body == m_pImpl->m_eType)
{
rUnoCursor.Move( fnMoveForward, GoInDoc );
}
- else if ( (CURSOR_FRAME == m_pImpl->m_eType)
- || (CURSOR_TBLTEXT == m_pImpl->m_eType)
- || (CURSOR_HEADER == m_pImpl->m_eType)
- || (CURSOR_FOOTER == m_pImpl->m_eType)
- || (CURSOR_FOOTNOTE== m_pImpl->m_eType)
- || (CURSOR_REDLINE == m_pImpl->m_eType))
+ else if ( (CursorType::Frame == m_pImpl->m_eType)
+ || (CursorType::TableText == m_pImpl->m_eType)
+ || (CursorType::Header == m_pImpl->m_eType)
+ || (CursorType::Footer == m_pImpl->m_eType)
+ || (CursorType::Footnote== m_pImpl->m_eType)
+ || (CursorType::Redline == m_pImpl->m_eType))
{
rUnoCursor.MoveSection( GoCurrSection, fnSectionEnd);
}
- else if (CURSOR_META == m_pImpl->m_eType)
+ else if (CursorType::Meta == m_pImpl->m_eType)
{
lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText, META_INIT_END);
}
@@ -1095,13 +1095,13 @@ SwXTextCursor::gotoRange(
SwStartNodeType eSearchNodeType = SwNormalStartNode;
switch (m_pImpl->m_eType)
{
- case CURSOR_FRAME: eSearchNodeType = SwFlyStartNode; break;
- case CURSOR_TBLTEXT: eSearchNodeType = SwTableBoxStartNode; break;
- case CURSOR_FOOTNOTE: eSearchNodeType = SwFootnoteStartNode; break;
- case CURSOR_HEADER: eSearchNodeType = SwHeaderStartNode; break;
- case CURSOR_FOOTER: eSearchNodeType = SwFooterStartNode; break;
+ case CursorType::Frame: eSearchNodeType = SwFlyStartNode; break;
+ case CursorType::TableText: eSearchNodeType = SwTableBoxStartNode; break;
+ case CursorType::Footnote: eSearchNodeType = SwFootnoteStartNode; break;
+ case CursorType::Header: eSearchNodeType = SwHeaderStartNode; break;
+ case CursorType::Footer: eSearchNodeType = SwFooterStartNode; break;
//case CURSOR_INVALID:
- //case CURSOR_BODY:
+ //case CursorType::Body:
default:
;
}
@@ -1142,7 +1142,7 @@ SwXTextCursor::gotoRange(
}
}
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
SwPaM CopyPam(*pPam->GetMark(), *pPam->GetPoint());
const bool bNotForced( lcl_ForceIntoMeta(
@@ -1249,7 +1249,7 @@ SwXTextCursor::gotoNextWord(sal_Bool Expand)
// return true if cursor has moved
bRet = (&pPoint->nNode.GetNode() != pOldNode) ||
(pPoint->nContent.GetIndex() != nOldIndex);
- if (bRet && (CURSOR_META == m_pImpl->m_eType))
+ if (bRet && (CursorType::Meta == m_pImpl->m_eType))
{
bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
META_CHECK_BOTH);
@@ -1289,7 +1289,7 @@ SwXTextCursor::gotoPreviousWord(sal_Bool Expand)
// return true if cursor has moved
bRet = (&pPoint->nNode.GetNode() != pOldNode) ||
(pPoint->nContent.GetIndex() != nOldIndex);
- if (bRet && (CURSOR_META == m_pImpl->m_eType))
+ if (bRet && (CursorType::Meta == m_pImpl->m_eType))
{
bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
META_CHECK_BOTH);
@@ -1325,7 +1325,7 @@ SwXTextCursor::gotoEndOfWord(sal_Bool Expand)
pPoint->nNode = rOldNode;
pPoint->nContent = nOldIndex;
}
- else if (CURSOR_META == m_pImpl->m_eType)
+ else if (CursorType::Meta == m_pImpl->m_eType)
{
bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
META_CHECK_BOTH);
@@ -1361,7 +1361,7 @@ SwXTextCursor::gotoStartOfWord(sal_Bool Expand)
pPoint->nNode = rOldNode;
pPoint->nContent = nOldIndex;
}
- else if (CURSOR_META == m_pImpl->m_eType)
+ else if (CursorType::Meta == m_pImpl->m_eType)
{
bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
META_CHECK_BOTH);
@@ -1443,7 +1443,7 @@ SwXTextCursor::gotoNextSentence(sal_Bool Expand)
bRet = false;
}
}
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
META_CHECK_BOTH)
@@ -1471,7 +1471,7 @@ SwXTextCursor::gotoPreviousSentence(sal_Bool Expand)
rUnoCursor.GoSentence(SwCursor::PREV_SENT);
}
}
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
META_CHECK_BOTH)
@@ -1494,7 +1494,7 @@ SwXTextCursor::gotoStartOfSentence(sal_Bool Expand)
bool bRet = SwUnoCursorHelper::IsStartOfPara(rUnoCursor)
|| rUnoCursor.GoSentence(SwCursor::START_SENT)
|| SwUnoCursorHelper::IsStartOfPara(rUnoCursor);
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
META_CHECK_BOTH)
@@ -1518,7 +1518,7 @@ SwXTextCursor::gotoEndOfSentence(sal_Bool Expand)
bool bRet = !bAlreadyParaEnd
&& (rUnoCursor.GoSentence(SwCursor::END_SENT)
|| rUnoCursor.MovePara(GoCurrPara, fnParaEnd));
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
bRet = lcl_ForceIntoMeta(rUnoCursor, m_pImpl->m_xParentText,
META_CHECK_BOTH)
@@ -1556,7 +1556,7 @@ SwXTextCursor::gotoStartOfParagraph(sal_Bool Expand)
SwUnoCursor & rUnoCursor( m_pImpl->GetCursorOrThrow() );
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
return false;
}
@@ -1581,7 +1581,7 @@ SwXTextCursor::gotoEndOfParagraph(sal_Bool Expand)
SwUnoCursor & rUnoCursor( m_pImpl->GetCursorOrThrow() );
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
return false;
}
@@ -1606,7 +1606,7 @@ SwXTextCursor::gotoNextParagraph(sal_Bool Expand)
SwUnoCursor & rUnoCursor( m_pImpl->GetCursorOrThrow() );
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
return false;
}
@@ -1622,7 +1622,7 @@ SwXTextCursor::gotoPreviousParagraph(sal_Bool Expand)
SwUnoCursor & rUnoCursor( m_pImpl->GetCursorOrThrow() );
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
return false;
}
@@ -1649,11 +1649,11 @@ SwXTextCursor::getStart()
uno::Reference< text::XTextRange > xRet;
SwPaM aPam(*rUnoCursor.Start());
const uno::Reference< text::XText > xParent = getText();
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
// return cursor to prevent modifying SwXTextRange for META
SwXTextCursor * const pXCursor(
- new SwXTextCursor(*rUnoCursor.GetDoc(), xParent, CURSOR_META,
+ new SwXTextCursor(*rUnoCursor.GetDoc(), xParent, CursorType::Meta,
*rUnoCursor.GetPoint()) );
pXCursor->gotoStart(false);
xRet = static_cast<text::XWordCursor*>(pXCursor);
@@ -1675,11 +1675,11 @@ SwXTextCursor::getEnd()
uno::Reference< text::XTextRange > xRet;
SwPaM aPam(*rUnoCursor.End());
const uno::Reference< text::XText > xParent = getText();
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
// return cursor to prevent modifying SwXTextRange for META
SwXTextCursor * const pXCursor(
- new SwXTextCursor(*rUnoCursor.GetDoc(), xParent, CURSOR_META,
+ new SwXTextCursor(*rUnoCursor.GetDoc(), xParent, CursorType::Meta,
*rUnoCursor.GetPoint()) );
pXCursor->gotoEnd(false);
xRet = static_cast<text::XWordCursor*>(pXCursor);
@@ -1710,7 +1710,7 @@ SwXTextCursor::setString(const OUString& aString)
SwUnoCursor & rUnoCursor( m_pImpl->GetCursorOrThrow() );
(void) rUnoCursor; // just to check if valid
- const bool bForceExpandHints( (CURSOR_META == m_pImpl->m_eType)
+ const bool bForceExpandHints( (CursorType::Meta == m_pImpl->m_eType)
&& dynamic_cast<SwXMeta*>(m_pImpl->m_xParentText.get())
->CheckForOwnMemberMeta(*GetPaM(), true) );
DeleteAndInsert(aString, bForceExpandHints);
@@ -2912,9 +2912,9 @@ SwXTextCursor::createEnumeration()
pNewCursor->SetMark();
*pNewCursor->GetMark() = *rUnoCursor.GetMark();
}
- const CursorType eSetType = (CURSOR_TBLTEXT == m_pImpl->m_eType)
- ? CURSOR_SELECTION_IN_TABLE : CURSOR_SELECTION;
- SwTableNode const*const pStartNode( (CURSOR_TBLTEXT == m_pImpl->m_eType)
+ const CursorType eSetType = (CursorType::TableText == m_pImpl->m_eType)
+ ? CursorType::SelectionInTable : CursorType::Selection;
+ SwTableNode const*const pStartNode( (CursorType::TableText == m_pImpl->m_eType)
? rUnoCursor.GetPoint()->nNode.GetNode().FindTableNode()
: nullptr);
SwTable const*const pTable(
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 8dd372f..8c32d66 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -470,13 +470,13 @@ struct SwXParagraphEnumerationImpl final : public SwXParagraphEnumeration
, m_pCursor(pCursor)
{
OSL_ENSURE(m_xParentText.is(), "SwXParagraphEnumeration: no parent?");
- OSL_ENSURE( !((CURSOR_SELECTION_IN_TABLE == eType) ||
- (CURSOR_TBLTEXT == eType))
+ OSL_ENSURE( !((CursorType::SelectionInTable == eType) ||
+ (CursorType::TableText == eType))
|| (m_pOwnTable && m_pOwnStartNode),
"SwXParagraphEnumeration: table type but no start node or table?");
- if ((CURSOR_SELECTION == m_eCursorType) ||
- (CURSOR_SELECTION_IN_TABLE == m_eCursorType))
+ if ((CursorType::Selection == m_eCursorType) ||
+ (CursorType::SelectionInTable == m_eCursorType))
{
SwUnoCursor & rCursor = GetCursor();
rCursor.Normalize();
@@ -572,14 +572,14 @@ SwXParagraphEnumerationImpl::NextElement_Impl()
// check for exceeding selections
if (!m_bFirstParagraph &&
- ((CURSOR_SELECTION == m_eCursorType) ||
- (CURSOR_SELECTION_IN_TABLE == m_eCursorType)))
+ ((CursorType::Selection == m_eCursorType) ||
+ (CursorType::SelectionInTable == m_eCursorType)))
{
SwPosition* pStart = rUnoCursor.Start();
auto aNewCursor(rUnoCursor.GetDoc()->CreateUnoCursor(*pStart));
// one may also go into tables here
- if ((CURSOR_TBLTEXT != m_eCursorType) &&
- (CURSOR_SELECTION_IN_TABLE != m_eCursorType))
+ if ((CursorType::TableText != m_eCursorType) &&
+ (CursorType::SelectionInTable != m_eCursorType))
{
aNewCursor->SetRemainInSection( false );
}
@@ -587,8 +587,8 @@ SwXParagraphEnumerationImpl::NextElement_Impl()
// os 2005-01-14: This part is only necessary to detect movements out
// of a selection; if there is no selection we don't have to care
SwTableNode *const pTableNode = aNewCursor->GetNode().FindTableNode();
- if (((CURSOR_TBLTEXT != m_eCursorType) &&
- (CURSOR_SELECTION_IN_TABLE != m_eCursorType)) && pTableNode)
+ if (((CursorType::TableText != m_eCursorType) &&
+ (CursorType::SelectionInTable != m_eCursorType)) && pTableNode)
{
aNewCursor->GetPoint()->nNode = pTableNode->EndOfSectionIndex();
aNewCursor->Move(fnMoveForward, GoInNode);
@@ -639,7 +639,7 @@ SwXParagraphEnumerationImpl::NextElement_Impl()
// position in a table, or in a simple paragraph?
SwTableNode * pTableNode = rUnoCursor.GetNode().FindTableNode();
pTableNode = lcl_FindTopLevelTable( pTableNode, m_pOwnTable );
- if (/*CURSOR_TBLTEXT != eCursorType && CURSOR_SELECTION_IN_TABLE != eCursorType && */
+ if (/*CursorType::TableText != eCursorType && CursorType::SelectionInTable != eCursorType && */
pTableNode && (&pTableNode->GetTable() != m_pOwnTable))
{
// this is a foreign table
@@ -1276,7 +1276,7 @@ SwXTextRange::createEnumeration()
}
const CursorType eSetType = (RANGE_IN_CELL == m_pImpl->m_eRangePosition)
- ? CURSOR_SELECTION_IN_TABLE : CURSOR_SELECTION;
+ ? CursorType::SelectionInTable : CursorType::Selection;
return SwXParagraphEnumeration::Create(m_pImpl->m_xParentText, pNewCursor, eSetType);
}
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index 3c688fd..d1b5b08 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -49,7 +49,7 @@
using namespace ::com::sun::star;
SwXRedlineText::SwXRedlineText(SwDoc* _pDoc, SwNodeIndex aIndex) :
- SwXText(_pDoc, CURSOR_REDLINE),
+ SwXText(_pDoc, CursorType::Redline),
aNodeIndex(aIndex)
{
}
@@ -105,7 +105,7 @@ uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursor()
SwPosition aPos(aNodeIndex);
SwXTextCursor *const pXCursor =
- new SwXTextCursor(*GetDoc(), this, CURSOR_REDLINE, aPos);
+ new SwXTextCursor(*GetDoc(), this, CursorType::Redline, aPos);
auto& rUnoCursor(pXCursor->GetCursor());
rUnoCursor.Move(fnMoveForward, GoInNode);
@@ -156,7 +156,7 @@ uno::Reference<container::XEnumeration> SwXRedlineText::createEnumeration()
SwPaM aPam(aNodeIndex);
aPam.Move(fnMoveForward, GoInNode);
auto pUnoCursor(GetDoc()->CreateUnoCursor(*aPam.Start()));
- return SwXParagraphEnumeration::Create(this, pUnoCursor, CURSOR_REDLINE);
+ return SwXParagraphEnumeration::Create(this, pUnoCursor, CursorType::Redline);
}
uno::Type SwXRedlineText::getElementType( )
@@ -360,7 +360,7 @@ uno::Sequence< beans::PropertyValue > SwXRedlinePortion::CreateRedlineProperties
}
SwXRedline::SwXRedline(SwRangeRedline& rRedline, SwDoc& rDoc) :
- SwXText(&rDoc, CURSOR_REDLINE),
+ SwXText(&rDoc, CursorType::Redline),
pDoc(&rDoc),
pRedline(&rRedline)
{
@@ -530,7 +530,7 @@ uno::Reference< container::XEnumeration > SwXRedline::createEnumeration()
SwPaM aPam(*pNodeIndex);
aPam.Move(fnMoveForward, GoInNode);
auto pUnoCursor(GetDoc()->CreateUnoCursor(*aPam.Start()));
- return SwXParagraphEnumeration::Create(this, pUnoCursor, CURSOR_REDLINE);
+ return SwXParagraphEnumeration::Create(this, pUnoCursor, CursorType::Redline);
}
uno::Type SwXRedline::getElementType( )
@@ -557,7 +557,7 @@ uno::Reference< text::XTextCursor > SwXRedline::createTextCursor()
{
SwPosition aPos(*pNodeIndex);
SwXTextCursor *const pXCursor =
- new SwXTextCursor(*pDoc, this, CURSOR_REDLINE, aPos);
+ new SwXTextCursor(*pDoc, this, CursorType::Redline, aPos);
auto& rUnoCursor(pXCursor->GetCursor());
rUnoCursor.Move(fnMoveForward, GoInNode);
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 3c6f6c7..0617be9 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -542,7 +542,7 @@ public:
};
SwXMetaText::SwXMetaText(SwDoc & rDoc, SwXMeta & rMeta)
- : SwXText(&rDoc, CURSOR_META)
+ : SwXText(&rDoc, CursorType::Meta)
, m_rMeta(rMeta)
{
}
@@ -559,7 +559,7 @@ void SwXMetaText::PrepareForAttach( uno::Reference<text::XTextRange> & xRange,
{
// create a new cursor to prevent modifying SwXTextRange
xRange = static_cast<text::XWordCursor*>(
- new SwXTextCursor(*GetDoc(), &m_rMeta, CURSOR_META, *rPam.GetPoint(),
+ new SwXTextCursor(*GetDoc(), &m_rMeta, CursorType::Meta, *rPam.GetPoint(),
(rPam.HasMark()) ? rPam.GetMark() : nullptr));
}
@@ -582,7 +582,7 @@ uno::Reference< text::XTextCursor > SwXMetaText::CreateCursor()
{
SwPosition aPos(*pTextNode, nMetaStart);
xRet = static_cast<text::XWordCursor*>(
- new SwXTextCursor(*GetDoc(), &m_rMeta, CURSOR_META, aPos));
+ new SwXTextCursor(*GetDoc(), &m_rMeta, CursorType::Meta, aPos));
}
}
return xRet;
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 80ac9f6..92eb37c 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -755,7 +755,7 @@ void sw_setValue( SwXCell &rCell, double nVal )
SwXCell::SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBx, size_t const nPos) :
- SwXText(pTableFormat->GetDoc(), CURSOR_TBLTEXT),
+ SwXText(pTableFormat->GetDoc(), CursorType::TableText),
SwClient(pTableFormat),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
pBox(pBx),
@@ -765,7 +765,7 @@ SwXCell::SwXCell(SwFrameFormat* pTableFormat, SwTableBox* pBx, size_t const nPos
}
SwXCell::SwXCell(SwFrameFormat* pTableFormat, const SwStartNode& rStartNode) :
- SwXText(pTableFormat->GetDoc(), CURSOR_TBLTEXT),
+ SwXText(pTableFormat->GetDoc(), CursorType::TableText),
SwClient(pTableFormat),
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_CELL)),
pBox(nullptr),
@@ -979,7 +979,7 @@ uno::Reference<text::XTextCursor> SwXCell::createTextCursor()
const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
SwPosition aPos(*pSttNd);
SwXTextCursor* const pXCursor =
- new SwXTextCursor(*GetDoc(), this, CURSOR_TBLTEXT, aPos);
+ new SwXTextCursor(*GetDoc(), this, CursorType::TableText, aPos);
auto& rUnoCursor(pXCursor->GetCursor());
rUnoCursor.Move(fnMoveForward, GoInNode);
return static_cast<text::XWordCursor*>(pXCursor);
@@ -999,7 +999,7 @@ uno::Reference<text::XTextCursor> SwXCell::createTextCursorByRange(const uno::Re
if( p1 != pSttNd )
return nullptr;
return static_cast<text::XWordCursor*>(
- new SwXTextCursor(*GetDoc(), this, CURSOR_TBLTEXT,
+ new SwXTextCursor(*GetDoc(), this, CursorType::TableText,
*aPam.GetPoint(), aPam.GetMark()));
}
@@ -1130,7 +1130,7 @@ uno::Reference<container::XEnumeration> SwXCell::createEnumeration()
// remember table and start node for later travelling
// (used in export of tables in tables)
SwTable const*const pTable(&pSttNd->FindTableNode()->GetTable());
- return SwXParagraphEnumeration::Create(this, pUnoCursor, CURSOR_TBLTEXT, pSttNd, pTable);
+ return SwXParagraphEnumeration::Create(this, pUnoCursor, CursorType::TableText, pSttNd, pTable);
}
uno::Type SAL_CALL SwXCell::getElementType()
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 7f6a1c6..f32836a 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -79,12 +79,12 @@ class SwXText::Impl
public:
SwXText & m_rThis;
SfxItemPropertySet const& m_rPropSet;
- const enum CursorType m_eType;
+ const CursorType m_eType;
SwDoc * m_pDoc;
bool m_bIsValid;
Impl( SwXText & rThis,
- SwDoc *const pDoc, const enum CursorType eType)
+ SwDoc *const pDoc, const CursorType eType)
: m_rThis(rThis)
, m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT))
, m_eType(eType)
@@ -119,7 +119,7 @@ public:
};
-SwXText::SwXText(SwDoc *const pDoc, const enum CursorType eType)
+SwXText::SwXText(SwDoc *const pDoc, const CursorType eType)
: m_pImpl( new SwXText::Impl(*this, pDoc, eType) )
{
}
@@ -162,7 +162,7 @@ SwXText::PrepareForAttach(uno::Reference< text::XTextRange > &, const SwPaM &)
bool SwXText::CheckForOwnMemberMeta(const SwPaM &, const bool)
{
- OSL_ENSURE(CURSOR_META != m_pImpl->m_eType, "should not be called!");
+ OSL_ENSURE(CursorType::Meta != m_pImpl->m_eType, "should not be called!");
return false;
}
@@ -335,7 +335,7 @@ SwXText::insertString(const uno::Reference< text::XTextRange >& xTextRange,
}
bool bForceExpandHints( false );
- if (CURSOR_META == m_pImpl->m_eType)
+ if (CursorType::Meta == m_pImpl->m_eType)
{
try
{
@@ -533,13 +533,13 @@ SwXText::insertTextContent(
SwStartNodeType eSearchNodeType = SwNormalStartNode;
switch (m_pImpl->m_eType)
{
- case CURSOR_FRAME: eSearchNodeType = SwFlyStartNode; break;
- case CURSOR_TBLTEXT: eSearchNodeType = SwTableBoxStartNode; break;
- case CURSOR_FOOTNOTE: eSearchNodeType = SwFootnoteStartNode; break;
- case CURSOR_HEADER: eSearchNodeType = SwHeaderStartNode; break;
- case CURSOR_FOOTER: eSearchNodeType = SwFooterStartNode; break;
+ case CursorType::Frame: eSearchNodeType = SwFlyStartNode; break;
+ case CursorType::TableText: eSearchNodeType = SwTableBoxStartNode; break;
+ case CursorType::Footnote: eSearchNodeType = SwFootnoteStartNode; break;
+ case CursorType::Header: eSearchNodeType = SwHeaderStartNode; break;
+ case CursorType::Footer: eSearchNodeType = SwFooterStartNode; break;
//case CURSOR_INVALID:
- //case CURSOR_BODY:
+ //case CursorType::Body:
default:
break;
}
@@ -924,7 +924,7 @@ SwXText::setString(const OUString& rString)
GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_START, nullptr);
//insert an empty paragraph at the start and at the end to ensure that
//all tables and sections can be removed by the selecting text::XTextCursor
- if (CURSOR_META != m_pImpl->m_eType)
+ if (CursorType::Meta != m_pImpl->m_eType)
{
SwPosition aStartPos(*pStartNode);
const SwEndNode* pEnd = pStartNode->EndOfSectionNode();
@@ -986,13 +986,13 @@ bool SwXText::Impl::CheckForOwnMember(
SwStartNodeType eSearchNodeType = SwNormalStartNode;
switch (m_eType)
{
- case CURSOR_FRAME: eSearchNodeType = SwFlyStartNode; break;
- case CURSOR_TBLTEXT: eSearchNodeType = SwTableBoxStartNode; break;
- case CURSOR_FOOTNOTE: eSearchNodeType = SwFootnoteStartNode; break;
- case CURSOR_HEADER: eSearchNodeType = SwHeaderStartNode; break;
- case CURSOR_FOOTER: eSearchNodeType = SwFooterStartNode; break;
+ case CursorType::Frame: eSearchNodeType = SwFlyStartNode; break;
+ case CursorType::TableText: eSearchNodeType = SwTableBoxStartNode; break;
+ case CursorType::Footnote: eSearchNodeType = SwFootnoteStartNode; break;
+ case CursorType::Header: eSearchNodeType = SwHeaderStartNode; break;
+ case CursorType::Footer: eSearchNodeType = SwFooterStartNode; break;
//case CURSOR_INVALID:
- //case CURSOR_BODY:
+ //case CursorType::Body:
default:
;
}
@@ -2332,7 +2332,7 @@ SwXText::copyText(
}
SwXBodyText::SwXBodyText(SwDoc *const pDoc)
- : SwXText(pDoc, CURSOR_BODY)
+ : SwXText(pDoc, CursorType::Body)
{
}
@@ -2440,7 +2440,7 @@ SwXTextCursor * SwXBodyText::CreateTextCursor(const bool bIgnoreTables)
aPam.GetPoint()->nContent.Assign(pCont, 0);
}
}
- return new SwXTextCursor(*GetDoc(), this, CURSOR_BODY, *aPam.GetPoint());
+ return new SwXTextCursor(*GetDoc(), this, CursorType::Body, *aPam.GetPoint());
}
uno::Reference< text::XTextCursor > SAL_CALL
@@ -2492,7 +2492,7 @@ SwXBodyText::createTextCursorByRange(
if(p1 == p2)
{
aRef = static_cast<text::XWordCursor*>(
- new SwXTextCursor(*GetDoc(), this, CURSOR_BODY,
+ new SwXTextCursor(*GetDoc(), this, CursorType::Body,
*aPam.GetPoint(), aPam.GetMark()));
}
}
@@ -2520,7 +2520,7 @@ SwXBodyText::createEnumeration()
SwPosition aPos(rNode);
auto pUnoCursor(GetDoc()->CreateUnoCursor(aPos));
pUnoCursor->Move(fnMoveBackward, GoInDoc);
- return SwXParagraphEnumeration::Create(this, pUnoCursor, CURSOR_BODY);
+ return SwXParagraphEnumeration::Create(this, pUnoCursor, CursorType::Body);
}
uno::Type SAL_CALL
@@ -2607,7 +2607,7 @@ SwXHeadFootText::CreateXHeadFootText(
SwXHeadFootText::SwXHeadFootText(SwFrameFormat & rHeadFootFormat, const bool bIsHeader)
: SwXText(rHeadFootFormat.GetDoc(),
- (bIsHeader) ? CURSOR_HEADER : CURSOR_FOOTER)
+ (bIsHeader) ? CursorType::Header : CursorType::Footer)
, m_pImpl( new SwXHeadFootText::Impl(*this, rHeadFootFormat, bIsHeader) )
{
}
@@ -2696,7 +2696,7 @@ SwXHeadFootText::createTextCursor()
const SwNode& rNode = rFlyContent.GetContentIdx()->GetNode();
SwPosition aPos(rNode);
SwXTextCursor *const pXCursor = new SwXTextCursor(*GetDoc(), this,
- (m_pImpl->m_bIsHeader) ? CURSOR_HEADER : CURSOR_FOOTER, aPos);
+ (m_pImpl->m_bIsHeader) ? CursorType::Header : CursorType::Footer, aPos);
auto& rUnoCursor(pXCursor->GetCursor());
rUnoCursor.Move(fnMoveForward, GoInNode);
@@ -2759,7 +2759,7 @@ SwXHeadFootText::createTextCursorByRange(
{
xRet = static_cast<text::XWordCursor*>(
new SwXTextCursor(*GetDoc(), this,
- (m_pImpl->m_bIsHeader) ? CURSOR_HEADER : CURSOR_FOOTER,
+ (m_pImpl->m_bIsHeader) ? CursorType::Header : CursorType::Footer,
*aPam.GetPoint(), aPam.GetMark()));
}
return xRet;
@@ -2778,7 +2778,7 @@ SwXHeadFootText::createEnumeration()
SwPosition aPos(rNode);
auto pUnoCursor(GetDoc()->CreateUnoCursor(aPos));
pUnoCursor->Move(fnMoveForward, GoInNode);
- return SwXParagraphEnumeration::Create(this, pUnoCursor, (m_pImpl->m_bIsHeader) ? CURSOR_HEADER : CURSOR_FOOTER);
+ return SwXParagraphEnumeration::Create(this, pUnoCursor, (m_pImpl->m_bIsHeader) ? CursorType::Header : CursorType::Footer);
}
uno::Type SAL_CALL
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index 9459928..5803700 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -464,7 +464,7 @@ Reference<XTextCursor> XMLRedlineImportHelper::CreateRedlineTextSection(
// create (UNO-) cursor
SwPosition aPos(*pRedlineNode);
SwXTextCursor *const pXCursor =
- new SwXTextCursor(*pDoc, pXText, CURSOR_REDLINE, aPos);
+ new SwXTextCursor(*pDoc, pXText, CursorType::Redline, aPos);
pXCursor->GetCursor().Move(fnMoveForward, GoInNode);
// cast to avoid ambiguity
xReturn = static_cast<text::XWordCursor*>(pXCursor);
More information about the Libreoffice-commits
mailing list