[Libreoffice-commits] core.git: sw/source

Caolán McNamara caolanm at redhat.com
Tue Jun 16 07:08:37 PDT 2015


 sw/source/core/undo/undel.cxx   |   42 +++++++++---------
 sw/source/core/undo/unmove.cxx  |   12 ++---
 sw/source/core/undo/unredln.cxx |   92 ++++++++++++++++++++--------------------
 sw/source/core/undo/untblk.cxx  |   80 +++++++++++++++++-----------------
 4 files changed, 113 insertions(+), 113 deletions(-)

New commits:
commit 6f7afbb4dccef0de5521d0a2d1cfef71690222f3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 16 13:38:01 2015 +0100

    change pointer to reference for the win
    
    Change-Id: Ia43a07dc7d6bc87bba297636771ee4bd3a0b477d

diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index c2871f9..bdfd99f8 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -745,14 +745,14 @@ static void lcl_ReAnchorAtContentFlyFrames( const SwFrameFormats& rSpzArr, SwPos
 
 void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
 {
-    SwDoc *const pDoc = & rContext.GetDoc();
+    SwDoc& rDoc = rContext.GetDoc();
 
     sal_uLong nCalcStt = nSttNode - nNdDiff;
 
     if( nSectDiff && bBackSp )
         nCalcStt += nSectDiff;
 
-    SwNodeIndex aIdx( pDoc->GetNodes(), nCalcStt );
+    SwNodeIndex aIdx(rDoc.GetNodes(), nCalcStt);
     SwNode* pInsNd = &aIdx.GetNode();
 
     {   // code block so that SwPosition is detached when deleting a Node
@@ -761,8 +761,8 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
         {
             if( pInsNd->IsTableNode() )
             {
-                pInsNd = pDoc->GetNodes().MakeTextNode( aIdx,
-                        pDoc->GetDfltTextFormatColl() );
+                pInsNd = rDoc.GetNodes().MakeTextNode( aIdx,
+                        rDoc.GetDfltTextFormatColl() );
                 --aIdx;
                 aPos.nNode = aIdx;
                 aPos.nContent.Assign( pInsNd->GetContentNode(), nSttContent );
@@ -794,13 +794,13 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
             if( pSttStr && !bFromTableCopy )
             {
                 sal_uLong nOldIdx = aPos.nNode.GetIndex();
-                pDoc->getIDocumentContentOperations().SplitNode( aPos, false );
+                rDoc.getIDocumentContentOperations().SplitNode( aPos, false );
                 // After the split all objects are anchored at the first
                 // paragraph, but the pHistory of the fly frame formats relies
                 // on anchoring at the start of the selection
                 // => selection backwards needs a correction.
                 if( bBackSp )
-                    lcl_ReAnchorAtContentFlyFrames( *pDoc->GetSpzFrameFormats(), aPos, nOldIdx );
+                    lcl_ReAnchorAtContentFlyFrames(*rDoc.GetSpzFrameFormats(), aPos, nOldIdx);
                 pTextNd = aPos.nNode.GetNode().GetTextNode();
             }
             if( pTextNd )
@@ -821,9 +821,9 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
                 if (nSttContent < pNd->GetText().getLength())
                 {
                     sal_uLong nOldIdx = aPos.nNode.GetIndex();
-                    pDoc->getIDocumentContentOperations().SplitNode( aPos, false );
+                    rDoc.getIDocumentContentOperations().SplitNode( aPos, false );
                     if( bBackSp )
-                        lcl_ReAnchorAtContentFlyFrames( *pDoc->GetSpzFrameFormats(), aPos, nOldIdx );
+                        lcl_ReAnchorAtContentFlyFrames(*rDoc.GetSpzFrameFormats(), aPos, nOldIdx);
                 }
                 else
                     ++aPos.nNode;
@@ -844,12 +844,12 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
                 nMoveIndex -= nSectDiff + 1;
                 ++nDiff;
             }
-            SwNodeIndex aMvIdx( pDoc->GetNodes(), nMoveIndex );
+            SwNodeIndex aMvIdx(rDoc.GetNodes(), nMoveIndex);
             SwNodeRange aRg( aPos.nNode, 0 - nDiff, aPos.nNode, 1 - nDiff );
             --aPos.nNode;
             if( !bJoinNext )
                 pMovedNode = &aPos.nNode.GetNode();
-            pDoc->GetNodes()._MoveNodes( aRg, pDoc->GetNodes(), aMvIdx, true );
+            rDoc.GetNodes()._MoveNodes(aRg, rDoc.GetNodes(), aMvIdx, true);
             ++aPos.nNode;
         }
 
@@ -857,7 +857,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
         {
             SwNodeRange aRange( *pMvStt, 0, *pMvStt, nNode );
             SwNodeIndex aCopyIndex( aPos.nNode, -1 );
-            pDoc->GetUndoManager().GetUndoNodes()._Copy( aRange, aPos.nNode );
+            rDoc.GetUndoManager().GetUndoNodes()._Copy( aRange, aPos.nNode );
 
             if( nReplaceDummy )
             {
@@ -872,16 +872,16 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
                     aPos = SwPosition( aCopyIndex );
                     nMoveIndex = aPos.nNode.GetIndex() + nReplaceDummy + 1;
                 }
-                SwNodeIndex aMvIdx( pDoc->GetNodes(), nMoveIndex );
+                SwNodeIndex aMvIdx(rDoc.GetNodes(), nMoveIndex);
                 SwNodeRange aRg( aPos.nNode, 0, aPos.nNode, 1 );
                 pMovedNode = &aPos.nNode.GetNode();
-                pDoc->GetNodes()._MoveNodes( aRg, pDoc->GetNodes(), aMvIdx, true );
-                pDoc->GetNodes().Delete( aMvIdx, 1 );
+                rDoc.GetNodes()._MoveNodes(aRg, rDoc.GetNodes(), aMvIdx, true);
+                rDoc.GetNodes().Delete( aMvIdx, 1 );
             }
         }
 
         if( pMovedNode )
-            lcl_MakeAutoFrms( *pDoc->GetSpzFrameFormats(), pMovedNode->GetIndex() );
+            lcl_MakeAutoFrms(*rDoc.GetSpzFrameFormats(), pMovedNode->GetIndex());
 
         if( pSttStr )
         {
@@ -911,7 +911,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
 
         if( pHistory )
         {
-            pHistory->TmpRollback( pDoc, nSetPos, false );
+            pHistory->TmpRollback(&rDoc, nSetPos, false);
             if( nSetPos )       // there were Footnodes/FlyFrames
             {
                 // are there others than these ones?
@@ -920,12 +920,12 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
                     // if so save the attributes of the others
                     SwHistory aHstr;
                     aHstr.Move( 0, pHistory, nSetPos );
-                    pHistory->Rollback( pDoc );
+                    pHistory->Rollback(&rDoc);
                     pHistory->Move( 0, &aHstr );
                 }
                 else
                 {
-                    pHistory->Rollback( pDoc );
+                    pHistory->Rollback(&rDoc);
                     DELETEZ( pHistory );
                 }
             }
@@ -936,7 +936,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
             sal_uInt16 nStt = static_cast<sal_uInt16>( bResetPgDesc ? RES_PAGEDESC : RES_BREAK );
             sal_uInt16 nEnd = static_cast<sal_uInt16>( bResetPgBrk ? RES_BREAK : RES_PAGEDESC );
 
-            SwNode* pNode = pDoc->GetNodes()[ nEndNode + 1 ];
+            SwNode* pNode = rDoc.GetNodes()[ nEndNode + 1 ];
             if( pNode->IsContentNode() )
                 static_cast<SwContentNode*>(pNode)->ResetAttr( nStt, nEnd );
             else if( pNode->IsTableNode() )
@@ -945,9 +945,9 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
     }
     // delete the temporarily added Node
     if( pInsNd )
-        pDoc->GetNodes().Delete( aIdx, 1 );
+        rDoc.GetNodes().Delete( aIdx, 1 );
     if( pRedlSaveData )
-        SetSaveData( *pDoc, *pRedlSaveData );
+        SetSaveData(rDoc, *pRedlSaveData);
 
     AddUndoRedoPaM(rContext, true);
 }
diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx
index aef019e..94cb6f6 100644
--- a/sw/source/core/undo/unmove.cxx
+++ b/sw/source/core/undo/unmove.cxx
@@ -278,8 +278,8 @@ void SwUndoMove::UndoImpl(::sw::UndoRedoContext & rContext)
 
 void SwUndoMove::RedoImpl(::sw::UndoRedoContext & rContext)
 {
-    SwPaM *const pPam = & AddUndoRedoPaM(rContext);
-    SwDoc & rDoc = rContext.GetDoc();
+    SwPaM& rPam = AddUndoRedoPaM(rContext);
+    SwDoc& rDoc = rContext.GetDoc();
 
     SwNodes& rNds = rDoc.GetNodes();
     SwNodeIndex aIdx( rNds, nMvDestNode );
@@ -294,7 +294,7 @@ void SwUndoMove::RedoImpl(::sw::UndoRedoContext & rContext)
     }
     else
     {
-        SwPaM aPam( *pPam->GetPoint() );
+        SwPaM aPam(*rPam.GetPoint());
         SetPaM( aPam );
         SwPosition aMvPos( aIdx, SwIndex( aIdx.GetNode().GetContentNode(),
                                         nMvDestContent ));
@@ -322,9 +322,9 @@ void SwUndoMove::RedoImpl(::sw::UndoRedoContext & rContext)
                 pTextNd->JoinNext();
             }
         }
