diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-04 14:47:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-05 09:17:55 +0200 |
commit | 8dd67096d9472aaf46c9db59921b65d92f8c3827 (patch) | |
tree | 6104de80a71e565c77484d92418e6ee527aae109 /sw/source | |
parent | fa5ba20b953da85ad387449cf613d7be59c3d5c2 (diff) |
use more SwPosition::Assign
as part of the process of hiding the internals of SwPosition
these are still the easy ones, i.e. no functional change intended
Change-Id: Ibb2adf17de47bab5374730b508d9c020991a945e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137802
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/crsr/pam.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/doc/CntntIdxStore.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 46 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentRedlineManager.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/doccomp.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/docfld.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/edit/eddel.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/frmedt/fetab.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/undo/unattr.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/undo/unins.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/undo/unredln.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/undo/unspnd.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/undo/untbl.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj2.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/ascii/parasc.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/docvw/AnnotationWin2.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 12 |
21 files changed, 59 insertions, 115 deletions
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx index d2bec56c9f98..c23dd899eeae 100644 --- a/sw/source/core/crsr/pam.cxx +++ b/sw/source/core/crsr/pam.cxx @@ -224,15 +224,15 @@ void SwPosition::Assign( const SwContentNode& rNode, sal_Int32 nContentOffset ) nNode = rNode; nContent.Assign(&rNode, nContentOffset); } -void SwPosition::Assign( const SwNode& rNd ) +void SwPosition::Assign( const SwNode& rNd, sal_Int32 nContentOffset ) { nNode.Assign(rNd); - nContent.Assign(rNd.GetContentNode(), 0); + nContent.Assign(rNd.GetContentNode(), nContentOffset); } -void SwPosition::Assign( const SwNodeIndex& rNdIdx ) +void SwPosition::Assign( const SwNodeIndex& rNdIdx, sal_Int32 nContentOffset ) { nNode = rNdIdx; - nContent.Assign(nNode.GetNode().GetContentNode(), 0); + nContent.Assign(nNode.GetNode().GetContentNode(), nContentOffset); } void SwPosition::Adjust( SwNodeOffset nDelta ) { diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx index a7795a6fdfb5..3c89c2384a17 100644 --- a/sw/source/core/doc/CntntIdxStore.cxx +++ b/sw/source/core/doc/CntntIdxStore.cxx @@ -108,15 +108,15 @@ namespace : m_pNewContentNode(pNewContentNode), m_nLen(nLen), m_nCorrLen(nCorrLen) {}; void operator()(SwPosition& rPos, sal_Int32 nContent) const { - rPos.nNode = *m_pNewContentNode; if( nContent < m_nCorrLen ) { - rPos.nContent.Assign(m_pNewContentNode, std::min( nContent, static_cast<sal_Int32>(m_nLen) ) ); + nContent = std::min( nContent, static_cast<sal_Int32>(m_nLen) ); } else { - rPos.nContent -= m_nCorrLen; + nContent -= m_nCorrLen; } + rPos.Assign( *m_pNewContentNode, nContent ); }; }; struct ContentIdxStoreImpl : sw::mark::ContentIdxStore diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index a5c2941979cc..9fa6df2f86c0 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -770,23 +770,21 @@ namespace void SetPos( SwNodeOffset nInsPos ) { - pRedl->GetPoint()->nNode = nInsPos + nStt; - pRedl->GetPoint()->nContent.Assign( pRedl->GetContentNode(), nSttCnt ); + pRedl->GetPoint()->Assign( nInsPos + nStt, nSttCnt ); if( pRedl->HasMark() ) { - pRedl->GetMark()->nNode = nInsPos + nEnd; - pRedl->GetMark()->nContent.Assign( pRedl->GetContentNode(false), nEndCnt ); + pRedl->GetMark()->Assign( nInsPos + nEnd, nEndCnt ); } } void SetPos( const SwPosition& aPos ) { - pRedl->GetPoint()->nNode = aPos.GetNodeIndex() + nStt; - pRedl->GetPoint()->nContent.Assign( pRedl->GetContentNode(), nSttCnt + ( nStt == SwNodeOffset(0) ? aPos.GetContentIndex() : 0 ) ); + pRedl->GetPoint()->Assign( aPos.GetNodeIndex() + nStt, + nSttCnt + ( nStt == SwNodeOffset(0) ? aPos.GetContentIndex() : 0 ) ); if( pRedl->HasMark() ) { - pRedl->GetMark()->nNode = aPos.GetNodeIndex() + nEnd; - pRedl->GetMark()->nContent.Assign( pRedl->GetContentNode(false), nEndCnt + ( nEnd == SwNodeOffset(0) ? aPos.GetContentIndex() : 0 ) ); + pRedl->GetMark()->Assign( aPos.GetNodeIndex() + nEnd, + nEndCnt + ( nEnd == SwNodeOffset(0) ? aPos.GetContentIndex() : 0 ) ); } } }; @@ -900,23 +898,17 @@ namespace // The copy is moved too. SwRangeRedline* pNewRedl = new SwRangeRedline( *pTmp ); SwPosition* pTmpPos = pNewRedl->Start(); - pTmpPos->nNode = rRg.aStart; - pTmpPos->nContent.Assign( - pTmpPos->GetNode().GetContentNode(), 0 ); + pTmpPos->Assign(rRg.aStart); rArr.emplace_back(pNewRedl, rRg.aStart); pTmpPos = pTmp->End(); - pTmpPos->nNode = rRg.aEnd; - pTmpPos->nContent.Assign( - pTmpPos->GetNode().GetContentNode(), 0 ); + pTmpPos->Assign(rRg.aEnd); } else if( pREnd->nNode == rRg.aStart ) { SwPosition* pTmpPos = pTmp->End(); - pTmpPos->nNode = rRg.aEnd; - pTmpPos->nContent.Assign( - pTmpPos->GetNode().GetContentNode(), 0 ); + pTmpPos->Assign(rRg.aEnd); } } else if( pRStt->nNode < rRg.aEnd ) @@ -933,16 +925,12 @@ namespace // split SwRangeRedline* pNewRedl = new SwRangeRedline( *pTmp ); SwPosition* pTmpPos = pNewRedl->End(); - pTmpPos->nNode = rRg.aEnd; - pTmpPos->nContent.Assign( - pTmpPos->GetNode().GetContentNode(), 0 ); + pTmpPos->Assign(rRg.aEnd); rArr.emplace_back( pNewRedl, rRg.aStart ); pTmpPos = pTmp->Start(); - pTmpPos->nNode = rRg.aEnd; - pTmpPos->nContent.Assign( - pTmpPos->GetNode().GetContentNode(), 0 ); + pTmpPos->Assign(rRg.aEnd); rDoc.getIDocumentRedlineAccess().AppendRedline( pTmp, true ); } } @@ -4566,9 +4554,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt SplitNode( *aDelPam.GetPoint(), false ); ++aMkNd; - aDelPam.GetMark()->nNode = aMkNd; - aDelPam.GetMark()->nContent.Assign( - aMkNd.GetNode().GetContentNode(), nMkCnt ); + aDelPam.GetMark()->Assign( aMkNd, nMkCnt ); bFirst = false; } else @@ -4583,9 +4569,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt aTmpRange.SetMark(); ++aPtNd; - aDelPam.GetPoint()->nNode = aPtNd; - aDelPam.GetPoint()->nContent.Assign( aPtNd.GetNode().GetContentNode(), - nPtCnt); + aDelPam.GetPoint()->Assign(aPtNd, nPtCnt); *aTmpRange.GetMark() = *aDelPam.GetPoint(); m_rDoc.RstTextAttrs( aTmpRange ); @@ -4700,9 +4684,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( SwPaM& rPam, const OUSt *rPam.GetPoint() = *aDelPam.GetMark(); ++aPtNd; - rPam.GetMark()->nNode = aPtNd; - rPam.GetMark()->nContent.Assign( aPtNd.GetNode().GetContentNode(), - nPtCnt ); + rPam.GetMark()->Assign( aPtNd, nPtCnt ); if (bJoinText) { diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 490b2bc00953..303b7d01dc8b 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -1759,9 +1759,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall if( (pStt->nContent == 0) && pEnd->GetNode().IsEndNode() ) { - pEnd->nNode--; - pEnd->nContent.Assign( - pEnd->GetNode().GetTextNode(), 0); + pEnd->Adjust(SwNodeOffset(-1)); m_rDoc.getIDocumentContentOperations().DelFullPara( *pNewRedl ); } else diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 4102c97aa25c..215c728e65a2 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -1458,13 +1458,13 @@ namespace sw::mark // Remove the old fieldmark and create a new one with the new type if (rNewType == ODF_FORMDROPDOWN || rNewType == ODF_FORMCHECKBOX) { - SwPosition aNewPos (aPaM.GetPoint()->nNode, aPaM.GetPoint()->nContent); + SwPosition aNewPos (*aPaM.GetPoint()); deleteFieldmarkAt(aNewPos); return makeNoTextFieldBookmark(aPaM, sName, rNewType); } else if(rNewType == ODF_FORMDATE) { - SwPosition aPos (aPaM.GetPoint()->nNode, aPaM.GetPoint()->nContent); + SwPosition aPos (*aPaM.GetPoint()); SwPaM aNewPaM(pFieldmark->GetMarkStart(), pFieldmark->GetMarkEnd()); deleteFieldmarkAt(aPos); // HACK: hard-code the separator position here at the start because diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 1d236a6aba7d..e526f6c5946b 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1959,9 +1959,7 @@ sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline) pDestRedl->SetMark(); ++aSaveNd; - pDestRedl->GetMark()->nNode = aSaveNd; - pDestRedl->GetMark()->nContent.Assign( aSaveNd.GetNode().GetContentNode(), - nSaveCnt ); + pDestRedl->GetMark()->Assign( aSaveNd, nSaveCnt ); if( pLastDestRedline && *pLastDestRedline->GetPoint() == *pDestRedl->GetPoint() ) *pLastDestRedline->GetPoint() = *pDestRedl->GetMark(); diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 1a52a8458cd7..dd178f7941aa 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -197,8 +197,7 @@ void SetGetExpField::GetPosOfContent( SwPosition& rPos ) const } else { - rPos.nNode = m_nNode; - rPos.nContent.Assign( rPos.GetNode().GetContentNode(), m_nContent ); + rPos.Assign( m_nNode, m_nContent ); } } diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 5ea677b2d9fc..c0d3efa66d35 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -69,10 +69,8 @@ namespace { if ( rPam.HasMark() && rPam.End()->GetNode().GetTextNode() ) { - SwPaM aPam( rPam.Start()->nNode, - rPam.End()->nNode ); - aPam.Start()->nContent = 0; - aPam.End()->nContent = rPam.End()->GetNode().GetTextNode()->Len(); + SwPaM aPam( rPam.Start()->nNode, 0, + rPam.End()->nNode, rPam.End()->GetNode().GetTextNode()->Len() ); pDoc->ResetAttrs( aPam, false, aResetAttrsArray, true, pLayout ); } else @@ -1563,8 +1561,7 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext, if( ::lcl_IsNumOk( nSrchNum, nLower, nUpper, bOverUpper, static_cast<sal_uInt8>(pNd->GetActualListLevel()) )) { - rPos.nNode = aIdx; - rPos.nContent.Assign( pNd, 0 ); + rPos.Assign(aIdx); bRet = true; break; } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 435480730372..961bdeaadcdf 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -675,9 +675,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts, || pEnd->GetNodeIndex() >= GetNodes().GetEndOfContent().GetIndex()-1 ) { getIDocumentContentOperations().SplitNode( *pEnd, false ); - --const_cast<SwNodeIndex&>(pEnd->nNode); - const_cast<SwContentIndex&>(pEnd->nContent).Assign( - pEnd->GetNode().GetContentNode(), 0 ); + const_cast<SwPosition*>(pEnd)->Adjust(SwNodeOffset(-1)); // A Node and at the End? if( pStt->GetNodeIndex() >= pEnd->GetNodeIndex() ) --aRg.aStart; @@ -1152,7 +1150,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > //!!! not necessarily TextNodes !!! SwPaM aOriginal( rStartRange.aStart, rEndRange.aEnd ); const SwPosition *pStt = aOriginal.GetMark(); - const SwPosition *pEnd = aOriginal.GetPoint(); + SwPosition *pEnd = aOriginal.GetPoint(); bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); if (bUndo) @@ -1177,9 +1175,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > || pEnd->GetNodeIndex() >= GetNodes().GetEndOfContent().GetIndex()-1 ) { getIDocumentContentOperations().SplitNode( *pEnd, false ); - --const_cast<SwNodeIndex&>(pEnd->nNode); - const_cast<SwContentIndex&>(pEnd->nContent).Assign( - pEnd->GetNode().GetContentNode(), 0 ); + pEnd->Adjust(SwNodeOffset(-1)); // A Node and at the End? if( pStt->GetNodeIndex() >= pEnd->GetNodeIndex() ) --aRg.aStart; diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index 3dbb4ef5d963..d3fd0fc45b43 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -273,8 +273,7 @@ bool SwEditShell::Copy( SwEditShell& rDestShell ) { SwPaM* pCursor = rDestShell.GetCursor(); pCursor->SetMark(); - pCursor->GetPoint()->nNode = aSttNdIdx.GetIndex()+1; - pCursor->GetPoint()->nContent.Assign( pCursor->GetContentNode(),nSttCntIdx); + pCursor->GetPoint()->Assign( aSttNdIdx.GetIndex()+1, nSttCntIdx ); pCursor->Exchange(); } else diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 5184bfda4284..ce09668a739e 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -473,8 +473,7 @@ bool SwFEShell::DeleteRow(bool bCompleteTable) if( pCNd ) { SwPaM* pPam = GetCursor(); - pPam->GetPoint()->nNode = aIdx; - pPam->GetPoint()->nContent.Assign( pCNd, 0 ); + pPam->GetPoint()->Assign( *pCNd, 0 ); pPam->SetMark(); // both want something pPam->DeleteMark(); } diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index e197c7c6f9bc..9d4660336745 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -724,8 +724,7 @@ void SwUndoAttr::UndoImpl(::sw::UndoRedoContext & rContext) SwPaM aPam(pDoc->GetNodes().GetEndOfContent()); if ( NODE_OFFSET_MAX != m_nNodeIndex ) { aPam.DeleteMark(); - aPam.GetPoint()->nNode = m_nNodeIndex; - aPam.GetPoint()->nContent.Assign( aPam.GetContentNode(), m_nSttContent ); + aPam.GetPoint()->Assign( m_nNodeIndex, m_nSttContent ); aPam.SetMark(); ++aPam.GetPoint()->nContent; pDoc->getIDocumentRedlineAccess().DeleteRedline(aPam, false, RedlineType::Any); @@ -1040,8 +1039,7 @@ void SwUndoDontExpandFormat::UndoImpl(::sw::UndoRedoContext & rContext) SwDoc *const pDoc = & rContext.GetDoc(); SwPosition& rPos = *pPam->GetPoint(); - rPos.nNode = m_nNodeIndex; - rPos.nContent.Assign( rPos.GetNode().GetContentNode(), m_nContentIndex); + rPos.Assign( m_nNodeIndex, m_nContentIndex ); pDoc->DontExpandFormat( rPos, false ); } @@ -1051,8 +1049,7 @@ void SwUndoDontExpandFormat::RedoImpl(::sw::UndoRedoContext & rContext) SwDoc *const pDoc = & rContext.GetDoc(); SwPosition& rPos = *pPam->GetPoint(); - rPos.nNode = m_nNodeIndex; - rPos.nContent.Assign( rPos.GetNode().GetContentNode(), m_nContentIndex); + rPos.Assign( m_nNodeIndex, m_nContentIndex ); pDoc->DontExpandFormat( rPos ); } diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index f8a8c73e2372..6ba42b5327cc 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -279,9 +279,7 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext) // set cursor to Undo range pPam->DeleteMark(); - pPam->GetPoint()->nNode = nNd; - pPam->GetPoint()->nContent.Assign( - pPam->GetPoint()->GetNode().GetContentNode(), nCnt ); + pPam->GetPoint()->Assign( nNd, nCnt ); } maUndoText.reset(); @@ -673,8 +671,7 @@ void SwUndoReplace::Impl::UndoImpl(::sw::UndoRedoContext & rContext) if (m_nSttNd != m_nEndNd) { // in case of regex inserting paragraph breaks, join nodes... assert(rPam.GetMark()->nContent == rPam.GetMark()->GetNode().GetTextNode()->Len()); - rPam.GetPoint()->nNode = m_nEndNd - m_nOffset; - rPam.GetPoint()->nContent.Assign(rPam.GetContentNode(true), m_nEndCnt); + rPam.GetPoint()->Assign( m_nEndNd - m_nOffset, m_nEndCnt ); pDoc->getIDocumentContentOperations().DeleteAndJoin(rPam); } rPam.DeleteMark(); @@ -718,8 +715,7 @@ void SwUndoReplace::Impl::UndoImpl(::sw::UndoRedoContext & rContext) } } - rPam.GetPoint()->nNode = m_nSttNd; - rPam.GetPoint()->nContent.Assign(rPam.GetPoint()->GetNode().GetTextNode(), m_nSttCnt); + rPam.GetPoint()->Assign( m_nSttNd, m_nSttCnt ); } void SwUndoReplace::Impl::RedoImpl(::sw::UndoRedoContext & rContext) diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 48327e653551..9117ddeadd62 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -356,8 +356,7 @@ void SwUndoRedlineSort::UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) SwPaM aTmp( *rPam.GetMark() ); aTmp.GetMark()->nContent = 0; aTmp.SetMark(); - aTmp.GetPoint()->nNode = m_nSaveEndNode; - aTmp.GetPoint()->nContent.Assign( aTmp.GetContentNode(), m_nSaveEndContent ); + aTmp.GetPoint()->Assign( m_nSaveEndNode, m_nSaveEndContent ); rDoc.getIDocumentRedlineAccess().DeleteRedline( aTmp, true, RedlineType::Any ); } @@ -404,8 +403,7 @@ void SwUndoRedlineSort::RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) SetValues( rPam ); SetPaM( rPam ); - rPam.GetPoint()->nNode = m_nSaveEndNode; - rPam.GetPoint()->nContent.Assign( rPam.GetContentNode(), m_nSaveEndContent ); + rPam.GetPoint()->Assign( m_nSaveEndNode, m_nSaveEndContent ); } void SwUndoRedlineSort::RepeatImpl(::sw::RepeatContext & rContext) diff --git a/sw/source/core/undo/unspnd.cxx b/sw/source/core/undo/unspnd.cxx index d91f21570641..51afe0d8145e 100644 --- a/sw/source/core/undo/unspnd.cxx +++ b/sw/source/core/undo/unspnd.cxx @@ -116,9 +116,7 @@ void SwUndoSplitNode::UndoImpl(::sw::UndoRedoContext & rContext) if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() )) { rPam.SetMark(); - ++rPam.GetMark()->nNode; - rPam.GetMark()->nContent.Assign( rPam.GetMark()-> - GetNode().GetContentNode(), 0 ); + rPam.GetMark()->Adjust(SwNodeOffset(1)); pDoc->getIDocumentRedlineAccess().DeleteRedline( rPam, true, RedlineType::Any ); rPam.DeleteMark(); } @@ -142,8 +140,7 @@ void SwUndoSplitNode::UndoImpl(::sw::UndoRedoContext & rContext) // also set the cursor onto undo section rPam.DeleteMark(); - rPam.GetPoint()->nNode = m_nNode; - rPam.GetPoint()->nContent.Assign( rPam.GetContentNode(), m_nContent ); + rPam.GetPoint()->Assign( m_nNode, m_nContent ); } void SwUndoSplitNode::RedoImpl(::sw::UndoRedoContext & rContext) diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index bb715149e328..6b0a0f01a4b8 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -671,8 +671,7 @@ void SwUndoTableToText::RedoImpl(::sw::UndoRedoContext & rContext) OSL_FAIL( "Where is the TextNode now?" ); } - pPam->GetPoint()->nNode = aSaveIdx; - pPam->GetPoint()->nContent.Assign( pCNd, 0 ); + pPam->GetPoint()->Assign( aSaveIdx ); pPam->SetMark(); // log off all indices pPam->DeleteMark(); @@ -1990,8 +1989,7 @@ void SwUndoTableMerge::UndoImpl(::sw::UndoRedoContext & rContext) } SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); pPam->DeleteMark(); - pPam->GetPoint()->nNode = m_nSttNode; - pPam->GetPoint()->nContent.Assign( pPam->GetContentNode(), m_nSttContent ); + pPam->GetPoint()->Assign(m_nSttNode, m_nSttContent ); pPam->SetMark(); pPam->DeleteMark(); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 53c98b71e149..60a560b8b042 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -1337,8 +1337,7 @@ SwXTextCursor::gotoEndOfWord(sal_Bool Expand) bRet = rUnoCursor.IsEndWordWT( nWordType ); if (!bRet) { - pPoint->nNode = rOldNode; - pPoint->nContent = nOldIndex; + pPoint->Assign(rOldNode, nOldIndex); } else if (CursorType::Meta == m_eType) { @@ -1373,8 +1372,7 @@ SwXTextCursor::gotoStartOfWord(sal_Bool Expand) bRet = rUnoCursor.IsStartWordWT( nWordType ); if (!bRet) { - pPoint->nNode = rOldNode; - pPoint->nContent = nOldIndex; + pPoint->Assign(rOldNode, nOldIndex); } else if (CursorType::Meta == m_eType) { diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 5df6323eaae7..4980208bb1ca 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1075,10 +1075,9 @@ bool SwXTextRange::GetPositions(SwPaM& rToFill, ::sw::TextRangeMode const eMode) assert(pSectionNode->GetNodes().IsDocNodes()); rToFill.GetPoint()->Assign( pSectionNode->GetNode(), SwNodeOffset(1) ); rToFill.SetMark(); - rToFill.GetMark()->nNode = *pSectionNode->GetNode().EndOfSectionNode(); - --rToFill.GetMark()->nNode; - rToFill.GetMark()->nContent.Assign(rToFill.GetMark()->GetNode().GetContentNode(), - rToFill.GetMark()->GetNode().GetContentNode() ? rToFill.GetMark()->GetNode().GetContentNode()->Len() : 0); + rToFill.GetMark()->Assign( *pSectionNode->GetNode().EndOfSectionNode(), SwNodeOffset(-1) ); + if (const SwContentNode* pCNd = rToFill.GetMark()->GetContentNode()) + rToFill.GetMark()->AssignEndIndex(*pCNd); return true; } } diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index b1e7c2bc2bac..7c88eae3c7b0 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -239,9 +239,8 @@ ErrCode SwASCIIParser::CallParser() { // then set over the insert range the defined attributes *pInsPam->GetMark() = *m_pPam->GetPoint(); - ++pInsPam->GetPoint()->nNode; - pInsPam->GetPoint()->nContent.Assign( - pInsPam->GetContentNode(), nSttContent ); + pInsPam->GetPoint()->Assign(pInsPam->GetPoint()->GetNode(), SwNodeOffset(1), + nSttContent ); // !!!!! OSL_ENSURE( false, "Have to change - hard attr. to para. style" ); diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 3dfe492c831a..0455fb909898 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -670,8 +670,7 @@ void SwAnnotationWin::SetPosAndSize() { SwShellTableCursor* pTableCursor = new SwShellTableCursor( mrView.GetWrtShell(), aStartPos ); pTableCursor->SetMark(); - pTableCursor->GetMark()->nNode = *pTextNode; - pTableCursor->GetMark()->nContent.Assign( pTextNode, pTextAnnotationField->GetStart()+1 ); + pTableCursor->GetMark()->Assign( *pTextNode, pTextAnnotationField->GetStart()+1 ); pTableCursor->NewTableSelection(); pTmpCursor = pTableCursor; } @@ -679,8 +678,7 @@ void SwAnnotationWin::SetPosAndSize() { SwShellCursor* pCursor = new SwShellCursor( mrView.GetWrtShell(), aStartPos ); pCursor->SetMark(); - pCursor->GetMark()->nNode = *pTextNode; - pCursor->GetMark()->nContent.Assign( pTextNode, pTextAnnotationField->GetStart()+1 ); + pCursor->GetMark()->Assign(*pTextNode, pTextAnnotationField->GetStart()+1 ); pTmpCursor = pCursor; } std::unique_ptr<SwShellCursor> pTmpCursorForAnnotationTextRange( pTmpCursor ); diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 863b5ac6c65e..359d01ddec40 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -5833,23 +5833,19 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) if( nPosNodeIdx < nMarkNodeIdx ) { - rSh.GetCursor()->GetPoint()->nNode = nPosNodeIdx; - rSh.GetCursor()->GetPoint()->nContent = nPosIdx; + rSh.GetCursor()->GetPoint()->Assign(nPosNodeIdx, nPosIdx); rSh.GetCursor()->GetMark()->nNode = nPosNodeIdx; rSh.GetCursor()->GetMark()->nContent = rSh.GetCursor()->GetContentNode()->Len(); } else if( nPosNodeIdx == nMarkNodeIdx ) { - rSh.GetCursor()->GetPoint()->nNode = nPosNodeIdx; - rSh.GetCursor()->GetPoint()->nContent = nPosIdx; - rSh.GetCursor()->GetMark()->nNode = nMarkNodeIdx; - rSh.GetCursor()->GetMark()->nContent = nMarkIdx; + rSh.GetCursor()->GetPoint()->Assign(nPosNodeIdx, nPosIdx); + rSh.GetCursor()->GetMark()->Assign(nMarkNodeIdx, nMarkIdx); } else { - rSh.GetCursor()->GetMark()->nNode = nMarkNodeIdx; - rSh.GetCursor()->GetMark()->nContent = nMarkIdx; + rSh.GetCursor()->GetMark()->Assign(nMarkNodeIdx, nMarkIdx); rSh.GetCursor()->GetPoint()->nNode = nMarkNodeIdx; rSh.GetCursor()->GetPoint()->nContent = rSh.GetCursor()->GetContentNode( false )->Len(); |