summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorPhilipp Riemer <ruderphilipp@gmail.com>2012-05-30 21:17:44 +0200
committerTor Lillqvist <tml@iki.fi>2012-05-30 23:45:10 +0300
commit4e22b45d383cdcb660bcc335322a4c4957b55b43 (patch)
tree75a7fb80b3d0b8e7a476b5e708861a17c194a64b /sw
parentc4f0da46d90620585efddc6fb18c574581730d24 (diff)
Clean up and translate comments
Change-Id: I7ecc27535622d7ee63251005f0768ea3cb47623b
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/undo/undobj.cxx103
-rw-r--r--sw/source/core/undo/undobj1.cxx23
-rw-r--r--sw/source/core/undo/unmove.cxx18
-rw-r--r--sw/source/core/undo/untblk.cxx55
4 files changed, 73 insertions, 126 deletions
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index b0a42ff6969b..d3976807ce0d 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -26,8 +26,6 @@
*
************************************************************************/
-
-
#include <IShellCursorSupplier.hxx>
#include <txtftn.hxx>
#include <fmtanchr.hxx>
@@ -69,8 +67,6 @@ public:
SV_IMPL_PTRARR( SwRedlineSaveDatas, SwRedlineSaveDataPtr )
-
-//------------------------------------------------------------
// This class saves the Pam as sal_uInt16s and can recompose those into a PaM
SwUndRng::SwUndRng()
: nSttNode( 0 ), nEndNode( 0 ), nSttCntnt( 0 ), nEndCntnt( 0 )
@@ -137,10 +133,6 @@ SwPaM & SwUndRng::AddUndoRedoPaM(
return rPaM;
}
-
-//------------------------------------------------------------
-
-
void SwUndo::RemoveIdxFromSection( SwDoc& rDoc, sal_uLong nSttIdx,
sal_uLong* pEndIdx )
{
@@ -180,7 +172,8 @@ void SwUndo::RemoveIdxFromRange( SwPaM& rPam, sal_Bool bMoveNext )
void SwUndo::RemoveIdxRel( sal_uLong nIdx, const SwPosition& rPos )
{
- // Move only the Crsr. Bookmarks/TOXMarks/etc. are done by the corresponding JoinNext/JoinPrev
+ // Move only the Crsr. Bookmarks/TOXMarks/etc. are done by the corresponding
+ // JoinNext/JoinPrev
SwNodeIndex aIdx( rPos.nNode.GetNode().GetNodes(), nIdx );
::PaMCorrRel( aIdx, rPos );
}
@@ -202,7 +195,6 @@ SwUndo::~SwUndo()
delete pComment;
}
-
class UndoRedoRedlineGuard
{
public:
@@ -322,9 +314,6 @@ SwRewriter SwUndo::GetRewriter() const
return aResult;
}
-
-//------------------------------------------------------------
-
SwUndoSaveCntnt::SwUndoSaveCntnt()
: pHistory( 0 )
{}
@@ -334,15 +323,14 @@ SwUndoSaveCntnt::~SwUndoSaveCntnt()
delete pHistory;
}
- // 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.
- // - MoveTo moves from NodesArray into UndoNodesArray
- // - MoveFrom moves from UndoNodesArray into NodesArray
-
- // 2.8.93: If pEndNdIdx is given, Undo/Redo calls -Ins/DelFly.
- // In that case the whole section should 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
+// the end of TextNodes. 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 )
{
@@ -389,13 +377,14 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx,
SwTxtNode* pTxtNd = aPos.nNode.GetNode().GetTxtNode();
if( pTxtNd ) // add a seperator for the attributes
{
- // But since all attributes will be touched at an insert (meaning deleted from the
- // array and re-added again), attributes might disappear (e.g. "no bold" for 10-20,
- // "bold" for 12-15 -> when inserting/deleting, the "bold" will be deleted, which is
- // not wanted here!)! Thus do not touch the hints but manipulate the string directly.
-
+ // But since all attributes will be touched at an insert (meaning
+ // deleted from the array and re-added again), attributes might
+ // disappear (e.g. "no bold" for 10-20, "bold" for 12-15 -> when
+ // inserting/deleting, the "bold" will be deleted, which is not
+ // wanted here!)! Thus do not touch the hints but manipulate the
+ // string directly.
String& rStr = (String&)pTxtNd->GetTxt();
- // For security reasons better only if positioned at the end
+ // For safety reasons better only if positioned at the end
if( rStr.Len() == aPos.nContent.GetIndex() )
{
rStr.Insert( ' ' );
@@ -494,10 +483,10 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, sal_uLong nNodeIdx,
}
}
-// These two methods move the Point of Pam backwards/forwards. With that, one can span an area for
-// a Undo/Redo. (The Point is then positioned in front of the area to manipulate!!)
+// These two methods move the Point of Pam backwards/forwards. With that, one
+// can span an area for a Undo/Redo. (The Point is then positioned in front of
+// the area to manipulate!)
// The flag indicates if there is still content in front of Point.
-
sal_Bool SwUndoSaveCntnt::MovePtBackward( SwPaM& rPam )
{
rPam.SetMark();
@@ -517,7 +506,7 @@ void SwUndoSaveCntnt::MovePtForward( SwPaM& rPam, sal_Bool bMvBkwrd )
if( bMvBkwrd )
rPam.Move( fnMoveForward );
else
- { // set Point to the next position
+ {
rPam.GetPoint()->nNode++;
SwCntntNode* pCNd = rPam.GetCntntNode();
if( pCNd )
@@ -528,14 +517,13 @@ void SwUndoSaveCntnt::MovePtForward( SwPaM& rPam, sal_Bool bMvBkwrd )
}
-/*
- JP 21.03.94: Delete all objects that have ContentIndices to the given area.
- Currently these exist:
- - Footnotes
- - Flys
- - Bookmarks
- - Directories
-*/
+// Delete all objects that have ContentIndices to the given area.
+// Currently (1994) these exist:
+// - Footnotes
+// - Flys
+// - Bookmarks
+// - Directories
+//
// #i81002# - extending method
// delete certain (not all) cross-reference bookmarks at text node of <rMark>
// and at text node of <rPoint>, if these text nodes aren't the same.
@@ -578,8 +566,10 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
continue;
}
- // Unfortunately an index needs to be created. Otherwise there will be problems
- // with TextNode because the index will be deleted in the DTOR of SwFtn!
+// FIXME: duplicated code here and below -> refactor?
+ // Unfortunately an index needs to be created. Otherwise there
+ // will be problems with TextNode because the index will be
+ // deleted in the DTOR of SwFtn!
SwTxtNode* pTxtNd = (SwTxtNode*)pFtnNd;
if( !pHistory )
pHistory = new SwHistory;
@@ -602,8 +592,9 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
nFtnSttIdx >= pEnd->nContent.GetIndex() )))
continue; // continue searching
- // Unfortunately an index needs to be created. Otherwise there will be problems
- // with TextNode because the index will be deleted in the DTOR of SwFtn!
+ // Unfortunately an index needs to be created. Otherwise there
+ // will be problems with TextNode because the index will be
+ // deleted in the DTOR of SwFtn!
SwTxtNode* pTxtNd = (SwTxtNode*)pFtnNd;
if( !pHistory )
pHistory = new SwHistory;
@@ -822,8 +813,8 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
if( !bSavePos && !bSaveOtherPos && bDifferentTxtNodesAtMarkAndPoint &&
dynamic_cast< const ::sw::mark::CrossRefBookmark* >(pBkmk))
{
- // delete cross-reference bookmark at <pStt>, if only part of
- // <pEnd> text node content is deleted.
+ // delete cross-reference bookmark at <pStt>, if only
+ // part of <pEnd> text node content is deleted.
if( pStt->nNode == pBkmk->GetMarkPos().nNode &&
pEnd->nContent.GetIndex() !=
pEnd->nNode.GetNode().GetTxtNode()->Len() )
@@ -831,8 +822,8 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
bSavePos = true;
bSaveOtherPos = false;
}
- // delete cross-reference bookmark at <pEnd>, if only part of
- // <pStt> text node content is deleted.
+ // delete cross-reference bookmark at <pEnd>, if only
+ // part of <pStt> text node content is deleted.
else if( pEnd->nNode == pBkmk->GetMarkPos().nNode &&
pStt->nContent.GetIndex() != 0 )
{
@@ -859,9 +850,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
}
}
-
// save a complete section into UndoNodes array
-
SwUndoSaveSection::SwUndoSaveSection()
: pMvStt( 0 ), pRedlSaveData( 0 ), nMvLen( 0 ), nStartPos( ULONG_MAX )
{
@@ -886,7 +875,6 @@ void SwUndoSaveSection::SaveSection( SwDoc* pDoc, const SwNodeIndex& rSttIdx )
SaveSection( pDoc, aRg );
}
-
void SwUndoSaveSection::SaveSection( SwDoc* , const SwNodeRange& rRange )
{
SwPaM aPam( rRange.aStart, rRange.aEnd );
@@ -923,8 +911,6 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx,
{
// check if the content is at the old position
SwNodeIndex aSttIdx( pDoc->GetNodes(), nStartPos );
-// OSL_ENSURE( !pDoc->GetNodes()[ aSttIdx ]->GetCntntNode(),
-// "RestoreSection(): Position on content node");
// move the content from UndoNodes array into Fly
SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection( aSttIdx,
@@ -957,8 +943,7 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, const SwNodeIndex& rInsPos
}
}
- // save and set the RedlineData
-
+// save and set the RedlineData
SwRedlineSaveData::SwRedlineSaveData( SwComparePosition eCmpPos,
const SwPosition& rSttPos,
const SwPosition& rEndPos,
@@ -1027,9 +1012,9 @@ void SwRedlineSaveData::RedlineToDoc( SwPaM& rPam )
pRedl->SetContentIdx( &aIdx );
}
SetPaM( *pRedl );
- // First, delete the "old" so that in an Append no unexpected things will happen, e.g. a delete
- // in an insert. In the latter case the just restored content will be deleted and not the one
- // you originally wanted.
+ // First, delete the "old" so that in an Append no unexpected things will
+ // happen, e.g. a delete in an insert. In the latter case the just restored
+ // content will be deleted and not the one you originally wanted.
rDoc.DeleteRedline( *pRedl, false, USHRT_MAX );
RedlineMode_t eOld = rDoc.GetRedlineMode();
@@ -1037,7 +1022,7 @@ void SwRedlineSaveData::RedlineToDoc( SwPaM& rPam )
//#i92154# let UI know about a new redline with comment
if (rDoc.GetDocShell() && (pRedl->GetComment() != String()) )
rDoc.GetDocShell()->Broadcast(SwRedlineHint(pRedl,SWREDLINE_INSERTED));
- //
+
bool const bSuccess = rDoc.AppendRedline( pRedl, true );
assert(bSuccess); // SwRedlineSaveData::RedlineToDoc: insert redline failed
(void) bSuccess; // unused in non-debug
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index cbeb0842c6e6..58f6e5e81bff 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -26,9 +26,7 @@
*
************************************************************************/
-
#include <svl/itemiter.hxx>
-
#include <hintids.hxx>
#include <hints.hxx>
#include <fmtflcnt.hxx>
@@ -50,10 +48,6 @@
#include <dcontact.hxx>
#include <ndole.hxx>
-
-//---------------------------------------------------------------------
-// SwUndoLayBase /////////////////////////////////////////////////////////
-
SwUndoFlyBase::SwUndoFlyBase( SwFrmFmt* pFormat, SwUndoId nUndoId )
: SwUndo( nUndoId ), pFrmFmt( pFormat )
{
@@ -115,10 +109,9 @@ void SwUndoFlyBase::InsFly(::sw::UndoRedoContext & rContext, bool bShowSelFrm)
pFrmFmt->SetFmtAttr( SwFmtCntnt( aIdx.GetNode().GetStartNode() ));
}
- //JP 18.12.98: Bug 60505 - set InCntntAttribute not until there is content!
- // Otherwise the layout would format the Fly beforehand but
- // would not find content; this happend with graphics from the
- // internet
+ // Set InCntntAttribute not until there is content!
+ // Otherwise the layout would format the Fly beforehand but would not find
+ // content; this happend with graphics from the internet.
if (FLY_AS_CHAR == nRndId)
{
// there must be at least the attribute in a TextNode
@@ -235,8 +228,6 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc )
rFlyFmts.Remove( rFlyFmts.GetPos( pFrmFmt ));
}
-// SwUndoInsLayFmt ///////////////////////////////////////////////////////
-
SwUndoInsLayFmt::SwUndoInsLayFmt( SwFrmFmt* pFormat, sal_uLong nNodeIdx, xub_StrLen nCntIdx )
: SwUndoFlyBase( pFormat, RES_DRAWFRMFMT == pFormat->Which() ?
UNDO_INSDRAWFMT : UNDO_INSLAYFMT ),
@@ -347,8 +338,6 @@ void SwUndoInsLayFmt::RepeatImpl(::sw::RepeatContext & rContext)
SwFrmFmt* pFlyFmt = pDoc->CopyLayoutFmt( *pFrmFmt, aAnchor, true, true );
(void) pFlyFmt;
-//FIXME nobody ever did anything with this selection:
-// rContext.SetSelections(pFlyFmt, 0);
}
// #111827#
@@ -367,7 +356,6 @@ rtl::OUString SwUndoInsLayFmt::GetComment() const
If frame format is present and has an SdrObject use the undo
comment of the SdrObject. Otherwise use the default comment.
*/
-
bool bDone = false;
if (pFrmFmt)
{
@@ -388,8 +376,6 @@ rtl::OUString SwUndoInsLayFmt::GetComment() const
return aResult;
}
-// SwUndoDelLayFmt ///////////////////////////////////////////////////////
-
static SwUndoId
lcl_GetSwUndoId(SwFrmFmt *const pFrmFmt)
{
@@ -473,8 +459,6 @@ void SwUndoDelLayFmt::RedoForRollback()
DelFly( pFrmFmt->GetDoc() );
}
-// SwUndoSetFlyFmt ///////////////////////////////////////////////////////
-
SwUndoSetFlyFmt::SwUndoSetFlyFmt( SwFrmFmt& rFlyFmt, SwFrmFmt& rNewFrmFmt )
: SwUndo( UNDO_SETFLYFRMFMT ), SwClient( &rFlyFmt ), pFrmFmt( &rFlyFmt ),
pOldFmt( (SwFrmFmt*)rFlyFmt.DerivedFrom() ), pNewFmt( &rNewFrmFmt ),
@@ -496,7 +480,6 @@ SwRewriter SwUndoSetFlyFmt::GetRewriter() const
return aRewriter;
}
-
SwUndoSetFlyFmt::~SwUndoSetFlyFmt()
{
delete pItemSet;
diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx
index 8bc5923bca2a..7d1b59c1f0dd 100644
--- a/sw/source/core/undo/unmove.cxx
+++ b/sw/source/core/undo/unmove.cxx
@@ -26,9 +26,7 @@
*
************************************************************************/
-
#include <UndoSplitMove.hxx>
-
#include <doc.hxx>
#include <IDocumentUndoRedo.hxx>
#include <pam.hxx>
@@ -37,9 +35,7 @@
#include <UndoCore.hxx>
#include <rolbck.hxx>
-
// MOVE
-
SwUndoMove::SwUndoMove( const SwPaM& rRange, const SwPosition& rMvPos )
: SwUndo( UNDO_MOVE ), SwUndRng( rRange ),
nMvDestNode( rMvPos.nNode.GetIndex() ),
@@ -91,7 +87,6 @@ SwUndoMove::SwUndoMove( const SwPaM& rRange, const SwPosition& rMvPos )
pHistory->CopyFmtAttr( *pTxtNd->GetpSwAttrSet(), nMvDestNode );
}
-
nFtnStt = pHistory->Count();
DelFtn( rRange );
@@ -99,7 +94,6 @@ SwUndoMove::SwUndoMove( const SwPaM& rRange, const SwPosition& rMvPos )
DELETEZ( pHistory );
}
-
SwUndoMove::SwUndoMove( SwDoc* pDoc, const SwNodeRange& rRg,
const SwNodeIndex& rMvPos )
: SwUndo( UNDO_MOVE ),
@@ -115,6 +109,7 @@ SwUndoMove::SwUndoMove( SwDoc* pDoc, const SwNodeRange& rRg,
nEndNode = rRg.aEnd.GetIndex();
// DelFtn( rRange );
+// FIXME: duplication of the method body of DelFtn below
// is the current move from CntntArea into the special section?
sal_uLong nCntntStt = pDoc->GetNodes().GetEndOfAutotext().GetIndex();
@@ -138,8 +133,6 @@ SwUndoMove::SwUndoMove( SwDoc* pDoc, const SwNodeRange& rRg,
nFtnStt = 0;
}
-
-
void SwUndoMove::SetDestRange( const SwPaM& rRange,
const SwPosition& rInsPos,
sal_Bool bJoin, sal_Bool bCorrPam )
@@ -169,7 +162,6 @@ void SwUndoMove::SetDestRange( const SwPaM& rRange,
bJoinPrev = bJoin;
}
-
void SwUndoMove::SetDestRange( const SwNodeIndex& rStt,
const SwNodeIndex& rEnd,
const SwNodeIndex& rInsPos )
@@ -186,7 +178,6 @@ void SwUndoMove::SetDestRange( const SwNodeIndex& rStt,
nDestSttCntnt = nDestEndCntnt = nInsPosCntnt = STRING_MAXLEN;
}
-
void SwUndoMove::UndoImpl(::sw::UndoRedoContext & rContext)
{
SwDoc *const pDoc = & rContext.GetDoc();
@@ -212,8 +203,8 @@ void SwUndoMove::UndoImpl(::sw::UndoRedoContext & rContext)
SwPaM aPam( aIdx.GetNode(), nDestSttCntnt,
*pDoc->GetNodes()[ nDestEndNode ], nDestEndCntnt );
- // #i17764# if redlines are to be moved, we may not remove them before
- // pDoc->Move gets a chance to handle them
+ // #i17764# if redlines are to be moved, we may not remove them
+ // before pDoc->Move gets a chance to handle them
if( ! bMoveRedlines )
RemoveIdxFromRange( aPam, sal_False );
@@ -236,7 +227,6 @@ void SwUndoMove::UndoImpl(::sw::UndoRedoContext & rContext)
aPam.Exchange();
aPam.DeleteMark();
-// pDoc->ResetAttr( aPam, sal_False );
if( aPam.GetNode()->IsCntntNode() )
aPam.GetNode()->GetCntntNode()->ResetAllAttr();
// the Pam will be dropped now
@@ -281,7 +271,6 @@ void SwUndoMove::UndoImpl(::sw::UndoRedoContext & rContext)
}
}
-
void SwUndoMove::RedoImpl(::sw::UndoRedoContext & rContext)
{
SwPaM *const pPam = & AddUndoRedoPaM(rContext);
@@ -334,7 +323,6 @@ void SwUndoMove::RedoImpl(::sw::UndoRedoContext & rContext)
}
}
-
void SwUndoMove::DelFtn( const SwPaM& rRange )
{
// is the current move from CntntArea into the special section?
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 02ca169c4d73..7e212c3b1c81 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -26,7 +26,6 @@
*
************************************************************************/
-
#include <hintids.hxx>
#include <fmtanchr.hxx>
#include <frmfmt.hxx>
@@ -34,15 +33,13 @@
#include <IDocumentUndoRedo.hxx>
#include <IShellCursorSupplier.hxx>
#include <docary.hxx>
-#include <swundo.hxx> // fuer die UndoIds
+#include <swundo.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
#include <UndoCore.hxx>
#include <rolbck.hxx>
#include <redline.hxx>
-
-
SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
: SwUndo( nUndoId ), SwUndRng( rPam ),
pTxtFmtColl( 0 ), pLastNdColl(0), pFrmFmts( 0 ), pRedlData( 0 ),
@@ -60,7 +57,7 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
if( pTxtNd->HasSwAttrSet() )
pHistory->CopyFmtAttr( *pTxtNd->GetpSwAttrSet(), nSttNode );
- if( !nSttCntnt ) // dann werden Flys mitgenommen !!
+ if( !nSttCntnt ) // than take the Flys along
{
sal_uInt16 nArrLen = pDoc->GetSpzFrmFmts()->Count();
for( sal_uInt16 n = 0; n < nArrLen; ++n )
@@ -79,7 +76,7 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
}
}
}
- // Redline beachten
+ // consider Redline
if( pDoc->IsRedlineOn() )
{
pRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_INSERT, pDoc->GetRedlineAuthor() );
@@ -87,8 +84,7 @@ SwUndoInserts::SwUndoInserts( SwUndoId nUndoId, const SwPaM& rPam )
}
}
-// setze den Destination-Bereich nach dem Einlesen.
-
+// set destination after reading input
void SwUndoInserts::SetInsertRange( const SwPaM& rPam, sal_Bool bScanFlys,
sal_Bool bSttIsTxtNd )
{
@@ -105,16 +101,16 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, sal_Bool bScanFlys,
nSttNode = pTmpPos->nNode.GetIndex();
nSttCntnt = pTmpPos->nContent.GetIndex();
- if( !bSttIsTxtNd ) // wird eine Tabellenselektion eingefuegt,
+ if( !bSttIsTxtNd ) // if a table selection is added ...
{
- ++nSttNode; // dann stimmt der CopyPam nicht ganz
+ ++nSttNode; // ... than the CopyPam is not fully correct
bSttWasTxtNd = sal_False;
}
}
if( bScanFlys && !nSttCntnt )
{
- // dann alle neuen Flys zusammen sammeln !!
+ // than collect all new Flys
SwDoc* pDoc = (SwDoc*)rPam.GetDoc();
sal_uInt16 nFndPos, nArrLen = pDoc->GetSpzFrmFmts()->Count();
for( sal_uInt16 n = 0; n < nArrLen; ++n )
@@ -141,18 +137,17 @@ void SwUndoInserts::SetInsertRange( const SwPaM& rPam, sal_Bool bScanFlys,
}
}
-
SwUndoInserts::~SwUndoInserts()
{
- if( pPos ) // loesche noch den Bereich aus dem UndoNodes Array
+ if( pPos ) // delete also the section from UndoNodes array
{
- // Insert speichert den Inhalt in der IconSection
+ // Insert saves content in IconSection
SwNodes& rUNds = pPos->nNode.GetNodes();
- if( pPos->nContent.GetIndex() ) // nicht den gesamten Node loeschen
+ if( pPos->nContent.GetIndex() ) // do not delete complete Node
{
SwTxtNode* pTxtNd = pPos->nNode.GetNode().GetTxtNode();
- OSL_ENSURE( pTxtNd, "kein TextNode, aus dem geloescht werden soll" );
- if( pTxtNd ) // Robust
+ OSL_ENSURE( pTxtNd, "no TextNode to delete from" );
+ if( pTxtNd ) // robust
{
pTxtNd->EraseText( pPos->nContent );
}
@@ -167,7 +162,6 @@ SwUndoInserts::~SwUndoInserts()
delete pRedlData;
}
-
void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
{
SwDoc *const pDoc = & rContext.GetDoc();
@@ -176,14 +170,13 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() ))
pDoc->DeleteRedline( *pPam, true, USHRT_MAX );
- // sind an Point/Mark 2 unterschiedliche TextNodes, dann muss ein
- // JoinNext ausgefuehrt werden.
+ // if Point and Mark are different text nodes so a JoinNext has to be done
sal_Bool bJoinNext = nSttNode != nEndNode &&
pPam->GetMark()->nNode.GetNode().GetTxtNode() &&
pPam->GetPoint()->nNode.GetNode().GetTxtNode();
- // gibts ueberhaupt Inhalt ? (laden von Zeichenvorlagen hat kein Inhalt!)
+ // Is there any content? (loading from template does not have content)
if( nSttNode != nEndNode || nSttCntnt != nEndCntnt )
{
if( nSttNode != nEndNode )
@@ -196,7 +189,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
RemoveIdxFromRange( *pPam, sal_False );
SetPaM(*pPam);
- // sind Fussnoten oder CntntFlyFrames im Text ??
+ // are there Footnotes or CntntFlyFrames in text?
nSetPos = pHistory->Count();
nNdDiff = pPam->GetMark()->nNode.GetIndex();
DelCntntIndex( *pPam->GetMark(), *pPam->GetPoint() );
@@ -226,12 +219,14 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
SwTxtNode* pTxtNode = rIdx.GetNode().GetTxtNode();
if( pTxtNode )
{
- if( !pTxtFmtColl ) // falls 0, dann war hier auch kein TextNode,
- { // dann muss dieser geloescht werden,
+ if( !pTxtFmtColl ) // if 0 than it's no TextNode -> delete
+ {
SwNodeIndex aDelIdx( rIdx );
rIdx++;
SwCntntNode* pCNd = rIdx.GetNode().GetCntntNode();
- xub_StrLen nCnt = 0; if( pCNd ) nCnt = pCNd->Len();
+ xub_StrLen nCnt = 0;
+ if( pCNd )
+ nCnt = pCNd->Len();
pPam->GetPoint()->nContent.Assign( pCNd, nCnt );
pPam->SetMark();
pPam->DeleteMark();
@@ -254,7 +249,6 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
pTxtNode->RstAttr( SwIndex(pTxtNode, 0), pTxtNode->Len(),
0, 0, true );
- // setze alle Attribute im Node zurueck
pTxtNode->ResetAllAttr();
if( USHRT_MAX != pDoc->GetTxtFmtColls()->GetPos( pTxtFmtColl ))
@@ -268,7 +262,7 @@ void SwUndoInserts::UndoImpl(::sw::UndoRedoContext & rContext)
void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
{
- // setze noch den Cursor auf den Redo-Bereich
+ // position cursor onto REDO section
SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor());
SwDoc* pDoc = pPam->GetDoc();
pPam->DeleteMark();
@@ -282,12 +276,12 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext)
pHistory->SetTmpEnd( nSetPos );
- // alte Anfangs-Position fuers Rollback zurueckholen
+ // retrieve start position for rollback
if( ( nSttNode != nEndNode || nSttCntnt != nEndCntnt ) && pPos )
{
sal_Bool bMvBkwrd = MovePtBackward( *pPam );
- // Inhalt wieder einfuegen. (erst pPos abmelden !!)
+ // re-insert content again (first detach pPos!)
sal_uLong nMvNd = pPos->nNode.GetIndex();
xub_StrLen nMvCnt = pPos->nContent.GetIndex();
DELETEZ( pPos );
@@ -340,9 +334,6 @@ void SwUndoInserts::RepeatImpl(::sw::RepeatContext & rContext)
aPam.GetDoc()->CopyRange( aPam, *rRepeatPaM.GetPoint(), false );
}
-
-//////////////////////////////////////////////////////////////////////////
-
SwUndoInsDoc::SwUndoInsDoc( const SwPaM& rPam )
: SwUndoInserts( UNDO_INSDOKUMENT, rPam )
{