-        *pPam->GetPoint() = *aPam.GetPoint();
-        pPam->SetMark();
-        *pPam->GetMark() = *aPam.GetMark();
+        *rPam.GetPoint() = *aPam.GetPoint();
+        rPam.SetMark();
+        *rPam.GetMark() = *aPam.GetMark();
     }
 }
 
diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx
index 4d07b68..cef198e 100644
--- a/sw/source/core/undo/unredln.cxx
+++ b/sw/source/core/undo/unredln.cxx
@@ -84,20 +84,20 @@ sal_uInt16 SwUndoRedline::GetRedlSaveCount() const
 
 void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext)
 {
-    SwDoc *const pDoc = & rContext.GetDoc();
-    SwPaM & rPam( AddUndoRedoPaM(rContext) );
+    SwDoc& rDoc = rContext.GetDoc();
+    SwPaM& rPam(AddUndoRedoPaM(rContext));
 
-    UndoRedlineImpl(*pDoc, rPam);
+    UndoRedlineImpl(rDoc, rPam);
 
     if( mpRedlSaveData )
     {
-        sal_uLong nEndExtra = pDoc->GetNodes().GetEndOfExtras().GetIndex();
-        SetSaveData( *pDoc, *mpRedlSaveData );
+        sal_uLong nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex();
+        SetSaveData(rDoc, *mpRedlSaveData);
         if( mbHiddenRedlines )
         {
             mpRedlSaveData->clear();
 
-            nEndExtra = pDoc->GetNodes().GetEndOfExtras().GetIndex() - nEndExtra;
+            nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex() - nEndExtra;
             nSttNode += nEndExtra;
             nEndNode += nEndExtra;
         }
@@ -107,25 +107,25 @@ void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext)
 
 void SwUndoRedline::RedoImpl(::sw::UndoRedoContext & rContext)
 {
-    SwDoc *const pDoc = & rContext.GetDoc();
-    RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
-    pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
+    SwDoc& rDoc = rContext.GetDoc();
+    RedlineMode_t eOld = rDoc.getIDocumentRedlineAccess().GetRedlineMode();
+    rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON ));
 
     SwPaM & rPam( AddUndoRedoPaM(rContext) );
     if( mpRedlSaveData && mbHiddenRedlines )
     {
-        sal_uLong nEndExtra = pDoc->GetNodes().GetEndOfExtras().GetIndex();
+        sal_uLong nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex();
         FillSaveData(rPam, *mpRedlSaveData, false, UNDO_REJECT_REDLINE != mnUserId );
 
-        nEndExtra -= pDoc->GetNodes().GetEndOfExtras().GetIndex();
+        nEndExtra -= rDoc.GetNodes().GetEndOfExtras().GetIndex();
         nSttNode -= nEndExtra;
         nEndNode -= nEndExtra;
     }
 
