sw/inc/pam.hxx | 1 sw/source/core/crsr/crstrvl.cxx | 25 +++++----------- sw/source/core/crsr/findtxt.cxx | 5 --- sw/source/core/crsr/pam.cxx | 5 +++ sw/source/core/crsr/swcrsr.cxx | 3 - sw/source/core/crsr/trvlfnfl.cxx | 9 +---- sw/source/core/crsr/trvltbl.cxx | 9 +---- sw/source/core/crsr/viscrs.cxx | 8 +---- sw/source/core/doc/CntntIdxStore.cxx | 3 - sw/source/core/doc/DocumentContentOperationsManager.cxx | 3 - sw/source/core/doc/docedt.cxx | 5 +-- sw/source/core/doc/docnum.cxx | 3 - sw/source/core/doc/docredln.cxx | 6 +-- sw/source/core/fields/expfld.cxx | 3 - sw/source/core/text/EnhancedPDFExportHelper.cxx | 3 - sw/source/core/txtnode/atrfld.cxx | 3 - sw/source/core/undo/rolbck.cxx | 3 - sw/source/core/undo/unins.cxx | 3 - sw/source/core/undo/unspnd.cxx | 3 - sw/source/core/undo/untbl.cxx | 3 - sw/source/core/unocore/unochart.cxx | 3 - sw/source/core/unocore/unoobj2.cxx | 3 - sw/source/filter/html/swhtml.cxx | 6 +-- sw/source/filter/rtf/swparrtf.cxx | 3 - sw/source/filter/ww8/ww8par.cxx | 8 +---- sw/source/filter/ww8/ww8par6.cxx | 3 - sw/source/filter/xml/xmlimp.cxx | 3 - sw/source/uibase/uno/unotxdoc.cxx | 4 -- 28 files changed, 50 insertions(+), 89 deletions(-)
New commits: commit 9afc3e2715027811fe0f8bfc5be924a7781fc2a1 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Aug 4 08:39:23 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Aug 4 14:00:04 2022 +0200 use more SwPosition::Assign Updating some more of the places where the usage is "safe" i.e. this patch should introduce no functional change. Change-Id: I02390b3daecf23c1541a69f1957e6cf507cef72d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137777 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx index 05a910d19422..0b40c03a7733 100644 --- a/sw/inc/pam.hxx +++ b/sw/inc/pam.hxx @@ -85,6 +85,7 @@ struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition /// These all set both nNode and nContent void Assign( const SwNode& rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset = 0 ); void Assign( SwNodeOffset nNodeOffset, sal_Int32 nContentOffset = 0 ); + void Assign( const SwContentNode& rNode, sal_Int32 nContentOffset = 0 ); void Assign( const SwNode& rNd ); void Assign( const SwNodeIndex& rNdIdx ); /// Adjust node position, and resets content position to zero diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 451a5913fe62..498e99795eb7 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -611,9 +611,8 @@ const SwTOXMark& SwCursorShell::GotoTOXMark( const SwTOXMark& rStart, IsReadOnlyAvailable() ); // set position SwPosition& rPos = *GetCursor()->GetPoint(); - rPos.nNode = rNewMark.GetTextTOXMark()->GetTextNode(); - rPos.nContent.Assign( rPos.GetNode().GetContentNode(), - rNewMark.GetTextTOXMark()->GetStart() ); + rPos.Assign(rNewMark.GetTextTOXMark()->GetTextNode(), + rNewMark.GetTextTOXMark()->GetStart() ); if( !m_pCurrentCursor->IsSelOvr() ) UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE | @@ -841,9 +840,8 @@ bool SwCursorShell::GotoFootnoteAnchor(const SwTextFootnote& rTextFootnote) SwCallLink aLk(*this); // watch Cursor-Moves SwCursorSaveState aSaveState(*pCursor); - pCursor->GetPoint()->nNode = rTextFootnote.GetTextNode(); - pCursor->GetPoint()->nContent.Assign(&rTextFootnote.GetTextNode(), - rTextFootnote.GetStart()); + pCursor->GetPoint()->Assign(rTextFootnote.GetTextNode(), + rTextFootnote.GetStart()); bRet = !pCursor->IsSelOvr(); if (bRet) UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); @@ -871,14 +869,12 @@ bool SwCursorShell::GotoFormatContentControl(const SwFormatContentControl& rCont pCursor->SetMark(); SwTextNode* pTextNode = pContentControl->GetTextNode(); - pCursor->GetPoint()->nNode = *pTextNode; // Don't select the text attribute itself at the start. sal_Int32 nStart = pTextContentControl->GetStart() + 1; - pCursor->GetPoint()->nContent.Assign(pTextNode, nStart); - pCursor->GetMark()->nNode = *pTextNode; + pCursor->GetPoint()->Assign(*pTextNode, nStart); // Don't select the CH_TXTATR_BREAKWORD itself at the end. sal_Int32 nEnd = *pTextContentControl->End() - 1; - pCursor->GetMark()->nContent.Assign(pTextNode, nEnd); + pCursor->GetMark()->Assign(*pTextNode, nEnd); // Assume that once the placeholder is selected, the content is no longer the placeholder. pContentControl->SetShowingPlaceHolder(false); @@ -910,8 +906,7 @@ bool SwCursorShell::GotoFormatField( const SwFormatField& rField ) SwCursorSaveState aSaveState( *pCursor ); SwTextNode* pTNd = pTextField->GetpTextNode(); - pCursor->GetPoint()->nNode = *pTNd; - pCursor->GetPoint()->nContent.Assign( pTNd, pTextField->GetStart() ); + pCursor->GetPoint()->Assign(*pTNd, pTextField->GetStart() ); bRet = !pCursor->IsSelOvr(); if( bRet ) @@ -1313,8 +1308,7 @@ bool SwCursorShell::GotoRefMark( const OUString& rRefMark, sal_uInt16 nSubType, nSubType, nSeqNo, &nPos, nullptr, GetLayout()); if( pTextNd && pTextNd->GetNodes().IsDocNodes() ) { - m_pCurrentCursor->GetPoint()->nNode = *pTextNd; - m_pCurrentCursor->GetPoint()->nContent.Assign( pTextNd, nPos ); + m_pCurrentCursor->GetPoint()->Assign(*pTextNd, nPos ); if( !m_pCurrentCursor->IsSelOvr() ) { @@ -2168,8 +2162,7 @@ bool SwCursorShell::GotoINetAttr( const SwTextINetFormat& rAttr ) SwCallLink aLk( *this ); // watch Cursor-Moves SwCursorSaveState aSaveState( *pCursor ); - pCursor->GetPoint()->nNode = *rAttr.GetpTextNode(); - pCursor->GetPoint()->nContent.Assign( rAttr.GetpTextNode(), rAttr.GetStart() ); + pCursor->GetPoint()->Assign(*rAttr.GetpTextNode(), rAttr.GetStart() ); bRet = !pCursor->IsSelOvr(); if( bRet ) UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 4e23a612766e..0ae04af5017b 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -560,10 +560,7 @@ bool FindTextImpl(SwPaM & rSearchPam, } else { - aPaM.GetPoint()->nNode = rTextNode; - aPaM.GetPoint()->nContent.Assign( - aPaM.GetPoint()->GetNode().GetTextNode(), - nStart.GetModelIndex()); + aPaM.GetPoint()->Assign(rTextNode, nStart.GetModelIndex()); } aPaM.SetMark(); if (pLayout) diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index 495edbea1683..e734b1cd9aa0 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -219,6 +219,11 @@ void SwPosition::Assign( SwNodeOffset nNodeOffset, sal_Int32 nContentOffset ) nNode = nNodeOffset; nContent.Assign(nNode.GetNode().GetContentNode(), nContentOffset); } +void SwPosition::Assign( const SwContentNode& rNode, sal_Int32 nContentOffset ) +{ + nNode = rNode; + nContent.Assign(&rNode, nContentOffset); +} void SwPosition::Assign( const SwNode& rNd ) { nNode.Assign(rNd); diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index ff0aefe52708..45ff8a132d6c 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1445,8 +1445,7 @@ bool SwCursor::SelectWordWT( SwViewShell const * pViewShell, sal_Int16 nWordType assert(pMark->GetMarkEnd() != *GetPoint()); SetMark(); - GetMark()->nNode = rEnd.nNode; - GetMark()->nContent = rEnd.nContent; + *GetMark() = rEnd; --GetMark()->nContent; // Don't select the end delimiter bRet = true; diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx index f19e9e6c9f4b..62f0abe444ab 100644 --- a/sw/source/core/crsr/trvlfnfl.cxx +++ b/sw/source/core/crsr/trvlfnfl.cxx @@ -155,8 +155,7 @@ bool SwCursor::GotoFootnoteAnchor() SwCursorSaveState aSaveState( *this ); SwTextNode& rTNd = const_cast<SwTextNode&>(pTextFootnote->GetTextNode()); - GetPoint()->nNode = rTNd; - GetPoint()->nContent.Assign( &rTNd, pTextFootnote->GetStart() ); + GetPoint()->Assign( rTNd, pTextFootnote->GetStart() ); return !IsSelOvr( SwCursorSelOverFlags::CheckNodeSection | SwCursorSelOverFlags::Toggle ); @@ -262,8 +261,7 @@ bool SwCursor::GotoNextFootnoteAnchor() SwCursorSaveState aSaveState( *this ); SwTextNode& rTNd = const_cast<SwTextNode&>(pTextFootnote->GetTextNode()); - GetPoint()->nNode = rTNd; - GetPoint()->nContent.Assign( &rTNd, pTextFootnote->GetStart() ); + GetPoint()->Assign( rTNd, pTextFootnote->GetStart() ); bRet = !IsSelOvr(); } return bRet; @@ -333,8 +331,7 @@ bool SwCursor::GotoPrevFootnoteAnchor() SwCursorSaveState aSaveState( *this ); SwTextNode& rTNd = const_cast<SwTextNode&>(pTextFootnote->GetTextNode()); - GetPoint()->nNode = rTNd; - GetPoint()->nContent.Assign( &rTNd, pTextFootnote->GetStart() ); + GetPoint()->Assign( rTNd, pTextFootnote->GetStart() ); bRet = !IsSelOvr(); } return bRet; diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index 66f9efb054c7..e8df01fa2db8 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -546,8 +546,7 @@ bool GotoPrevTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable SwTextNode* pTextNode = aIdx.GetNode().GetTextNode(); if ( pTextNode ) { - rCurrentCursor.GetPoint()->nNode = *pTextNode; - rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, &fnPosTable == &fnMoveBackward ? + rCurrentCursor.GetPoint()->Assign(*pTextNode, &fnPosTable == &fnMoveBackward ? pTextNode->Len() : 0 ); } @@ -616,8 +615,7 @@ bool GotoNextTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable SwTextNode* pTextNode = aIdx.GetNode().GetTextNode(); if ( pTextNode ) { - rCurrentCursor.GetPoint()->nNode = *pTextNode; - rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, &fnPosTable == &fnMoveBackward ? + rCurrentCursor.GetPoint()->Assign(*pTextNode, &fnPosTable == &fnMoveBackward ? pTextNode->Len() : 0 ); } @@ -655,8 +653,7 @@ bool GotoCurrTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable if ( pTextNode ) { - rCurrentCursor.GetPoint()->nNode = *pTextNode; - rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, &fnPosTable == &fnMoveBackward ? + rCurrentCursor.GetPoint()->Assign(*pTextNode, &fnPosTable == &fnMoveBackward ? pTextNode->Len() : 0 ); } diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index f819ed297c12..8246dfcf8dd8 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -590,8 +590,7 @@ void SwSelPaintRects::HighlightInputField() std::unique_ptr<SwShellCursor> pCursorForInputTextField( new SwShellCursor( *GetShell(), SwPosition( *pTextNode, pCurTextInputFieldAtCursor->GetStart() ) ) ); pCursorForInputTextField->SetMark(); - pCursorForInputTextField->GetMark()->nNode = *pTextNode; - pCursorForInputTextField->GetMark()->nContent.Assign( pTextNode, *(pCurTextInputFieldAtCursor->End()) ); + pCursorForInputTextField->GetMark()->Assign(*pTextNode, *(pCurTextInputFieldAtCursor->End()) ); pCursorForInputTextField->FillRects(); SwRects* pRects = pCursorForInputTextField.get(); @@ -664,9 +663,8 @@ void SwSelPaintRects::HighlightContentControl() auto pCursorForContentControl = std::make_unique<SwShellCursor>( *GetShell(), SwPosition(*pTextNode, pCurContentControlAtCursor->GetStart())); pCursorForContentControl->SetMark(); - pCursorForContentControl->GetMark()->nNode = *pTextNode; - pCursorForContentControl->GetMark()->nContent.Assign( - pTextNode, *(pCurContentControlAtCursor->End())); + pCursorForContentControl->GetMark()->Assign( + *pTextNode, *(pCurContentControlAtCursor->End())); pCursorForContentControl->FillRects(); SwRects* pRects = pCursorForContentControl.get(); diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx index 58de4967a42d..a7795a6fdfb5 100644 --- a/sw/source/core/doc/CntntIdxStore.cxx +++ b/sw/source/core/doc/CntntIdxStore.cxx @@ -96,8 +96,7 @@ namespace : m_pNewContentNode(pNewContentNode), m_nOffset(nOffset) {}; void operator()(SwPosition& rPos, sal_Int32 nContent) const { - rPos.nNode = *m_pNewContentNode; - rPos.nContent.Assign(m_pNewContentNode, nContent + m_nOffset); + rPos.Assign(*m_pNewContentNode, nContent + m_nOffset); }; }; struct LimitUpdater diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index e68ad2ea7731..c5dca681c9eb 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -4931,8 +4931,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo if ((rPos.GetNodeIndex() - pCopyPam->GetPoint()->GetNodeIndex()) > SwNodeOffset(1)) { // First go back to the original place - pCopyPam->GetPoint()->nNode = rPos.nNode; - pCopyPam->GetPoint()->nContent = rPos.nContent; + *(pCopyPam->GetPoint()) = rPos; bCanMoveBack = false; bAfterTable = true; diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 48608b9b2dce..63eb1f967690 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -66,9 +66,8 @@ void RestFlyInRange( SaveFlyArr & rArr, const SwPosition& rStartPos, { if (aAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA) { - aPos.nNode = *pInsertPos; - assert(aPos.GetNode().GetContentNode()); - aPos.nContent.Assign(aPos.GetNode().GetContentNode(), + assert(pInsertPos->GetNode().GetContentNode()); + aPos.Assign( *pInsertPos->GetNode().GetContentNode(), rSave.nContentIndex); } else diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 1a18daa44fda..5ea677b2d9fc 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1869,9 +1869,8 @@ bool SwDoc::MoveParagraph(SwPaM& rPam, SwNodeOffset nOffset, bool const bIsOutlM rPam.SetMark(); } assert(rPam.End()->GetNodeIndex() < nodes.second->GetIndex()); - rPam.End()->nNode = *nodes.second; // until end, otherwise Impl will detect overlapping redline - rPam.End()->nContent.Assign(nodes.second, nodes.second->GetTextNode()->Len()); + rPam.End()->Assign(*nodes.second, nodes.second->GetTextNode()->Len()); } if (nOffset > SwNodeOffset(0)) diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index f167f5268895..edc8b44752e9 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -362,8 +362,7 @@ void SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRangeRe { SwShellCursor aCursor(pView->GetWrtShell(), *pStartPos); aCursor.SetMark(); - aCursor.GetMark()->nNode = pEndPos->nNode; - aCursor.GetMark()->nContent = pEndPos->nContent; + *aCursor.GetMark() = *pEndPos; aCursor.FillRects(); @@ -549,8 +548,7 @@ std::vector<SwRangeRedline*> GetAllValidRanges(std::unique_ptr<SwRangeRedline> p aNewStt.nContent = pEnd->nContent; else if( pC ) { - aNewStt.nNode = *pC; - aNewStt.nContent.Assign( pC, pC->Len() ); + aNewStt.Assign(*pC, pC->Len() ); } if( aNewStt <= *pEnd ) diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 4e0e66f29d68..383fb8d1a778 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -212,8 +212,7 @@ const SwTextNode* GetBodyTextNode( const SwDoc& rDoc, SwPosition& rPos, // get the anchor's node const SwTextFootnote* pFootnote = static_cast<const SwFootnoteFrame*>(pLayout)->GetAttr(); pTextNode = &pFootnote->GetTextNode(); - rPos.nNode = *pTextNode; - rPos.nContent = pFootnote->GetStart(); + rPos.Assign( *pTextNode, pFootnote->GetStart() ); } else if( pLayout->IsHeaderFrame() || pLayout->IsFooterFrame() ) { diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index b57fe7178fb5..af66250c3393 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1938,8 +1938,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() const SwTextFootnote* pTextFootnote = pDoc->GetFootnoteIdxs()[ nIdx ]; SwTextNode& rTNd = const_cast<SwTextNode&>(pTextFootnote->GetTextNode()); - mrSh.GetCursor_()->GetPoint()->nNode = rTNd; - mrSh.GetCursor_()->GetPoint()->nContent.Assign( &rTNd, pTextFootnote->GetStart() ); + mrSh.GetCursor_()->GetPoint()->Assign(rTNd, pTextFootnote->GetStart()); // 1. Check if the whole paragraph is hidden // 2. Check for hidden text attribute diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index d07c9d6b32d2..74bf184b487f 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -235,8 +235,7 @@ void SwFormatField::SwClientNotify( const SwModify& rModify, const SfxHint& rHin SwDoc& rDoc = pPaM->GetDoc(); const SwTextNode& rTextNode = mpTextField->GetTextNode(); - pPaM->GetPoint()->nNode = rTextNode; - pPaM->GetPoint()->nContent.Assign( &rTextNode, mpTextField->GetStart() ); + pPaM->GetPoint()->Assign(rTextNode, mpTextField->GetStart()); OUString const aEntry(mpField->ExpandField(rDoc.IsClipBoard(), pFieldHint->m_pLayout)); pPaM->SetMark(); diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index 60713e18f8de..69ac6d1571cd 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -674,8 +674,7 @@ void SwHistoryBookmark::SetInDoc( SwDoc* pDoc, bool ) if (pPam && pContentNd) { pPam->SetMark(); - pPam->GetMark()->nNode = m_nOtherNode; - pPam->GetMark()->nContent.Assign(pContentNd, m_nOtherContent); + pPam->GetMark()->Assign(*pContentNd, m_nOtherContent); } } else if(m_bHadOtherPos) diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index c03304e03b65..f8a8c73e2372 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -662,8 +662,7 @@ void SwUndoReplace::Impl::UndoImpl(::sw::UndoRedoContext & rContext) // don't look at m_sIns for deletion, maybe it was not completely inserted { - rPam.GetPoint()->nNode = *pNd; - rPam.GetPoint()->nContent.Assign( pNd, m_nSttCnt ); + rPam.GetPoint()->Assign(*pNd, m_nSttCnt ); rPam.SetMark(); rPam.GetPoint()->nNode = m_nSttNd - m_nOffset; rPam.GetPoint()->nContent.Assign(rPam.GetContentNode(), m_nSttNd == m_nEndNd ? m_nEndCnt : pNd->Len()); diff --git a/sw/source/core/undo/unspnd.cxx b/sw/source/core/undo/unspnd.cxx index 932aa697b53a..d91f21570641 100644 --- a/sw/source/core/undo/unspnd.cxx +++ b/sw/source/core/undo/unspnd.cxx @@ -111,8 +111,7 @@ void SwUndoSplitNode::UndoImpl(::sw::UndoRedoContext & rContext) SwTextNode * pTNd = pDoc->GetNodes()[ m_nNode ]->GetTextNode(); if( pTNd ) { - rPam.GetPoint()->nNode = *pTNd; - rPam.GetPoint()->nContent.Assign(pTNd, pTNd->GetText().getLength()); + rPam.GetPoint()->Assign(*pTNd, pTNd->GetText().getLength()); if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() )) { diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 5525ebbf7767..bb715149e328 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -2423,8 +2423,7 @@ void SwUndoTableCpyTable::UndoImpl(::sw::UndoRedoContext & rContext) SwTextNode *pText = aTmpIdx.GetNode().GetTextNode(); if( pText ) { - aPam.GetPoint()->nNode = *pText; - aPam.GetPoint()->nContent.Assign( pText, + aPam.GetPoint()->Assign(*pText, pUndoRedlineDelete->ContentStart() ); } else diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index b0386c44dca1..18ad4c75b316 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -2383,8 +2383,7 @@ bool SwChartDataSequence::DeleteBox( const SwTableBox &rBox ) m_pTableCursor->GetPoint() : m_pTableCursor->GetMark(); if (pPos) { - pPos->nNode = aNewPos.nNode; - pPos->nContent = aNewPos.nContent; + *pPos = aNewPos; } else { OSL_FAIL( "neither point nor mark available for change" ); diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 52a04b0c383c..5df6323eaae7 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1073,8 +1073,7 @@ bool SwXTextRange::GetPositions(SwPaM& rToFill, ::sw::TextRangeMode const eMode) SwNodeIndex const*const pSectionNode(pSectFormat->GetContent().GetContentIdx()); assert(pSectionNode); assert(pSectionNode->GetNodes().IsDocNodes()); - rToFill.GetPoint()->nNode = *pSectionNode; - rToFill.GetPoint()->Adjust(SwNodeOffset(1)); + rToFill.GetPoint()->Assign( pSectionNode->GetNode(), SwNodeOffset(1) ); rToFill.SetMark(); rToFill.GetMark()->nNode = *pSectionNode->GetNode().EndOfSectionNode(); --rToFill.GetMark()->nNode; diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 13dd07c810ff..0ebe4a93c675 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -755,8 +755,7 @@ void SwHTMLParser::Continue( HtmlTokenId nToken ) // when the cursor is still in the node, then set him at the end if( m_pPam->GetPoint()->nNode == aNxtIdx ) { - m_pPam->GetPoint()->nNode = *m_pSttNdIdx; - m_pPam->GetPoint()->nContent.Assign( pTextNode, nStt ); + m_pPam->GetPoint()->Assign( *pTextNode, nStt ); } #if OSL_DEBUG_LEVEL > 0 @@ -3062,8 +3061,7 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable, for (auto & field : aFields) { pCNd = field->m_nStartPara.GetNode().GetContentNode(); - aAttrPam.GetPoint()->nNode = field->m_nStartPara; - aAttrPam.GetPoint()->nContent.Assign( pCNd, field->m_nStartContent ); + aAttrPam.GetPoint()->Assign( *pCNd, field->m_nStartContent ); if( bBeforeTable && aAttrPam.GetPoint()->GetNodeIndex() == rEndIdx.GetIndex() ) diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index ba9c6b80d076..f89151ee629b 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -126,8 +126,7 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam // end of the previous node. if (aPam.GetPoint()->nNode == aNxtIdx) { - aPam.GetPoint()->nNode = *pSttNdIdx; - aPam.GetPoint()->nContent.Assign(pTextNode, pTextNode->GetText().getLength()); + aPam.GetPoint()->Assign(*pTextNode, pTextNode->GetText().getLength()); } // If the first new node isn't empty, convert the node's text // attributes into hints. Otherwise, set the new node's diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index de2f096bdff9..8024ac6dea1d 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -4597,9 +4597,7 @@ void wwSectionManager::InsertSegments() if (aNext != aEnd) { aAnchor = aNext->maStart; - aSectPaM.GetPoint()->nNode = aAnchor; - aSectPaM.GetPoint()->nContent.Assign( - aNext->maStart.GetNode().GetContentNode(), 0); + aSectPaM.GetPoint()->Assign(aAnchor); aSectPaM.Move(fnMoveBackward); } @@ -4619,9 +4617,7 @@ void wwSectionManager::InsertSegments() aSectPaM.SetMark(); - aSectPaM.GetPoint()->nNode = aIter->maStart; - aSectPaM.GetPoint()->nContent.Assign( - aSectPaM.GetContentNode(), 0); + aSectPaM.GetPoint()->Assign(aIter->maStart); bool bHasOwnHdFt = false; /* diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index 553a62dc296b..29006f5fbcc3 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -2557,8 +2557,7 @@ bool SwWW8ImplReader::JoinNode(SwPaM &rPam, bool bStealAttr) if (SwTextNode* pNode = aPref.GetNode().GetTextNode()) { m_aSectionManager.JoinNode(*rPam.GetPoint(), aPref.GetNode()); - rPam.GetPoint()->nNode = aPref; - rPam.GetPoint()->nContent.Assign(pNode, pNode->GetText().getLength()); + rPam.GetPoint()->Assign(*pNode, pNode->GetText().getLength()); if (bStealAttr) m_xCtrlStck->StealAttr(rPam.GetPoint()->nNode); diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 30b8daaf4840..72f1192f36e1 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -658,8 +658,7 @@ void SwXMLImport::endDocument() // end of the previous node. if( pPaM->GetPoint()->nNode == aNxtIdx ) { - pPaM->GetPoint()->nNode = *m_pSttNdIdx; - pPaM->GetPoint()->nContent.Assign( pTextNode, + pPaM->GetPoint()->Assign( *pTextNode, pTextNode->GetText().getLength()); } diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index f348abcf48f6..f002d6a960b5 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3240,9 +3240,7 @@ void SwXTextDocument::getTrackedChanges(tools::JsonWriter& rJson) { SwShellCursor aCursor(pView->GetWrtShell(), *(rRedlineTable[i]->Start())); aCursor.SetMark(); - aCursor.GetMark()->nNode = *pContentNd; - aCursor.GetMark()->nContent.Assign(pContentNd, - rRedlineTable[i]->End()->GetContentIndex()); + aCursor.GetMark()->Assign(*pContentNd, rRedlineTable[i]->End()->GetContentIndex()); aCursor.FillRects();