diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-01 10:09:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-01 13:00:20 +0200 |
commit | fe8dfdf6dad15f39f68859b935e7337f1d1fa0eb (patch) | |
tree | 817e2b0de27a8091ba9080c74d8dcf130eea158a /sw | |
parent | 5dd22c7fe8aeaaee76cb8124113adda6c43dfd39 (diff) |
use more SwPosition::Assign
part of hiding the internals of SwPosition
Change-Id: Ia832fec32146c0d323a9a6ee1d8645f713e0371f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139146
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/IDocumentContentOperations.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/doc/doclay.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docsort.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/edit/edglbldc.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/frmedt/tblsel.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentContentOperationsManager.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/inc/UndoSplitMove.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/inc/UndoTable.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/table/swnewtable.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/undo/unmove.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/undo/unsort.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/undo/untbl.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/html/htmltab.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/docvw/UnfloatTableButton.cxx | 3 |
16 files changed, 38 insertions, 37 deletions
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx index 94bb7102dee0..5a95d0ba95b8 100644 --- a/sw/inc/IDocumentContentOperations.hxx +++ b/sw/inc/IDocumentContentOperations.hxx @@ -153,7 +153,7 @@ public: virtual bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) = 0; - virtual bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) = 0; + virtual bool MoveNodeRange(SwNodeRange&, SwNode&, SwMoveFlags) = 0; /** Move a range. */ diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 402325687e01..5011e066eb50 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -960,7 +960,7 @@ namespace } bool lcl_SaveFootnote( const SwNodeIndex& rSttNd, const SwNodeIndex& rEndNd, - const SwNodeIndex& rInsPos, + const SwNode& rInsPos, SwFootnoteIdxs& rFootnoteArr, SwFootnoteIdxs& rSaveArr, const SwContentIndex* pSttCnt = nullptr, const SwContentIndex* pEndCnt = nullptr ) { @@ -2371,7 +2371,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos, } else { - bUpdateFootnote = lcl_SaveFootnote( pStt->nNode, pEnd->nNode, rPos.nNode, + bUpdateFootnote = lcl_SaveFootnote( pStt->nNode, pEnd->nNode, rPos.GetNode(), m_rDoc.GetFootnoteIdxs(), aTmpFntIdx, &pStt->nContent, &pEnd->nContent ); } @@ -2551,7 +2551,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& rPaM, SwPosition& rPos, return true; } -bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos, +bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNode& rDestNd, SwMoveFlags eMvFlags ) { // Moves all Nodes to the new position. @@ -2568,11 +2568,11 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod std::unique_ptr<SwUndoMove> pUndo; if ((SwMoveFlags::CREATEUNDOOBJ & eMvFlags ) && m_rDoc.GetIDocumentUndoRedo().DoesUndo()) { - pUndo.reset(new SwUndoMove( m_rDoc, rRange, rPos )); + pUndo.reset(new SwUndoMove( m_rDoc, rRange, rDestNd )); } else { - bUpdateFootnote = lcl_SaveFootnote( rRange.aStart, rRange.aEnd, rPos, + bUpdateFootnote = lcl_SaveFootnote( rRange.aStart, rRange.aEnd, rDestNd, m_rDoc.GetFootnoteIdxs(), aTmpFntIdx ); } @@ -2584,7 +2584,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod // Find all RedLines that end at the InsPos. // These have to be moved back to the "old" position after the Move. - SwRedlineTable::size_type nRedlPos = m_rDoc.getIDocumentRedlineAccess().GetRedlinePos( rPos.GetNode(), RedlineType::Any ); + SwRedlineTable::size_type nRedlPos = m_rDoc.getIDocumentRedlineAccess().GetRedlinePos( rDestNd, RedlineType::Any ); if( SwRedlineTable::npos != nRedlPos ) { const SwPosition *pRStt, *pREnd; @@ -2592,11 +2592,11 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod SwRangeRedline* pTmp = m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nRedlPos ]; pRStt = pTmp->Start(); pREnd = pTmp->End(); - if( pREnd->GetNode() == rPos.GetNode() && pRStt->GetNode() < rPos.GetNode() ) + if( pREnd->GetNode() == rDestNd && pRStt->GetNode() < rDestNd ) { aSavRedlInsPosArr.push_back( pTmp ); } - } while( pRStt->GetNode() < rPos.GetNode() && ++nRedlPos < m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size()); + } while( pRStt->GetNode() < rDestNd && ++nRedlPos < m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().size()); } } @@ -2612,7 +2612,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod SaveFlyInRange( rRange, aSaveFlyArr ); // Set it to before the Position, so that it cannot be moved further. - SwNodeIndex aIdx( rPos, -1 ); + SwNodeIndex aIdx( rDestNd, -1 ); std::optional<SwNodeIndex> oSaveInsPos; if( pUndo ) @@ -2620,7 +2620,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod // move the Nodes bool bNoDelFrames = bool(SwMoveFlags::NO_DELFRMS & eMvFlags); - if( m_rDoc.GetNodes().MoveNodes( rRange, m_rDoc.GetNodes(), rPos.GetNode(), !bNoDelFrames ) ) + if( m_rDoc.GetNodes().MoveNodes( rRange, m_rDoc.GetNodes(), rDestNd, !bNoDelFrames ) ) { ++aIdx; // again back to old position if( oSaveInsPos ) @@ -2660,7 +2660,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod if( pUndo ) { - pUndo->SetDestRange( aIdx, rPos, *oSaveInsPos ); + pUndo->SetDestRange( aIdx.GetNode(), rDestNd, *oSaveInsPos ); m_rDoc.GetIDocumentUndoRedo().AppendUndo(std::move(pUndo)); } diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 8caeb37e79db..e1ade4a118ec 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -389,7 +389,7 @@ SwFlyFrameFormat* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rS GetNodes().MakeTextNode( aRg.aStart.GetNode(), GetDfltTextFormatColl() ); - getIDocumentContentOperations().MoveNodeRange( aRg, aPos.nNode, SwMoveFlags::DEFAULT ); + getIDocumentContentOperations().MoveNodeRange( aRg, aPos.GetNode(), SwMoveFlags::DEFAULT ); } else { diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index e41549d75e83..7462b608df99 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -2354,7 +2354,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, SwNodeOffset const nOffset, assert(!pLayout // check not moving *into* delete redline (caller's fault) || aIdx.GetNode().GetRedlineMergeFlag() == SwNode::Merge::None || aIdx.GetNode().GetRedlineMergeFlag() == SwNode::Merge::First); - getIDocumentContentOperations().MoveNodeRange( aMvRg, aIdx, SwMoveFlags::REDLINES ); + getIDocumentContentOperations().MoveNodeRange( aMvRg, aIdx.GetNode(), SwMoveFlags::REDLINES ); if( pUndo ) { diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 1252a941e7df..4ebabdc74821 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -396,7 +396,7 @@ bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) aRg.aEnd = aRg.aStart.GetIndex() + 1; // Move Nodes - getIDocumentContentOperations().MoveNodeRange( aRg, aStart, + getIDocumentContentOperations().MoveNodeRange( aRg, aStart.GetNode(), SwMoveFlags::DEFAULT ); // Insert Move in Undo @@ -719,7 +719,7 @@ void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, const SwTableBox* pTar, // Insert the Source SwNodeIndex aIns( *pTar->GetSttNd()->EndOfSectionNode() ); - pDoc->getIDocumentContentOperations().MoveNodeRange( aRg, aIns, + pDoc->getIDocumentContentOperations().MoveNodeRange( aRg, aIns.GetNode(), SwMoveFlags::DEFAULT ); // If first Node is empty -> delete it diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index 7151939151e1..c538a97b6a96 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -324,7 +324,7 @@ bool SwEditShell::MoveGlobalDocContent( const SwGlblDocContents& rArr , else aInsPos = pMyDoc->GetNodes().GetEndOfContent(); - bool bRet = pMyDoc->getIDocumentContentOperations().MoveNodeRange( aRg, aInsPos, + bool bRet = pMyDoc->getIDocumentContentOperations().MoveNodeRange( aRg, aInsPos.GetNode(), SwMoveFlags::CREATEUNDOOBJ ); EndAllAction(); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index ccbb1219d6fe..fb08054edf8d 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1376,10 +1376,10 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, SwNodeRange aRg( aSttNdIdx.GetNode(), aPam.GetPoint()->GetNode() ); ++rInsPosNd; if( pUndo ) - pUndo->MoveBoxContent( *pDoc, aRg, rInsPosNd ); + pUndo->MoveBoxContent( *pDoc, aRg, rInsPosNd.GetNode() ); else { - pDoc->getIDocumentContentOperations().MoveNodeRange( aRg, rInsPosNd, + pDoc->getIDocumentContentOperations().MoveNodeRange( aRg, rInsPosNd.GetNode(), SwMoveFlags::DEFAULT ); } // where is now aInsPos ?? diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx index 6b45e6ca01ae..49473930f7fe 100644 --- a/sw/source/core/inc/DocumentContentOperationsManager.hxx +++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx @@ -48,7 +48,7 @@ public: bool MoveRange(SwPaM&, SwPosition&, SwMoveFlags) override; - bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) override; + bool MoveNodeRange(SwNodeRange&, SwNode&, SwMoveFlags) override; void MoveAndJoin(SwPaM&, SwPosition&) override; diff --git a/sw/source/core/inc/UndoSplitMove.hxx b/sw/source/core/inc/UndoSplitMove.hxx index 9cf2fda25af4..cd8b653df9fa 100644 --- a/sw/source/core/inc/UndoSplitMove.hxx +++ b/sw/source/core/inc/UndoSplitMove.hxx @@ -63,13 +63,13 @@ class SwUndoMove final : public SwUndo, private SwUndRng, private SwUndoSaveCont public: SwUndoMove( const SwPaM&, const SwPosition& ); - SwUndoMove( SwDoc& rDoc, const SwNodeRange&, const SwNodeIndex& ); + SwUndoMove( SwDoc& rDoc, const SwNodeRange&, const SwNode& ); virtual void UndoImpl( ::sw::UndoRedoContext & ) override; virtual void RedoImpl( ::sw::UndoRedoContext & ) override; /// set the destination range after the move - void SetDestRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd, + void SetDestRange( const SwNode& rStt, const SwNode& rEnd, const SwNodeIndex& rInsPos ); bool IsMoveRange() const { return m_bMoveRange; } diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx index 749f4873d77b..e43ed4847b3d 100644 --- a/sw/source/core/inc/UndoTable.hxx +++ b/sw/source/core/inc/UndoTable.hxx @@ -234,7 +234,7 @@ public: virtual void UndoImpl( ::sw::UndoRedoContext & ) override; virtual void RedoImpl( ::sw::UndoRedoContext & ) override; - void MoveBoxContent( SwDoc& rDoc, SwNodeRange& rRg, SwNodeIndex& rPos ); + void MoveBoxContent( SwDoc& rDoc, SwNodeRange& rRg, SwNode& rPos ); void SetSelBoxes( const SwSelBoxes& rBoxes ); diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 2c6122b26aaa..59428ec61f97 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -902,10 +902,10 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes, } SwNodeRange aRg( aSttNdIdx.GetNode(), aPam.GetPoint()->GetNode() ); if( pUndo ) - pUndo->MoveBoxContent( *pDoc, aRg, rInsPosNd ); + pUndo->MoveBoxContent( *pDoc, aRg, rInsPosNd.GetNode() ); else { - pDoc->getIDocumentContentOperations().MoveNodeRange( aRg, rInsPosNd, + pDoc->getIDocumentContentOperations().MoveNodeRange( aRg, rInsPosNd.GetNode(), SwMoveFlags::NO_DELFRMS ); } } @@ -2208,7 +2208,7 @@ void SwTable::ConvertSubtableBox(sal_uInt16 const nRow, sal_uInt16 const nBox) #if 0 pDoc->GetNodes().MoveNodes(content, pDoc->GetNodes(), insPos, false); #else - pDoc->getIDocumentContentOperations().MoveNodeRange(content, insPos, SwMoveFlags::NO_DELFRMS|SwMoveFlags::REDLINES); + pDoc->getIDocumentContentOperations().MoveNodeRange(content, insPos.GetNode(), SwMoveFlags::NO_DELFRMS|SwMoveFlags::REDLINES); #endif // delete the empty node that was bundled in the new box pDoc->GetNodes().Delete(insPos); diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx index 4ddaca99051e..6776f71b872c 100644 --- a/sw/source/core/undo/unmove.cxx +++ b/sw/source/core/undo/unmove.cxx @@ -92,7 +92,7 @@ SwUndoMove::SwUndoMove( const SwPaM& rRange, const SwPosition& rMvPos ) } SwUndoMove::SwUndoMove( SwDoc& rDoc, const SwNodeRange& rRg, - const SwNodeIndex& rMvPos ) + const SwNode& rMvPos ) : SwUndo(SwUndoId::MOVE, &rDoc) , m_nDestStartNode(0) , m_nDestEndNode(0) @@ -134,8 +134,8 @@ SwUndoMove::SwUndoMove( SwDoc& rDoc, const SwNodeRange& rRg, m_nFootnoteStart = 0; } -void SwUndoMove::SetDestRange( const SwNodeIndex& rStt, - const SwNodeIndex& rEnd, +void SwUndoMove::SetDestRange( const SwNode& rStt, + const SwNode& rEnd, const SwNodeIndex& rInsPos ) { m_nDestStartNode = rStt.GetIndex(); @@ -165,7 +165,7 @@ void SwUndoMove::UndoImpl(::sw::UndoRedoContext & rContext) SwNodeRange aRg( aIdx, aIdx ); aRg.aEnd = m_nDestEndNode; aIdx = m_nInsPosNode; - bool bSuccess = pDoc->getIDocumentContentOperations().MoveNodeRange( aRg, aIdx, + bool bSuccess = pDoc->getIDocumentContentOperations().MoveNodeRange( aRg, aIdx.GetNode(), SwMoveFlags::DEFAULT ); if (!bSuccess) break; @@ -244,7 +244,7 @@ void SwUndoMove::RedoImpl(::sw::UndoRedoContext & rContext) { // only a move with SwRange SwNodeRange aRg( rNds, m_nSttNode, m_nEndNode ); - rDoc.getIDocumentContentOperations().MoveNodeRange( aRg, aIdx, m_bMoveRedlines + rDoc.getIDocumentContentOperations().MoveNodeRange( aRg, aIdx.GetNode(), m_bMoveRedlines ? SwMoveFlags::REDLINES : SwMoveFlags::DEFAULT ); } diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx index 516f341a17a3..39ca01a65c44 100644 --- a/sw/source/core/undo/unsort.cxx +++ b/sw/source/core/undo/unsort.cxx @@ -140,7 +140,7 @@ void SwUndoSort::UndoImpl(::sw::UndoRedoContext & rContext) { SwNodeIndex aIdx( rDoc.GetNodes(), m_nSttNode + SwNodeOffset(i) ); SwNodeRange aRg( aIdxList[i], SwNodeOffset(0), aIdxList[i], SwNodeOffset(1) ); - rDoc.getIDocumentContentOperations().MoveNodeRange(aRg, aIdx, + rDoc.getIDocumentContentOperations().MoveNodeRange(aRg, aIdx.GetNode(), SwMoveFlags::DEFAULT); } // delete indices @@ -213,7 +213,7 @@ void SwUndoSort::RedoImpl(::sw::UndoRedoContext & rContext) { SwNodeIndex aIdx( rDoc.GetNodes(), m_nSttNode + SwNodeOffset(i)); SwNodeRange aRg( aIdxList[i], SwNodeOffset(0), aIdxList[i], SwNodeOffset(1) ); - rDoc.getIDocumentContentOperations().MoveNodeRange(aRg, aIdx, + rDoc.getIDocumentContentOperations().MoveNodeRange(aRg, aIdx.GetNode(), SwMoveFlags::DEFAULT); } // delete indices diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 98122704058d..fb7d2eb1e5e9 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -2000,7 +2000,7 @@ void SwUndoTableMerge::RedoImpl(::sw::UndoRedoContext & rContext) rDoc.MergeTable(rPam); } -void SwUndoTableMerge::MoveBoxContent( SwDoc& rDoc, SwNodeRange& rRg, SwNodeIndex& rPos ) +void SwUndoTableMerge::MoveBoxContent( SwDoc& rDoc, SwNodeRange& rRg, SwNode& rPos ) { SwNodeIndex aTmp( rRg.aStart, -1 ), aTmp2( rPos, -1 ); std::unique_ptr<SwUndoMove> pUndo(new SwUndoMove( rDoc, rRg, rPos )); @@ -2010,7 +2010,7 @@ void SwUndoTableMerge::MoveBoxContent( SwDoc& rDoc, SwNodeRange& rRg, SwNodeInde SwMoveFlags::DEFAULT ); ++aTmp; ++aTmp2; - pUndo->SetDestRange( aTmp2, rPos, aTmp ); + pUndo->SetDestRange( aTmp2.GetNode(), rPos, aTmp ); m_vMoves.push_back(std::move(pUndo)); } diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index af4c9fd3d71f..11e2ecbd5bc5 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -5156,7 +5156,7 @@ std::shared_ptr<HTMLTable> SwHTMLParser::BuildTable(SvxAdjust eParentAdjust, pNd = pTableStNd->EndOfSectionNode(); SwNodeIndex aDstIdx( *pNd, bTop ? 0 : 1 ); - m_xDoc->getIDocumentContentOperations().MoveNodeRange( aSrcRg, aDstIdx, + m_xDoc->getIDocumentContentOperations().MoveNodeRange( aSrcRg, aDstIdx.GetNode(), SwMoveFlags::DEFAULT ); // If the caption was added before the table, a page style on that table diff --git a/sw/source/uibase/docvw/UnfloatTableButton.cxx b/sw/source/uibase/docvw/UnfloatTableButton.cxx index 49bf9c660771..2f0f596cc3c0 100644 --- a/sw/source/uibase/docvw/UnfloatTableButton.cxx +++ b/sw/source/uibase/docvw/UnfloatTableButton.cxx @@ -173,7 +173,8 @@ void UnfloatTableButton::MouseButtonDown(const MouseEvent& /*rMEvt*/) // Move the table outside of the text frame SwNodeRange aRange(*pTableNode, SwNodeOffset(0), *pTableNode->EndOfSectionNode(), SwNodeOffset(1)); - rDoc.getIDocumentContentOperations().MoveNodeRange(aRange, aInsertPos, SwMoveFlags::DEFAULT); + rDoc.getIDocumentContentOperations().MoveNodeRange(aRange, aInsertPos.GetNode(), + SwMoveFlags::DEFAULT); // Remove the floating table's frame SwFlyFrameFormat* pFrameFormat = pFlyFrame->GetFormat(); |