-    RedoRedlineImpl(*pDoc, rPam);
+    RedoRedlineImpl(rDoc, rPam);
 
     SetPaM(rPam, true);
-    pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
+    rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
 }
 
 void SwUndoRedline::UndoRedlineImpl(SwDoc &, SwPaM &)
@@ -392,84 +392,84 @@ SwUndoCompDoc::~SwUndoCompDoc()
 
 void SwUndoCompDoc::UndoImpl(::sw::UndoRedoContext & rContext)
 {
-    SwDoc *const pDoc = & rContext.GetDoc();
-    SwPaM *const pPam( & AddUndoRedoPaM(rContext) );
+    SwDoc& rDoc = rContext.GetDoc();
+    SwPaM& rPam(AddUndoRedoPaM(rContext));
 
     if( !bInsert )
     {
         // delete Redlines
-        RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
-        pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON));
+        RedlineMode_t eOld = rDoc.getIDocumentRedlineAccess().GetRedlineMode();
+        rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)(( eOld & ~nsRedlineMode_t::REDLINE_IGNORE) | nsRedlineMode_t::REDLINE_ON));
 
-        pDoc->getIDocumentRedlineAccess().DeleteRedline( *pPam, true, USHRT_MAX );
+        rDoc.getIDocumentRedlineAccess().DeleteRedline(rPam, true, USHRT_MAX);
 
