summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-12-20 13:52:42 +0100
committerMichael Stahl <mstahl@redhat.com>2012-12-20 14:11:45 +0100
commit357bb0d5afc44f74eafca4c9c28619226f5610f8 (patch)
treef2485060507933ce9439eca29afa4c519a1964ba /sw
parentcdceee72ae4f1642d50b6df9e0afc2fd365bc7d6 (diff)
SwUndoSaveCntnt: remove index parameter from Move{From,To}UndoNds
There are now no callers that need it, and it is alwyas 0 anyway. Change-Id: Iddee488084e644ac82e9dbf9f251d5ef4bd7c59d
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/undobj.hxx8
-rw-r--r--sw/source/core/undo/undobj.cxx26
-rw-r--r--sw/source/core/undo/unins.cxx4
-rw-r--r--sw/source/core/undo/untblk.cxx4
4 files changed, 16 insertions, 26 deletions
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 5148327a6b13..7f4a05f7ff38 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -147,14 +147,14 @@ protected:
SwHistory* pHistory;
// Needed for deletion of content. For Redo content is moved into the
- // UndoNodesArray. These methods insert a separator for the attributes
- // at the end of a TextNode. So the attributes do not get expanded.
+ // UndoNodesArray. These methods always create a new node to insert
+ // content. So the attributes do not get expanded.
// MoveTo: moves from the NodesArray into the UndoNodesArray.
// MoveFrom: moves from the UndoNodesArray into the NodesArray.
void MoveToUndoNds( SwPaM& rPam,
- SwNodeIndex* pNodeIdx = 0, SwIndex* pCntIdx = 0,
+ SwNodeIndex* pNodeIdx = 0,
sal_uLong* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 0 );
- void MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx, xub_StrLen nCntntIdx,
+ void MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
SwPosition& rInsPos,
sal_uLong* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 0 );
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index ab3035cd3d27..d6fb9fd6091e 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -313,15 +313,15 @@ SwUndoSaveCntnt::~SwUndoSaveCntnt()
}
// This is needed when deleting content. For REDO all contents will be moved
-// into the UndoNodesArray. These methods add a seperator for the attributes to
-// the end of TextNodes. As a result, the attributes will not be expanded.
+// into the UndoNodesArray. These methods always create a new node to insert
+// content. As a result, the attributes will not be expanded.
// - MoveTo moves from NodesArray into UndoNodesArray
// - MoveFrom moves from UndoNodesArray into NodesArray
//
// If pEndNdIdx is given, Undo/Redo calls -Ins/DelFly. In that case the whole
// section should be moved.
void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
- SwIndex* pCntIdx, sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx )
+ sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx )
{
SwDoc& rDoc = *rPaM.GetDoc();
::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
@@ -337,7 +337,6 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
// keep as sal_uInt16; the indices shift!
sal_uLong nTmpMvNode = aPos.nNode.GetIndex();
- xub_StrLen nTmpMvCntnt = aPos.nContent.GetIndex();
if( pCpyNd || pEndNdIdx )
{
@@ -359,19 +358,10 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
aPos.nNode = nTmpMvNode;
if( pNodeIdx )
*pNodeIdx = aPos.nNode;
-
- if( pCntIdx )
- {
- SwCntntNode* pCNd = aPos.nNode.GetNode().GetCntntNode();
- if( pCNd )
- pCntIdx->Assign( pCNd, nTmpMvCntnt );
- else
- pCntIdx->Assign( 0, 0 );
- }
}
void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
- xub_StrLen nCntIdx, SwPosition& rInsPos,
+ SwPosition& rInsPos,
sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx )
{
// here comes the recovery
@@ -398,7 +388,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
aPaM.SetMark();
aPaM.GetPoint()->nNode = nNodeIdx;
- aPaM.GetPoint()->nContent.Assign( aPaM.GetCntntNode(), nCntIdx );
+ aPaM.GetPoint()->nContent.Assign(aPaM.GetCntntNode(), 0);
_SaveRedlEndPosForRestore aRedlRest( rInsPos.nNode, rInsPos.nContent.GetIndex() );
@@ -427,7 +417,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
}
else {
- OSL_FAIL( "What happened now?" );
+ assert(false); // wtf?
}
}
@@ -848,7 +838,7 @@ void SwUndoSaveSection::SaveSection( SwDoc* , const SwNodeRange& rRange )
// Keep positions as SwIndex so that this section can be deleted in DTOR
sal_uLong nEnd;
pMvStt = new SwNodeIndex( rRange.aStart );
- MoveToUndoNds( aPam, pMvStt, 0, &nEnd, 0 );
+ MoveToUndoNds(aPam, pMvStt, &nEnd, 0);
nMvLen = nEnd - pMvStt->GetIndex() + 1;
}
@@ -877,7 +867,7 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, const SwNodeIndex& rInsPos
{
SwPosition aInsPos( rInsPos );
sal_uLong nEnd = pMvStt->GetIndex() + nMvLen - 1;
- MoveFromUndoNds( *pDoc, pMvStt->GetIndex(), 0, aInsPos, &nEnd, 0 );
+ MoveFromUndoNds(*pDoc, pMvStt->GetIndex(), aInsPos, &nEnd, 0);
// destroy indices again, content was deleted from UndoNodes array
DELETEZ( pMvStt );
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 4b8ce61009a1..0dbb1bed7b56 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -258,7 +258,7 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext)
{
m_pUndoNodeIndex.reset(
new SwNodeIndex(pDoc->GetNodes().GetEndOfContent()));
- MoveToUndoNds(aPaM, m_pUndoNodeIndex.get(), 0);
+ MoveToUndoNds(aPaM, m_pUndoNodeIndex.get());
}
nNode = aPaM.GetPoint()->nNode.GetIndex();
nCntnt = aPaM.GetPoint()->nContent.GetIndex();
@@ -328,7 +328,7 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & rContext)
// re-insert content again (first detach m_pUndoNodeIndex!)
sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex();
m_pUndoNodeIndex.reset();
- MoveFromUndoNds(*pTmpDoc, nMvNd, 0, *pPam->GetMark());
+ MoveFromUndoNds(*pTmpDoc, nMvNd, *pPam->GetMark());
}
nNode = pPam->GetMark()->nNode.GetIndex();
nCntnt = pPam->GetMark()->nContent.GetIndex();
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 407edbaf6c7b..b2857c90b0bc 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -180,7 +180,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
{
m_pUndoNodeIndex.reset(
new SwNodeIndex(pDoc->GetNodes().GetEndOfContent()));
- MoveToUndoNds( *pPam, m_pUndoNodeIndex.get(), 0 );
+ MoveToUndoNds(*pPam, m_pUndoNodeIndex.get());
if( !bSttWasTxtNd )
pPam->Move( fnMoveBackward, fnGoCntnt );
@@ -266,7 +266,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
// re-insert content again (first detach m_pUndoNodeIndex!)
sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex();
m_pUndoNodeIndex.reset();
- MoveFromUndoNds( *pDoc, nMvNd, 0, *pPam->GetMark() );
+ MoveFromUndoNds(*pDoc, nMvNd, *pPam->GetMark());
if( bSttWasTxtNd )
MovePtForward( *pPam, bMvBkwrd );
pPam->Exchange();