summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-08-13 11:05:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-13 15:41:38 +0200
commitf7748dfefe3ffcf0b8f905d418b4be6e1befcbba (patch)
tree3524c26c3a7a7b41f7f5d5ef37bb886da493e3f5
parent38c1cba4067cffbf9f16b524ac4697efdb5c9e01 (diff)
pass SwNode instead of SwNodeIndex to CopyNode
part of the process of hiding the internals of SwPosition Change-Id: Icaecb1c2eee09baf3f1630937bca9a96556eb023 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138225 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/inc/ndarr.hxx4
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx2
-rw-r--r--sw/source/core/doc/doc.cxx2
-rw-r--r--sw/source/core/doc/docdesc.cxx6
-rw-r--r--sw/source/core/doc/docfmt.cxx3
-rw-r--r--sw/source/core/doc/docsort.cxx2
-rw-r--r--sw/source/core/docnode/ndcopy.cxx2
-rw-r--r--sw/source/core/docnode/ndsect.cxx2
-rw-r--r--sw/source/core/docnode/nodes.cxx20
-rw-r--r--sw/source/core/undo/undel.cxx2
10 files changed, 21 insertions, 24 deletions
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 69aa1b24cdb7..ebf7696a7707 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -122,7 +122,7 @@ class SW_DLLPUBLIC SwNodes final
void UpdateOutlineIdx( const SwNode& ); ///< Update all OutlineNodes starting from Node.
- void CopyNodes( const SwNodeRange&, const SwNodeIndex&,
+ void CopyNodes( const SwNodeRange&, SwNode& rPos,
bool bNewFrames, bool bTableInsDummyNode = false ) const;
void DelDummyNodes( const SwNodeRange& rRg );
@@ -173,7 +173,7 @@ public:
bool bNewFrames = true );
void MoveRange( SwPaM&, SwPosition&, SwNodes& rNodes );
- void Copy_( const SwNodeRange& rRg, const SwNodeIndex& rInsPos,
+ void Copy_( const SwNodeRange& rRg, SwNode& rInsPos,
bool bNewFrames = true ) const
{ CopyNodes( rRg, rInsPos, bNewFrames ); }
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d6c782027ae5..d27762215749 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3641,7 +3641,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly(
SaveRedlEndPosForRestore aRedlRest( rInsPos, 0 );
// insert behind the already copied start node
- m_rDoc.GetNodes().CopyNodes( rRg, rInsPos, false, true );
+ m_rDoc.GetNodes().CopyNodes( rRg, rInsPos.GetNode(), false, true );
aRedlRest.Restore();
if (bEndIsEqualEndPos)
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 0a95206b0be9..6132efb16d97 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1248,7 +1248,7 @@ void SwDoc::Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImp
}
SwNodeRange aRange( *rOutNds[ i ], SwNodeOffset(0), *rOutNds[ i ], nEndOfs );
- GetNodes().Copy_( aRange, aEndOfDoc );
+ GetNodes().Copy_( aRange, aEndOfDoc.GetNode() );
}
const SwTextFormatColls *pColl = rExtDoc.GetTextFormatColls();
for( SwTextFormatColls::size_type i = 0; i < pColl->size(); ++i )
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index a12c80f01bda..0098be0331f3 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -299,8 +299,7 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHe
SwStartNode* pSttNd = SwNodes::MakeEmptySection( aTmp, SwHeaderStartNode );
SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), SwNodeOffset(0),
*aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() );
- aTmp = *pSttNd->EndOfSectionNode();
- GetNodes().Copy_( aRange, aTmp, false );
+ GetNodes().Copy_( aRange, *pSttNd->EndOfSectionNode(), false );
aTmp = *pSttNd;
GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, aTmp);
SwPaM const source(aRange.aStart, aRange.aEnd);
@@ -379,8 +378,7 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFo
SwStartNode* pSttNd = SwNodes::MakeEmptySection( aTmp, SwFooterStartNode );
SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), SwNodeOffset(0),
*aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() );
- aTmp = *pSttNd->EndOfSectionNode();
- GetNodes().Copy_( aRange, aTmp, false );
+ GetNodes().Copy_( aRange, *pSttNd->EndOfSectionNode(), false );
aTmp = *pSttNd;
GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, aTmp);
SwPaM const source(aRange.aStart, aRange.aEnd);
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 163fc16e1039..fa48318b1163 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1402,8 +1402,7 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader,
: SwFooterStartNode );
const SwNode& rCSttNd = pContent->GetContentIdx()->GetNode();
SwNodeRange aRg( rCSttNd, SwNodeOffset(0), *rCSttNd.EndOfSectionNode() );
- aTmpIdx = *pSttNd->EndOfSectionNode();
- rSrcNds.Copy_( aRg, aTmpIdx );
+ rSrcNds.Copy_( aRg, *pSttNd->EndOfSectionNode() );
aTmpIdx = *pSttNd;
rSrcFormat.GetDoc()->GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRg, nullptr, aTmpIdx);
// TODO: investigate calling CopyWithFlyInFly?
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index e1ab60da4f6c..cb25e057c791 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -334,7 +334,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
// First copy the range
SwNodeIndex aEndIdx( pEnd->nNode, 1 );
SwNodeRange aRg( pStart->nNode, aEndIdx );
- GetNodes().Copy_( aRg, aEndIdx );
+ GetNodes().Copy_( aRg, aEndIdx.GetNode() );
// range is new from pEnd->nNode+1 to aEndIdx
getIDocumentRedlineAccess().DeleteRedline( *pRedlPam, true, RedlineType::Any );
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 1296239719ba..b5383174336d 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -305,7 +305,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc& rDoc, const SwNodeIndex& rIdx ) const
// We have to make sure that the table node of the SwTable is accessible, even
// without any content in m_TabSortContentBoxes. #i26629#
pTableNd->GetTable().SetTableNode( pTableNd );
- rNds.Copy_( aRg, aInsPos, false );
+ rNds.Copy_( aRg, aInsPos.GetNode(), false );
pTableNd->GetTable().SetTableNode( nullptr );
// Special case for a single box
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 728ba76db1a8..816f54715c73 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -1277,7 +1277,7 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc& rDoc, const SwNodeIndex& rIdx ) c
pNewSect->SetEditInReadonly();
SwNodeRange aRg( *this, SwNodeOffset(+1), *EndOfSectionNode() ); // Where am I?
- rNds.Copy_( aRg, aInsPos, false );
+ rNds.Copy_( aRg, aInsPos.GetNode(), false );
// Delete all Frames from the copied Area. They are created when creating
// the SectionFrames.
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 1858999bd958..c01cbf7ee8c9 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1692,13 +1692,13 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
///@see SwNodes::MoveNodes (TODO: seems to be C&P programming here)
void SwNodes::CopyNodes( const SwNodeRange& rRange,
- const SwNodeIndex& rIndex, bool bNewFrames, bool bTableInsDummyNode ) const
+ SwNode& rPos, bool bNewFrames, bool bTableInsDummyNode ) const
{
- SwDoc& rDoc = rIndex.GetNode().GetDoc();
+ SwDoc& rDoc = rPos.GetDoc();
SwNode * pCurrentNode;
- if( rIndex == SwNodeOffset(0) ||
- ( (pCurrentNode = &rIndex.GetNode())->GetStartNode() &&
+ if( rPos.GetIndex() == SwNodeOffset(0) ||
+ ( (pCurrentNode = &rPos)->GetStartNode() &&
!pCurrentNode->StartOfSectionIndex() ))
return;
@@ -1742,13 +1742,13 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
"aRg should use this node array" );
OSL_ENSURE( &aRg.aStart.GetNodes() == &aRg.aEnd.GetNodes(),
"Range across different nodes arrays? You deserve punishment!");
- if( &rIndex.GetNodes() == &aRg.aStart.GetNodes() &&
- rIndex.GetIndex() >= aRg.aStart.GetIndex() &&
- rIndex.GetIndex() < aRg.aEnd.GetIndex() )
+ if( &rPos.GetNodes() == &aRg.aStart.GetNodes() &&
+ rPos.GetIndex() >= aRg.aStart.GetIndex() &&
+ rPos.GetIndex() < aRg.aEnd.GetIndex() )
return;
- SwNodeIndex aInsPos( rIndex );
- SwNodeIndex aOrigInsPos( rIndex, -1 ); // original insertion position
+ SwNodeIndex aInsPos( rPos );
+ SwNodeIndex aOrigInsPos( rPos, -1 ); // original insertion position
int nLevel = 0; // level counter
for( SwNodeOffset nNodeCnt = aRg.aEnd.GetIndex() - aRg.aStart.GetIndex();
@@ -1787,7 +1787,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
SwStartNode* pSttNd = aRg.aStart.GetNode().GetStartNode();
CopyNodes( SwNodeRange( *pSttNd, SwNodeOffset(+ 1),
*pSttNd->EndOfSectionNode() ),
- aInsPos, bNewFrames );
+ aInsPos.GetNode(), bNewFrames );
// insert a DummyNode for the box-EndNode?
if( bTableInsDummyNode )
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index d261ade7f82a..4ee55770e83d 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -971,7 +971,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
{
SwNodeRange aRange( *m_oMvStt, SwNodeOffset(0), *m_oMvStt, m_nNode );
SwNodeIndex aCopyIndex( aPos.nNode, -1 );
- rDoc.GetUndoManager().GetUndoNodes().Copy_(aRange, aPos.nNode,
+ rDoc.GetUndoManager().GetUndoNodes().Copy_(aRange, aPos.GetNode(),
// sw_redlinehide: delay creating frames: the flags on the
// nodes aren't necessarily up-to-date, and the redlines
// from m_pRedlSaveData aren't applied yet...