-        pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
+        rDoc.getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
 
         // per definition Point is end (in SwUndRng!)
-        SwContentNode* pCSttNd = pPam->GetContentNode( false );
-        SwContentNode* pCEndNd = pPam->GetContentNode( true );
+        SwContentNode* pCSttNd = rPam.GetContentNode(false);
+        SwContentNode* pCEndNd = rPam.GetContentNode(true);
 
         // if start- and end-content is zero, then the doc-compare moves
         // complete nodes into the current doc. And then the selection
         // must be from end to start, so the delete join into the right
         // direction.
         if( !nSttContent && !nEndContent )
-            pPam->Exchange();
+            rPam.Exchange();
 
         bool bJoinText, bJoinPrev;
-        sw_GetJoinFlags( *pPam, bJoinText, bJoinPrev );
+        sw_GetJoinFlags(rPam, bJoinText, bJoinPrev);
 
-        pUnDel = new SwUndoDelete( *pPam, false );
+        pUnDel = new SwUndoDelete(rPam, false);
 
         if( bJoinText )
-            sw_JoinText( *pPam, bJoinPrev );
+            sw_JoinText(rPam, bJoinPrev);
 
         if( pCSttNd && !pCEndNd)
         {
             // #112139# Do not step behind the end of content.
-            SwNode & rTmp = pPam->GetNode(true);
-            SwNode * pEnd = pDoc->GetNodes().DocumentSectionEndNode(&rTmp);
+            SwNode & rTmp = rPam.GetNode(true);
+            SwNode * pEnd = rDoc.GetNodes().DocumentSectionEndNode(&rTmp);
 
             if (&rTmp != pEnd)
             {
-                pPam->SetMark();
-                ++pPam->GetPoint()->nNode;
-                pPam->GetBound( true ).nContent.Assign( 0, 0 );
-                pPam->GetBound( false ).nContent.Assign( 0, 0 );
-                pUnDel2 = new SwUndoDelete( *pPam, true );
+                rPam.SetMark();
+                ++rPam.GetPoint()->nNode;
+                rPam.GetBound( true ).nContent.Assign( 0, 0 );
+                rPam.GetBound( false ).nContent.Assign( 0, 0 );
+                pUnDel2 = new SwUndoDelete(rPam, true);
             }
         }
