sw/source/core/access/accmap.cxx                        |    3 -
 sw/source/core/crsr/crsrsh.cxx                          |   12 +----
 sw/source/core/crsr/crstrvl.cxx                         |    5 --
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   32 +++++----------
 sw/source/core/doc/DocumentRedlineManager.cxx           |   26 ++++--------
 sw/source/core/doc/docedt.cxx                           |    5 --
 sw/source/core/doc/docfmt.cxx                           |    6 +-
 sw/source/core/doc/docftn.cxx                           |    2 
 sw/source/core/doc/doclay.cxx                           |    3 -
 sw/source/core/doc/docnum.cxx                           |    8 +--
 sw/source/core/doc/docredln.cxx                         |   34 ++++++----------
 sw/source/core/doc/docruby.cxx                          |    6 --
 sw/source/core/doc/docsort.cxx                          |    2 
 sw/source/core/doc/list.cxx                             |    3 -
 sw/source/core/doc/swserv.cxx                           |    2 
 sw/source/core/docnode/ndsect.cxx                       |    8 +--
 sw/source/core/docnode/ndtbl.cxx                        |    5 --
 sw/source/core/docnode/nodes.cxx                        |    3 -
 sw/source/core/edit/edattr.cxx                          |    3 -
 sw/source/core/edit/edlingu.cxx                         |    3 -
 sw/source/core/edit/edsect.cxx                          |    6 --
 sw/source/core/edit/edtox.cxx                           |    3 -
 sw/source/core/frmedt/fews.cxx                          |    3 -
 sw/source/core/layout/trvlfrm.cxx                       |    3 -
 sw/source/core/text/redlnitr.cxx                        |    3 -
 sw/source/core/text/txtfld.cxx                          |    2 
 sw/source/core/undo/undel.cxx                           |    6 --
 sw/source/core/undo/undobj.cxx                          |    3 -
 sw/source/core/undo/unins.cxx                           |    3 -
 sw/source/core/undo/unredln.cxx                         |    6 --
 sw/source/core/unocore/unotextmarkup.cxx                |    6 --
 sw/source/filter/ascii/ascatr.cxx                       |    3 -
 sw/source/filter/basflt/fltshell.cxx                    |    2 
 sw/source/filter/ww8/wrtw8nds.cxx                       |    9 +---
 sw/source/uibase/lingu/hhcwrp.cxx                       |    3 -
 sw/source/uibase/uno/unotxvw.cxx                        |    3 -
 36 files changed, 88 insertions(+), 147 deletions(-)

