sw/source/core/crsr/crsrsh.cxx | 10 +--- sw/source/core/doc/DocumentContentOperationsManager.cxx | 7 +-- sw/source/core/doc/DocumentRedlineManager.cxx | 34 +++++----------- sw/source/core/doc/doccomp.cxx | 7 --- sw/source/core/doc/docedt.cxx | 3 - sw/source/core/doc/docnum.cxx | 3 - sw/source/core/doc/docredln.cxx | 31 +++++--------- sw/source/core/doc/docruby.cxx | 8 --- sw/source/core/doc/extinput.cxx | 26 +++--------- sw/source/core/edit/edattr.cxx | 33 ++++----------- sw/source/core/edit/ednumber.cxx | 16 +------ sw/source/core/edit/edtab.cxx | 5 -- sw/source/core/layout/trvlfrm.cxx | 2 sw/source/core/undo/undel.cxx | 8 --- sw/source/core/undo/undobj.cxx | 4 - sw/source/core/unocore/unocrsrhelper.cxx | 8 --- sw/source/filter/ww8/wrtw8nds.cxx | 12 +---- 17 files changed, 67 insertions(+), 150 deletions(-)
New commits: commit 76513619c14ed131145f0f0440540221a00a8f39 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Oct 20 15:05:36 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Oct 20 20:13:43 2021 +0200 make more use of SwPaM::End() instead of open-coding the same thing Change-Id: I45ddc87317569c9ad6378eab1067ebea79c583f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123894 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 07092e1100ad..1a59b16ba2de 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -86,7 +86,7 @@ using namespace util; static void CheckRange( SwCursor* pCurrentCursor ) { const SwPosition *pStt = pCurrentCursor->Start(), - *pEnd = pCurrentCursor->GetPoint() == pStt ? pCurrentCursor->GetMark() : pCurrentCursor->GetPoint(); + *pEnd = pCurrentCursor->End(); SwPaM *pTmpDel = nullptr, *pTmp = pCurrentCursor->GetNext(); @@ -95,8 +95,7 @@ static void CheckRange( SwCursor* pCurrentCursor ) while( pTmp != pCurrentCursor ) { const SwPosition *pTmpStt = pTmp->Start(), - *pTmpEnd = pTmp->GetPoint() == pTmpStt ? - pTmp->GetMark() : pTmp->GetPoint(); + *pTmpEnd = pTmp->End(); if( *pStt <= *pTmpStt ) { if( *pEnd > *pTmpStt || @@ -2797,7 +2796,7 @@ bool SwCursorShell::ParkTableCursor() void SwCursorShell::ParkPams( SwPaM* pDelRg, SwShellCursor** ppDelRing ) { const SwPosition *pStt = pDelRg->Start(), - *pEnd = pDelRg->GetPoint() == pStt ? pDelRg->GetMark() : pDelRg->GetPoint(); + *pEnd = pDelRg->End(); SwPaM *pTmpDel = nullptr, *pTmp = *ppDelRing; @@ -2809,8 +2808,7 @@ void SwCursorShell::ParkPams( SwPaM* pDelRg, SwShellCursor** ppDelRing ) break; const SwPosition *pTmpStt = pTmp->Start(), - *pTmpEnd = pTmp->GetPoint() == pTmpStt ? - pTmp->GetMark() : pTmp->GetPoint(); + *pTmpEnd = pTmp->End(); // If a SPoint or GetMark are in a cursor area then cancel the old area. // During comparison keep in mind that End() is outside the area. if( *pStt <= *pTmpStt ) diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index e078b3aeda8e..4504b74bafd3 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -711,7 +711,7 @@ namespace , nEndCnt(0) { const SwPosition* pStt = pR->Start(), - * pEnd = pR->GetMark() == pStt ? pR->GetPoint() : pR->GetMark(); + * pEnd = pR->End(); sal_uInt32 nSttIdx = rSttIdx.GetIndex(); nStt = pStt->nNode.GetIndex() - nSttIdx; nSttCnt = pStt->nContent.GetIndex(); @@ -733,7 +733,7 @@ namespace , nEndCnt(0) { const SwPosition* pStt = pR->Start(), - * pEnd = pR->GetMark() == pStt ? pR->GetPoint() : pR->GetMark(); + * pEnd = pR->End(); sal_uInt32 nSttIdx = rPos.nNode.GetIndex(); nStt = pStt->nNode.GetIndex() - nSttIdx; nSttCnt = pStt->nContent.GetIndex(); @@ -877,8 +877,7 @@ namespace SwRangeRedline* pTmp = rRedlTable[ nRedlPos ]; const SwPosition* pRStt = pTmp->Start(), - * pREnd = pTmp->GetMark() == pRStt - ? pTmp->GetPoint() : pTmp->GetMark(); + * pREnd = pTmp->End(); if( pRStt->nNode < rRg.aStart ) { diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 6dfac2b67012..82342dfbbb2e 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -918,8 +918,7 @@ namespace int nCount = 0; const SwPosition* pStt = rPam.Start(), - * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark() - : rPam.GetPoint(); + * pEnd = rPam.End(); const SwRangeRedline* pFnd = rArr.FindAtPosition( *pStt, n ); if( pFnd && // Is new a part of it? ( *pFnd->Start() != *pStt || *pFnd->End() > *pEnd )) @@ -975,8 +974,7 @@ namespace // to Non-ContentNodes before or after that, then the Selections // expand to them. SwPosition* pStt = rPam.Start(), - * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark() - : rPam.GetPoint(); + * pEnd = rPam.End(); SwDoc& rDoc = rPam.GetDoc(); if( !pStt->nContent.GetIndex() && !rDoc.GetNodes()[ pStt->nNode.GetIndex() - 1 ]->IsContentNode() ) @@ -1246,8 +1244,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall } SwPosition* pStt = pNewRedl->Start(), - * pEnd = pStt == pNewRedl->GetPoint() ? pNewRedl->GetMark() - : pNewRedl->GetPoint(); + * pEnd = pNewRedl->End(); { SwTextNode* pTextNode = pStt->nNode.GetNode().GetTextNode(); if( pTextNode == nullptr ) @@ -1303,8 +1300,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall SwRangeRedline* pRedl = maRedlineTable[ n ]; SwPosition* pRStt = pRedl->Start(), - * pREnd = pRStt == pRedl->GetPoint() ? pRedl->GetMark() - : pRedl->GetPoint(); + * pREnd = pRedl->End(); // #i8518# remove empty redlines while we're at it if( ( *pRStt == *pREnd ) && @@ -2408,11 +2404,9 @@ void DocumentRedlineManager::CompressRedlines() SwRangeRedline* pPrev = maRedlineTable[ n-1 ], * pCur = maRedlineTable[ n ]; const SwPosition* pPrevStt = pPrev->Start(), - * pPrevEnd = pPrevStt == pPrev->GetPoint() - ? pPrev->GetMark() : pPrev->GetPoint(); + * pPrevEnd = pPrev->End(); const SwPosition* pCurStt = pCur->Start(), - * pCurEnd = pCurStt == pCur->GetPoint() - ? pCur->GetMark() : pCur->GetPoint(); + * pCurEnd = pCur->End(); if( *pPrevEnd == *pCurStt && pPrev->CanCombine( *pCur ) && pPrevStt->nNode.GetNode().StartOfSectionNode() == pCurEnd->nNode.GetNode().StartOfSectionNode() && @@ -2515,8 +2509,7 @@ bool DocumentRedlineManager::DeleteRedline( const SwPaM& rRange, bool bSaveInUnd } const SwPosition* pStt = rRange.Start(), - * pEnd = pStt == rRange.GetPoint() ? rRange.GetMark() - : rRange.GetPoint(); + * pEnd = rRange.End(); SwRedlineTable::size_type n = 0; GetRedline( *pStt, &n ); for( ; n < maRedlineTable.size() ; ++n ) @@ -2526,8 +2519,7 @@ bool DocumentRedlineManager::DeleteRedline( const SwPaM& rRange, bool bSaveInUnd continue; SwPosition* pRStt = pRedl->Start(), - * pREnd = pRStt == pRedl->GetPoint() ? pRedl->GetMark() - : pRedl->GetPoint(); + * pREnd = pRedl->End(); switch( ComparePosition( *pStt, *pEnd, *pRStt, *pREnd ) ) { case SwComparePosition::Equal: @@ -2723,9 +2715,7 @@ const SwRangeRedline* DocumentRedlineManager::GetRedline( const SwPosition& rPos nM = nU + ( nO - nU ) / 2; const SwRangeRedline* pRedl = maRedlineTable[ nM ]; const SwPosition* pStt = pRedl->Start(); - const SwPosition* pEnd = pStt == pRedl->GetPoint() - ? pRedl->GetMark() - : pRedl->GetPoint(); + const SwPosition* pEnd = pRedl->End(); if( pEnd == pStt ? *pStt == rPos : ( *pStt <= rPos && rPos < *pEnd ) ) @@ -2903,8 +2893,7 @@ bool DocumentRedlineManager::AcceptRedline( const SwPaM& rPam, bool bCallDelete void DocumentRedlineManager::AcceptRedlineParagraphFormatting( const SwPaM &rPam ) { const SwPosition* pStt = rPam.Start(), - * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark() - : rPam.GetPoint(); + * pEnd = rPam.End(); const sal_uLong nSttIdx = pStt->nNode.GetIndex(); const sal_uLong nEndIdx = pEnd->nNode.GetIndex(); @@ -3336,8 +3325,7 @@ bool DocumentRedlineManager::SetRedlineComment( const SwPaM& rPaM, const OUStrin { bool bRet = false; const SwPosition* pStt = rPaM.Start(), - * pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark() - : rPaM.GetPoint(); + * pEnd = rPaM.End(); SwRedlineTable::size_type n = 0; if( GetRedlineTable().FindAtPosition( *pStt, n ) ) { diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 589f977e4937..97f7acc35dd7 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1928,9 +1928,7 @@ SaveMergeRedline::SaveMergeRedline( const SwNode& rDstNd, return; // mark the area as deleted - const SwPosition* pEnd = pStt == rSrcRedl.GetPoint() - ? rSrcRedl.GetMark() - : rSrcRedl.GetPoint(); + const SwPosition* pEnd = rSrcRedl.End(); pDestRedl->SetMark(); pDestRedl->GetPoint()->nNode += pEnd->nNode.GetIndex() - @@ -1987,8 +1985,7 @@ sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline) { SwRangeRedline* pRedl = rRedlineTable[ n ]; SwPosition* pRStt = pRedl->Start(), - * pREnd = pRStt == pRedl->GetPoint() ? pRedl->GetMark() - : pRedl->GetPoint(); + * pREnd = pRedl->End(); if( RedlineType::Delete == pRedl->GetType() || RedlineType::Insert == pRedl->GetType() ) { diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 2a9272214593..b588a1db8eea 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -841,8 +841,7 @@ void SwDoc::CountWords( const SwPaM& rPaM, SwDocStat& rStat ) { // This is a modified version of SwDoc::TransliterateText const SwPosition* pStt = rPaM.Start(); - const SwPosition* pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark() - : rPaM.GetPoint(); + const SwPosition* pEnd = rPaM.End(); const sal_uLong nSttNd = pStt->nNode.GetIndex(); const sal_uLong nEndNd = pEnd->nNode.GetIndex(); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 1e08ec1e1664..644d360bc6bf 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -451,8 +451,7 @@ bool SwDoc::MoveOutlinePara( const SwPaM& rPam, SwOutlineNodes::difference_type { // Do not move to special sections in the nodes array const SwPosition& rStt = *rPam.Start(), - & rEnd = &rStt == rPam.GetPoint() ? *rPam.GetMark() - : *rPam.GetPoint(); + & rEnd = *rPam.End(); if( GetNodes().GetOutLineNds().empty() || !nOffset || (rStt.nNode.GetIndex() < GetNodes().GetEndOfExtras().GetIndex()) || (rEnd.nNode.GetIndex() < GetNodes().GetEndOfExtras().GetIndex())) diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 3542693b815d..a39b2fcc28ee 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -330,7 +330,7 @@ void lcl_LOKInvalidateStartEndFrames(SwShellCursor& rCursor) SwPosition *pStartPos = rCursor.Start(), - *pEndPos = rCursor.GetPoint() == pStartPos ? rCursor.GetMark() : rCursor.GetPoint(); + *pEndPos = rCursor.End(); lcl_LOKInvalidateFrames(*(pStartPos->nNode.GetNode().GetContentNode()), @@ -489,7 +489,7 @@ std::vector<SwRangeRedline*> GetAllValidRanges(std::unique_ptr<SwRangeRedline> p std::vector<SwRangeRedline*> ret; // Create valid "sub-ranges" from the Selection SwPosition* pStt = p->Start(), - * pEnd = pStt == p->GetPoint() ? p->GetMark() : p->GetPoint(); + * pEnd = p->End(); SwPosition aNewStt( *pStt ); SwNodes& rNds = aNewStt.nNode.GetNodes(); SwContentNode* pC; @@ -750,8 +750,7 @@ const SwRangeRedline* SwRedlineTable::FindAtPosition( const SwPosition& rSttPos, if( pTmp->HasMark() && pTmp->IsVisible() ) { const SwPosition* pRStt = pTmp->Start(), - * pREnd = pRStt == pTmp->GetPoint() ? pTmp->GetMark() - : pTmp->GetPoint(); + * pREnd = pTmp->End(); if( bNext ? *pRStt <= rSttPos : *pRStt < rSttPos ) { if( bNext ? *pREnd > rSttPos : *pREnd >= rSttPos ) @@ -875,9 +874,7 @@ void SwRedlineExtraData_FormatColl::Reject( SwPaM& rPam ) const SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() ); - const SwPosition* pStt = rPam.Start(), - * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark() - : rPam.GetPoint(); + const SwPosition* pEnd = rPam.End(); if ( !m_bFormatAll || pEnd->nContent == 0 ) { @@ -1332,16 +1329,10 @@ void SwRangeRedline::ShowOriginal(sal_uInt16 nLoop, size_t nMyPos, bool /*bForce // trigger the Layout void SwRangeRedline::InvalidateRange(Invalidation const eWhy) { - sal_uLong nSttNd = GetMark()->nNode.GetIndex(), - nEndNd = GetPoint()->nNode.GetIndex(); - sal_Int32 nSttCnt = GetMark()->nContent.GetIndex(); - sal_Int32 nEndCnt = GetPoint()->nContent.GetIndex(); - - if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt )) - { - sal_uLong nTmp = nSttNd; nSttNd = nEndNd; nEndNd = nTmp; - sal_Int32 nTmp2 = nSttCnt; nSttCnt = nEndCnt; nEndCnt = nTmp2; - } + sal_uLong nSttNd = Start()->nNode.GetIndex(), + nEndNd = End()->nNode.GetIndex(); + sal_Int32 nSttCnt = Start()->nContent.GetIndex(); + sal_Int32 nEndCnt = End()->nContent.GetIndex(); SwNodes& rNds = GetDoc().GetNodes(); for (sal_uLong n(nSttNd); n <= nEndNd; ++n) @@ -1458,7 +1449,7 @@ void SwRangeRedline::MoveToSection() if( !m_pContentSect ) { const SwPosition* pStt = Start(), - * pEnd = pStt == GetPoint() ? GetMark() : GetPoint(); + * pEnd = End(); SwDoc& rDoc = GetDoc(); SwPaM aPam( *pStt, *pEnd ); @@ -1534,7 +1525,7 @@ void SwRangeRedline::CopyToSection() return; const SwPosition* pStt = Start(), - * pEnd = pStt == GetPoint() ? GetMark() : GetPoint(); + * pEnd = End(); SwContentNode* pCSttNd = pStt->nNode.GetNode().GetContentNode(); SwContentNode* pCEndNd = pEnd->nNode.GetNode().GetContentNode(); @@ -1612,7 +1603,7 @@ void SwRangeRedline::DelCopyOfSection(size_t nMyPos) return; const SwPosition* pStt = Start(), - * pEnd = pStt == GetPoint() ? GetMark() : GetPoint(); + * pEnd = End(); SwDoc& rDoc = GetDoc(); SwPaM aPam( *pStt, *pEnd ); diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx index 122fd266e7ee..1a9f39c3aab7 100644 --- a/sw/source/core/doc/docruby.cxx +++ b/sw/source/core/doc/docruby.cxx @@ -52,9 +52,7 @@ sal_uInt16 SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList ) bool bCheckEmpty = &rPam != _pStartCursor; do { const SwPosition* pStt = _pStartCursor->Start(), - * pEnd = pStt == _pStartCursor->GetPoint() - ? _pStartCursor->GetMark() - : _pStartCursor->GetPoint(); + * pEnd = _pStartCursor->End(); if( !bCheckEmpty || ( pStt != pEnd && *pStt != *pEnd )) { SwPaM aPam( *pStt ); @@ -103,9 +101,7 @@ void SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList ) bool bCheckEmpty = &rPam != _pStartCursor; do { const SwPosition* pStt = _pStartCursor->Start(), - * pEnd = pStt == _pStartCursor->GetPoint() - ? _pStartCursor->GetMark() - : _pStartCursor->GetPoint(); + * pEnd = _pStartCursor->End(); if( !bCheckEmpty || ( pStt != pEnd && *pStt != *pEnd )) { diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index 09f4dba1e016..23ac77484004 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -148,12 +148,8 @@ void SwExtTextInput::SetInputData( const CommandExtTextInputData& rData ) if( !pTNd ) return; - sal_Int32 nSttCnt = GetPoint()->nContent.GetIndex(); - sal_Int32 nEndCnt = GetMark()->nContent.GetIndex(); - if( nEndCnt < nSttCnt ) - { - std::swap(nSttCnt, nEndCnt); - } + sal_Int32 nSttCnt = Start()->nContent.GetIndex(); + sal_Int32 nEndCnt = End()->nContent.GetIndex(); SwIndex aIdx( pTNd, nSttCnt ); const OUString& rNewStr = rData.GetText(); @@ -279,20 +275,14 @@ SwExtTextInput* SwDoc::GetExtTextInput( const SwNode& rNd, sal_uLong nNdIdx = rNd.GetIndex(); SwExtTextInput* pTmp = mpExtInputRing; do { - sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(), - nMk = pTmp->GetMark()->nNode.GetIndex(); - sal_Int32 nPtCnt = pTmp->GetPoint()->nContent.GetIndex(); - sal_Int32 nMkCnt = pTmp->GetMark()->nContent.GetIndex(); - - if( nPt < nMk || ( nPt == nMk && nPtCnt < nMkCnt )) - { - sal_uLong nTmp = nMk; nMk = nPt; nPt = nTmp; - sal_Int32 nTmp2 = nMkCnt; nMkCnt = nPtCnt; nPtCnt = nTmp2; - } + sal_uLong nStartNode = pTmp->Start()->nNode.GetIndex(), + nEndNode = pTmp->End()->nNode.GetIndex(); + sal_Int32 nStartCnt = pTmp->Start()->nContent.GetIndex(); + sal_Int32 nEndCnt = pTmp->End()->nContent.GetIndex(); - if( nMk <= nNdIdx && nNdIdx <= nPt && + if( nStartNode <= nNdIdx && nNdIdx <= nEndNode && ( nContentPos<0 || - ( nMkCnt <= nContentPos && nContentPos <= nPtCnt ))) + ( nStartCnt <= nContentPos && nContentPos <= nEndCnt ))) { pRet = pTmp; break; diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index 030e9dd9d088..86d9763599bc 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -105,16 +105,10 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet, continue; } - sal_uLong nSttNd = rCurrentPaM.GetMark()->nNode.GetIndex(), - nEndNd = rCurrentPaM.GetPoint()->nNode.GetIndex(); - sal_Int32 nSttCnt = rCurrentPaM.GetMark()->nContent.GetIndex(); - sal_Int32 nEndCnt = rCurrentPaM.GetPoint()->nContent.GetIndex(); - - if( nSttNd > nEndNd || ( nSttNd == nEndNd && nSttCnt > nEndCnt )) - { - std::swap(nSttNd, nEndNd); - std::swap(nSttCnt, nEndCnt); - } + sal_uLong nSttNd = rCurrentPaM.Start()->nNode.GetIndex(), + nEndNd = rCurrentPaM.End()->nNode.GetIndex(); + sal_Int32 nSttCnt = rCurrentPaM.Start()->nContent.GetIndex(); + sal_Int32 nEndCnt = rCurrentPaM.End()->nContent.GetIndex(); if( nEndNd - nSttNd >= getMaxLookup() ) { @@ -255,12 +249,8 @@ SwTextFormatColl* SwEditShell::GetPaMTextFormatColl( SwPaM* pPaM ) const { // for all the point and mark (selections) // get the start and the end node of the current selection - sal_uLong nSttNd = rCurrentPaM.GetMark()->nNode.GetIndex(), - nEndNd = rCurrentPaM.GetPoint()->nNode.GetIndex(); - - // reverse start and end if they aren't sorted correctly - if( nSttNd > nEndNd ) - std::swap(nSttNd, nEndNd); + sal_uLong nSttNd = rCurrentPaM.Start()->nNode.GetIndex(), + nEndNd = rCurrentPaM.End()->nNode.GetIndex(); // for all the nodes in the current Point and Mark for( sal_uLong n = nSttNd; n <= nEndNd; ++n ) @@ -513,11 +503,8 @@ bool SwEditShell::IsMoveLeftMargin( bool bRight, bool bModulus ) const for(SwPaM& rPaM : GetCursor()->GetRingContainer()) { - sal_uLong nSttNd = rPaM.GetMark()->nNode.GetIndex(), - nEndNd = rPaM.GetPoint()->nNode.GetIndex(); - - if( nSttNd > nEndNd ) - std::swap(nSttNd, nEndNd); + sal_uLong nSttNd = rPaM.Start()->nNode.GetIndex(), + nEndNd = rPaM.End()->nNode.GetIndex(); SwContentNode* pCNd; for( sal_uLong n = nSttNd; bRet && n <= nEndNd; ++n ) @@ -681,9 +668,7 @@ SvtScriptType SwEditShell::GetScriptType() const for(SwPaM& rPaM : GetCursor()->GetRingContainer()) { const SwPosition *pStt = rPaM.Start(), - *pEnd = pStt == rPaM.GetMark() - ? rPaM.GetPoint() - : rPaM.GetMark(); + *pEnd = rPaM.End(); if( pStt == pEnd || *pStt == *pEnd ) { const SwTextNode* pTNd = pStt->nNode.GetNode().GetTextNode(); diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index 101e1494e4fc..a1f40783c455 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -160,12 +160,8 @@ bool SwEditShell::SelectionHasNumber() const { aRangeArr.SetPam( n, aPam ); { - sal_uInt32 nStt = aPam.GetPoint()->nNode.GetIndex(), - nEnd = aPam.GetMark()->nNode.GetIndex(); - if( nStt > nEnd ) - { - sal_uInt32 nTmp = nStt; nStt = nEnd; nEnd = nTmp; - } + sal_uInt32 nStt = aPam.Start()->nNode.GetIndex(), + nEnd = aPam.End()->nNode.GetIndex(); for (sal_uInt32 nPos = nStt; nPos<=nEnd; nPos++) { pTextNd = mxDoc->GetNodes()[nPos]->GetTextNode(); @@ -209,12 +205,8 @@ bool SwEditShell::SelectionHasBullet() const { aRangeArr.SetPam( n, aPam ); { - sal_uInt32 nStt = aPam.GetPoint()->nNode.GetIndex(), - nEnd = aPam.GetMark()->nNode.GetIndex(); - if( nStt > nEnd ) - { - sal_uInt32 nTmp = nStt; nStt = nEnd; nEnd = nTmp; - } + sal_uInt32 nStt = aPam.Start()->nNode.GetIndex(), + nEnd = aPam.End()->nNode.GetIndex(); for (sal_uInt32 nPos = nStt; nPos<=nEnd; nPos++) { pTextNd = mxDoc->GetNodes()[nPos]->GetTextNode(); diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index b5d5cb3a4532..7fac4d6721ee 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -205,9 +205,8 @@ bool SwEditShell::IsTextToTableAvailable() const bOnlyText = true; // check if selection is in listing - sal_uLong nStt = rPaM.GetMark()->nNode.GetIndex(), - nEnd = rPaM.GetPoint()->nNode.GetIndex(); - if( nStt > nEnd ) { sal_uLong n = nStt; nStt = nEnd; nEnd = n; } + sal_uLong nStt = rPaM.Start()->nNode.GetIndex(), + nEnd = rPaM.End()->nNode.GetIndex(); for( ; nStt <= nEnd; ++nStt ) if( !GetDoc()->GetNodes()[ nStt ]->IsTextNode() ) diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index bbf94d9d149a..05814632251b 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -2008,7 +2008,7 @@ static void Add( SwRegionRects& rRegion, const SwRect& rRect ) void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor) { SwPosition *pStartPos = rCursor.Start(), - *pEndPos = rCursor.GetPoint() == pStartPos ? rCursor.GetMark() : rCursor.GetPoint(); + *pEndPos = rCursor.End(); SwViewShell *pSh = GetCurrShell(); diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index 891e63d06fd7..953048f9edad 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -210,9 +210,7 @@ SwUndoDelete::SwUndoDelete( // delete all footnotes for now const SwPosition *pStt = rPam.Start(), - *pEnd = rPam.GetPoint() == pStt - ? rPam.GetMark() - : rPam.GetPoint(); + *pEnd = rPam.End(); // Step 1. deletion/record of content indices if( m_bDelFullPara ) @@ -526,9 +524,7 @@ bool SwUndoDelete::CanGrouping( SwDoc& rDoc, const SwPaM& rDelPam ) return false; const SwPosition *pStt = rDelPam.Start(), - *pEnd = rDelPam.GetPoint() == pStt - ? rDelPam.GetMark() - : rDelPam.GetPoint(); + *pEnd = rDelPam.End(); if( pStt->nNode != pEnd->nNode || pStt->nContent.GetIndex()+1 != pEnd->nContent.GetIndex() || diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 27d6c5e6d1c7..816ec4381076 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -62,9 +62,7 @@ void SwUndRng::SetValues( const SwPaM& rPam ) const SwPosition *pStt = rPam.Start(); if( rPam.HasMark() ) { - const SwPosition *pEnd = rPam.GetPoint() == pStt - ? rPam.GetMark() - : rPam.GetPoint(); + const SwPosition *pEnd = rPam.End(); m_nEndNode = pEnd->nNode.GetIndex(); m_nEndContent = pEnd->nContent.GetIndex(); } diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 7035f19628d1..1491b2bb14c5 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -752,12 +752,8 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& rEntry if (&rPam.GetNode() == &rPam.GetNode(false) && pTextNode && pTextNode->GetpSwpHints()) { - sal_Int32 nPaMStart = rPam.GetPoint()->nContent.GetIndex(); - sal_Int32 nPaMEnd = rPam.GetMark() ? rPam.GetMark()->nContent.GetIndex() : nPaMStart; - if(nPaMStart > nPaMEnd) - { - std::swap(nPaMStart, nPaMEnd); - } + sal_Int32 nPaMStart = rPam.Start()->nContent.GetIndex(); + sal_Int32 nPaMEnd = rPam.End()->nContent.GetIndex(); Sequence< OUString> aCharStyles; SwpHints* pHints = pTextNode->GetpSwpHints(); for( size_t nAttr = 0; nAttr < pHints->Count(); ++nAttr ) diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 43c3d9ba3c53..1c21424cbe39 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -308,9 +308,7 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos ) const SwRangeRedline* pRedl = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nRedLinePos ]; const SwPosition* pStt = pRedl->Start(); - const SwPosition* pEnd = pStt == pRedl->GetPoint() - ? pRedl->GetMark() - : pRedl->GetPoint(); + const SwPosition* pEnd = pRedl->End(); if( pStt->nNode == rNd ) { @@ -1565,9 +1563,7 @@ const SwRedlineData* SwWW8AttrIter::GetRunLevelRedline( sal_Int32 nPos ) const SwRangeRedline* pRedl = m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nCurRedlinePos ]; const SwPosition* pStt = pRedl->Start(); - const SwPosition* pEnd = pStt == pRedl->GetPoint() - ? pRedl->GetMark() - : pRedl->GetPoint(); + const SwPosition* pEnd = pRedl->End(); if( pStt->nNode == rNd ) { @@ -1823,9 +1819,7 @@ static SwTextFormatColl& lcl_getFormatCollection( MSWordExportBase& rExport, con { const SwRangeRedline* pRedl = rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nPos++ ]; const SwPosition* pStt = pRedl->Start(); - const SwPosition* pEnd = pStt == pRedl->GetPoint() - ? pRedl->GetMark() - : pRedl->GetPoint(); + const SwPosition* pEnd = pRedl->End(); // Looking for deletions, which ends in current pTextNode if( RedlineType::Delete == pRedl->GetRedlineData().GetType() && pEnd->nNode == *pTextNode && pStt->nNode != *pTextNode &&