-        pPam->DeleteMark();
+        rPam.DeleteMark();
     }
     else
     {
         if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
         {
-            pDoc->getIDocumentRedlineAccess().DeleteRedline( *pPam, true, USHRT_MAX );
+            rDoc.getIDocumentRedlineAccess().DeleteRedline(rPam, true, USHRT_MAX);
 
             if( pRedlSaveData )
-                SetSaveData( *pDoc, *pRedlSaveData );
+                SetSaveData(rDoc, *pRedlSaveData);
         }
-        SetPaM(*pPam, true);
+        SetPaM(rPam, true);
     }
 }
 
 void SwUndoCompDoc::RedoImpl(::sw::UndoRedoContext & rContext)
 {
-    SwDoc *const pDoc = & rContext.GetDoc();
-    SwPaM *const pPam( & AddUndoRedoPaM(rContext) );
+    SwDoc& rDoc = rContext.GetDoc();
+    SwPaM& rPam(AddUndoRedoPaM(rContext));
 
     if( bInsert )
     {
         if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
         {
-            SwRangeRedline* pTmp = new SwRangeRedline( *pRedlData, *pPam );
-            static_cast<SwRedlineTable&>(pDoc->getIDocumentRedlineAccess().GetRedlineTable()).Insert( pTmp );
+            SwRangeRedline* pTmp = new SwRangeRedline(*pRedlData, rPam);
+            static_cast<SwRedlineTable&>(rDoc.getIDocumentRedlineAccess().GetRedlineTable()).Insert( pTmp );
             pTmp->InvalidateRange();
         }
         else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
-                !pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() )
-            pDoc->getIDocumentRedlineAccess().SplitRedline( *pPam );
+                !rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() )
+            rDoc.getIDocumentRedlineAccess().SplitRedline(rPam);
     }
     else
     {
@@ -481,14 +481,14 @@ void SwUndoCompDoc::RedoImpl(::sw::UndoRedoContext & rContext)
         pUnDel->UndoImpl(rContext);
         delete pUnDel, pUnDel = 0;
 
-        SetPaM( *pPam );
+        SetPaM(rPam);
 
-        SwRangeRedline* pTmp = new SwRangeRedline( *pRedlData, *pPam );
-        static_cast<SwRedlineTable&>(pDoc->getIDocumentRedlineAccess().GetRedlineTable()).Insert( pTmp );
+        SwRangeRedline* pTmp = new SwRangeRedline(*pRedlData, rPam);
+        static_cast<SwRedlineTable&>(rDoc.getIDocumentRedlineAccess().GetRedlineTable()).Insert( pTmp );
         pTmp->InvalidateRange();
     }
 
