summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-08-01 09:45:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-01 10:44:36 +0200
commit915f3959fe6b3e756b9797a9222b95d9b8c3d293 (patch)
treeb5eac3ce73fde9cca978e6154d992a4ceb1eab76
parent4f48bdf758239b7928586c40d9072c65e4633009 (diff)
introduce SwPosition::GetNodes
as part of the process of hiding the internals of SwPosition largely done by doing: git grep -lF 'nNode.GetNodes' | xargs perl -pi -e 's/nNode\.GetNodes/GetNodes/g' Change-Id: I05ac253803ef3f265edfa9be6f24f8f66b2b02c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137670 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/inc/pam.hxx5
-rw-r--r--sw/source/core/crsr/bookmark.cxx2
-rw-r--r--sw/source/core/crsr/crsrsh.cxx2
-rw-r--r--sw/source/core/crsr/pam.cxx10
-rw-r--r--sw/source/core/crsr/swcrsr.cxx2
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx8
-rw-r--r--sw/source/core/doc/docredln.cxx2
-rw-r--r--sw/source/core/doc/swserv.cxx2
-rw-r--r--sw/source/core/text/itrcrsr.cxx2
-rw-r--r--sw/source/core/undo/undobj.cxx6
-rw-r--r--sw/source/filter/basflt/fltshell.cxx2
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx6
12 files changed, 27 insertions, 22 deletions
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index dd91d355b7f6..606aebb9bea9 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -69,6 +69,11 @@ struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition
bool operator ==(const SwPosition &) const;
bool operator !=(const SwPosition &) const;
void dumpAsXml(xmlTextWriterPtr pWriter) const;
+
+
+ // Gets pointer on NodesArray.
+ const SwNodes& GetNodes() const { return nNode.GetNodes(); }
+ SwNodes& GetNodes() { return nNode.GetNodes(); }
};
SW_DLLPUBLIC std::ostream &operator <<(std::ostream& s, const SwPosition& position);
diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx
index ac7f9fe2c8a3..37b6b611a8b5 100644
--- a/sw/source/core/crsr/bookmark.cxx
+++ b/sw/source/core/crsr/bookmark.cxx
@@ -58,7 +58,7 @@ namespace sw::mark
{
SwPosition const& rStartPos(rMark.GetMarkStart());
SwPosition const& rEndPos(rMark.GetMarkEnd());
- SwNodes const& rNodes(rStartPos.nNode.GetNodes());
+ SwNodes const& rNodes(rStartPos.GetNodes());
SwNodeOffset const nStartNode(rStartPos.nNode.GetIndex());
SwNodeOffset const nEndNode(rEndPos.nNode.GetIndex());
int nFields(0);
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index ff4051be1e4d..2a860387b160 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2560,7 +2560,7 @@ OUString SwCursorShell::GetSelText() const
SwPosition const*const pEnd(m_pCurrentCursor->End());
for (SwNodeOffset i = pStart->nNode.GetIndex(); i <= pEnd->nNode.GetIndex(); ++i)
{
- SwNode const& rNode(*pStart->nNode.GetNodes()[i]);
+ SwNode const& rNode(*pStart->GetNodes()[i]);
assert(!rNode.IsEndNode());
if (rNode.IsStartNode())
{
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 838ca42e411f..cb1265c5be4f 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -898,7 +898,7 @@ SwContentNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFnCollection const &
{
SwPosition aPos( *rPam.GetPoint() );
bool bSrchForward = &fnMove == &fnMoveForward;
- SwNodes& rNodes = aPos.nNode.GetNodes();
+ SwNodes& rNodes = aPos.GetNodes();
// go to next/previous ContentNode
while( true )
@@ -943,7 +943,7 @@ SwContentNode* GetNode( SwPaM & rPam, bool& rbFirst, SwMoveFnCollection const &
void GoStartDoc( SwPosition * pPos )
{
- SwNodes& rNodes = pPos->nNode.GetNodes();
+ SwNodes& rNodes = pPos->GetNodes();
pPos->nNode = *rNodes.GetEndOfContent().StartOfSectionNode();
// we always need to find a ContentNode!
SwContentNode* pCNd = rNodes.GoNext( &pPos->nNode );
@@ -953,7 +953,7 @@ void GoStartDoc( SwPosition * pPos )
void GoEndDoc( SwPosition * pPos )
{
- SwNodes& rNodes = pPos->nNode.GetNodes();
+ SwNodes& rNodes = pPos->GetNodes();
pPos->nNode = rNodes.GetEndOfContent();
SwContentNode* pCNd = GoPreviousNds( &pPos->nNode, true );
if( pCNd )
@@ -963,7 +963,7 @@ void GoEndDoc( SwPosition * pPos )
void GoStartSection( SwPosition * pPos )
{
// jump to section's beginning
- SwNodes& rNodes = pPos->nNode.GetNodes();
+ SwNodes& rNodes = pPos->GetNodes();
sal_uInt16 nLevel = SwNodes::GetSectionLevel( pPos->nNode );
if( pPos->nNode < rNodes.GetEndOfContent().StartOfSectionIndex() )
nLevel--;
@@ -977,7 +977,7 @@ void GoStartSection( SwPosition * pPos )
void GoEndSection( SwPosition * pPos )
{
// jump to section's beginning/end
- SwNodes& rNodes = pPos->nNode.GetNodes();
+ SwNodes& rNodes = pPos->GetNodes();
sal_uInt16 nLevel = SwNodes::GetSectionLevel( pPos->nNode );
if( pPos->nNode < rNodes.GetEndOfContent().StartOfSectionIndex() )
nLevel--;
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 6a54a17dfcd3..03d746bd7c8e 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -2345,7 +2345,7 @@ void SwCursor::RestoreSavePos()
{
// This method is not supposed to be used in cases when nodes may be
// deleted; detect such cases, but do not crash (example: fdo#40831).
- SwNodeOffset uNodeCount(GetPoint()->nNode.GetNodes().Count());
+ SwNodeOffset uNodeCount(GetPoint()->GetNodes().Count());
OSL_ENSURE(m_vSavePos.empty() || m_vSavePos.back().nNode < uNodeCount,
"SwCursor::RestoreSavePos: invalid node: "
"probably something was deleted; consider using SwUnoCursor instead");
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index f34ceda93e55..a0e5c11fecfd 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -523,7 +523,7 @@ namespace sw
{
SwNodeOffset const nStartNode(rPam.Start()->nNode.GetIndex());
SwNodeOffset const nEndNode(rPam.End()->nNode.GetIndex());
- SwNodes const& rNodes(rPam.GetPoint()->nNode.GetNodes());
+ SwNodes const& rNodes(rPam.GetPoint()->GetNodes());
IDocumentMarkAccess const& rIDMA(*rPam.GetDoc().getIDocumentMarkAccess());
std::stack<std::tuple<sw::mark::IFieldmark const*, bool, SwNodeOffset, sal_Int32>> startedFields;
@@ -671,7 +671,7 @@ namespace
// iterate from end to start, to avoid invalidating the offsets!
auto iter( Breaks.rbegin() );
SwNodeOffset nOffset(0);
- SwNodes const& rNodes(rPam.GetPoint()->nNode.GetNodes());
+ SwNodes const& rNodes(rPam.GetPoint()->GetNodes());
SwPaM aPam( rSelectionEnd, rSelectionEnd ); // end node!
SwPosition & rEnd( *aPam.End() );
SwPosition & rStart( *aPam.Start() );
@@ -3512,7 +3512,7 @@ bool DocumentContentOperationsManager::ReplaceRange( SwPaM& rPam, const OUString
// iterate from end to start, to avoid invalidating the offsets!
auto iter( Breaks.rbegin() );
SwNodeOffset nOffset(0);
- SwNodes const& rNodes(rPam.GetPoint()->nNode.GetNodes());
+ SwNodes const& rNodes(rPam.GetPoint()->GetNodes());
OSL_ENSURE(aPam.GetPoint() == aPam.End(), "wrong!");
SwPosition & rEnd( *aPam.End() );
SwPosition & rStart( *aPam.Start() );
@@ -4833,7 +4833,7 @@ bool DocumentContentOperationsManager::CopyImpl(SwPaM& rPam, SwPosition& rPos,
// iterate from end to start, ... don't think it's necessary here?
auto iter( Breaks.rbegin() );
SwNodeOffset nOffset(0);
- SwNodes const& rNodes(rPam.GetPoint()->nNode.GetNodes());
+ SwNodes const& rNodes(rPam.GetPoint()->GetNodes());
SwPaM aPam( rSelectionEnd, rSelectionEnd ); // end node!
SwPosition & rEnd( *aPam.End() );
SwPosition & rStart( *aPam.Start() );
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index a41509c69a21..4844b464d9d4 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -483,7 +483,7 @@ std::vector<SwRangeRedline*> GetAllValidRanges(std::unique_ptr<SwRangeRedline> p
// Create valid "sub-ranges" from the Selection
auto [pStt, pEnd] = p->StartEnd(); // SwPosition*
SwPosition aNewStt( *pStt );
- SwNodes& rNds = aNewStt.nNode.GetNodes();
+ SwNodes& rNds = aNewStt.GetNodes();
SwContentNode* pC;
if( !aNewStt.nNode.GetNode().IsContentNode() )
diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx
index 3fa443e1e939..2d3da62aed2b 100644
--- a/sw/source/core/doc/swserv.cxx
+++ b/sw/source/core/doc/swserv.cxx
@@ -194,7 +194,7 @@ bool SwServerObject::IsLinkInServer( const SwBaseLink* pChkLnk ) const
nSttNd = pStt->nNode.GetIndex();
nEndNd = pEnd->nNode.GetIndex();
- pNds = &pStt->nNode.GetNodes();
+ pNds = &pStt->GetNodes();
}
break;
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index e20a90a715d4..f8220650c827 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1840,7 +1840,7 @@ bool SwTextFrame::FillSelection( SwSelectionList& rSelList, const SwRect& rRect
}
else if( aRect.HasArea() )
{
- SwPosition aOld(aPosL.nNode.GetNodes().GetEndOfContent());
+ SwPosition aOld(aPosL.GetNodes().GetEndOfContent());
SwPosition aPosR( aPosL );
Point aPoint;
SwTextInfo aInf( const_cast<SwTextFrame*>(this) );
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 03a3c056ad2d..5e9d0053b15e 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -872,8 +872,8 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark,
SwDoc& rDoc = rMark.nNode.GetNode().GetDoc();
// if it's not in the doc array, probably missing some invalidation somewhere
- assert(&rPoint.nNode.GetNodes() == &rDoc.GetNodes());
- assert(&rMark.nNode.GetNodes() == &rDoc.GetNodes());
+ assert(&rPoint.GetNodes() == &rDoc.GetNodes());
+ assert(&rMark.GetNodes() == &rDoc.GetNodes());
::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
@@ -1571,7 +1571,7 @@ static bool IsAtEndOfSection(SwPosition const& rAnchorPos)
static bool IsAtStartOfSection(SwPosition const& rAnchorPos)
{
- SwNodes const& rNodes(rAnchorPos.nNode.GetNodes());
+ SwNodes const& rNodes(rAnchorPos.GetNodes());
SwNodeIndex node(*rAnchorPos.nNode.GetNode().StartOfSectionNode());
SwContentNode *const pNode(rNodes.GoNext(&node));
assert(pNode);
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index 571f32b1aa0d..8e0d9b1e47bd 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -133,7 +133,7 @@ bool SwFltStackEntry::MakeRegion(SwDoc& rDoc, SwPaM& rRegion, RegionMode const e
if (rMkPos.m_nNode != rPtPos.m_nNode)
{
SwNodeOffset n = rPtPos.m_nNode.GetIndex() + 1;
- SwNodes& rNodes = rRegion.GetPoint()->nNode.GetNodes();
+ SwNodes& rNodes = rRegion.GetPoint()->GetNodes();
if (n >= rNodes.Count())
return false;
rRegion.GetPoint()->nNode = n;
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index eabaeb91a79e..70c5f63faa4f 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -117,7 +117,7 @@ namespace
{
// the anchor position will be invalidated by SetRedlineFlags
// so set a dummy position and fix it in UpdateFramePositions
- SwPosition const dummy(const_cast<SwNodes&>(pAnchor->nNode.GetNodes()));
+ SwPosition const dummy(const_cast<SwNodes&>(pAnchor->GetNodes()));
aRet.emplace_back(rEntry, dummy);
}
else
@@ -763,7 +763,7 @@ namespace sw
(nPosCt <= rMkPos.m_nContent))
{
rMkPos.m_nContent += nInserted;
- SAL_WARN_IF(rMkPos.m_nContent > rPos.nNode.GetNodes()[nPosNd]->GetContentNode()->Len(),
+ SAL_WARN_IF(rMkPos.m_nContent > rPos.GetNodes()[nPosNd]->GetContentNode()->Len(),
"sw.ww8", "redline ends after end of line");
if (isPoint) // sigh ... important special case...
{
@@ -777,7 +777,7 @@ namespace sw
(nPosCt < rPtPos.m_nContent))
{
rPtPos.m_nContent += nInserted;
- SAL_WARN_IF(rPtPos.m_nContent > rPos.nNode.GetNodes()[nPosNd]->GetContentNode()->Len(),
+ SAL_WARN_IF(rPtPos.m_nContent > rPos.GetNodes()[nPosNd]->GetContentNode()->Len(),
"sw.ww8", "range ends after end of line");
}
}