New commits:
commit 3df5be9210ec0a057567f7f68aac445a77facb71
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jul 29 12:08:28 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Jul 29 13:20:56 2022 +0200

    use more SwPaM::StartEnd
    
    which is more efficient than calling Start() and End() separately
    
    Change-Id: I41c99527bcb37728bb9a87f63ed654e0be3d1f0b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137614
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index d5c30b9d9be0..acd5c3fc7d9b 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -3277,8 +3277,7 @@ std::unique_ptr<SwAccessibleSelectedParas_Impl> 
SwAccessibleMap::BuildSelectedPa
              pCursor->GetPoint()->nNode.GetNode().IsTextNode() &&
              pCursor->GetMark()->nNode.GetNode().IsTextNode() )
         {
-            SwPosition* pStartPos = pCursor->Start();
-            SwPosition* pEndPos = pCursor->End();
+            auto [pStartPos, pEndPos] = pCursor->StartEnd(); // SwPosition*
             // loop on all text nodes inside the selection
             SwNodeIndex aIdx( pStartPos->nNode );
             for ( ; aIdx.GetIndex() <= pEndPos->nNode.GetIndex(); ++aIdx )
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 601906cff29f..ff4051be1e4d 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -86,8 +86,7 @@ using namespace util;
  */
 static void CheckRange( SwCursor* pCurrentCursor )
 {
-    const SwPosition *pStt = pCurrentCursor->Start(),
-        *pEnd = pCurrentCursor->End();
+    auto [pStt, pEnd] = pCurrentCursor->StartEnd(); // SwPosition*
 
     SwPaM *pTmpDel = nullptr,
           *pTmp = pCurrentCursor->GetNext();
@@ -95,8 +94,7 @@ static void CheckRange( SwCursor* pCurrentCursor )
     // Search the complete ring
     while( pTmp != pCurrentCursor )
     {
-        const SwPosition *pTmpStt = pTmp->Start(),
-                        *pTmpEnd = pTmp->End();
+        auto [pTmpStt, pTmpEnd] = pTmp->StartEnd(); // SwPosition*
         if( *pStt <= *pTmpStt )
         {
             if( *pEnd > *pTmpStt ||
@@ -2806,8 +2804,7 @@ bool SwCursorShell::ParkTableCursor()
 
 void SwCursorShell::ParkPams( SwPaM* pDelRg, SwShellCursor** ppDelRing )
 {
-    const SwPosition *pStt = pDelRg->Start(),
-        *pEnd = pDelRg->End();
+    auto [pStt, pEnd] = pDelRg->StartEnd(); // SwPosition*
 
     SwPaM *pTmpDel = nullptr, *pTmp = *ppDelRing;
 
@@ -2818,8 +2815,7 @@ void SwCursorShell::ParkPams( SwPaM* pDelRg, 
SwShellCursor** ppDelRing )
         if (!pTmp)
             break;
 
-        const SwPosition *pTmpStt = pTmp->Start(),
-                        *pTmpEnd = pTmp->End();
+        auto [pTmpStt, pTmpEnd] = pTmp->StartEnd(); // SwPosition*
         // 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/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index aad5d9a7ef42..8effeef1fc4f 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -2515,11 +2515,10 @@ const SwRangeRedline* SwCursorShell::GotoRedline( 
SwRedlineTable::size_type nArr
                     // Redlines were stretched over a whole paragraph
                     SwPaM* pCur = m_pCurrentCursor;
                     SwPaM* pNextPam = pCur->GetNext();
-                    SwPosition* pCStt = pCur->Start(), *pCEnd = pCur->End();
+                    auto [pCStt, pCEnd] = pCur->StartEnd(); // SwPosition*
                     while( pCur != pNextPam )
                     {
-                        const SwPosition *pNStt = pNextPam->Start(),
-                                         *pNEnd = pNextPam->End();
+                        auto [pNStt, pNEnd] = pNextPam->StartEnd(); // 
SwPosition*
 
                         bool bDel = true;
                         switch( ::ComparePosition( *pCStt, *pCEnd,
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 9be8e4b417c1..f34ceda93e55 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -360,7 +360,7 @@ namespace
         SwDoc& rDestDoc = rCpyPam.GetDoc();
         SwPosition* pCpyStt = rCpyPam.Start(), *pCpyEnd = rCpyPam.End();
         std::unique_ptr<SwPaM> pDelPam;
-        const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
+        auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
         // We have to count the "non-copied" nodes
         SwNodeOffset nDelCount;
         SwNodeIndex aCorrIdx(InitDelCount(rPam, nDelCount));
@@ -372,7 +372,7 @@ namespace
             const SwRangeRedline* pRedl = rTable[ n ];
             if( RedlineType::Delete == pRedl->GetType() && pRedl->IsVisible() )
             {
-                const SwPosition *pRStt = pRedl->Start(), *pREnd = 
pRedl->End();
+                auto [pRStt, pREnd] = pRedl->StartEnd(); // SwPosition*
 
                 SwComparePosition eCmpPos = ComparePosition( *pStt, *pEnd, 
*pRStt, *pREnd );
                 switch( eCmpPos )
@@ -496,8 +496,7 @@ namespace
     bool lcl_MarksWholeNode(const SwPaM & rPam)
     {
         bool bResult = false;
-        const SwPosition* pStt = rPam.Start();
-        const SwPosition* pEnd = rPam.End();
+        auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
 
         if (nullptr != pStt && nullptr != pEnd)
         {
@@ -704,7 +703,7 @@ namespace
         // the string doesn't exceed the allowed string length
         if( rPam.GetPoint()->nNode != rPam.GetMark()->nNode )
         {
-            const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
+            auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
             const SwTextNode* pEndNd = pEnd->nNode.GetNode().GetTextNode();
             if( (nullptr != pEndNd) && pStt->nNode.GetNode().IsTextNode() )
             {
@@ -728,8 +727,7 @@ namespace
             , nEnd(0)
             , nEndCnt(0)
         {
-            const SwPosition* pStt = pR->Start(),
-                            * pEnd = pR->End();
+            auto [pStt, pEnd] = pR->StartEnd(); // SwPosition*
             SwNodeOffset nSttIdx = rSttIdx.GetIndex();
             nStt = pStt->nNode.GetIndex() - nSttIdx;
             nSttCnt = pStt->nContent.GetIndex();
@@ -750,8 +748,7 @@ namespace
             , nEnd(0)
             , nEndCnt(0)
         {
-            const SwPosition* pStt = pR->Start(),
-                            * pEnd = pR->End();
+            auto [pStt, pEnd] = pR->StartEnd(); // SwPosition*
             SwNodeOffset nSttIdx = rPos.nNode.GetIndex();
             nStt = pStt->nNode.GetIndex() - nSttIdx;
             nSttCnt = pStt->nContent.GetIndex();
@@ -800,8 +797,7 @@ namespace
     {
         SwDoc& rDoc = aPam.GetNode().GetDoc();
 
-        const SwPosition* pStart = aPam.Start();
-        const SwPosition* pEnd = aPam.End();
+        auto [pStart, pEnd] = aPam.StartEnd(); // SwPosition*
 
         // get first relevant redline
         SwRedlineTable::size_type nCurrentRedline;
@@ -894,8 +890,7 @@ namespace
         do {
             SwRangeRedline* pTmp = rRedlTable[ nRedlPos ];
 
-            const SwPosition* pRStt = pTmp->Start(),
-                            * pREnd = pTmp->End();
+            auto [pRStt, pREnd] = pTmp->StartEnd(); // SwPosition*
 
             if( pRStt->nNode < rRg.aStart )
             {
@@ -2962,8 +2957,7 @@ void DocumentContentOperationsManager::TransliterateText(
     if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
         pUndo.reset(new SwUndoTransliterate( rPaM, rTrans ));
 
-    const SwPosition* pStt = rPaM.Start(),
-                       * pEnd = rPaM.End();
+    auto [pStt, pEnd] = rPaM.StartEnd(); // SwPosition*
     SwNodeOffset nSttNd = pStt->nNode.GetIndex(),
           nEndNd = pEnd->nNode.GetIndex();
     sal_Int32 nSttCnt = pStt->nContent.GetIndex();
@@ -4285,7 +4279,7 @@ bool 
DocumentContentOperationsManager::DeleteRangeImpl(SwPaM & rPam, SwDeleteFla
 
 bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam, 
SwDeleteFlags const flags)
 {
-    SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
+    auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
 
     if (!rPam.HasMark()
         || (*pStt == *pEnd && !IsFlySelectedByCursor(m_rDoc, *pStt, *pEnd)))
@@ -4499,8 +4493,7 @@ bool DocumentContentOperationsManager::ReplaceRangeImpl( 
SwPaM& rPam, const OUSt
         SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() );
         ::PaMCorrAbs( aDelPam, *aDelPam.GetPoint() );
 
-        SwPosition *pStt = aDelPam.Start(),
-                   *pEnd = aDelPam.End();
+        auto [pStt, pEnd] = aDelPam.StartEnd(); // SwPosition*
         bool bOneNode = pStt->nNode == pEnd->nNode;
 
         // Own Undo?
@@ -4894,8 +4887,7 @@ bool 
DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
     SwDoc& rDoc = rPos.nNode.GetNode().GetDoc();
     const bool bColumnSel = rDoc.IsClipBoard() && rDoc.IsColumnSelection();
 
-    SwPosition const*const pStt = rPam.Start();
-    SwPosition *const pEnd = rPam.End();
+    auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
 
     // Catch when there's no copy to do.
     if (!rPam.HasMark() || (IsEmptyRange(*pStt, *pEnd, flags) && !bColumnSel) 
||
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 3f25007c66e5..066481c76bb6 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1023,8 +1023,7 @@ namespace
         // The Selection is only in the ContentSection. If there are Redlines
         // to Non-ContentNodes before or after that, then the Selections
         // expand to them.
-        SwPosition* pStt = rPam.Start(),
-                  * pEnd = rPam.End();
+        auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
         SwDoc& rDoc = rPam.GetDoc();
         if( !pStt->nContent.GetIndex() &&
             !rDoc.GetNodes()[ pStt->nNode.GetIndex() - 1 ]->IsContentNode() )
@@ -1293,8 +1292,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
         }
     }
 
-    SwPosition* pStt = pNewRedl->Start(),
-              * pEnd = pNewRedl->End();
+    auto [pStt, pEnd] = pNewRedl->StartEnd(); // SwPosition*
     {
         SwTextNode* pTextNode = pStt->nNode.GetNode().GetTextNode();
         if( pTextNode == nullptr )
@@ -2493,8 +2491,7 @@ void DocumentRedlineManager::CompressRedlines(size_t 
nStartIndex)
 bool DocumentRedlineManager::SplitRedline( const SwPaM& rRange )
 {
     bool bChg = false;
-    const SwPosition* pStt = rRange.Start();
-    const SwPosition* pEnd = rRange.End();
+    auto [pStt, pEnd] = rRange.StartEnd(); // SwPosition*
     //FIXME overlapping problem GetRedline( *pStt, &n );
     // Loop backwards, because we are mostly called with rRange pointing
     // something near the end of the table.
@@ -2570,8 +2567,7 @@ bool DocumentRedlineManager::DeleteRedline( const SwPaM& 
rRange, bool bSaveInUnd
         }
     }
 
-    const SwPosition* pStt = rRange.Start(),
-                    * pEnd = rRange.End();
+    auto [pStt, pEnd] = rRange.StartEnd(); // SwPosition*
     SwRedlineTable::size_type n = 0;
     GetRedline( *pStt, &n );
     for( ; n < maRedlineTable.size() ; ++n )
@@ -2580,8 +2576,7 @@ bool DocumentRedlineManager::DeleteRedline( const SwPaM& 
rRange, bool bSaveInUnd
         if( RedlineType::Any != nDelType && nDelType != pRedl->GetType() )
             continue;
 
-        SwPosition* pRStt = pRedl->Start(),
-                  * pREnd = pRedl->End();
+        auto [pRStt, pREnd] = pRedl->StartEnd(); // SwPosition*
         switch( ComparePosition( *pStt, *pEnd, *pRStt, *pREnd ) )
         {
         case SwComparePosition::Equal:
@@ -2703,8 +2698,9 @@ SwRedlineTable::size_type 
DocumentRedlineManager::GetRedlinePos( const SwNode& r
         for( ; it != maRedlineTable.end(); ++it)
         {
             const SwRangeRedline* pTmp = *it;
-            SwNodeOffset nStart = pTmp->Start()->nNode.GetIndex(),
-                      nEnd = pTmp->End()->nNode.GetIndex();
+            auto [pStart, pEnd] = pTmp->StartEnd(); // SwPosition*
+            SwNodeOffset nStart = pStart->nNode.GetIndex(),
+                         nEnd = pEnd->nNode.GetIndex();
 
             if( ( RedlineType::Any == nType || nType == pTmp->GetType()) &&
                 nStart <= nNdIdx && nNdIdx <= nEnd )
@@ -2953,8 +2949,7 @@ bool DocumentRedlineManager::AcceptRedline( const SwPaM& 
rPam, bool bCallDelete
 
 void DocumentRedlineManager::AcceptRedlineParagraphFormatting( const SwPaM 
&rPam )
 {
-    const SwPosition* pStt = rPam.Start(),
-                    * pEnd = rPam.End();
+    auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
 
     const SwNodeOffset nSttIdx = pStt->nNode.GetIndex();
     const SwNodeOffset nEndIdx = pEnd->nNode.GetIndex();
@@ -3385,8 +3380,7 @@ const SwRangeRedline* 
DocumentRedlineManager::SelPrevRedline( SwPaM& rPam ) cons
 bool DocumentRedlineManager::SetRedlineComment( const SwPaM& rPaM, const 
OUString& rS )
 {
     bool bRet = false;
-    const SwPosition* pStt = rPaM.Start(),
-                    * pEnd = rPaM.End();
+    auto [pStt, pEnd] = rPaM.StartEnd(); // SwPosition*
     SwRedlineTable::size_type n = 0;
     if( GetRedlineTable().FindAtPosition( *pStt, n ) )
     {
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 4f16b6042a8c..2f13552c9106 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -334,7 +334,7 @@ void sw_GetJoinFlags( SwPaM& rPam, bool& rJoinText, bool& 
rJoinPrev )
     if( rPam.GetPoint()->nNode == rPam.GetMark()->nNode )
         return;
 
-    const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
+    auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
     SwTextNode *pSttNd = pStt->nNode.GetNode().GetTextNode();
     if( !pSttNd )
         return;
@@ -844,8 +844,7 @@ void SwDoc::DeleteAutoCorrExceptWord()
 void SwDoc::CountWords( const SwPaM& rPaM, SwDocStat& rStat )
 {
     // This is a modified version of SwDoc::TransliterateText
-    const SwPosition* pStt = rPaM.Start();
-    const SwPosition* pEnd = rPaM.End();
+    auto [pStt, pEnd] = rPaM.StartEnd(); // SwPosition*
 
     const SwNodeOffset nSttNd = pStt->nNode.GetIndex();
     const SwNodeOffset nEndNd = pEnd->nNode.GetIndex();
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index ba900eceef2f..5f4e33ddacc5 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -229,7 +229,7 @@ void SwDoc::RstTextAttrs(const SwPaM &rRg, bool 
bInclRefToxMark,
         pHst = &pUndo->GetHistory();
         GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
     }
-    const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
+    auto [pStt, pEnd] = rRg.StartEnd(); // SwPosition*
     sw::DocumentContentOperationsManager::ParaRstFormat aPara(
             pStt, pEnd, pHst, nullptr, pLayout );
     aPara.bInclRefToxMark = bInclRefToxMark;
@@ -316,7 +316,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
         GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
     }
 
-    const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End();
+    auto [pStt, pEnd] = pPam->StartEnd(); // SwPosition*
     sw::DocumentContentOperationsManager::ParaRstFormat aPara(
             pStt, pEnd, pHst, nullptr, pLayout);
 
@@ -1086,7 +1086,7 @@ bool SwDoc::SetTextFormatColl(const SwPaM &rRg,
                           SwRootFrame const*const pLayout)
 {
     SwDataChanged aTmp( rRg );
-    const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
+    auto [pStt, pEnd] = rRg.StartEnd(); // SwPosition*
     SwHistory* pHst = nullptr;
     bool bRet = true;
 
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index 376994160e7d..d9e955619916 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -435,7 +435,7 @@ bool SwDoc::SetCurFootnote( const SwPaM& rPam, const 
OUString& rNumStr,
     SwFootnoteIdxs& rFootnoteArr = GetFootnoteIdxs();
     SwRootFrame* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout();
 
-    const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
+    auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
     const SwNodeOffset nSttNd = pStt->nNode.GetIndex();
     const sal_Int32 nSttCnt = pStt->nContent.GetIndex();
     const SwNodeOffset nEndNd = pEnd->nNode.GetIndex();
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 6f0d81067955..661875a12cc3 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -470,8 +470,7 @@ static bool lcl_TstFlyRange( const SwPaM* pPam, const 
SwPosition* pFlyPos,
     const SwPaM* pTmp = pPam;
     do {
         const SwNodeOffset nFlyIndex = pFlyPos->nNode.GetIndex();
-        const SwPosition* pPaMStart = pTmp->Start();
-        const SwPosition* pPaMEnd = pTmp->End();
+        auto [pPaMStart, pPaMEnd] = pTmp->StartEnd(); // SwPosition*
         const SwNodeOffset nPamStartIndex = pPaMStart->nNode.GetIndex();
         const SwNodeOffset nPamEndIndex = pPaMEnd->nNode.GetIndex();
         if (RndStdIds::FLY_AT_PARA == nAnchorId)
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 45c62c2db860..fa91ccf32649 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1936,7 +1936,7 @@ bool SwDoc::MoveParagraph(SwPaM& rPam, SwNodeOffset 
nOffset, bool const bIsOutlM
 bool SwDoc::MoveParagraphImpl(SwPaM& rPam, SwNodeOffset const nOffset,
         bool const bIsOutlMv, SwRootFrame const*const pLayout)
 {
-    const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
+    auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
 
     SwNodeOffset nStIdx = pStt->nNode.GetIndex();
     SwNodeOffset nEndIdx = pEnd->nNode.GetIndex();
@@ -2051,7 +2051,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, SwNodeOffset 
const nOffset,
                 const SwRangeRedline* pTmp = 
getIDocumentRedlineAccess().GetRedlineTable()[ nRedlPos ];
                 if( !bCheckDel || RedlineType::Delete == pTmp->GetType() )
                 {
-                    const SwPosition *pRStt = pTmp->Start(), *pREnd = 
pTmp->End();
+                    auto [pRStt, pREnd] = pTmp->StartEnd(); // SwPosition*
                     switch( ComparePosition( *pRStt, *pREnd, aStPos, aEndPos ))
                     {
                     case SwComparePosition::CollideStart:
@@ -2097,7 +2097,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, SwNodeOffset 
const nOffset,
         if( SwRedlineTable::npos != nRedlPos )
         {
             SwRangeRedline* pTmp = 
getIDocumentRedlineAccess().GetRedlineTable()[ nRedlPos ];
-            const SwPosition *pRStt = pTmp->Start(), *pREnd = pTmp->End();
+            auto [pRStt, pREnd] = pTmp->StartEnd(); // SwPosition*
             SwRangeRedline aTmpRedl( RedlineType::Insert, rPam );
             const SwContentNode* pCEndNd = 
pEnd->nNode.GetNode().GetContentNode();
             // Is completely in the range and is the own Redline too?
@@ -2385,7 +2385,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, SwNodeOffset 
const nOffset,
 
     if( pOwnRedl )
     {
-        SwPosition *pRStt = pOwnRedl->Start(), *pREnd = pOwnRedl->End();
+        auto [pRStt, pREnd] = pOwnRedl->StartEnd(); // SwPosition*
         if( pRStt->nNode.GetIndex() != nRedlSttNd )
         {
             pRStt->nNode = nRedlSttNd;
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 916d81c48d9b..a41509c69a21 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -314,10 +314,7 @@ void lcl_LOKInvalidateStartEndFrames(SwShellCursor& 
rCursor)
         return;
     }
 
-
-    SwPosition *pStartPos = rCursor.Start(),
-               *pEndPos   = rCursor.End();
-
+    auto [pStartPos, pEndPos] = rCursor.StartEnd(); // SwPosition*
 
     lcl_LOKInvalidateFrames(*(pStartPos->nNode.GetNode().GetContentNode()),
                             rCursor.GetShell()->GetLayout(),
@@ -358,8 +355,7 @@ void 
SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRangeRe
     OUString sDateTime = 
utl::toISO8601(pRedline->GetRedlineData().GetTimeStamp().GetUNODateTime());
     aRedline.put("dateTime", sDateTime.toUtf8().getStr());
 
-    SwPosition* pStartPos = pRedline->Start();
-    SwPosition* pEndPos = pRedline->End();
+    auto [pStartPos, pEndPos] = pRedline->StartEnd(); // SwPosition*
     SwContentNode* pContentNd = pRedline->GetContentNode();
     SwView* pView = dynamic_cast<SwView*>(SfxViewShell::Current());
     if (pView && pContentNd)
@@ -485,8 +481,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 = p->End();
+    auto [pStt, pEnd] = p->StartEnd(); // SwPosition*
     SwPosition aNewStt( *pStt );
     SwNodes& rNds = aNewStt.nNode.GetNodes();
     SwContentNode* pC;
@@ -746,8 +741,7 @@ const SwRangeRedline* SwRedlineTable::FindAtPosition( const 
SwPosition& rSttPos,
         const SwRangeRedline* pTmp = (*this)[ rPos ];
         if( pTmp->HasMark() && pTmp->IsVisible() )
         {
-            const SwPosition* pRStt = pTmp->Start(),
-                      * pREnd = pTmp->End();
+            auto [pRStt, pREnd] = pTmp->StartEnd(); // SwPosition*
             if( bNext ? *pRStt <= rSttPos : *pRStt < rSttPos )
             {
                 if( bNext ? *pREnd > rSttPos : *pREnd >= rSttPos )
@@ -1388,10 +1382,11 @@ void SwRangeRedline::ShowOriginal(sal_uInt16 nLoop, 
size_t nMyPos, bool /*bForce
 // trigger the Layout
 void SwRangeRedline::InvalidateRange(Invalidation const eWhy)
 {
-    SwNodeOffset nSttNd = Start()->nNode.GetIndex(),
-                 nEndNd = End()->nNode.GetIndex();
-    sal_Int32 nSttCnt = Start()->nContent.GetIndex();
-    sal_Int32 nEndCnt = End()->nContent.GetIndex();
+    auto [pRStt, pREnd] = StartEnd(); // SwPosition*
+    SwNodeOffset nSttNd = pRStt->nNode.GetIndex(),
+                 nEndNd = pREnd->nNode.GetIndex();
+    sal_Int32 nSttCnt = pRStt->nContent.GetIndex();
+    sal_Int32 nEndCnt = pREnd->nContent.GetIndex();
 
     SwNodes& rNds = GetDoc().GetNodes();
     for (SwNodeOffset n(nSttNd); n <= nEndNd; ++n)
@@ -1433,7 +1428,7 @@ void SwRangeRedline::InvalidateRange(Invalidation const 
eWhy)
     text node nNdIdx */
 void SwRangeRedline::CalcStartEnd( SwNodeOffset nNdIdx, sal_Int32& rStart, 
sal_Int32& rEnd ) const
 {
-    const SwPosition *pRStt = Start(), *pREnd = End();
+    auto [pRStt, pREnd] = StartEnd(); // SwPosition*
     if( pRStt->nNode < nNdIdx )
     {
         if( pREnd->nNode > nNdIdx )
@@ -1507,8 +1502,7 @@ void SwRangeRedline::MoveToSection()
 {
     if( !m_pContentSect )
     {
-        const SwPosition* pStt = Start(),
-                        * pEnd = End();
+        auto [pStt, pEnd] = StartEnd(); // SwPosition*
 
         SwDoc& rDoc = GetDoc();
         SwPaM aPam( *pStt, *pEnd );
@@ -1582,8 +1576,7 @@ void SwRangeRedline::CopyToSection()
     if( m_pContentSect )
         return;
 
-    const SwPosition* pStt = Start(),
-                    * pEnd = End();
+    auto [pStt, pEnd] = StartEnd(); // SwPosition*
 
     SwContentNode* pCSttNd = pStt->nNode.GetNode().GetContentNode();
     SwContentNode* pCEndNd = pEnd->nNode.GetNode().GetContentNode();
@@ -1658,8 +1651,7 @@ void SwRangeRedline::DelCopyOfSection(size_t nMyPos)
     if( !m_pContentSect )
         return;
 
-    const SwPosition* pStt = Start(),
-                    * pEnd = End();
+    auto [pStt, pEnd] = StartEnd(); // SwPosition*
 
     SwDoc& rDoc = GetDoc();
     SwPaM aPam( *pStt, *pEnd );
diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx
index e0296697b281..2e5e084faeea 100644
--- a/sw/source/core/doc/docruby.cxx
+++ b/sw/source/core/doc/docruby.cxx
@@ -51,8 +51,7 @@ sal_uInt16 SwDoc::FillRubyList( const SwPaM& rPam, 
SwRubyList& rList )
                 *_pStartCursor2 = _pStartCursor;
     bool bCheckEmpty = &rPam != _pStartCursor;
     do {
-        const SwPosition* pStt = _pStartCursor->Start(),
-                        * pEnd = _pStartCursor->End();
+        auto [pStt, pEnd] = _pStartCursor->StartEnd(); // SwPosition*
         if( !bCheckEmpty || ( pStt != pEnd && *pStt != *pEnd ))
         {
             SwPaM aPam( *pStt );
@@ -100,8 +99,7 @@ void SwDoc::SetRubyList( const SwPaM& rPam, const 
SwRubyList& rList )
                 *_pStartCursor2 = _pStartCursor;
     bool bCheckEmpty = &rPam != _pStartCursor;
     do {
-        const SwPosition* pStt = _pStartCursor->Start(),
-                        * pEnd = _pStartCursor->End();
+        auto [pStt, pEnd] = _pStartCursor->StartEnd(); // SwPosition*
         if( !bCheckEmpty || ( pStt != pEnd && *pStt != *pEnd ))
         {
 
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index bd86cf29c649..bb4b9ef3aeea 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -283,7 +283,7 @@ double SwSortBoxElement::GetValue( sal_uInt16 nKey ) const
 bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
 {
     // Check if Frame is in the Text
-    const SwPosition *pStart = rPaM.Start(), *pEnd = rPaM.End();
+    auto [pStart, pEnd] = rPaM.StartEnd(); // SwPosition*
 
     // Set index to the Selection's start
     for ( const auto *pFormat : *GetSpzFrameFormats() )
diff --git a/sw/source/core/doc/list.cxx b/sw/source/core/doc/list.cxx
index 9543e083d711..f75edba55bb5 100644
--- a/sw/source/core/doc/list.cxx
+++ b/sw/source/core/doc/list.cxx
@@ -83,8 +83,7 @@ void SwList::InsertListItem(SwNodeNum& rNodeNum, 
SwListRedlineType const eRedlin
 
     for ( const auto& rNumberTree : maListTrees )
     {
-        const SwPosition* pStart = rNumberTree.pSection->Start();
-        const SwPosition* pEnd = rNumberTree.pSection->End();
+        auto [pStart, pEnd] = rNumberTree.pSection->StartEnd(); // SwPosition*
         const SwNodes* pRangeNodes = &(pStart->nNode.GetNode().GetNodes());
 
         if ( pRangeNodes == pNodesOfNodeNum &&
diff --git a/sw/source/core/doc/swserv.cxx b/sw/source/core/doc/swserv.cxx
index 83ea7affe60c..3fa443e1e939 100644
--- a/sw/source/core/doc/swserv.cxx
+++ b/sw/source/core/doc/swserv.cxx
@@ -148,7 +148,7 @@ void SwServerObject::SendDataChanged( const SwPaM& rRange )
 
     bool bCall = false;
     const SwStartNode* pNd = nullptr;
-    const SwPosition* pStt = rRange.Start(), *pEnd = rRange.End();
+    auto [pStt, pEnd] = rRange.StartEnd(); // SwPosition*
     switch( m_eType )
     {
     case BOOKMARK_SERVER:
diff --git a/sw/source/core/docnode/ndsect.cxx 
b/sw/source/core/docnode/ndsect.cxx
index 76831ae61925..27bcafec82fd 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -174,7 +174,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & 
rNewData,
     // See if the whole Document should be hidden, which we currently are not 
able to do.
     if (rNewData.IsHidden() && rRange.HasMark())
     {
-        const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End();
+        auto [pStt, pEnd] = rRange.StartEnd(); // SwPosition*
         if( !pStt->nContent.GetIndex() &&
             pEnd->nNode.GetNode().GetContentNode()->Len() ==
             pEnd->nContent.GetIndex() )
@@ -210,8 +210,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & 
rNewData,
 
     if( rRange.HasMark() )
     {
-        SwPosition *pSttPos = const_cast<SwPosition*>(rRange.Start()),
-                    *pEndPos = const_cast<SwPosition*>(rRange.End());
+        auto [pSttPos, pEndPos] = const_cast<SwPaM&>(rRange).StartEnd(); // 
SwPosition*
         if( pPrvNd && 3 == nRegionRet )
         {
             OSL_ENSURE( pPrvNd, "The SectionNode is missing" );
@@ -397,8 +396,7 @@ sal_uInt16 SwDoc::IsInsRegionAvailable( const SwPaM& rRange,
     if( rRange.HasMark() )
     {
         // See if we have a valid Section
-        const SwPosition* pStt = rRange.Start();
-        const SwPosition* pEnd = rRange.End();
+        auto [pStt, pEnd] = rRange.StartEnd(); // SwPosition*
 
         const SwContentNode* pCNd = pEnd->nNode.GetNode().GetContentNode();
         const SwNode* pNd = &pStt->nNode.GetNode();
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 635476cf3f9a..569be7bfcfaf 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -632,7 +632,7 @@ const SwTable* SwDoc::TextToTable( const 
SwInsertTableOptions& rInsTableOpts,
                                    const SwTableAutoFormat* pTAFormat )
 {
     // See if the selection contains a Table
-    const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End();
+    auto [pStt, pEnd] = rRange.StartEnd(); // SwPosition*
     {
         SwNodeOffset nCnt = pStt->nNode.GetIndex();
         for( ; nCnt <= pEnd->nNode.GetIndex(); ++nCnt )
@@ -4530,8 +4530,7 @@ void SwDoc::UnProtectTables( const SwPaM& rPam )
                 bool bFound = false;
                 SwPaM* pTmp = const_cast<SwPaM*>(&rPam);
                 do {
-                    const SwPosition *pStt = pTmp->Start(),
-                                    *pEnd = pTmp->End();
+                    auto [pStt, pEnd] = pTmp->StartEnd(); // SwPosition*
                     bFound = pStt->nNode.GetIndex() < nTableIdx &&
                             nTableIdx < pEnd->nNode.GetIndex();
 
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 399ea39a35ad..1c5d7f279893 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1434,8 +1434,7 @@ sal_uInt16 HighestLevel( SwNodes & rNodes, const 
SwNodeRange & rRange )
  */
 void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
 {
-    SwPosition * const pStt = rPam.Start();
-    SwPosition * const pEnd = rPam.End();
+    auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
 
     if( !rPam.HasMark() || *pStt >= *pEnd )
         return;
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 9818a621b049..dbb4bfa67edf 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -666,8 +666,7 @@ SvtScriptType SwEditShell::GetScriptType() const
     {
         for(SwPaM& rPaM : GetCursor()->GetRingContainer())
         {
-            const SwPosition *pStt = rPaM.Start(),
-                             *pEnd = rPaM.End();
+            auto [pStt, pEnd] = rPaM.StartEnd(); // SwPosition*
             if( pStt == pEnd || *pStt == *pEnd )
             {
                 const SwTextNode* pTNd = pStt->nNode.GetNode().GetTextNode();
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 1c946b2d4592..1e611653420a 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -550,8 +550,7 @@ void SwHyphIter::InsertSoftHyph( const sal_Int32 nHyphPos )
         return;
 
     SwPaM *pCursor = pMySh->GetCursor();
-    SwPosition* pSttPos = pCursor->Start();
-    SwPosition* pEndPos = pCursor->End();
+    auto [pSttPos, pEndPos] = pCursor->StartEnd(); // SwPosition*
 
     const sal_Int32 nLastHyphLen = GetEnd()->nContent.GetIndex() -
                           pSttPos->nContent.GetIndex();
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index 71541b4de96d..2ea498dfd4f3 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -179,8 +179,7 @@ void SwEditShell::SetSectionAttr( const SfxItemSet& rSet,
 
         for(SwPaM& rPaM : GetCursor()->GetRingContainer())
         {
-            const SwPosition* pStt = rPaM.Start(),
-                            * pEnd = rPaM.End();
+            auto [pStt, pEnd] = rPaM.StartEnd(); // SwPosition*
 
             SwSectionNode* pSttSectNd = 
pStt->nNode.GetNode().FindSectionNode(),
                                * pEndSectNd = 
pEnd->nNode.GetNode().FindSectionNode();
@@ -250,8 +249,7 @@ sal_uInt16 SwEditShell::GetFullSelectedSectionCount() const
     for(SwPaM& rPaM : GetCursor()->GetRingContainer())
     {
 
-        const SwPosition* pStt = rPaM.Start(),
-                        * pEnd = rPaM.End();
+        auto [pStt, pEnd] = rPaM.StartEnd(); // SwPosition*
         const SwContentNode* pCNd;
         // check the selection, if Start at Node begin and End at Node end
         if( pStt->nContent.GetIndex() ||
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index 38c9e7dd82be..655a6dfd0174 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -57,8 +57,7 @@ void SwEditShell::Insert(const SwTOXMark& rMark)
     StartAllAction();
     for(SwPaM& rPaM : GetCursor()->GetRingContainer())
     {
-        const SwPosition *pStt = rPaM.Start(),
-                         *pEnd = rPaM.End();
+        auto [pStt, pEnd] = rPaM.StartEnd(); // SwPosition*
         if( bInsAtPos )
         {
             SwPaM aTmp( *pStt );
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 0e9a0a2ca18e..4e29e509e10a 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -553,8 +553,7 @@ bool SwFEShell::Sort(const SwSortOptions& rOpt)
         {
             SwPaM* pPam = &rPaM;
 
-            SwPosition* pStart = pPam->Start();
-            SwPosition* pEnd   = pPam->End();
+            auto [pStart, pEnd] = pPam->StartEnd(); // SwPosition*
 
             SwNodeIndex aPrevIdx( pStart->nNode, -1 );
             SwNodeOffset nOffset = pEnd->nNode.GetIndex() - 
pStart->nNode.GetIndex();
diff --git a/sw/source/core/layout/trvlfrm.cxx 
b/sw/source/core/layout/trvlfrm.cxx
index 2a424739a1b7..a388b807769c 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2020,8 +2020,7 @@ static void Add( SwRegionRects& rRegion, const SwRect& 
rRect )
  */
 void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor)
 {
-    SwPosition *pStartPos = rCursor.Start(),
-               *pEndPos   = rCursor.End();
+    auto [pStartPos, pEndPos] = rCursor.StartEnd(); // SwPosition*
 
     SwViewShell *pSh = GetCurrShell();
 
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index 374035d479e0..fcf0ac5a86be 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -110,8 +110,7 @@ public:
                 if (pRed->GetType() != RedlineType::Delete)
                     continue;
 
-                SwPosition const*const pStart(pRed->Start());
-                SwPosition const*const pEnd(pRed->End());
+                auto [pStart, pEnd] = pRed->StartEnd(); // SwPosition*
                 if (*pStart == *pEnd)
                 {   // only allowed while moving (either way?)
 //                  
assert(IDocumentRedlineAccess::IsHideChanges(rIDRA.GetRedlineFlags()));
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index d9727deabeec..d258127f0701 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -556,7 +556,7 @@ static const SwRangeRedline* 
lcl_GetRedlineAtNodeInsertionOrDeletion( const SwTe
             if( RedlineType::Delete == pTmp->GetType() ||
                 RedlineType::Insert == pTmp->GetType() )
             {
-                const SwPosition *pRStt = pTmp->Start(), *pREnd = pTmp->End();
+                auto [pRStt, pREnd ]= pTmp->StartEnd(); // SwPosition*
                 if( pRStt->nNode <= nNdIdx && pREnd->nNode > nNdIdx )
                 {
                     bIsMoved = pTmp->IsMoved();
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 0ccb11526bb6..884aab114253 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -215,8 +215,7 @@ SwUndoDelete::SwUndoDelete(
         m_pHistory.reset( new SwHistory );
 
     // delete all footnotes for now
-    const SwPosition *pStt = rPam.Start(),
-                     *pEnd = rPam.End();
+    auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
 
     // Step 1. deletion/record of content indices
     if( m_bDelFullPara )
@@ -531,8 +530,7 @@ bool SwUndoDelete::CanGrouping( SwDoc& rDoc, const SwPaM& 
rDelPam )
     if( m_nSttNode != m_nEndNode || ( !m_bGroup && m_nSttContent+1 != 
m_nEndContent ))
         return false;
 
-    const SwPosition *pStt = rDelPam.Start(),
-                     *pEnd = rDelPam.End();
+    auto [pStt, pEnd] = rDelPam.StartEnd(); // SwPosition*
 
     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 401dab1ec648..03a3c056ad2d 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1423,8 +1423,7 @@ bool SwUndo::FillSaveData(
 {
     rSData.clear();
 
-    const SwPosition* pStt = rRange.Start();
-    const SwPosition* pEnd = rRange.End();
+    auto [pStt, pEnd] = rRange.StartEnd(); // SwPosition*
     const SwRedlineTable& rTable = 
rRange.GetDoc().getIDocumentRedlineAccess().GetRedlineTable();
     SwRedlineTable::size_type n = 0;
     rRange.GetDoc().getIDocumentRedlineAccess().GetRedline( *pStt, &n );
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 8338bfe44de2..762a2c12d5b2 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -587,8 +587,7 @@ SwUndoReplace::Impl::Impl(
     , m_bRegExp(bRegExp)
 {
 
-    const SwPosition * pStt( rPam.Start() );
-    const SwPosition * pEnd( rPam.End() );
+    auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
 
     m_nSttNd = m_nEndNd = pStt->nNode.GetIndex();
     m_nSttCnt = pStt->nContent.GetIndex();
diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx
index 1970eff02aeb..7203479b150e 100644
--- a/sw/source/core/undo/unredln.cxx
+++ b/sw/source/core/undo/unredln.cxx
@@ -333,8 +333,7 @@ void SwUndoRedlineSort::UndoRedlineImpl(SwDoc & rDoc, SwPaM 
& rPam)
     // rPam contains the sorted range
     // aSaveRange contains copied (i.e. original) range
 
-    SwPosition *const pStart = rPam.Start();
-    SwPosition *const pEnd   = rPam.End();
+    auto [pStart, pEnd] = rPam.StartEnd(); // SwPosition*
 
     SwNodeIndex aPrevIdx( pStart->nNode, -1 );
     SwNodeOffset nOffsetTemp = pEnd->nNode.GetIndex() - 
pStart->nNode.GetIndex();
@@ -383,8 +382,7 @@ void SwUndoRedlineSort::UndoRedlineImpl(SwDoc & rDoc, SwPaM 
& rPam)
 void SwUndoRedlineSort::RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam)
 {
     SwPaM* pPam = &rPam;
-    SwPosition* pStart = pPam->Start();
-    SwPosition* pEnd   = pPam->End();
+    auto [pStart, pEnd] = pPam->StartEnd(); // SwPosition*
 
     SwNodeIndex aPrevIdx( pStart->nNode, -1 );
     SwNodeOffset nOffsetTemp = pEnd->nNode.GetIndex() - 
pStart->nNode.GetIndex();
diff --git a/sw/source/core/unocore/unotextmarkup.cxx 
b/sw/source/core/unocore/unotextmarkup.cxx
index 0ea41f5f132d..1e051ceb3ca9 100644
--- a/sw/source/core/unocore/unotextmarkup.cxx
+++ b/sw/source/core/unocore/unotextmarkup.cxx
@@ -111,8 +111,7 @@ void SAL_CALL 
SwXTextMarkup::commitTextRangeMarkup(::sal_Int32 nType, const OUSt
 
         ::sw::XTextRangeToSwPaM(aPam, xRange);
 
-        SwPosition* startPos = aPam.Start();
-        SwPosition* endPos   = aPam.End();
+        auto [startPos, endPos] = aPam.StartEnd(); // SwPosition*
 
         commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), 
endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), 
xMarkupInfoContainer);
     }
@@ -120,8 +119,7 @@ void SAL_CALL 
SwXTextMarkup::commitTextRangeMarkup(::sal_Int32 nType, const OUSt
     {
         SwPaM & rPam(*pCursor->GetPaM());
 
-        SwPosition* startPos = rPam.Start();
-        SwPosition* endPos   = rPam.End();
+        auto [startPos, endPos] = rPam.StartEnd(); // SwPosition*
 
         commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), 
endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), 
xMarkupInfoContainer);
     }
diff --git a/sw/source/filter/ascii/ascatr.cxx 
b/sw/source/filter/ascii/ascatr.cxx
index 42d16c7eed1a..130c0572bfc5 100644
--- a/sw/source/filter/ascii/ascatr.cxx
+++ b/sw/source/filter/ascii/ascatr.cxx
@@ -206,8 +206,7 @@ public:
             {
                 continue;
             }
-            SwPosition const*const pStart(pRedline->Start());
-            SwPosition const*const pEnd(pRedline->End());
+            auto [pStart, pEnd] = pRedline->StartEnd(); // SwPosition*
             if (m_rNode.GetIndex() < pStart->nNode.GetIndex())
             {
                 m_nextRedline = SwRedlineTable::npos;
diff --git a/sw/source/filter/basflt/fltshell.cxx 
b/sw/source/filter/basflt/fltshell.cxx
index b4319e3d5a4f..571f32b1aa0d 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -764,7 +764,7 @@ const SfxPoolItem* 
SwFltControlStack::GetOpenStackAttr(const SwPosition& rPos, s
 
 void SwFltControlStack::Delete(const SwPaM &rPam)
 {
-    const SwPosition *pStt = rPam.Start(), *pEnd = rPam.End();
+    auto [pStt, pEnd] = rPam.StartEnd(); // SwPosition*
 
     if( !rPam.HasMark() || *pStt >= *pEnd )
         return;
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx 
b/sw/source/filter/ww8/wrtw8nds.cxx
index 7366750d894b..cd48428cadb0 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -308,8 +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 = pRedl->End();
+            auto [pStt, pEnd] = pRedl->StartEnd(); // SwPosition*
 
             if( pStt->nNode == m_rNode )
             {
@@ -1595,8 +1594,7 @@ const SwRedlineData* SwWW8AttrIter::GetRunLevelRedline( 
sal_Int32 nPos )
     {
         const SwRangeRedline* pRedl = 
m_rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ 
m_nCurRedlinePos ];
 
-        const SwPosition* pStt = pRedl->Start();
-        const SwPosition* pEnd = pRedl->End();
+        auto [pStt, pEnd] = pRedl->StartEnd(); // SwPosition*
 
         if( pStt->nNode == m_rNode )
         {
@@ -1852,8 +1850,7 @@ static SwTextFormatColl& lcl_getFormatCollection( 
MSWordExportBase& rExport, con
     while( nPos < nMax )
     {
         const SwRangeRedline* pRedl = 
rExport.m_rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nPos++ ];
-        const SwPosition* pStt = pRedl->Start();
-        const SwPosition* pEnd = pRedl->End();
+        auto [pStt, pEnd] = pRedl->StartEnd(); // SwPosition*
         // Looking for deletions, which ends in current pTextNode
         if( RedlineType::Delete == pRedl->GetRedlineData().GetType() &&
             pEnd->nNode == *pTextNode && pStt->nNode != *pTextNode &&
diff --git a/sw/source/uibase/lingu/hhcwrp.cxx 
b/sw/source/uibase/lingu/hhcwrp.cxx
index f21dc91d6faf..72651c5fc40f 100644
--- a/sw/source/uibase/lingu/hhcwrp.cxx
+++ b/sw/source/uibase/lingu/hhcwrp.cxx
@@ -506,8 +506,7 @@ void SwHHCWrapper::Convert()
     OSL_ENSURE( m_pConvArgs == nullptr, "NULL pointer expected" );
     {
         SwPaM *pCursor = m_pView->GetWrtShell().GetCursor();
-        SwPosition* pSttPos = pCursor->Start();
-        SwPosition* pEndPos = pCursor->End();
+        auto [pSttPos, pEndPos] = pCursor->StartEnd(); // SwPosition*
 
         if (pSttPos->nNode.GetNode().IsTextNode() &&
             pEndPos->nNode.GetNode().IsTextNode())
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index cfa2cf9c7341..7c9acfe5a65f 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -1124,8 +1124,7 @@ void SwXTextViewCursor::gotoRange(
         // by him and the transferred Range.
         SwPosition aOwnLeft(*aOwnPaM.Start());
         SwPosition aOwnRight(*aOwnPaM.End());
-        SwPosition* pParamLeft = rDestPam.Start();
-        SwPosition* pParamRight = rDestPam.End();
+        auto [pParamLeft, pParamRight] = rDestPam.StartEnd(); // SwPosition*
         // Now four SwPositions are there, two of them are needed, but which?
         if(aOwnRight > *pParamRight)
             *aOwnPaM.GetPoint() = aOwnRight;

Reply via email to