-    SetPaM(*pPam, true);
+    SetPaM(rPam, true);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index d0148ef..69be161 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -146,58 +146,58 @@ SwUndoInserts::~SwUndoInserts()
 
 void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
 {
-    SwDoc *const pDoc = & rContext.GetDoc();
-    SwPaM *const pPam = & AddUndoRedoPaM(rContext);
+    SwDoc& rDoc = rContext.GetDoc();
+    SwPaM& rPam = AddUndoRedoPaM(rContext);
 
     if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
-        pDoc->getIDocumentRedlineAccess().DeleteRedline( *pPam, true, USHRT_MAX );
+        rDoc.getIDocumentRedlineAccess().DeleteRedline(rPam, true, USHRT_MAX);
 
     // if Point and Mark are different text nodes so a JoinNext has to be done
     bool bJoinNext = nSttNode != nEndNode &&
-                pPam->GetMark()->nNode.GetNode().GetTextNode() &&
-                pPam->GetPoint()->nNode.GetNode().GetTextNode();
+                rPam.GetMark()->nNode.GetNode().GetTextNode() &&
+                rPam.GetPoint()->nNode.GetNode().GetTextNode();
 
     // Is there any content? (loading from template does not have content)
     if( nSttNode != nEndNode || nSttContent != nEndContent )
     {
         if( nSttNode != nEndNode )
         {
-            SwTextNode* pTextNd = pDoc->GetNodes()[ nEndNode ]->GetTextNode();
+            SwTextNode* pTextNd = rDoc.GetNodes()[ nEndNode ]->GetTextNode();
             if (pTextNd && pTextNd->GetText().getLength() == nEndContent)
                 pLastNdColl = pTextNd->GetTextColl();
         }
 
-        RemoveIdxFromRange( *pPam, false );
-        SetPaM(*pPam);
+        RemoveIdxFromRange(rPam, false);
+        SetPaM(rPam);
 
         // are there Footnotes or ContentFlyFrames in text?
         nSetPos = pHistory->Count();
-        nNdDiff = pPam->GetMark()->nNode.GetIndex();
-        DelContentIndex( *pPam->GetMark(), *pPam->GetPoint() );
-        nNdDiff -= pPam->GetMark()->nNode.GetIndex();
+        nNdDiff = rPam.GetMark()->nNode.GetIndex();
+        DelContentIndex(*rPam.GetMark(), *rPam.GetPoint());
+        nNdDiff -= rPam.GetMark()->nNode.GetIndex();
 
-        if( *pPam->GetPoint() != *pPam->GetMark() )
+        if( *rPam.GetPoint() != *rPam.GetMark() )
         {
             m_pUndoNodeIndex.reset(
-                    new SwNodeIndex(pDoc->GetNodes().GetEndOfContent()));
-            MoveToUndoNds(*pPam, m_pUndoNodeIndex.get());
+                    new SwNodeIndex(rDoc.GetNodes().GetEndOfContent()));
+            MoveToUndoNds(rPam, m_pUndoNodeIndex.get());
 
             if( !bSttWasTextNd )
-                pPam->Move( fnMoveBackward, fnGoContent );
+                rPam.Move( fnMoveBackward, fnGoContent );
         }
     }
 
     if (m_FlyUndos.size())
     {
-        sal_uLong nTmp = pPam->GetPoint()->nNode.GetIndex();
+        sal_uLong nTmp = rPam.GetPoint()->nNode.GetIndex();
         for (size_t n = m_FlyUndos.size(); 0 < n; --n)
         {
             m_FlyUndos[ n-1 ]->UndoImpl(rContext);
         }
-        nNdDiff += nTmp - pPam->GetPoint()->nNode.GetIndex();
+        nNdDiff += nTmp - rPam.GetPoint()->nNode.GetIndex();
     }
 
-    SwNodeIndex& rIdx = pPam->GetPoint()->nNode;
+    SwNodeIndex& rIdx = rPam.GetPoint()->nNode;
     SwTextNode* pTextNode = rIdx.GetNode().GetTextNode();
     if( pTextNode )
     {
@@ -206,13 +206,13 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
             SwNodeIndex aDelIdx( rIdx );
             ++rIdx;
             SwContentNode* pCNd = rIdx.GetNode().GetContentNode();
-            pPam->GetPoint()->nContent.Assign( pCNd, pCNd ? pCNd->Len() : 0 );
-            pPam->SetMark();
-            pPam->DeleteMark();
+            rPam.GetPoint()->nContent.Assign( pCNd, pCNd ? pCNd->Len() : 0 );
+            rPam.SetMark();
+            rPam.DeleteMark();
 
-            RemoveIdxRel( aDelIdx.GetIndex(), *pPam->GetPoint() );
+            RemoveIdxRel(aDelIdx.GetIndex(), *rPam.GetPoint());
 
-            pDoc->GetNodes().Delete( aDelIdx, 1 );
+            rDoc.GetNodes().Delete( aDelIdx, 1 );
         }
         else
         {
@@ -229,11 +229,11 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
 
             pTextNode->ResetAllAttr();
 
-            if( pDoc->GetTextFormatColls()->Contains( pTextFormatColl ))
+            if (rDoc.GetTextFormatColls()->Contains(pTextFormatColl))
                 pTextFormatColl = static_cast<SwTextFormatColl*>(pTextNode->ChgFormatColl( pTextFormatColl )) ;
 
             pHistory->SetTmpEnd( nSetPos );
-            pHistory->TmpRollback( pDoc, 0, false );
+            pHistory->TmpRollback(&rDoc, 0, false);
         }
     }
 }
