diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-08-13 16:26:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-13 19:08:46 +0200 |
commit | a0b9a7e7f0d14d0f121e54cb8979074bc5dfbe38 (patch) | |
tree | a862697741a540523d3bb58ed7bd4a3019bbd6ae /sw | |
parent | 0182491e5fdfe5fa085d6bed527bb66e8b6fdf39 (diff) |
pass SwNode instead of SwNodeIndex to CopyFlyInFlyImpl
part of the process of hiding the internals of SwPosition
Change-Id: Ib2ac69352ca7e37117ad449fa7cb9f7cd69dd333
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138232
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/doc/docdesc.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/doc/docfmt.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentContentOperationsManager.hxx | 2 |
4 files changed, 15 insertions, 18 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index d27762215749..b7328a40bb24 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -3763,8 +3763,8 @@ void DocumentContentOperationsManager::CopyWithFlyInFly( CopyFlyInFlyImpl(rRg, pCopiedPaM ? &pCopiedPaM->first : nullptr, // see comment below regarding use of pCopiedPaM->second (pCopiedPaM && rRg.aStart != pCopiedPaM->first.Start()->nNode) - ? pCopiedPaM->second.nNode - : aSavePos, + ? pCopiedPaM->second.GetNode() + : aSavePos.GetNode(), bCopyFlyAtFly, flags); } @@ -3782,7 +3782,7 @@ void DocumentContentOperationsManager::CopyWithFlyInFly( void DocumentContentOperationsManager::CopyFlyInFlyImpl( const SwNodeRange& rRg, SwPaM const*const pCopiedPaM, - const SwNodeIndex& rStartIdx, + SwNode& rStartIdx, const bool bCopyFlyAtFly, SwCopyFlags const flags) const { @@ -3791,7 +3791,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl( // First collect all Flys, sort them according to their ordering number, // and then only copy them. This maintains the ordering numbers (which are only // managed in the DrawModel). - SwDoc& rDest = rStartIdx.GetNode().GetDoc(); + SwDoc& rDest = rStartIdx.GetDoc(); std::set< ZSortFly > aSet; const size_t nArrLen = m_rDoc.GetSpzFrameFormats()->size(); @@ -5059,11 +5059,11 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo POP_NUMRULE_STATE } - // copy at-char flys in rPam - SwNodeIndex temp(*pDestTextNd); // update to new (start) node for flys - // tdf#126626 prevent duplicate Undos + // Copy at-char flys in rPam. + // Update to new (start) node for flys. + // tdf#126626 prevent duplicate Undos. ::sw::UndoGuard const ug(rDoc.GetIDocumentUndoRedo()); - CopyFlyInFlyImpl(aRg, &rPam, temp, false); + CopyFlyInFlyImpl(aRg, &rPam, *pDestTextNd, false); break; } diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 2060332d9d6a..d75caf8cac0b 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -299,10 +299,9 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHe SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), SwNodeOffset(0), *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() ); GetNodes().Copy_( aRange, *pSttNd->EndOfSectionNode(), false ); - SwNodeIndex aTmp( *pSttNd ); - GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, aTmp); + GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, *pSttNd); SwPaM const source(aRange.aStart, aRange.aEnd); - SwPosition dest(aTmp); + SwPosition dest(*pSttNd); sw::CopyBookmarks(source, dest); pFormat->SetFormatAttr( SwFormatContent( pSttNd ) ); rDescFrameFormat.SetFormatAttr( SwFormatHeader( pFormat ) ); @@ -377,10 +376,9 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFo SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), SwNodeOffset(0), *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() ); GetNodes().Copy_( aRange, *pSttNd->EndOfSectionNode(), false ); - SwNodeIndex aTmp( *pSttNd ); - GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, aTmp); + GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, *pSttNd); SwPaM const source(aRange.aStart, aRange.aEnd); - SwPosition dest(aTmp); + SwPosition dest(*pSttNd); sw::CopyBookmarks(source, dest); pFormat->SetFormatAttr( SwFormatContent( pSttNd ) ); rDescFrameFormat.SetFormatAttr( SwFormatFooter( pFormat ) ); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index dfa71cf341df..702bdd6edbee 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1402,11 +1402,10 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, const SwNode& rCSttNd = pContent->GetContentIdx()->GetNode(); SwNodeRange aRg( rCSttNd, SwNodeOffset(0), *rCSttNd.EndOfSectionNode() ); rSrcNds.Copy_( aRg, *pSttNd->EndOfSectionNode() ); - SwNodeIndex aTmpIdx( *pSttNd ); - rSrcFormat.GetDoc()->GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRg, nullptr, aTmpIdx); + rSrcFormat.GetDoc()->GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRg, nullptr, *pSttNd); // TODO: investigate calling CopyWithFlyInFly? SwPaM const source(aRg.aStart, aRg.aEnd); - SwPosition dest(aTmpIdx); + SwPosition dest(*pSttNd); sw::CopyBookmarks(source, dest); pNewFormat->SetFormatAttr( SwFormatContent( pSttNd )); } diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx index ce6dc7788a86..89df4e3416bd 100644 --- a/sw/source/core/inc/DocumentContentOperationsManager.hxx +++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx @@ -111,7 +111,7 @@ public: SwCopyFlags flags = SwCopyFlags::Default) const; void CopyFlyInFlyImpl( const SwNodeRange& rRg, SwPaM const*const pCopiedPaM, - const SwNodeIndex& rStartIdx, + SwNode& rStartIdx, const bool bCopyFlyAtFly = false, SwCopyFlags flags = SwCopyFlags::Default) const; |