Translate German comments in sw/source/core/undo/undobj.cxx

This commit is contained in:
Philipp Riemer
2012-05-26 14:33:51 +02:00
committed by Tor Lillqvist
parent a4fbd12762
commit f0c1887fc6

View File

@@ -36,7 +36,7 @@
#include <doc.hxx> #include <doc.hxx>
#include <UndoManager.hxx> #include <UndoManager.hxx>
#include <docary.hxx> #include <docary.hxx>
#include <swundo.hxx> // fuer die UndoIds #include <swundo.hxx>
#include <pam.hxx> #include <pam.hxx>
#include <ndtxt.hxx> #include <ndtxt.hxx>
#include <UndoCore.hxx> #include <UndoCore.hxx>
@@ -71,10 +71,7 @@ SV_IMPL_PTRARR( SwRedlineSaveDatas, SwRedlineSaveDataPtr )
//------------------------------------------------------------ //------------------------------------------------------------
// This class saves the Pam as sal_uInt16s and can recompose those into a PaM
// Diese Klasse speichert den Pam als sal_uInt16's und kann diese wieder zu
// einem PaM zusammensetzen
SwUndRng::SwUndRng() SwUndRng::SwUndRng()
: nSttNode( 0 ), nEndNode( 0 ), nSttCntnt( 0 ), nEndCntnt( 0 ) : nSttNode( 0 ), nEndNode( 0 ), nSttCntnt( 0 ), nEndCntnt( 0 )
{ {
@@ -97,7 +94,7 @@ void SwUndRng::SetValues( const SwPaM& rPam )
nEndCntnt = pEnd->nContent.GetIndex(); nEndCntnt = pEnd->nContent.GetIndex();
} }
else else
// keine Selektion !! // no selection !!
nEndNode = 0, nEndCntnt = STRING_MAXLEN; nEndNode = 0, nEndCntnt = STRING_MAXLEN;
nSttNode = pStt->nNode.GetIndex(); nSttNode = pStt->nNode.GetIndex();
@@ -116,12 +113,12 @@ void SwUndRng::SetPaM( SwPaM & rPam, sal_Bool bCorrToCntnt ) const
else else
rPam.GetPoint()->nContent.Assign( 0, 0 ); rPam.GetPoint()->nContent.Assign( 0, 0 );
if( !nEndNode && STRING_MAXLEN == nEndCntnt ) // keine Selection if( !nEndNode && STRING_MAXLEN == nEndCntnt ) // no selection
return ; return ;
rPam.SetMark(); rPam.SetMark();
if( nSttNode == nEndNode && nSttCntnt == nEndCntnt ) if( nSttNode == nEndNode && nSttCntnt == nEndCntnt )
return; // nichts mehr zu tun return; // nothing left to do
rPam.GetPoint()->nNode = nEndNode; rPam.GetPoint()->nNode = nEndNode;
if( (pNd = rPam.GetNode())->IsCntntNode() ) if( (pNd = rPam.GetNode())->IsCntntNode() )
@@ -183,8 +180,7 @@ void SwUndo::RemoveIdxFromRange( SwPaM& rPam, sal_Bool bMoveNext )
void SwUndo::RemoveIdxRel( sal_uLong nIdx, const SwPosition& rPos ) void SwUndo::RemoveIdxRel( sal_uLong nIdx, const SwPosition& rPos )
{ {
// nur die Crsr verschieben; die Bookmarks/TOXMarks/.. werden vom // Move only the Crsr. Bookmarks/TOXMarks/etc. are done by the corresponding JoinNext/JoinPrev
// entsp. JoinNext/JoinPrev erledigt!
SwNodeIndex aIdx( rPos.nNode.GetNode().GetNodes(), nIdx ); SwNodeIndex aIdx( rPos.nNode.GetNode().GetNodes(), nIdx );
::PaMCorrRel( aIdx, rPos ); ::PaMCorrRel( aIdx, rPos );
} }
@@ -338,15 +334,14 @@ SwUndoSaveCntnt::~SwUndoSaveCntnt()
delete pHistory; delete pHistory;
} }
// wird fuer das Loeschen von Inhalt benoetigt. Fuer das ReDo werden // This is needed when deleting content. For REDO all contents will be moved into the
// Inhalte in das UndoNodesArray verschoben. Diese Methoden fuegen // UndoNodesArray. These methods add a seperator for the attributes to the end of TextNodes.
// am Ende eines TextNodes fuer die Attribute einen Trenner ein. // As a result, the attributes will not be expanded.
// Dadurch werden die Attribute nicht expandiert. // - MoveTo moves from NodesArray into UndoNodesArray
// MoveTo.. verschiebt aus dem NodesArray in das UndoNodesArray // - MoveFrom moves from UndoNodesArray into NodesArray
// MoveFrom.. verschiebt aus dem UndoNodesArray in das NodesArray
// 2.8.93: ist pEndNdIdx angebenen, wird vom Undo/Redo -Ins/DelFly // 2.8.93: If pEndNdIdx is given, Undo/Redo calls -Ins/DelFly.
// aufgerufen. Dann soll die gesamte Section verschoben werden. // In that case the whole 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 ) SwIndex* pCntIdx, sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx )
@@ -356,7 +351,7 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
SwNoTxtNode* pCpyNd = rPaM.GetNode()->GetNoTxtNode(); SwNoTxtNode* pCpyNd = rPaM.GetNode()->GetNoTxtNode();
// jetzt kommt das eigentliche Loeschen(Verschieben) // here comes the actual delete (move)
SwNodes & rNds = rDoc.GetUndoManager().GetUndoNodes(); SwNodes & rNds = rDoc.GetUndoManager().GetUndoNodes();
SwPosition aPos( pEndNdIdx ? rNds.GetEndOfPostIts() SwPosition aPos( pEndNdIdx ? rNds.GetEndOfPostIts()
: rNds.GetEndOfExtras() ); : rNds.GetEndOfExtras() );
@@ -376,7 +371,7 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
else else
aPos.nNode.GetNode().GetCntntNode()->MakeEndIndex( &aPos.nContent ); aPos.nNode.GetNode().GetCntntNode()->MakeEndIndex( &aPos.nContent );
// als sal_uInt16 merken; die Indizies verschieben sich !! // 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(); xub_StrLen nTmpMvCntnt = aPos.nContent.GetIndex();
@@ -392,17 +387,15 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
rDoc.GetNodes().MoveRange( rPaM, aPos, rNds ); rDoc.GetNodes().MoveRange( rPaM, aPos, rNds );
SwTxtNode* pTxtNd = aPos.nNode.GetNode().GetTxtNode(); SwTxtNode* pTxtNd = aPos.nNode.GetNode().GetTxtNode();
if( pTxtNd ) // fuege einen Trenner fuer die Attribute ein ! if( pTxtNd ) // add a seperator for the attributes
{ {
// weil aber beim Insert die Attribute angefasst/sprich // But since all attributes will be touched at an insert (meaning deleted from the
// aus dem Array geloescht und wieder eingefuegt werden, koennen // array and re-added again), attributes might disappear (e.g. "no bold" for 10-20,
// dadurch Attribute verschwinden (z.B "Fett aus" von 10-20, // "bold" for 12-15 -> when inserting/deleting, the "bold" will be deleted, which is
// "Fett an" von 12-15, dann wird durchs Insert/Delete das // not wanted here!)! Thus do not touch the hints but manipulate the string directly.
// "Fett an" geloescht !! Ist hier aber nicht erwuenscht !!)
// DARUM: nicht die Hints anfassen, direct den String manipulieren
String& rStr = (String&)pTxtNd->GetTxt(); String& rStr = (String&)pTxtNd->GetTxt();
// Zur Sicherheit lieber nur wenn wirklich am Ende steht // For security reasons better only if positioned at the end
if( rStr.Len() == aPos.nContent.GetIndex() ) if( rStr.Len() == aPos.nContent.GetIndex() )
{ {
rStr.Insert( ' ' ); rStr.Insert( ' ' );
@@ -420,7 +413,7 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
if( pEndCntIdx ) if( pEndCntIdx )
*pEndCntIdx = aPos.nContent.GetIndex(); *pEndCntIdx = aPos.nContent.GetIndex();
// alte Position // old position
aPos.nNode = nTmpMvNode; aPos.nNode = nTmpMvNode;
if( pNodeIdx ) if( pNodeIdx )
*pNodeIdx = aPos.nNode; *pNodeIdx = aPos.nNode;
@@ -439,15 +432,15 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
xub_StrLen nCntIdx, SwPosition& rInsPos, xub_StrLen nCntIdx, SwPosition& rInsPos,
sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx ) sal_uLong* pEndNdIdx, xub_StrLen* pEndCntIdx )
{ {
// jetzt kommt das wiederherstellen // here comes the recovery
SwNodes & rNds = rDoc.GetUndoManager().GetUndoNodes(); SwNodes & rNds = rDoc.GetUndoManager().GetUndoNodes();
if( nNodeIdx == rNds.GetEndOfPostIts().GetIndex() ) if( nNodeIdx == rNds.GetEndOfPostIts().GetIndex() )
return; // nichts gespeichert return; // nothing saved
::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo()); ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
SwPaM aPaM( rInsPos ); SwPaM aPaM( rInsPos );
if( pEndNdIdx ) // dann hole aus diesem den Bereich if( pEndNdIdx ) // than get the section from it
aPaM.GetPoint()->nNode.Assign( rNds, *pEndNdIdx ); aPaM.GetPoint()->nNode.Assign( rNds, *pEndNdIdx );
else else
{ {
@@ -456,7 +449,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
} }
SwTxtNode* pTxtNd = aPaM.GetNode()->GetTxtNode(); SwTxtNode* pTxtNd = aPaM.GetNode()->GetTxtNode();
if( !pEndNdIdx && pTxtNd ) // loesche den Trenner wieder if( !pEndNdIdx && pTxtNd ) // delete the seperator again
{ {
if( pEndCntIdx ) if( pEndCntIdx )
aPaM.GetPoint()->nContent.Assign( pTxtNd, *pEndCntIdx ); aPaM.GetPoint()->nContent.Assign( pTxtNd, *pEndCntIdx );
@@ -474,9 +467,9 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
rNds.MoveRange( aPaM, rInsPos, rDoc.GetNodes() ); rNds.MoveRange( aPaM, rInsPos, rDoc.GetNodes() );
// noch den letzen Node loeschen. // delete the last Node as well
if( !aPaM.GetPoint()->nContent.GetIndex() || if( !aPaM.GetPoint()->nContent.GetIndex() ||
( aPaM.GetPoint()->nNode++ && // noch leere Nodes am Ende ?? ( aPaM.GetPoint()->nNode++ && // still empty Nodes at the end?
&rNds.GetEndOfExtras() != &aPaM.GetPoint()->nNode.GetNode() )) &rNds.GetEndOfExtras() != &aPaM.GetPoint()->nNode.GetNode() ))
{ {
aPaM.GetPoint()->nContent.Assign( 0, 0 ); aPaM.GetPoint()->nContent.Assign( 0, 0 );
@@ -497,14 +490,13 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
} }
else { else {
OSL_FAIL( "was ist es denn nun?" ); OSL_FAIL( "What happened now?" );
} }
} }
// diese beiden Methoden bewegen den Point vom Pam zurueck/vor. Damit // These two methods move the Point of Pam backwards/forwards. With that, one can span an area for
// kann fuer ein Undo/Redo ein Bereich aufgespannt werden. (Der // a Undo/Redo. (The Point is then positioned in front of the area to manipulate!!)
// Point liegt dann vor dem manipuliertem Bereich !!) // The flag indicates if there is still content in front of Point.
// Das Flag gibt an, ob noch vorm Point Inhalt steht.
sal_Bool SwUndoSaveCntnt::MovePtBackward( SwPaM& rPam ) sal_Bool SwUndoSaveCntnt::MovePtBackward( SwPaM& rPam )
{ {
@@ -512,9 +504,8 @@ sal_Bool SwUndoSaveCntnt::MovePtBackward( SwPaM& rPam )
if( rPam.Move( fnMoveBackward )) if( rPam.Move( fnMoveBackward ))
return sal_True; return sal_True;
// gibt es nach vorne keinen Inhalt mehr, so setze den Point einfach // If there is no content onwards, set Point simply to the previous position
// auf die vorherige Position (Node und Content, damit der Content // (Node and Content, so that Content will be detached!)
// abgemeldet wird !!)
rPam.GetPoint()->nNode--; rPam.GetPoint()->nNode--;
rPam.GetPoint()->nContent.Assign( 0, 0 ); rPam.GetPoint()->nContent.Assign( 0, 0 );
return sal_False; return sal_False;
@@ -522,11 +513,11 @@ sal_Bool SwUndoSaveCntnt::MovePtBackward( SwPaM& rPam )
void SwUndoSaveCntnt::MovePtForward( SwPaM& rPam, sal_Bool bMvBkwrd ) void SwUndoSaveCntnt::MovePtForward( SwPaM& rPam, sal_Bool bMvBkwrd )
{ {
// gab es noch Inhalt vor der Position ? // Was there content before this position?
if( bMvBkwrd ) if( bMvBkwrd )
rPam.Move( fnMoveForward ); rPam.Move( fnMoveForward );
else else
{ // setzen Point auf die naechste Position { // set Point to the next position
rPam.GetPoint()->nNode++; rPam.GetPoint()->nNode++;
SwCntntNode* pCNd = rPam.GetCntntNode(); SwCntntNode* pCNd = rPam.GetCntntNode();
if( pCNd ) if( pCNd )
@@ -538,13 +529,12 @@ void SwUndoSaveCntnt::MovePtForward( SwPaM& rPam, sal_Bool bMvBkwrd )
/* /*
JP 21.03.94: loesche alle Objecte, die ContentIndizies auf den ang. JP 21.03.94: Delete all objects that have ContentIndices to the given area.
Bereich besitzen. Currently these exist:
Zur Zeit gibts folgende Objecte - Footnotes
- Fussnoten
- Flys - Flys
- Bookmarks - Bookmarks
- Verzeichnisse - Directories
*/ */
// #i81002# - extending method // #i81002# - extending method
// delete certain (not all) cross-reference bookmarks at text node of <rMark> // delete certain (not all) cross-reference bookmarks at text node of <rMark>
@@ -560,7 +550,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo()); ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
// 1. Fussnoten // 1. Footnotes
if( nsDelCntntType::DELCNT_FTN & nDelCntntType ) if( nsDelCntntType::DELCNT_FTN & nDelCntntType )
{ {
SwFtnIdxs& rFtnArr = pDoc->GetFtnIdxs(); SwFtnIdxs& rFtnArr = pDoc->GetFtnIdxs();
@@ -571,7 +561,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
rFtnArr.SeekEntry( pStt->nNode, &nPos ); rFtnArr.SeekEntry( pStt->nNode, &nPos );
SwTxtFtn* pSrch; SwTxtFtn* pSrch;
// loesche erstmal alle, die dahinter stehen // for now delete all that come afterwards
while( nPos < rFtnArr.Count() && ( pFtnNd = while( nPos < rFtnArr.Count() && ( pFtnNd =
&( pSrch = rFtnArr[ nPos ] )->GetTxtNode())->GetIndex() &( pSrch = rFtnArr[ nPos ] )->GetTxtNode())->GetIndex()
<= pEnd->nNode.GetIndex() ) <= pEnd->nNode.GetIndex() )
@@ -584,12 +574,12 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
( &pEnd->nNode.GetNode() == pFtnNd && ( &pEnd->nNode.GetNode() == pFtnNd &&
nFtnSttIdx >= pEnd->nContent.GetIndex() )) ) nFtnSttIdx >= pEnd->nContent.GetIndex() )) )
{ {
++nPos; // weiter suchen ++nPos; // continue searching
continue; continue;
} }
// es muss leider ein Index angelegt werden. Sonst knallts im // Unfortunately an index needs to be created. Otherwise there will be problems
// TextNode, weil im DTOR der SwFtn dieser geloescht wird !! // with TextNode because the index will be deleted in the DTOR of SwFtn!
SwTxtNode* pTxtNd = (SwTxtNode*)pFtnNd; SwTxtNode* pTxtNd = (SwTxtNode*)pFtnNd;
if( !pHistory ) if( !pHistory )
pHistory = new SwHistory; pHistory = new SwHistory;
@@ -610,10 +600,10 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
pStt->nContent.GetIndex() > nFtnSttIdx ) || pStt->nContent.GetIndex() > nFtnSttIdx ) ||
( &pEnd->nNode.GetNode() == pFtnNd && ( &pEnd->nNode.GetNode() == pFtnNd &&
nFtnSttIdx >= pEnd->nContent.GetIndex() ))) nFtnSttIdx >= pEnd->nContent.GetIndex() )))
continue; // weiter suchen continue; // continue searching
// es muss leider ein Index angelegt werden. Sonst knallts im // Unfortunately an index needs to be created. Otherwise there will be problems
// TextNode, weil im DTOR der SwFtn dieser geloescht wird !! // with TextNode because the index will be deleted in the DTOR of SwFtn!
SwTxtNode* pTxtNd = (SwTxtNode*)pFtnNd; SwTxtNode* pTxtNd = (SwTxtNode*)pFtnNd;
if( !pHistory ) if( !pHistory )
pHistory = new SwHistory; pHistory = new SwHistory;
@@ -661,7 +651,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
pAPos->nContent.GetIndex()); pAPos->nContent.GetIndex());
assert(pFlyHnt); assert(pFlyHnt);
pHistory->Add( pFlyHnt, 0, false ); pHistory->Add( pFlyHnt, 0, false );
// n wieder zurueck, damit nicht ein Format uebesprungen wird ! // reset n so that no Format is skipped
n = n >= rSpzArr.Count() ? rSpzArr.Count() : n+1; n = n >= rSpzArr.Count() ? rSpzArr.Count() : n+1;
} }
break; break;
@@ -705,8 +695,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
else else
{ {
pHistory->Add( *pFmt, nChainInsPos ); pHistory->Add( *pFmt, nChainInsPos );
// n wieder zurueck, damit nicht ein // reset n so that no Format is skipped
// Format uebesprungen wird !
n = n >= rSpzArr.Count() ? n = n >= rSpzArr.Count() ?
rSpzArr.Count() : n+1; rSpzArr.Count() : n+1;
} }
@@ -754,7 +743,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
pHistory->Add( *pFmt, nChainInsPos ); pHistory->Add( *pFmt, nChainInsPos );
// n wieder zurueck, damit nicht ein Format uebesprungen wird ! // reset n so that no Format is skipped
n = n >= rSpzArr.Count() ? rSpzArr.Count() : n+1; n = n >= rSpzArr.Count() ? rSpzArr.Count() : n+1;
} }
break; break;
@@ -871,7 +860,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
} }
// sicher eine vollstaendige Section im Undo-Nodes-Array // save a complete section into UndoNodes array
SwUndoSaveSection::SwUndoSaveSection() SwUndoSaveSection::SwUndoSaveSection()
: pMvStt( 0 ), pRedlSaveData( 0 ), nMvLen( 0 ), nStartPos( ULONG_MAX ) : pMvStt( 0 ), pRedlSaveData( 0 ), nMvLen( 0 ), nStartPos( ULONG_MAX )
@@ -880,9 +869,9 @@ SwUndoSaveSection::SwUndoSaveSection()
SwUndoSaveSection::~SwUndoSaveSection() SwUndoSaveSection::~SwUndoSaveSection()
{ {
if( pMvStt ) // loesche noch den Bereich aus dem UndoNodes Array if( pMvStt ) // delete also the section from UndoNodes array
{ {
// SaveSection speichert den Inhalt in der PostIt-Section // SaveSection saves the content in the PostIt section.
SwNodes& rUNds = pMvStt->GetNode().GetNodes(); SwNodes& rUNds = pMvStt->GetNode().GetNodes();
rUNds.Delete( *pMvStt, nMvLen ); rUNds.Delete( *pMvStt, nMvLen );
@@ -902,7 +891,7 @@ void SwUndoSaveSection::SaveSection( SwDoc* , const SwNodeRange& rRange )
{ {
SwPaM aPam( rRange.aStart, rRange.aEnd ); SwPaM aPam( rRange.aStart, rRange.aEnd );
// loesche alle Fussnoten / FlyFrames / Bookmarks / Verzeichnisse // delete all Footnotes / FlyFrames / Bookmarks / Directories
DelCntntIndex( *aPam.GetMark(), *aPam.GetPoint() ); DelCntntIndex( *aPam.GetMark(), *aPam.GetPoint() );
pRedlSaveData = new SwRedlineSaveDatas; pRedlSaveData = new SwRedlineSaveDatas;
@@ -920,8 +909,7 @@ void SwUndoSaveSection::SaveSection( SwDoc* , const SwNodeRange& rRange )
if( 0 != ( pCNd = aPam.GetCntntNode( sal_True )) ) if( 0 != ( pCNd = aPam.GetCntntNode( sal_True )) )
aPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() ); aPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
// Positionen als SwIndex merken, damit im DTOR dieser Bereich // Keep positions as SwIndex so that this section can be deleted in DTOR
// entfernt werden kann !!
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, 0, &nEnd, 0 );
@@ -931,14 +919,14 @@ void SwUndoSaveSection::SaveSection( SwDoc* , const SwNodeRange& rRange )
void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx, void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx,
sal_uInt16 nSectType ) sal_uInt16 nSectType )
{ {
if( ULONG_MAX != nStartPos ) // gab es ueberhaupt Inhalt ? if( ULONG_MAX != nStartPos ) // was there any content?
{ {
// ueberpruefe, ob der Inhalt an der alten Position steht // check if the content is at the old position
SwNodeIndex aSttIdx( pDoc->GetNodes(), nStartPos ); SwNodeIndex aSttIdx( pDoc->GetNodes(), nStartPos );
// OSL_ENSURE( !pDoc->GetNodes()[ aSttIdx ]->GetCntntNode(), // OSL_ENSURE( !pDoc->GetNodes()[ aSttIdx ]->GetCntntNode(),
// "RestoreSection(): Position on content node"); // "RestoreSection(): Position on content node");
// move den Inhalt aus dem UndoNodes-Array in den Fly // move the content from UndoNodes array into Fly
SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection( aSttIdx, SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection( aSttIdx,
(SwStartNodeType)nSectType ); (SwStartNodeType)nSectType );
@@ -951,14 +939,13 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx,
void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, const SwNodeIndex& rInsPos ) void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, const SwNodeIndex& rInsPos )
{ {
if( ULONG_MAX != nStartPos ) // gab es ueberhaupt Inhalt ? if( ULONG_MAX != nStartPos ) // was there any content?
{ {
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(), 0, aInsPos, &nEnd, 0 );
// Indizies wieder zerstoren, Inhalt ist aus dem UndoNodes-Array // destroy indices again, content was deleted from UndoNodes array
// entfernt worden.
DELETEZ( pMvStt ); DELETEZ( pMvStt );
nMvLen = 0; nMvLen = 0;
@@ -970,7 +957,7 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, const SwNodeIndex& rInsPos
} }
} }
// sicher und setze die RedlineDaten // save and set the RedlineData
SwRedlineSaveData::SwRedlineSaveData( SwComparePosition eCmpPos, SwRedlineSaveData::SwRedlineSaveData( SwComparePosition eCmpPos,
const SwPosition& rSttPos, const SwPosition& rSttPos,
@@ -985,32 +972,32 @@ SwRedlineSaveData::SwRedlineSaveData( SwComparePosition eCmpPos,
switch( eCmpPos ) switch( eCmpPos )
{ {
case POS_OVERLAP_BEFORE: // Pos1 ueberlappt Pos2 am Anfang case POS_OVERLAP_BEFORE: // Pos1 overlaps Pos2 at the beginning
nEndNode = rEndPos.nNode.GetIndex(); nEndNode = rEndPos.nNode.GetIndex();
nEndCntnt = rEndPos.nContent.GetIndex(); nEndCntnt = rEndPos.nContent.GetIndex();
break; break;
case POS_OVERLAP_BEHIND: // Pos1 ueberlappt Pos2 am Ende case POS_OVERLAP_BEHIND: // Pos1 overlaps Pos2 at the end
nSttNode = rSttPos.nNode.GetIndex(); nSttNode = rSttPos.nNode.GetIndex();
nSttCntnt = rSttPos.nContent.GetIndex(); nSttCntnt = rSttPos.nContent.GetIndex();
break; break;
case POS_INSIDE: // Pos1 liegt vollstaendig in Pos2 case POS_INSIDE: // Pos1 lays completely in Pos2
nSttNode = rSttPos.nNode.GetIndex(); nSttNode = rSttPos.nNode.GetIndex();
nSttCntnt = rSttPos.nContent.GetIndex(); nSttCntnt = rSttPos.nContent.GetIndex();
nEndNode = rEndPos.nNode.GetIndex(); nEndNode = rEndPos.nNode.GetIndex();
nEndCntnt = rEndPos.nContent.GetIndex(); nEndCntnt = rEndPos.nContent.GetIndex();
break; break;
case POS_OUTSIDE: // Pos2 liegt vollstaendig in Pos1 case POS_OUTSIDE: // Pos2 lays completely in Pos1
if( rRedl.GetContentIdx() ) if( rRedl.GetContentIdx() )
{ {
// dann den Bereich ins UndoArray verschieben und merken // than move section into UndoArray and memorize it
SaveSection( rRedl.GetDoc(), *rRedl.GetContentIdx() ); SaveSection( rRedl.GetDoc(), *rRedl.GetContentIdx() );
rRedl.SetContentIdx( 0 ); rRedl.SetContentIdx( 0 );
} }
break; break;
case POS_EQUAL: // Pos1 ist genauso gross wie Pos2 case POS_EQUAL: // Pos1 ist exactly as big as Pos2
break; break;
default: default:
@@ -1040,9 +1027,9 @@ void SwRedlineSaveData::RedlineToDoc( SwPaM& rPam )
pRedl->SetContentIdx( &aIdx ); pRedl->SetContentIdx( &aIdx );
} }
SetPaM( *pRedl ); SetPaM( *pRedl );
// erstmal die "alten" entfernen, damit im Append keine unerwarteten // First, delete the "old" so that in an Append no unexpected things will happen, e.g. a delete
// Dinge passieren, wie z.B. eine Delete in eigenen Insert. Dann wird // in an insert. In the latter case the just restored content will be deleted and not the one
// naehmlich das gerade restaurierte wieder geloescht - nicht das gewollte // you originally wanted.
rDoc.DeleteRedline( *pRedl, false, USHRT_MAX ); rDoc.DeleteRedline( *pRedl, false, USHRT_MAX );
RedlineMode_t eOld = rDoc.GetRedlineMode(); RedlineMode_t eOld = rDoc.GetRedlineMode();