@@ -241,12 +241,12 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
 void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
 {
     // position cursor onto REDO section
-    SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
-    SwDoc* pDoc = pPam->GetDoc();
-    pPam->DeleteMark();
-    pPam->GetPoint()->nNode = nSttNode - nNdDiff;
-    SwContentNode* pCNd = pPam->GetContentNode();
-    pPam->GetPoint()->nContent.Assign( pCNd, nSttContent );
+    SwPaM& rPam(rContext.GetCursorSupplier().CreateNewShellCursor());
+    SwDoc* pDoc = rPam.GetDoc();
+    rPam.DeleteMark();
+    rPam.GetPoint()->nNode = nSttNode - nNdDiff;
+    SwContentNode* pCNd = rPam.GetContentNode();
+    rPam.GetPoint()->nContent.Assign( pCNd, nSttContent );
 
     SwTextFormatColl* pSavTextFormatColl = pTextFormatColl;
     if( pTextFormatColl && pCNd && pCNd->IsTextNode() )
@@ -257,29 +257,29 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
     // retrieve start position for rollback
     if( ( nSttNode != nEndNode || nSttContent != nEndContent ) && m_pUndoNodeIndex)
     {
-        const bool bMvBkwrd = MovePtBackward( *pPam );
+        const bool bMvBkwrd = MovePtBackward(rPam);
 
         // re-insert content again (first detach m_pUndoNodeIndex!)
         sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex();
         m_pUndoNodeIndex.reset();
-        MoveFromUndoNds(*pDoc, nMvNd, *pPam->GetMark());
+        MoveFromUndoNds(*pDoc, nMvNd, *rPam.GetMark());
         if( bSttWasTextNd )
-            MovePtForward( *pPam, bMvBkwrd );
-        pPam->Exchange();
+            MovePtForward(rPam, bMvBkwrd);
+        rPam.Exchange();
     }
 
     if( pDoc->GetTextFormatColls()->Contains( pTextFormatColl ))
     {
-        SwTextNode* pTextNd = pPam->GetMark()->nNode.GetNode().GetTextNode();
+        SwTextNode* pTextNd = rPam.GetMark()->nNode.GetNode().GetTextNode();
         if( pTextNd )
             pTextNd->ChgFormatColl( pTextFormatColl );
     }
     pTextFormatColl = pSavTextFormatColl;
 
     if( pLastNdColl && pDoc->GetTextFormatColls()->Contains( pLastNdColl ) &&
-        pPam->GetPoint()->nNode != pPam->GetMark()->nNode )
+        rPam.GetPoint()->nNode != rPam.GetMark()->nNode )
     {
-        SwTextNode* pTextNd = pPam->GetPoint()->nNode.GetNode().GetTextNode();
+        SwTextNode* pTextNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
         if( pTextNd )
             pTextNd->ChgFormatColl( pLastNdColl );
     }
@@ -295,12 +295,12 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
     {
         RedlineMode_t eOld = pDoc->getIDocumentRedlineAccess().GetRedlineMode();
         pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern((RedlineMode_t)( eOld & ~nsRedlineMode_t::REDLINE_IGNORE ));
-        pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *pRedlData, *pPam ), true);
+        pDoc->getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( *pRedlData, rPam ), true);
         pDoc->getIDocumentRedlineAccess().SetRedlineMode_intern( eOld );
     }
     else if( !( nsRedlineMode_t::REDLINE_IGNORE & GetRedlineMode() ) &&
             !pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() )
-        pDoc->getIDocumentRedlineAccess().SplitRedline( *pPam );
+        pDoc->getIDocumentRedlineAccess().SplitRedline(rPam);
 }
 
 void SwUndoInserts::RepeatImpl(::sw::RepeatContext & rContext)


More information about the Libreoffice-commits mailing list