Kaydet (Commit) 357bb0d5 authored tarafından Michael Stahl's avatar Michael Stahl

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
üst cdceee72
...@@ -147,14 +147,14 @@ protected: ...@@ -147,14 +147,14 @@ protected:
SwHistory* pHistory; SwHistory* pHistory;
// Needed for deletion of content. For Redo content is moved into the // Needed for deletion of content. For Redo content is moved into the
// UndoNodesArray. These methods insert a separator for the attributes // UndoNodesArray. These methods always create a new node to insert
// at the end of a TextNode. So the attributes do not get expanded. // content. So the attributes do not get expanded.
// MoveTo: moves from the NodesArray into the UndoNodesArray. // MoveTo: moves from the NodesArray into the UndoNodesArray.
// MoveFrom: moves from the UndoNodesArray into the NodesArray. // MoveFrom: moves from the UndoNodesArray into the NodesArray.
void MoveToUndoNds( SwPaM& rPam, void MoveToUndoNds( SwPaM& rPam,
SwNodeIndex* pNodeIdx = 0, SwIndex* pCntIdx = 0, SwNodeIndex* pNodeIdx = 0,
sal_uLong* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 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, SwPosition& rInsPos,
sal_uLong* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 0 ); sal_uLong* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 0 );
......
...@@ -313,15 +313,15 @@ SwUndoSaveCntnt::~SwUndoSaveCntnt() ...@@ -313,15 +313,15 @@ SwUndoSaveCntnt::~SwUndoSaveCntnt()
} }
// This is needed when deleting content. For REDO all contents will be moved // 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 // into the UndoNodesArray. These methods always create a new node to insert
// the end of TextNodes. As a result, the attributes will not be expanded. // content. As a result, the attributes will not be expanded.
// - MoveTo moves from NodesArray into UndoNodesArray // - MoveTo moves from NodesArray into UndoNodesArray
// - MoveFrom moves from UndoNodesArray into NodesArray // - MoveFrom moves from UndoNodesArray into NodesArray
// //
// If pEndNdIdx is given, Undo/Redo calls -Ins/DelFly. In that case the whole // If pEndNdIdx is given, Undo/Redo calls -Ins/DelFly. In that case the whole
// section should be moved. // section should be moved.
void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx, 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(); SwDoc& rDoc = *rPaM.GetDoc();
::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
...@@ -337,7 +337,6 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx, ...@@ -337,7 +337,6 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
// keep as sal_uInt16; the indices shift! // keep as sal_uInt16; the indices shift!
sal_uLong nTmpMvNode = aPos.nNode.GetIndex(); sal_uLong nTmpMvNode = aPos.nNode.GetIndex();
xub_StrLen nTmpMvCntnt = aPos.nContent.GetIndex();
if( pCpyNd || pEndNdIdx ) if( pCpyNd || pEndNdIdx )
{ {
...@@ -359,19 +358,10 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx, ...@@ -359,19 +358,10 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
aPos.nNode = nTmpMvNode; aPos.nNode = nTmpMvNode;
if( pNodeIdx ) if( pNodeIdx )
*pNodeIdx = aPos.nNode; *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, void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
xub_StrLen nCntIdx, SwPosition& rInsPos, SwPosition& rInsPos,
sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx ) sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx )
{ {
// here comes the recovery // here comes the recovery
...@@ -398,7 +388,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx, ...@@ -398,7 +388,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
aPaM.SetMark(); aPaM.SetMark();
aPaM.GetPoint()->nNode = nNodeIdx; 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() ); _SaveRedlEndPosForRestore aRedlRest( rInsPos.nNode, rInsPos.nContent.GetIndex() );
...@@ -427,7 +417,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx, ...@@ -427,7 +417,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
} }
else { else {
OSL_FAIL( "What happened now?" ); assert(false); // wtf?
} }
} }
...@@ -848,7 +838,7 @@ void SwUndoSaveSection::SaveSection( SwDoc* , const SwNodeRange& rRange ) ...@@ -848,7 +838,7 @@ void SwUndoSaveSection::SaveSection( SwDoc* , const SwNodeRange& rRange )
// Keep positions as SwIndex so that this section can be deleted in DTOR // Keep positions as SwIndex so that this section can be deleted in DTOR
sal_uLong nEnd; sal_uLong nEnd;
pMvStt = new SwNodeIndex( rRange.aStart ); pMvStt = new SwNodeIndex( rRange.aStart );
MoveToUndoNds( aPam, pMvStt, 0, &nEnd, 0 ); MoveToUndoNds(aPam, pMvStt, &nEnd, 0);
nMvLen = nEnd - pMvStt->GetIndex() + 1; nMvLen = nEnd - pMvStt->GetIndex() + 1;
} }
...@@ -877,7 +867,7 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, const SwNodeIndex& rInsPos ...@@ -877,7 +867,7 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, const SwNodeIndex& rInsPos
{ {
SwPosition aInsPos( rInsPos ); SwPosition aInsPos( rInsPos );
sal_uLong nEnd = pMvStt->GetIndex() + nMvLen - 1; 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 // destroy indices again, content was deleted from UndoNodes array
DELETEZ( pMvStt ); DELETEZ( pMvStt );
......
...@@ -258,7 +258,7 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext) ...@@ -258,7 +258,7 @@ void SwUndoInsert::UndoImpl(::sw::UndoRedoContext & rContext)
{ {
m_pUndoNodeIndex.reset( m_pUndoNodeIndex.reset(
new SwNodeIndex(pDoc->GetNodes().GetEndOfContent())); new SwNodeIndex(pDoc->GetNodes().GetEndOfContent()));
MoveToUndoNds(aPaM, m_pUndoNodeIndex.get(), 0); MoveToUndoNds(aPaM, m_pUndoNodeIndex.get());
} }
nNode = aPaM.GetPoint()->nNode.GetIndex(); nNode = aPaM.GetPoint()->nNode.GetIndex();
nCntnt = aPaM.GetPoint()->nContent.GetIndex(); nCntnt = aPaM.GetPoint()->nContent.GetIndex();
...@@ -328,7 +328,7 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & rContext) ...@@ -328,7 +328,7 @@ void SwUndoInsert::RedoImpl(::sw::UndoRedoContext & rContext)
// re-insert content again (first detach m_pUndoNodeIndex!) // re-insert content again (first detach m_pUndoNodeIndex!)
sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex(); sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex();
m_pUndoNodeIndex.reset(); m_pUndoNodeIndex.reset();
MoveFromUndoNds(*pTmpDoc, nMvNd, 0, *pPam->GetMark()); MoveFromUndoNds(*pTmpDoc, nMvNd, *pPam->GetMark());
} }
nNode = pPam->GetMark()->nNode.GetIndex(); nNode = pPam->GetMark()->nNode.GetIndex();
nCntnt = pPam->GetMark()->nContent.GetIndex(); nCntnt = pPam->GetMark()->nContent.GetIndex();
......
...@@ -180,7 +180,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext) ...@@ -180,7 +180,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
{ {
m_pUndoNodeIndex.reset( m_pUndoNodeIndex.reset(
new SwNodeIndex(pDoc->GetNodes().GetEndOfContent())); new SwNodeIndex(pDoc->GetNodes().GetEndOfContent()));
MoveToUndoNds( *pPam, m_pUndoNodeIndex.get(), 0 ); MoveToUndoNds(*pPam, m_pUndoNodeIndex.get());
if( !bSttWasTxtNd ) if( !bSttWasTxtNd )
pPam->Move( fnMoveBackward, fnGoCntnt ); pPam->Move( fnMoveBackward, fnGoCntnt );
...@@ -266,7 +266,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext) ...@@ -266,7 +266,7 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
// re-insert content again (first detach m_pUndoNodeIndex!) // re-insert content again (first detach m_pUndoNodeIndex!)
sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex(); sal_uLong const nMvNd = m_pUndoNodeIndex->GetIndex();
m_pUndoNodeIndex.reset(); m_pUndoNodeIndex.reset();
MoveFromUndoNds( *pDoc, nMvNd, 0, *pPam->GetMark() ); MoveFromUndoNds(*pDoc, nMvNd, *pPam->GetMark());
if( bSttWasTxtNd ) if( bSttWasTxtNd )
MovePtForward( *pPam, bMvBkwrd ); MovePtForward( *pPam, bMvBkwrd );
pPam->Exchange(); pPam->Exchange();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment