summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Riemer <ruderphilipp@gmail.com>2014-02-16 20:11:48 +0100
committerPhilipp Riemer <ruderphilipp@gmail.com>2014-02-16 20:22:07 +0100
commit5d6abb55d21891dec1f079c993452b2bca93ca1f (patch)
treead13b2fac44bca7f0a92f8c64a932154f40a646c
parent6570eec5da5dc574c4fc2c10a96c46bb3c7309c9 (diff)
fdo#39468: Translate German comments in sw/source/core/layout/
Change-Id: Ia0a8443c6989d7938e479a88e3899fb611106544
-rw-r--r--sw/source/core/layout/colfrm.cxx6
-rw-r--r--sw/source/core/layout/dbg_lay.cxx60
-rw-r--r--sw/source/core/layout/fly.cxx3
-rw-r--r--sw/source/core/layout/frmtool.cxx264
-rw-r--r--sw/source/core/layout/ftnfrm.cxx546
-rw-r--r--sw/source/core/layout/pagechg.cxx344
-rw-r--r--sw/source/core/layout/sectfrm.cxx11
7 files changed, 515 insertions, 719 deletions
diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx
index 34d8baa1bbb2..a6317ce4bf99 100644
--- a/sw/source/core/layout/colfrm.cxx
+++ b/sw/source/core/layout/colfrm.cxx
@@ -57,14 +57,14 @@ SwColumnFrm::~SwColumnFrm()
static void lcl_RemoveColumns( SwLayoutFrm *pCont, sal_uInt16 nCnt )
{
OSL_ENSURE( pCont && pCont->Lower() && pCont->Lower()->IsColumnFrm(),
- "Keine Spalten zu entfernen." );
+ "no columns to remove." );
SwColumnFrm *pColumn = (SwColumnFrm*)pCont->Lower();
sw_RemoveFtns( pColumn, sal_True, sal_True );
while ( pColumn->GetNext() )
{
OSL_ENSURE( pColumn->GetNext()->IsColumnFrm(),
- "Nachbar von ColFrm kein ColFrm." );
+ "neighbor of ColumnFrame is no ColumnFrame." );
pColumn = (SwColumnFrm*)pColumn->GetNext();
}
for ( sal_uInt16 i = 0; i < nCnt; ++i )
@@ -275,7 +275,7 @@ void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew,
OSL_ENSURE( Lower() && Lower()->IsLayoutFrm() &&
((SwLayoutFrm*)Lower())->Lower() &&
((SwLayoutFrm*)Lower())->Lower()->IsLayoutFrm(),
- "Gesucht: Spaltenbody (Tod oder Lebend)." ); // ColumnFrms jetzt mit BodyFrm
+ "no column body." ); // ColumnFrms contain BodyFrms
::RestoreCntnt( pSave, (SwLayoutFrm*)((SwLayoutFrm*)Lower())->Lower(), 0, true );
}
}
diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx
index 4f4627279f6d..b756e5af5f61 100644
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -42,7 +42,6 @@
* directory. The file contains lines with FrmId, function group and additional
* information.
*
- * Was genau protokolliert wird, kann auf folgende Arten eingestellt werden:
* What exactly is going to be logged, can be defined as follows:
* 1. The static variable SwProtocol::nRecord contains the function groups
* which shall be logged.
@@ -55,63 +54,19 @@
* The member nTypes can be set to values like FRM_PAGE or FRM_SECTION and
* may be combined using binary OR. The default values is 0xFFFF - meaning
* all frame types.
-
- * 3. In der SwImplProtocol-Klasse gibt es einen ArrayPointer auf FrmIds, die zu ueberwachen sind.
- * Ist der Pointer Null, so werden alle Frames protokolliert, ansonsten nur Frames,
- * die in dem Array vermerkt sind.
-
* 3. The SwImplProtocol class contains an ArrayPointer to FrmIds which need to be
* tracked. If the pointer is null, all frames will be logged; otherwise
* only frames of linked from the array will be logged.
*
- * Eine Aufzeichnung in Gang zu setzen, erfordert entweder Codemanipulation, z.B. in
- * SwProtocol::Init() einen anderen Default fuer nRecord setzen oder Debuggermanipulation.
- * Im Debugger gibt verschiedene, sich anbietende Stellen:
-
* Code changes are needed to start logging; either change the default of nRecord
* in SwProtocol::Init() or change the debugger. There are several possible
* places in the debugger:
-
- * 1. In SwProtocol::Init() einen Breakpoint setzen und dort nRecord manipulieren, ggf.
- * FrmIds eintragen, dann beginnt die Aufzeichnung bereits beim Programmstart.
-
* 1. Set a breakpoint in SwProtocol::Init() and manipulate nRecord there, set
- FrmIds accordingly then start logging during program start.
-
- * 2. Waehrend des Programmlaufs einen Breakpoint vor irgendein PROTOCOL oder PROTOCOL_ENTER-
- * Makro setzen, dann am SwProtocol::nRecord das unterste Bit setzen (PROT_INIT). Dies
- * bewirkt, dass die Funktionsgruppe des folgenden Makros aktiviert und in Zukunft
- * protokolliert wird.
-
+ * FrmIds accordingly then start logging during program start.
* 2. Set a breakpoint before any PROTOCOL or PROTOCOL_ENTER macro during
- program execution, then set the lowest bit (PROT_INIT) of
- SwProtocol::nRecord. This activates the function group of the following
- macro and causes it to be logged in the future.
-
- * 3. Spezialfall von 2.: Wenn man 2. in der Methode SwRootFrm::Paint(..) anwendet, werden
- * die Aufzeichnungseinstellung aus der Datei "dbg_lay.ini" ausgelesen!
- * In dieser INI-Datei kann es Kommentarzeilen geben, diese beginnen mit '#', dann
- * sind die Sektionen "[frmid]", "[frmtype]" und "[record]" relevant.
- * Nach [frmid] koennen die FrameIds der zu protokollierenden Frames folgen. Gibt es
- * dort keine Eintraege, werden alle Frames aufgezeichnet.
- * Nach [frmtype] koennen FrameTypen folgen, die aufgezeichnet werden sollen, da der
- * Default hier allerdings USHRT_MAX ist, werden sowieso alle aufgezeichnet. Man kann
- * allerdings auch Typen entfernen, in dem man ein '!' vor den Wert setzt, z.B.
- * !0xC000 nimmt die SwCntntFrms aus der Aufzeichnung heraus.
- * Nach [record] folgen die Funktionsgruppen, die aufgezeichnet werden sollen, Default
- * ist hier 0, also keine. Auch hier kann man mit einem vorgestellten '!' Funktionen
- * wieder entfernen.
- * Hier mal ein Beispiel fuer eine INI-Datei:
- * ------------------------------------------
- * #Funktionen: Alle, ausser PRTAREA
- * [record] 0xFFFFFFE !0x200
- * [frmid]
- * #folgende FrmIds:
- * 1 2 12 13 14 15
- * #keine Layoutframes ausser ColumnFrms
- * [frmtype] !0x3FFF 0x4
- * ------------------------------------------
- *
+ * program execution, then set the lowest bit (PROT_INIT) of
+ * SwProtocol::nRecord. This activates the function group of the following
+ * macro and causes it to be logged in the future.
* 3. There's a special case for 2: If one uses 2. in SwRootFrm::Paint(..),
* the log settings are taken from the file "dbg_lay.ini"!
* In this INI-file you can have comment lines starting with a '#'.
@@ -136,16 +91,11 @@
* #no layout frames, except ColumnFrms
* [frmtype] !0x3FFF 0x4
* ------------------------------------------
-
- * Wenn die Aufzeichnung erstmal laeuft, kann man in SwImplProtocol::_Record(...) mittels
- * Debugger vielfaeltige Manipulationen vornehmen, z.B. bezueglich FrameTypen oder FrmIds.
*
-
* As soon as the logging is in process, one can manipulate many things in
* SwImplProtocol::_Record(...) using a debugger, especially concerning
* frame types and FrmIds.
-
- * --------------------------------------------------*/
+ */
#include "dbg_lay.hxx"
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 8f792d32b4ba..e7f4ce0e78c5 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -258,7 +258,6 @@ SwFlyFrm::~SwFlyFrm()
// OD 2004-01-19 #110582#
DeleteCnt();
- //Tschuess sagen.
if ( GetAnchorFrm() )
AnchorFrm()->RemoveFly( this );
}
@@ -1935,7 +1934,7 @@ Size SwFlyFrm::ChgSize( const Size& aNewSize )
SwFmtFrmSize aSz( pFmt->GetFrmSize() );
aSz.SetWidth( aAdjustedNewSize.Width() );
aSz.SetHeight( aAdjustedNewSize.Height() );
- // uebers Doc fuers Undo!
+ // go via the Doc for UNDO
pFmt->GetDoc()->SetAttr( aSz, *pFmt );
return aSz.GetSize();
}
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index bed1e14eab33..a1ae9cd9e84c 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -498,13 +498,10 @@ SwLayNotify::~SwLayNotify()
{
pLay->ChgLowersProp( aPrt.SSize() );
}
- //Wenn die PrtArea gewachsen ist, so ist es moeglich, dass die
- //Kette der Untergeordneten einen weiteren Frm aufnehmen kann,
- //mithin muss also der 'moeglicherweise passende' Invalidiert werden.
- //Das invalidieren lohnt nur, wenn es sich beim mir bzw. meinen
- //Uppers um eine Moveable-Section handelt.
- //Die PrtArea ist gewachsen, wenn die Breite oder die Hoehe groesser
- //geworden ist.
+ // If the PrtArea has been extended, it might be possible that the chain of parts
+ // can take another frame. As a result, the "possible right one" needs to be
+ // invalidated. This only pays off if this or its Uppers are moveable sections.
+ // A PrtArea has been extended if width or height are larger than before.
if ( (pLay->Prt().Height() > aPrt.Height() ||
pLay->Prt().Width() > aPrt.Width()) &&
(pLay->IsMoveable() || pLay->IsFlyFrm()) )
@@ -871,7 +868,7 @@ SwCntntNotify::~SwCntntNotify()
pNd->SetOLESizeInvalid( sal_False );
//TODO/LATER: needs OnDocumentPrinterChanged
//xObj->OnDocumentPrinterChanged( pNd->GetDoc()->getPrinter( false ) );
- pFESh->CalcAndSetScale( xObj );//Client erzeugen lassen.
+ pFESh->CalcAndSetScale( xObj ); // create client
}
}
//dito animated graphics
@@ -1516,16 +1513,15 @@ void _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc,
break;
++nIndex;
- // Der Endnode wird nicht mehr mitgenommen, es muss vom
- // Aufrufenden (Section/MakeFrms()) sichergestellt sein, dass das Ende
- // des Bereichs vor dem EndIndex liegt!
+ // Do not consider the end node. The caller (section/MakeFrms()) has to ensure that the end
+ // of this area is positioned before EndIndex!
if ( nEndIndex && nIndex >= nEndIndex )
break;
}
if ( pActualSection )
{
- //Kann passieren, dass noch eine leere (Follow-)Section uebrig geblieben ist.
+ // Might happen that an empty (Follow-)Section is left over.
if ( !(pLay = pActualSection->GetSectionFrm())->ContainsCntnt() )
{
pLay->Remove();
@@ -1534,7 +1530,7 @@ void _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc,
delete pActualSection;
}
- if ( bPages ) //Jetzt noch die Flys verbinden lassen.
+ if ( bPages ) // let the Flys connect to each other
{
if ( !bDontCreateObjects )
AppendAllObjs( pTbl, pLayout );
@@ -1586,24 +1582,22 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
else
bOldFtn = sal_True;
SwSectionFrm* pSct = pUpper->FindSctFrm();
- // Es sind innerhalb von Fussnoten nur die Bereiche interessant,
- // die in den Fussnoten liegen, nicht etwa die (spaltigen) Bereiche,
- // in denen die Fussnoten(Container) liegen.
+ // Inside of footnotes only those areas are interesting that are inside of them. But
+ // not the ones (e.g. column areas) in which are the footnote containers positioned.
// #109767# Table frame is in section, insert section in cell frame.
if( pSct && ((pFtnFrm && !pSct->IsInFtn()) || pUpper->IsCellFrm()) )
pSct = NULL;
if( pSct )
- { // damit der SectionFrm nicht zerstoert wird durch pTmp->MoveFwd()
+ { // to prevent pTmp->MoveFwd from destroying the SectionFrm
bOldLock = pSct->IsColLocked();
pSct->ColLock();
}
else
bOldLock = sal_True;
- // Wenn pFrm sich nicht bewegen kann, koennen wir auch niemanden
- // auf die naechste Seite schieben. Innerhalb eines Rahmens auch
- // nicht ( in der 1. Spalte eines Rahmens waere pFrm Moveable()! )
- // Auch in spaltigen Bereichen in Tabellen waere pFrm Moveable.
+ // If pFrm cannot be moved, it is not possible to move it to the next page. This applies
+ // also for frames (in the first column of a frame pFrm is moveable) and column
+ // sections of tables (also here pFrm is moveable).
bool bMoveNext = nEndIdx - rSttIdx.GetIndex() > 120;
bool bAllowMove = !pFrm->IsInFly() && pFrm->IsMoveable() &&
(!pFrm->IsInTab() || pFrm->IsTabFrm() );
@@ -1616,13 +1610,12 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
if ( bApres )
{
- // Wir wollen, dass der Rest der Seite leer ist, d.h.
- // der naechste muss auf die naechste Seite wandern.
- // Dieser kann auch in der naechsten Spalte stehen!
+ // The rest of this page should be empty. Thus, the following one has to move to
+ // the next page (it might also be located in the following column).
OSL_ENSURE( !pTmp->HasFollow(), "Follows forbidden" );
pPrev = pFrm;
- // Wenn unser umgebender SectionFrm einen Next besitzt,
- // so soll dieser ebenfalls gemoved werden!
+ // If the surrounding SectionFrm has a "next" one,
+ // so this one needs to be moved as well.
pMove = pFrm->GetIndNext();
SwColumnFrm* pCol = (SwColumnFrm*)pFrm->FindColFrm();
if( pCol )
@@ -1630,16 +1623,13 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
do
{
if( pCol && !pMove )
- { // Bisher haben wir keinen Nachfolger gefunden
- // jetzt gucken wir in die naechste Spalte
+ { // No successor so far, look into the next column
pMove = pCol->ContainsAny();
if( pCol->GetNext() )
pCol = (SwColumnFrm*)pCol->GetNext();
else if( pCol->IsInSct() )
- { // Wenn es keine naechste Spalte gibt, wir aber
- // innerhalb eines spaltigen Bereichs sind,
- // koennte es noch ausserhalb des Bereich
- // (Seiten-)Spalten geben
+ { // If there is no following column but we are in a column frame,
+ // there might be (page) columns outside of it.
pCol = (SwColumnFrm*)pCol->FindSctFrm()->FindColFrm();
if( pCol )
pCol = (SwColumnFrm*)pCol->GetNext();
@@ -1647,8 +1637,7 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
else
pCol = NULL;
}
- // Falls hier verschrottete SectionFrms herumgammeln,
- // muessen diese uebersprungen werden.
+ // skip invalid SectionFrms
while( pMove && pMove->IsSctFrm() &&
!((SwSectionFrm*)pMove)->GetSection() )
pMove = pMove->GetNext();
@@ -1675,8 +1664,7 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
else
{
OSL_ENSURE( !pTmp->IsFollow(), "Follows really forbidden" );
- // Bei Bereichen muss natuerlich der Inhalt auf die Reise
- // geschickt werden.
+ // move the _content_ of a section frame
if( pMove->IsSctFrm() )
{
while( pMove && pMove->IsSctFrm() &&
@@ -1694,9 +1682,8 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
if( pTmp )
{
SwFrm* pOldUp = pTmp->GetFrm()->GetUpper();
- // MoveFwd==sal_True bedeutet, dass wir auf der gleichen
- // Seite geblieben sind, wir wollen aber die Seite wechseln,
- // sofern dies moeglich ist
+ // MoveFwd==sal_True means that we are still on the same page.
+ // But since we want to move if possible!
sal_Bool bTmpOldLock = pTmp->IsJoinLocked();
pTmp->LockJoin();
while( pTmp->MoveFwd( sal_True, sal_False, sal_True ) )
@@ -1715,12 +1702,10 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
{
sal_Bool bSplit;
SwFrm* pPrv = bApres ? pFrm : pFrm->GetPrev();
- // Wenn in einen SectionFrm ein anderer eingefuegt wird,
- // muss dieser aufgebrochen werden
+ // If the section frame is inserted into another one, it must be split.
if( pSct && rSttIdx.GetNode().IsSectionNode() )
{
bSplit = pSct->SplitSect( pFrm, bApres );
- // Wenn pSct nicht aufgespalten werden konnte
if( !bSplit && !bApres )
{
pUpper = pSct->GetUpper();
@@ -1740,8 +1725,7 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
AppendAllObjs( pTbl, pUpper );
}
- // Wenn nichts eingefuegt wurde, z.B. ein ausgeblendeter Bereich,
- // muss das Splitten rueckgaengig gemacht werden
+ // If nothing was added (e.g. a hidden section), the split must be reversed.
if( bSplit && pSct && pSct->GetNext()
&& pSct->GetNext()->IsSctFrm() )
pSct->MergeNext( (SwSectionFrm*)pSct->GetNext() );
@@ -1758,9 +1742,8 @@ void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
if( !bOldLock )
{
pSct->ColUnlock();
- // Zum Beispiel beim Einfuegen von gelinkten Bereichen,
- // die wiederum Bereiche enthalten, kann pSct jetzt leer sein
- // und damit ruhig zerstoert werden.
+ // pSct might be empty (e.g. when inserting linked section containing further
+ // sections) and can be destroyed in such cases.
if( !pSct->ContainsCntnt() )
{
pSct->DelEmpty( sal_True );
@@ -1798,10 +1781,9 @@ SwBorderAttrs::SwBorderAttrs( const SwModify *pMod, const SwFrm *pConstructor )
rLR = SvxLRSpaceItem ( RES_LR_SPACE );
}
- //Achtung: Die USHORTs fuer die gecache'ten Werte werden absichtlich
- //nicht initialisiert!
+ // Caution: The USHORTs for the cached values are not initialized by intention!
- //Muessen alle einmal berechnet werden:
+ // everything needs to be calculated at least once:
bTopLine = bBottomLine = bLeftLine = bRightLine =
bTop = bBottom = bLine = sal_True;
@@ -1819,13 +1801,10 @@ SwBorderAttrs::~SwBorderAttrs()
((SwModify*)pOwner)->SetInCache( sal_False );
}
-/*
-|* Die Calc-Methoden errechnen zusaetzlich zu den
-|* von den Attributen vorgegebenen Groessen einen Sicherheitsabstand.
-|* der Sicherheitsabstand wird nur einkalkuliert, wenn Umrandung und/oder
-|* Schatten im Spiel sind; er soll vermeiden, dass aufgrund der
-|* groben physikalischen Gegebenheiten Raender usw. uebermalt werden.
-|*/
+/* All calc methods calculate a safety distance in addition to the values given by the attributes.
+ * This safety distance is only added when working with borders and/or shadows to prevent that
+ * e.g. borders are painted over.
+ */
void SwBorderAttrs::_CalcTop()
{
@@ -1932,12 +1911,10 @@ long SwBorderAttrs::CalcLeft( const SwFrm *pCaller ) const
return nLeft;
}
-/*
-|* Beschreibung Berechnung der Groessen fuer Umrandung und Schatten.
-|* Es kann auch ohne Linien ein Abstand erwuenscht sein,
-|* dieser wird dann nicht vom Attribut sondern hier
-|* beruecksichtigt (bBorderDist, z.B. fuer Zellen).
-|*/
+/* Calculated values for borders and shadows.
+ * It might be that a distance is wanted even without lines. This will be
+ * considered here and not by the attribute (e.g. bBorderDist for cells).
+ */
void SwBorderAttrs::_CalcTopLine()
{
@@ -1982,21 +1959,15 @@ void SwBorderAttrs::_IsLine()
bLine = sal_False;
}
-/*
-|* Die Umrandungen benachbarter Absaetze werden nach folgendem
-|* Algorithmus zusammengefasst:
-|*
-|* 1. Die Umrandung oben faellt weg, wenn der Vorgaenger dieselbe
-|* Umrandung oben aufweist und 3. Zutrifft.
-|* Zusaetzlich muss der Absatz mindestens rechts oder links oder
-|* unten eine Umrandung haben.
-|* 2. Die Umrandung unten faellt weg, wenn der Nachfolger dieselbe
-|* Umrandung untern aufweist und 3. Zustrifft.
-|* Zusaetzlich muss der Absatz mindestens rechts oder links oder
-|* oben eine Umrandung haben.
-|* 3. Die Umrandungen links und rechts vor Vorgaenger bzw. Nachfolger
-|* sind identisch.
-|*/
+/* The borders of neighboring paragraphs are condensed by following algorithm:
+ *
+ * 1. No top border if the predecessor has the same top border and (3) applies.
+ * In addition, the paragraph needs to have a border at at least one side (left/right/bottom).
+ * 2. No bottom border if the successor has the same bottom border and (3) applies.
+ * In addition, the paragraph needs to have a border at at least one side (left/right/top).
+ * 3. The borders on the left and right side are identical between the current and the
+ * pre-/succeeding paragraph.
+ */
inline bool CmpLines( const editeng::SvxBorderLine *pL1, const editeng::SvxBorderLine *pL2 )
{
@@ -2202,7 +2173,7 @@ const SdrObject *SwOrderIter::Top()
if ( pObjs->Count() )
{
sal_uInt32 nTopOrd = 0;
- (*pObjs)[0]->GetDrawObj()->GetOrdNum(); //Aktualisieren erzwingen!
+ (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
for ( sal_uInt16 i = 0; i < pObjs->Count(); ++i )
{
const SdrObject* pObj = (*pObjs)[i]->GetDrawObj();
@@ -2229,7 +2200,7 @@ const SdrObject *SwOrderIter::Bottom()
const SwSortedObjs *pObjs = pPage->GetSortedObjs();
if ( pObjs->Count() )
{
- (*pObjs)[0]->GetDrawObj()->GetOrdNum(); //Aktualisieren erzwingen!
+ (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
for ( sal_uInt16 i = 0; i < pObjs->Count(); ++i )
{
const SdrObject* pObj = (*pObjs)[i]->GetDrawObj();
@@ -2257,7 +2228,7 @@ const SdrObject *SwOrderIter::Next()
const SwSortedObjs *pObjs = pPage->GetSortedObjs();
if ( pObjs->Count() )
{
- (*pObjs)[0]->GetDrawObj()->GetOrdNum(); //Aktualisieren erzwingen!
+ (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
for ( sal_uInt16 i = 0; i < pObjs->Count(); ++i )
{
const SdrObject* pObj = (*pObjs)[i]->GetDrawObj();
@@ -2285,7 +2256,7 @@ const SdrObject *SwOrderIter::Prev()
if ( pObjs->Count() )
{
sal_uInt32 nOrd = 0;
- (*pObjs)[0]->GetDrawObj()->GetOrdNum(); //Aktualisieren erzwingen!
+ (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
for ( sal_uInt16 i = 0; i < pObjs->Count(); ++i )
{
const SdrObject* pObj = (*pObjs)[i]->GetDrawObj();
@@ -2303,24 +2274,19 @@ const SdrObject *SwOrderIter::Prev()
return pCurrent;
}
-//Unterstruktur eines LayoutFrms fuer eine Aktion aufheben und wieder
-//restaurieren.
-//Neuer Algorithmus: Es ist unuetz jeden Nachbarn einzeln zu betrachten und
-//die Pointer sauber zu setzen (Upper, Nachbarn, usw.)
-//Es reicht vollkommen jeweils eine Einzelkette zu loesen, und mit dem
-//Letzen der Einzelkette nachzuschauen ob noch eine weitere Kette
-//angeheangt werden muss. Es brauchen nur die Pointer korrigiert werden,
-//die zur Verkettung notwendig sind. So koennen Beipspielsweise die Pointer
-//auf die Upper auf den alten Uppern stehenbleiben. Korrigiert werden die
-//Pointer dann im RestoreCntnt. Zwischenzeitlich ist sowieso jeder Zugriff
-//verboten.
-//Unterwegs werden die Flys bei der Seite abgemeldet.
-
+/// Keep and restore the substructure of a layout frame for an action.
+// New algorithm:
+// Do not look at each neighbor one by one to set all pointers correctly.
+// It is sufficient to detach a part of a chain and check if another chain needs to be added
+// when attaching it again. Only the pointers necessary for the chain connection need to be
+// adjusted. The correction happens in RestoreCntnt(). In between all access is restricted.
+// During this action, the Flys are detached from the page.
+//
// #115759# - 'remove' also drawing object from page and
// at-fly anchored objects from page
static void lcl_RemoveObjsFromPage( SwFrm* _pFrm )
{
- OSL_ENSURE( _pFrm->GetDrawObjs(), "Keine DrawObjs fuer lcl_RemoveFlysFromPage." );
+ OSL_ENSURE( _pFrm->GetDrawObjs(), "no DrawObjs in lcl_RemoveObjsFromPage." );
SwSortedObjs &rObjs = *_pFrm->GetDrawObjs();
for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
{
@@ -2393,7 +2359,7 @@ SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart )
pSav = pSav->GetUpper();
if( pSav->IsInSct() )
- { // Jetzt wird der oberste Bereich gesucht, der innerhalb von pLay ist.
+ { // search the upmost section inside of pLay
SwFrm* pSect = pLay->FindSctFrm();
SwFrm *pTmp = pSav;
do
@@ -2410,9 +2376,9 @@ SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart )
do
{
if( bGo )
- pFloat->GetUpper()->pLower = 0; //Die Teilkette ausklinken.
+ pFloat->GetUpper()->pLower = 0; // detach the chain part
- //Das Ende der Teilkette suchen, unterwegs die Flys abmelden.
+ // search the end of the chain part, remove Flys on the way
do
{
if( bGo )
@@ -2435,7 +2401,7 @@ SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart )
}
}
else {
- OSL_ENSURE( !pFloat, "Neuer Float-Frame?" );
+ OSL_ENSURE( !pFloat, "new FloatFrame?" );
}
}
if ( pFloat->GetNext() )
@@ -2455,7 +2421,7 @@ SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart )
} while ( pFloat );
- //Die naechste Teilkette suchen und die Ketten miteinander verbinden.
+ // search next chain part and connect both chains
SwFrm *pTmp = pFloat->FindNext();
if( bGo )
pFloat->mpUpper = NULL;
@@ -2469,7 +2435,7 @@ SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart )
if ( pTmp && bGo )
{
- pFloat->mpNext = pTmp; //Die beiden Ketten verbinden.
+ pFloat->mpNext = pTmp; // connect both chains
pFloat->mpNext->mpPrev = pFloat;
}
pFloat = pTmp;
@@ -2483,7 +2449,7 @@ SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart )
// anchored objects to page
static void lcl_AddObjsToPage( SwFrm* _pFrm, SwPageFrm* _pPage )
{
- OSL_ENSURE( _pFrm->GetDrawObjs(), "Keine DrawObjs fuer lcl_AddFlysToPage." );
+ OSL_ENSURE( _pFrm->GetDrawObjs(), "no DrawObjs in lcl_AddObjsToPage." );
SwSortedObjs &rObjs = *_pFrm->GetDrawObjs();
for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
{
@@ -2535,20 +2501,19 @@ static void lcl_AddObjsToPage( SwFrm* _pFrm, SwPageFrm* _pPage )
void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGrow )
{
- OSL_ENSURE( pSav && pParent, "Kein Save oder Parent fuer Restore." );
+ OSL_ENSURE( pSav && pParent, "no Save or Parent provided for RestoreCntnt." );
SWRECTFN( pParent )
- //Wenn es bereits FlowFrms unterhalb des neuen Parent gibt, so wird die
- //Kette, beginnend mit pSav, hinter dem letzten angehaengt.
- //Die Teile werden kurzerhand insertet und geeignet invalidiert.
- //Unterwegs werden die Flys der CntntFrms bei der Seite angemeldet.
+ // If there are already FlowFrms below the new parent, so add the chain (starting with pSav)
+ // after the last one. The parts are inserted and invalidated if needed.
+ // On the way, the Flys of the CntntFrms are registered at the page.
SwPageFrm *pPage = pParent->FindPageFrm();
if ( pPage )
- pPage->InvalidatePage( pPage ); //Invalides Layout anmelden.
+ pPage->InvalidatePage( pPage );
- //Vorgaenger festellen und die Verbindung herstellen bzw. initialisieren.
+ // determine predecessor and establish connection or initialize
pSav->mpPrev = pSibling;
SwFrm* pNxt;
if ( pSibling )
@@ -2556,27 +2521,26 @@ void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGro
pNxt = pSibling->mpNext;
pSibling->mpNext = pSav;
pSibling->_InvalidatePrt();
- ((SwCntntFrm*)pSibling)->InvalidatePage( pPage );//Invaliden Cntnt anmelden.
+ ((SwCntntFrm*)pSibling)->InvalidatePage( pPage );
if ( ((SwCntntFrm*)pSibling)->GetFollow() )
pSibling->Prepare( PREP_CLEAR, 0, sal_False );
}
else
{ pNxt = pParent->pLower;
pParent->pLower = pSav;
- pSav->mpUpper = pParent; //Schon mal setzen, sonst ist fuer das
- //invalidate der Parent (z.B. ein Fly) nicht klar.
- //Invaliden Cntnt anmelden.
+ pSav->mpUpper = pParent; // set here already, so that it is explicit when invalidating
+
if ( pSav->IsCntntFrm() )
((SwCntntFrm*)pSav)->InvalidatePage( pPage );
else
- { // pSav koennte auch ein leerer SectFrm sein
+ { // pSav might be an empty SectFrm
SwCntntFrm* pCnt = pParent->ContainsCntnt();
if( pCnt )
pCnt->InvalidatePage( pPage );
}
}
- //Der Parent muss entsprechend gegrow'ed werden.
+ // the parent needs to grow appropiately
SwTwips nGrowVal = 0;
SwFrm* pLast;
do
@@ -2584,12 +2548,12 @@ void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGro
nGrowVal += (pSav->Frm().*fnRect->fnGetHeight)();
pSav->_InvalidateAll();
- //Jetzt die Flys anmelden, fuer TxtFrms gleich geeignet invalidieren.
+ // register Flys, if TxtFrms than also invalidate appropriately
if ( pSav->IsCntntFrm() )
{
if ( pSav->IsTxtFrm() &&
((SwTxtFrm*)pSav)->GetCacheIdx() != USHRT_MAX )
- ((SwTxtFrm*)pSav)->Init(); //Ich bin sein Freund.
+ ((SwTxtFrm*)pSav)->Init(); // I am its friend
if ( pPage && pSav->GetDrawObjs() )
::lcl_AddObjsToPage( (SwCntntFrm*)pSav, pPage );
@@ -2603,7 +2567,7 @@ void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGro
::lcl_AddObjsToPage( pBlub, pPage );
if( pBlub->IsTxtFrm() && ((SwTxtFrm*)pBlub)->HasFtn() &&
((SwTxtFrm*)pBlub)->GetCacheIdx() != USHRT_MAX )
- ((SwTxtFrm*)pBlub)->Init(); //Ich bin sein Freund.
+ ((SwTxtFrm*)pBlub)->Init(); // I am its friend
pBlub = pBlub->GetNextCntntFrm();
} while ( pBlub && ((SwLayoutFrm*)pSav)->IsAnLower( pBlub ));
}
@@ -2651,8 +2615,7 @@ SwPageFrm * InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
}
}
SwFrmFmt *pFmt(bOdd ? rDesc.GetRightFmt(bFirst) : rDesc.GetLeftFmt(bFirst));
- //Wenn ich kein FrmFmt fuer die Seite gefunden habe, muss ich eben
- //eine Leerseite einfuegen.
+ // If there is no FrmFmt for this page, add an empty page
if ( !pFmt )
{
pFmt = bOdd ? rDesc.GetLeftFmt() : rDesc.GetRightFmt();
@@ -2675,10 +2638,9 @@ SwPageFrm * InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
return pRet;
}
-/* Die beiden folgenden Methoden durchsuchen rekursiv
-|* eine Layoutstruktur und melden alle FlyFrms, die einen beliebigen Frm
-|* innerhalb der Struktur als Anker haben bei der Seite an.
-|*/
+/* The following two methods search the layout structure recursively and
+ * register all Flys at the page that have a Frm in this structure as an anchor.
+ */
static void lcl_Regist( SwPageFrm *pPage, const SwFrm *pAnch )
{
@@ -2689,7 +2651,7 @@ static void lcl_Regist( SwPageFrm *pPage, const SwFrm *pAnch )
if ( pObj->ISA(SwFlyFrm) )
{
SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pObj);
- //Ggf. ummelden, nicht anmelden wenn bereits bekannt.
+ // register (not if already known)
// #i28701# - use new method <GetPageFrm()>
SwPageFrm *pPg = pFly->IsFlyFreeFrm()
? pFly->GetPageFrm() : pFly->FindPageFrm();
@@ -2740,13 +2702,13 @@ void RegistFlys( SwPageFrm *pPage, const SwLayoutFrm *pLay )
}
}
-/// Benachrichtigt den Hintergrund je nach der Veraenderung zwischen altem und neuem Rechteck.
+/// Notify the background based on the difference between old and new rectangle
void Notify( SwFlyFrm *pFly, SwPageFrm *pOld, const SwRect &rOld,
const SwRect* pOldPrt )
{
const SwRect aFrm( pFly->GetObjRectWithSpaces() );
if ( rOld.Pos() != aFrm.Pos() )
- { //Positionsaenderung, alten und neuen Bereich invalidieren
+ { // changed position, invalidate old and new area
if ( rOld.HasArea() &&
rOld.Left()+pFly->GetFmt()->GetLRSpace().GetLeft() < FAR_AWAY )
{
@@ -2755,10 +2717,8 @@ void Notify( SwFlyFrm *pFly, SwPageFrm *pOld, const SwRect &rOld,
pFly->NotifyBackground( pFly->FindPageFrm(), aFrm, PREP_FLY_ARRIVE );
}
else if ( rOld.SSize() != aFrm.SSize() )
- { //Groessenaenderung, den Bereich der Verlassen wurde bzw. jetzt
- //ueberdeckt wird invalidieren.
- //Der Einfachheit halber wird hier bewusst jeweils ein Twip
- //unnoetig invalidiert.
+ { // changed size, invalidate the area that was left or is now overlapped
+ // For simplicity, we purposely invalidate a Twip even if not needed.
SwViewShell *pSh = pFly->getRootFrm()->GetCurrShell();
if( pSh && rOld.HasArea() )
@@ -2886,9 +2846,7 @@ void Notify_Background( const SdrObject* pObj,
const PrepareHint eHint,
const sal_Bool bInva )
{
-
- //Wenn der Frm gerade erstmalig sinnvoll positioniert wurde, braucht der
- //alte Bereich nicht benachrichtigt werden.
+ // If the frame was positioned correctly for the first time, do not inform the old area
if ( eHint == PREP_FLY_LEAVE && rRect.Top() == FAR_AWAY )
return;
@@ -2916,12 +2874,11 @@ void Notify_Background( const SdrObject* pObj,
if( PREP_FLY_ARRIVE != eHint )
lcl_CheckFlowBack( pArea, rRect );
- //Es reagieren sowieso nur die auf den Anker folgenden auf den Fly, also
- //brauchen diese nicht abgeklappert werden.
- //Ausnahme sind ist natuerlich das LEAVE, denn der Fly koennte ja von
- //"oben" kommen.
- // Wenn der Anker auf der vorhergehenden Seite liegt, muss ebenfalls
- // die gesamte Seite abgearbeitet werden. (47722)
+ // Only the Flys following this anchor are reacting. Thus, those do not
+ // need to be processed.
+ // An exception is LEAVE, since the Fly might come "from above".
+ // If the anchor is positioned on the previous page, the whole page
+ // needs to be processed (47722).
// OD 2004-05-13 #i28701# - If the wrapping style has to be considered
// on the object positioning, the complete area has to be processed,
// because content frames before the anchor frame also have to consider
@@ -3006,11 +2963,9 @@ void Notify_Background( const SdrObject* pObj,
pFly->InvalidateSize();
}
}
- //Flys, die ueber mir liegen muessen/mussten evtl.
- //ausweichen, wenn sie eine automatische Ausrichtung haben.
- //das ist unabhaengig von meinem Attribut, weil dies sich
- //gerade geaendert haben kann und eben deshalb
- //umformatiert wurde.
+ // Flys above myself might sidestep if they have an automatic
+ // alignment. This happens independently of my attributes since
+ // this might have been changed as well.
else if ( pFly->IsFlyAtCntFrm() &&
pObj->GetOrdNumDirect() <
pFly->GetVirtDrawObj()->GetOrdNumDirect() &&
@@ -3039,8 +2994,8 @@ void Notify_Background( const SdrObject* pObj,
}
}
-/// liefert bei absatzgebundenen Objekten den Upper des Ankers. Falls es sich dabei um
-/// verkettete Rahmen oder Fussnoten handelt, wird ggf. der "virtuelle" Upper ermittelt.
+/// Provides the Upper of an anchor in paragraph-bound objects. If the latter
+/// is a chained border or a footnote, the "virtual" Upper might be returne.
const SwFrm* GetVirtualUpper( const SwFrm* pFrm, const Point& rPos )
{
if( pFrm->IsTxtFrm() )
@@ -3104,10 +3059,9 @@ bool Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj )
return false;
}
+/// provides the area of a frame in that no Fly from another area can overlap
const SwFrm *FindKontext( const SwFrm *pFrm, sal_uInt16 nAdditionalKontextTyp )
{
- //Liefert die Umgebung des Frm in die kein Fly aus einer anderen
- //Umgebung hineinragen kann.
const sal_uInt16 nTyp = FRM_ROOT | FRM_HEADER | FRM_FOOTER | FRM_FTNCONT |
FRM_FTN | FRM_FLY |
FRM_TAB | FRM_ROW | FRM_CELL |
@@ -3168,9 +3122,7 @@ static SwTwips lcl_CalcCellRstHeight( SwLayoutFrm *pCell )
if ( nFlyAdd )
nHeight += nFlyAdd;
- //Der Border will natuerlich auch mitspielen, er kann leider nicht
- //aus PrtArea und Frm errechnet werden, da diese in beliebiger
- //Kombination ungueltig sein koennen.
+ // The border cannot be calculated based on PrtArea and Frm, since both can be invalid.
SwBorderAttrAccess aAccess( SwFrm::GetCache(), pCell );
const SwBorderAttrs &rAttrs = *aAccess.Get();
nHeight += rAttrs.CalcTop() + rAttrs.CalcBottom();
@@ -3309,8 +3261,7 @@ SwFrm* GetFrmOfModify( const SwRootFrm* pLayout, SwModify const& rMod, sal_uInt1
break;
}
- // bei Flys ggfs. ueber den Parent gehen wenn sie selbst
- // nocht nicht "formatiert" sind
+ // for Flys go via the parent if the Fly is not yet "formatted"
if( !bCalcFrm && nFrmType & FRM_FLY &&
((SwFlyFrm*)pTmpFrm)->GetAnchorFrm() &&
FAR_AWAY == pTmpFrm->Frm().Pos().getX() &&
@@ -3337,8 +3288,7 @@ SwFrm* GetFrmOfModify( const SwRootFrm* pLayout, SwModify const& rMod, sal_uInt1
}
else
{
- // Wenn kein pPoint angegeben ist, dann reichen
- // wir irgendeinen raus: den ersten!
+ // if no pPoint is provided, take the first one
pMinFrm = pTmpFrm;
break;
}
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 5fc4f50f8973..e1ac1b3b0fa7 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -36,8 +36,8 @@
#define ENDNOTE 0x80000000
-/// Sucht die Position des Attributes im FtnArray am Dokument, dort stehen die Fussnoten
-/// gluecklicherweise nach ihrem Index sortiert.
+/// Search the position of an attribute in the FtnArray at the document,
+/// because all footnotes are located there, ordered by their index.
static sal_uLong lcl_FindFtnPos( const SwDoc *pDoc, const SwTxtFtn *pAttr )
{
const SwFtnIdxs &rFtnIdxs = pDoc->GetFtnIdxs();
@@ -63,9 +63,8 @@ sal_Bool SwFtnFrm::operator<( const SwTxtFtn* pTxtFtn ) const
lcl_FindFtnPos( pDoc, pTxtFtn );
}
-/// setzt pBoss auf den naechsten SwFtnBossFrm, das kann entweder eine Spalte oder eine
-/// Seite (ohne Spalten) sein. Wenn die Seite dabei gewechselt wird enthaelt pPage die
-/// neue Seite und die Funktion liefert sal_True.
+/// Set pBoss to the next SwFtnBossFrm, this might be a column or a page (w/o columns).
+/// If this includes a page change, pPage contains the new page and returns TRUE.
static sal_Bool lcl_NextFtnBoss( SwFtnBossFrm* &rpBoss, SwPageFrm* &rpPage,
sal_Bool bDontLeave )
{
@@ -107,7 +106,7 @@ static sal_Bool lcl_NextFtnBoss( SwFtnBossFrm* &rpBoss, SwPageFrm* &rpPage,
return sal_True;
}
-/// liefert die Spaltennummer, wenn pBoss eine Spalte ist, sonst eine Null (bei Seiten).
+/// @returns column number if pBoss is a column, otherwise 0.
static sal_uInt16 lcl_ColumnNum( const SwFrm* pBoss )
{
sal_uInt16 nRet = 0;
@@ -142,8 +141,8 @@ SwFtnContFrm::SwFtnContFrm( SwFrmFmt *pFmt, SwFrm* pSib ):
mnType = FRMC_FTNCONT;
}
-/// lcl_Undersize(..) klappert einen SwFrm und dessen Inneres ab
-/// und liefert die Summe aller TxtFrm-Vergroesserungswuensche
+/// Visits pFrm and its content and returns the sum of all TxtFrm resize requests
+/// E.g. for column sections when those do not yet have the max. size.
static long lcl_Undersize( const SwFrm* pFrm )
{
long nRet = 0;
@@ -152,7 +151,7 @@ static long lcl_Undersize( const SwFrm* pFrm )
{
if( ((SwTxtFrm*)pFrm)->IsUndersized() )
{
- // Dieser TxtFrm waere gern ein bisschen groesser
+ // Does this TxtFrm would like to be a little bit bigger?
nRet = ((SwTxtFrm*)pFrm)->GetParHeight() -
(pFrm->Prt().*fnRect->fnGetHeight)();
if( nRet < 0 )
@@ -171,11 +170,10 @@ static long lcl_Undersize( const SwFrm* pFrm )
return nRet;
}
-/// "Formatiert" den Frame.
-/// Die Fixsize wird hier nicht eingestellt.
+/// "format" the frame (Fixsize is not set here).
void SwFtnContFrm::Format( const SwBorderAttrs * )
{
- //GesamtBorder ermitteln, es gibt nur einen Abstand nach oben.
+ // calculate total border, only one distance to the top
const SwPageFrm* pPage = FindPageFrm();
const SwPageFtnInfo &rInf = pPage->GetPageDesc()->GetFtnInfo();
const SwTwips nBorder = rInf.GetTopDist() + rInf.GetBottomDist() +
@@ -204,19 +202,15 @@ void SwFtnContFrm::Format( const SwBorderAttrs * )
Grow( LONG_MAX, sal_False );
else
{
- //Die Groesse in der VarSize wird durch den Inhalt plus den
- //Raendern bestimmt.
+ // VarSize is determined based on the content plus the borders
SwTwips nRemaining = 0;
SwFrm *pFrm = pLower;
while ( pFrm )
- { // lcl_Undersize(..) beruecksichtigt (rekursiv) TxtFrms, die gerne
- // groesser waeren. Diese entstehen insbesondere in spaltigen Rahmen,
- // wenn diese noch nicht ihre maximale Groesse haben.
- nRemaining += (pFrm->Frm().*fnRect->fnGetHeight)()
- + lcl_Undersize( pFrm );
+ {
+ nRemaining += (pFrm->Frm().*fnRect->fnGetHeight)() + lcl_Undersize( pFrm );
pFrm = pFrm->GetNext();
}
- //Jetzt noch den Rand addieren
+ // add the own border
nRemaining += nBorder;
SwTwips nDiff;
@@ -238,9 +232,8 @@ void SwFtnContFrm::Format( const SwBorderAttrs * )
else if ( nDiff < 0 )
{
Grow( -nDiff );
- //Es kann passieren, dass weniger Platz zur Verfuegung steht,
- //als der bereits der Border benoetigt - die Groesse der
- //PrtArea wird dann negativ.
+ // It might happen that there is less space available than the border
+ // requires. In those cases the size of PrtArea will be negative.
SwTwips nPrtHeight = (Prt().*fnRect->fnGetHeight)();
if( nPrtHeight < 0 )
{
@@ -256,15 +249,12 @@ void SwFtnContFrm::Format( const SwBorderAttrs * )
SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool )
{
- //Keine Pruefung ob FixSize oder nicht, die FtnContainer sind immer bis
- //zur Maximalhoehe variabel.
- //Wenn die Maximalhoehe LONG_MAX ist, so nehmen wir uns soviel Platz wie eben
- //moeglich.
- //Wenn die Seite eine spezielle Fussnotenseite ist, so nehmen wir uns auch
- //soviel Platz wie eben moeglich.
+ // No check if FixSize since FtnContainer are variable up to their max. height.
+ // If the max. height is LONG_MAX, take as much space as needed.
+ // If the page is a special footnote page, take also as much as possible.
#if OSL_DEBUG_LEVEL > 1
if ( !GetUpper() || !GetUpper()->IsFtnBossFrm() )
- { OSL_ENSURE( !this, "Keine FtnBoss." );
+ { OSL_ENSURE( !this, "no FtnBoss." );
return 0;
}
#endif
@@ -300,7 +290,7 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool )
if ( nDist <= 0 )
return 0L;
}
- //Der FtnBoss will bezueglich des MaxWerts auch noch mitreden.
+ // FtnBoss also influences the max value
if( !IsInSct() )
{
const SwTwips nMax = pBoss->GetVarSpace();
@@ -311,8 +301,7 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool )
}
}
else if( nDist > (GetPrev()->Frm().*fnRect->fnGetHeight)() )
- //aber mehr als der Body kann koennen und wollen wir nun auch wieder
- //nicht herausruecken.
+ // do not use more space than the body has
nDist = (GetPrev()->Frm().*fnRect->fnGetHeight)();
long nAvail = 0;
@@ -372,15 +361,13 @@ SwTwips SwFtnContFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool )
if ( nReal != nDist )
{
nDist -= nReal;
- //Den masslosen Wunsch koennen wir leider nur in Grenzen erfuellen.
Frm().SSize().Height() -= nDist;
//Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
if( IsVertical() && !IsVertLR() && !IsReverse() )
Frm().Pos().X() += nDist;
}
- //Nachfolger braucht nicht invalidiert werden, denn wir wachsen
- //immer nach oben.
+ // growing happends upwards, so successors to not need to be invalidated
if( nReal )
{
_InvalidateSize();
@@ -495,10 +482,10 @@ void SwFtnFrm::Cut()
else if ( GetPrev() )
GetPrev()->SetRetouche();
- //Erst removen, dann Upper Shrinken.
+ // first move then shrink Upper
SwLayoutFrm *pUp = GetUpper();
- //Verkettung korrigieren.
+ // correct chaining
SwFtnFrm *pFtn = (SwFtnFrm*)this;
if ( pFtn->GetFollow() )
pFtn->GetFollow()->SetMaster( pFtn->GetMaster() );
@@ -507,12 +494,12 @@ void SwFtnFrm::Cut()
pFtn->SetFollow( 0 );
pFtn->SetMaster( 0 );
- // Alle Verbindungen kappen.
+ // cut all connections
Remove();
if ( pUp )
{
- //Die letzte Fussnote nimmt ihren Container mit.
+ // the last footnote takes the container along
if ( !pUp->Lower() )
{
SwPageFrm *pPage = pUp->FindPageFrm();
@@ -525,8 +512,8 @@ void SwFtnFrm::Cut()
SwSectionFrm* pSect = pUp->FindSctFrm();
pUp->Cut();
delete pUp;
- // Wenn der letzte Fussnotencontainer aus einem spaltigen Bereich verschwindet,
- // so kann dieser, falls er keinen Follow besitzt, zusammenschrumpfen.
+ // If the last footnote container was removed from a column
+ // section without a Follow, then this section can be shrinked.
if( pSect && !pSect->ToMaximize( sal_False ) && !pSect->IsColLocked() )
pSect->_InvalidateSize();
}
@@ -541,14 +528,14 @@ void SwFtnFrm::Cut()
void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
{
- OSL_ENSURE( pParent, "Kein Parent fuer Paste." );
- OSL_ENSURE( pParent->IsLayoutFrm(), "Parent ist CntntFrm." );
- OSL_ENSURE( pParent != this, "Bin selbst der Parent." );
- OSL_ENSURE( pSibling != this, "Bin mein eigener Nachbar." );
+ OSL_ENSURE( pParent, "no parent in Paste." );
+ OSL_ENSURE( pParent->IsLayoutFrm(), "Parent is CntntFrm." );
+ OSL_ENSURE( pParent != this, "I am my own parent." );
+ OSL_ENSURE( pSibling != this, "I am my own sibling." );
OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(),
- "Bin noch irgendwo angemeldet." );
+ "I am still somewhere registered." );
- //In den Baum einhaengen.
+ // insert into tree structure
InsertBefore( (SwLayoutFrm*)pParent, pSibling );
SWRECTFN( this )
@@ -562,11 +549,11 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
if( (Frm().*fnRect->fnGetHeight)() )
pParent->Grow( (Frm().*fnRect->fnGetHeight)() );
- //Wenn mein Vorgaenger mein Master ist und/oder wenn mein Nachfolger mein
- //Follow ist so kann ich deren Inhalt uebernehmen und sie vernichten.
+ // If the predecessor is the master and/or the successor is the Follow,
+ // then take their content and destroy them.
if ( GetPrev() && GetPrev() == GetMaster() )
{ OSL_ENSURE( SwFlowFrm::CastFlowFrm( GetPrev()->GetLower() ),
- "Fussnote ohne Inhalt?" );
+ "Footnote without content?" );
(SwFlowFrm::CastFlowFrm( GetPrev()->GetLower()))->
MoveSubTree( this, GetLower() );
SwFrm *pDel = GetPrev();
@@ -575,7 +562,7 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
}
if ( GetNext() && GetNext() == GetFollow() )
{ OSL_ENSURE( SwFlowFrm::CastFlowFrm( GetNext()->GetLower() ),
- "Fussnote ohne Inhalt?" );
+ "Footnote without content?" );
(SwFlowFrm::CastFlowFrm( GetNext()->GetLower()))->MoveSubTree( this );
SwFrm *pDel = GetNext();
pDel->Cut();
@@ -586,7 +573,7 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
if ( GetPrev() )
{
OSL_ENSURE( lcl_FindFtnPos( pDoc, ((SwFtnFrm*)GetPrev())->GetAttr() ) <=
- lcl_FindFtnPos( pDoc, GetAttr() ), "Prev ist not FtnPrev" );
+ lcl_FindFtnPos( pDoc, GetAttr() ), "Prev is not FtnPrev" );
}
if ( GetNext() )
{
@@ -598,21 +585,20 @@ void SwFtnFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
InvalidateNxtFtnCnts( pPage );
}
-/// Liefert das naechste LayoutBlatt in den das Frame gemoved werden kann.
-/// Neue Seiten werden nur dann erzeugt, wenn der Parameter sal_True ist.
+/// Return the next layout leaf in that the frame can be moved.
SwLayoutFrm *SwFrm::GetNextFtnLeaf( MakePageType eMakePage )
{
SwFtnBossFrm *pOldBoss = FindFtnBossFrm();
SwPageFrm* pOldPage = pOldBoss->FindPageFrm();
SwPageFrm* pPage;
SwFtnBossFrm *pBoss = pOldBoss->IsColumnFrm() ?
- (SwFtnBossFrm*)pOldBoss->GetNext() : 0; // naechste Spalte, wenn vorhanden
+ (SwFtnBossFrm*)pOldBoss->GetNext() : 0; // next column, if existing
if( pBoss )
pPage = NULL;
else
{
if( pOldBoss->GetUpper()->IsSctFrm() )
- { // Das kann nur in einem spaltigen Bereich sein
+ { // this can only be in a column area
SwLayoutFrm* pNxt = pOldBoss->GetNextSctLeaf( eMakePage );
if( pNxt )
{
@@ -625,39 +611,37 @@ SwLayoutFrm *SwFrm::GetNextFtnLeaf( MakePageType eMakePage )
}
else
{
- // naechste Seite
+ // next page
pPage = (SwPageFrm*)pOldPage->GetNext();
- // Leerseiten ueberspringen
+ // skip empty pages
if( pPage && pPage->IsEmptyPage() )
pPage = (SwPageFrm*)pPage->GetNext();
pBoss = pPage;
}
}
- // Was haben wir jetzt?
- // pBoss != NULL, pPage==NULL => pBoss ist die auf der gleichen Seite folgende Spalte
- // pBoss != NULL, pPage!=NULL => pBoss und pPage sind die folgende Seite (Empty uebersprungen)
- // pBoss == NULL => pPage == NULL, es gibt keine folgende Seite
+ // What do we have until here?
+ // pBoss != NULL, pPage==NULL => pBoss is the next column on the same page
+ // pBoss != NULL, pPage!=NULL => pBoss and pPage are the following page (empty pages skipped)
+ // pBoss == NULL => pPage == NULL, so there are no following pages
- //Wenn die Fussnote bereits einen Follow hat brauchen wir nicht zu suchen.
- //Wenn allerdings zwischen Ftn und Follow unerwuenschte Leerseiten/spalten
- //herumlungern, so legen wir auf der naechstbesten Seite/Spalte einen weiteren
- //Follow an, der Rest wird sich schon finden.
+ // If the footnote has already a Follow we do not need to search.
+ // However, if there are unwanted empty columns/pages between Ftn and Follow,
+ // create another Follow on the next best column/page and the rest will sort itself out.
SwFtnFrm *pFtn = FindFtnFrm();
if ( pFtn && pFtn->GetFollow() )
{
SwFtnBossFrm* pTmpBoss = pFtn->GetFollow()->FindFtnBossFrm();
- // Folgende Faelle werden hier erkannt und akzeptiert
- // 1. Die FtnBosse sind benachbarte Seiten oder benachbarte Spalten
- // 2. Der neue ist die erste Spalte der benachbarten Seite
- // 3. Der neue ist die erste Spalte in einem Bereich in der naechsten Spalte/Seite
+ // Following cases will be handled:
+ // 1. both "FtnBoss"es are neighboring columns/pages
+ // 2. the new one is the first column of a neighboring page
+ // 3. the new one is the first column in a section of the next page
while( pTmpBoss != pBoss && pTmpBoss && !pTmpBoss->GetPrev() )
pTmpBoss = pTmpBoss->GetUpper()->FindFtnBossFrm();
if( pTmpBoss == pBoss )
return pFtn->GetFollow();
}
- // Wenn wir keinen pBoss gefunden haben oder es sich um eine "falsche" Seite handelt,
- // muss eine neue Seite her
+ // If no pBoss could be found or it is a "wrong" page, we need a new page.
if ( !pBoss || ( pPage && pPage->IsEndNotePage() && !pOldPage->IsEndNotePage() ) )
{
if ( eMakePage == MAKEPAGE_APPEND || eMakePage == MAKEPAGE_INSERT )
@@ -669,13 +653,13 @@ SwLayoutFrm *SwFrm::GetNextFtnLeaf( MakePageType eMakePage )
return 0;
}
if( pBoss->IsPageFrm() )
- { // Wenn wir auf einer spaltigen Seite gelandet sind,
- // gehen wir in die erste Spalte
+ {
+ // If this page has columns, then go to the first one
SwLayoutFrm* pLay = pBoss->FindBodyCont();
if( pLay && pLay->Lower() && pLay->Lower()->IsColumnFrm() )
pBoss = (SwFtnBossFrm*)pLay->Lower();
}
- //Seite/Spalte gefunden, da schummeln wir uns doch gleich mal 'rein
+ // found column/page - add myself
SwFtnContFrm *pCont = pBoss->FindFtnCont();
if ( !pCont && pBoss->GetMaxFtnHeight() &&
( eMakePage == MAKEPAGE_APPEND || eMakePage == MAKEPAGE_INSERT ) )
@@ -683,11 +667,11 @@ SwLayoutFrm *SwFrm::GetNextFtnLeaf( MakePageType eMakePage )
return pCont;
}
-/// Liefert das vorhergehende LayoutBlatt in das der Frame gemoved werden kann.
+/// Get the preceeding layout leaf in that the frame can be moved.
SwLayoutFrm *SwFrm::GetPrevFtnLeaf( MakePageType eMakeFtn )
{
- //Der Vorgaenger fuer eine Fussnote ist falls moeglich der Master
- //in der Fussnoteneigenen Verkettung.
+ // The predecessor of a footnote is (if possible)
+ // the master of the chain of the footnote.
SwFtnFrm *pFtn = FindFtnFrm();
SwLayoutFrm *pRet = pFtn->GetMaster();
@@ -695,7 +679,7 @@ SwLayoutFrm *SwFrm::GetPrevFtnLeaf( MakePageType eMakeFtn )
SwPageFrm *pOldPage = pOldBoss->FindPageFrm();
if ( !pOldBoss->GetPrev() && !pOldPage->GetPrev() )
- return pRet; // es gibt weder eine Spalte noch eine Seite vor uns
+ return pRet; // there is neither a predecessor column nor page
if ( !pRet )
{
@@ -713,9 +697,8 @@ SwLayoutFrm *SwFrm::GetPrevFtnLeaf( MakePageType eMakeFtn )
const sal_uInt16 nNum = pStop->GetPhyPageNum();
- //Wenn die Fussnoten am Dokumentende angezeigt werden, so verlassen wir
- //die Entsprechenden Seiten nicht.
- //Selbiges gilt analog fuer die Endnotenseiten.
+ // Do not leave the corresponding page if the footnote should
+ // be shown at the document ending or the footnote is an endnote.
const sal_Bool bEndNote = pOldPage->IsEndNotePage();
const sal_Bool bFtnEndDoc = pOldPage->IsFtnPage();
SwFtnBossFrm* pNxtBoss = pOldBoss;
@@ -725,8 +708,8 @@ SwLayoutFrm *SwFrm::GetPrevFtnLeaf( MakePageType eMakeFtn )
do
{
if( pNxtBoss->IsColumnFrm() && pNxtBoss->GetPrev() )
- pNxtBoss = (SwFtnBossFrm*)pNxtBoss->GetPrev(); // eine Spalte zurueck
- else // oder eine Seite zurueck
+ pNxtBoss = (SwFtnBossFrm*)pNxtBoss->GetPrev(); // one column backwards
+ else // one page backwards
{
SwLayoutFrm* pBody = 0;
if( pSect )
@@ -753,12 +736,11 @@ SwLayoutFrm *SwFrm::GetPrevFtnLeaf( MakePageType eMakeFtn )
SwPageFrm* pPage = (SwPageFrm*)pNxtBoss->FindPageFrm()->GetPrev();
if( !pPage || pPage->GetPhyPageNum() < nNum ||
bEndNote != pPage->IsEndNotePage() || bFtnEndDoc != pPage->IsFtnPage() )
- return NULL; // Keine in Frage kommende Seite mehr gefunden
+ return NULL; // no further pages found
pNxtBoss = pPage;
pBody = pPage->FindBodyCont();
}
- // Die vorherige Seite haben wir nun, ggf. sollten wir in die letzte Spalte
- // der Seite wechseln
+ // We have the previous page, we might need to find the last column of it
if( pBody )
{
if ( pBody->Lower() && pBody->Lower()->IsColumnFrm() )
@@ -774,9 +756,9 @@ SwLayoutFrm *SwFrm::GetPrevFtnLeaf( MakePageType eMakeFtn )
break;
}
if ( pStop == pNxtBoss )
- { //Die Seite/Spalte auf der sich auch die Referenz tummelt, ist erreicht.
- //Wir koennen jetzt probehalber mal einen Container erzeugen und
- //uns hineinpasten.
+ {
+ // Reached the column/page of the reference.
+ // Try to add a container and paste our content.
if ( eMakeFtn == MAKEPAGE_FTN && pNxtBoss->GetMaxFtnHeight() )
pRet = pNxtBoss->MakeFtnCont();
break;
@@ -787,14 +769,14 @@ SwLayoutFrm *SwFrm::GetPrevFtnLeaf( MakePageType eMakeFtn )
{
const SwFtnBossFrm* pNewBoss = pRet->FindFtnBossFrm();
bool bJump = false;
- if( pOldBoss->IsColumnFrm() && pOldBoss->GetPrev() ) // es gibt eine vorherige Spalte
- bJump = pOldBoss->GetPrev() != (SwFrm*)pNewBoss; // sind wir darin gelandet?
+ if( pOldBoss->IsColumnFrm() && pOldBoss->GetPrev() ) // a previous column exists
+ bJump = pOldBoss->GetPrev() != (SwFrm*)pNewBoss; // did we chose it?
else if( pNewBoss->IsColumnFrm() && pNewBoss->GetNext() )
- bJump = true; // es gibt hinter dem neuen Boss noch eine Spalte, die aber nicht
- // der alte Boss sein kann, das haben wir ja bereits geprueft.
- else // hier landen wir nur, wenn neuer und alter Boss entweder Seiten oder letzte (neu)
- { // bzw. erste (alt) Spalten einer Seite sind. In diesem Fall muss noch geprueft
- // werden, ob Seiten ueberspringen wurden.
+ bJump = true; // there is another column after the boss (not the old boss)
+ else
+ {
+ // Will be reached only if old and new boss are both either pages or the last (new)
+ // or first (old) column of a page. In this case, check if pages were skipped.
sal_uInt16 nDiff = pOldPage->GetPhyPageNum() - pRet->FindPageFrm()->GetPhyPageNum();
if ( nDiff > 2 ||
(nDiff > 1 && !((SwPageFrm*)pOldPage->GetPrev())->IsEmptyPage()) )
@@ -813,7 +795,7 @@ sal_Bool SwFrm::IsFtnAllowed() const
if ( IsInTab() )
{
- //Keine Ftns in wiederholten Headlines.
+ // no footnotes in repeated headlines
const SwTabFrm *pTab = ((SwFrm*)this)->ImplFindTabFrm();
if ( pTab->IsFollow() )
return !pTab->IsInHeadline( *this );
@@ -823,7 +805,7 @@ sal_Bool SwFrm::IsFtnAllowed() const
void SwRootFrm::UpdateFtnNums()
{
- //Seitenweise Numerierung nur wenn es am Dokument so eingestellt ist.
+ // page numbering only if set at the document
if ( GetFmt()->GetDoc()->GetFtnInfo().eNum == FTNNUM_PAGE )
{
SwPageFrm *pPage = (SwPageFrm*)Lower();
@@ -835,7 +817,7 @@ void SwRootFrm::UpdateFtnNums()
}
}
-/// Entfernen aller Fussnoten (nicht etwa die Referenzen) und Entfernen aller Fussnotenseiten.
+/// remove all footnotes (not the references) and all footnote pages
void sw_RemoveFtns( SwFtnBossFrm* pBoss, sal_Bool bPageOnly, sal_Bool bEndNotes )
{
do
@@ -844,7 +826,7 @@ void sw_RemoveFtns( SwFtnBossFrm* pBoss, sal_Bool bPageOnly, sal_Bool bEndNotes
if ( pCont )
{
SwFtnFrm *pFtn = (SwFtnFrm*)pCont->Lower();
- OSL_ENSURE( pFtn, "FtnCont ohne Ftn." );
+ OSL_ENSURE( pFtn, "Footnote content without footnote." );
if ( bPageOnly )
while ( pFtn->GetMaster() )
pFtn = pFtn->GetMaster();
@@ -885,7 +867,7 @@ void sw_RemoveFtns( SwFtnBossFrm* pBoss, sal_Bool bPageOnly, sal_Bool bEndNotes
}
}
}
- // noch 'ne Spalte?
+ // is there another column?
pBoss = pBoss->IsColumnFrm() ? (SwColumnFrm*)pBoss->GetNext() : NULL;
} while( pBoss );
}
@@ -896,13 +878,14 @@ void SwRootFrm::RemoveFtns( SwPageFrm *pPage, sal_Bool bPageOnly, sal_Bool bEndN
pPage = (SwPageFrm*)Lower();
do
- { // Bei spaltigen Seiten muessen wir in allen Spalten aufraeumen
+ {
+ // if the page has columns, cleanup all of them
SwFtnBossFrm* pBoss;
SwLayoutFrm* pBody = pPage->FindBodyCont();
if( pBody && pBody->Lower() && pBody->Lower()->IsColumnFrm() )
- pBoss = (SwFtnBossFrm*)pBody->Lower(); // die erste Spalte
+ pBoss = (SwFtnBossFrm*)pBody->Lower(); // first column
else
- pBoss = pPage; // keine Spalten
+ pBoss = pPage; // no columns
sw_RemoveFtns( pBoss, bPageOnly, bEndNotes );
if ( !bPageOnly )
{
@@ -923,7 +906,6 @@ void SwRootFrm::RemoveFtns( SwPageFrm *pPage, sal_Bool bPageOnly, sal_Bool bEndN
} while ( pPage );
}
-/// Seitenvorlagen der Fussnotenseiten aendern
void SwRootFrm::CheckFtnPageDescs( sal_Bool bEndNote )
{
SwPageFrm *pPage = (SwPageFrm*)Lower();
@@ -931,19 +913,24 @@ void SwRootFrm::CheckFtnPageDescs( sal_Bool bEndNote )
pPage = (SwPageFrm*)pPage->GetNext();
while ( pPage && pPage->IsEndNotePage() != bEndNote )
pPage = (SwPageFrm*)pPage->GetNext();
+
if ( pPage )
SwFrm::CheckPageDescs( pPage, sal_False );
}
+/** Insert a footnote container
+ *
+ * A footnote container is always placed directly behind the body text.
+ *
+ * The frame format (FrmFmt) is always the default frame format.
+ *
+ * @return footnote container frame
+ */
SwFtnContFrm *SwFtnBossFrm::MakeFtnCont()
{
- //Einfuegen eines Fussnotencontainers. Der Fussnotencontainer sitzt
- //immer direkt hinter dem Bodytext.
- //Sein FrmFmt ist immer das DefaultFrmFmt.
-
#if OSL_DEBUG_LEVEL > 1
if ( FindFtnCont() )
- { OSL_ENSURE( !this, "Fussnotencontainer bereits vorhanden." );
+ { OSL_ENSURE( !this, "footnote container exists already." );
return 0;
}
#endif
@@ -964,10 +951,10 @@ SwFtnContFrm *SwFtnBossFrm::FindFtnCont()
if ( pFrm )
{
SwFrm *pFtn = pFrm->GetLower();
- OSL_ENSURE( pFtn, "Cont ohne Fussnote." );
+ OSL_ENSURE( pFtn, "Content without footnote." );
while ( pFtn )
{
- OSL_ENSURE( pFtn->IsFtnFrm(), "Nachbar von Fussnote keine Fussnote." );
+ OSL_ENSURE( pFtn->IsFtnFrm(), "Neighbor of footnote is not a footnote." );
pFtn = pFtn->GetNext();
}
}
@@ -990,8 +977,7 @@ SwFtnContFrm *SwFtnBossFrm::FindNearestFtnCont( sal_Bool bDontLeave )
do
{
sal_Bool bChgPage = lcl_NextFtnBoss( pBoss, pPage, bDontLeave );
- // Haben wir noch einen Boss gefunden? Bei einem Seitenwechsel muss
- // zudem noch das EndNotenFlag uebereinstimmen
+ // Found another boss? When changing pages, also the endnote flag must match.
if( pBoss && ( !bChgPage || pPage->IsEndNotePage() == bEndNote ) )
pCont = pBoss->FindFtnCont();
} while ( !pCont && pPage );
@@ -1002,18 +988,18 @@ SwFtnContFrm *SwFtnBossFrm::FindNearestFtnCont( sal_Bool bDontLeave )
SwFtnFrm *SwFtnBossFrm::FindFirstFtn()
{
- //Erstmal den naechsten FussnotenContainer suchen.
+ // search for the nearest footnote container
SwFtnContFrm *pCont = FindNearestFtnCont();
if ( !pCont )
return 0;
- //Ab der ersten Fussnote im Container die erste suchen, die
- //von der aktuellen Spalte (bzw. einspaltigen Seite) referenziert wird.
+ // Starting from the first footnote, search the first
+ // footnote that is referenced by the current column/page
SwFtnFrm *pRet = (SwFtnFrm*)pCont->Lower();
const sal_uInt16 nRefNum = FindPageFrm()->GetPhyPageNum();
const sal_uInt16 nRefCol = lcl_ColumnNum( this );
- sal_uInt16 nPgNum, nColNum; //Seitennummer, Spaltennummer
+ sal_uInt16 nPgNum, nColNum; // page number, column number
SwFtnBossFrm* pBoss;
SwPageFrm* pPage;
if( pRet )
@@ -1028,17 +1014,16 @@ SwFtnFrm *SwFtnBossFrm::FindFirstFtn()
{
nColNum = lcl_ColumnNum( pBoss );
if( nColNum == nRefCol )
- return pRet; //hat ihn.
+ return pRet; // found
else if( nColNum > nRefCol )
- return NULL; //mind. eine Spalte zu weit.
+ return NULL; // at least one column too far
}
else if ( nPgNum > nRefNum )
- return NULL; //mind. eine Seite zu weit.
+ return NULL; // at least one column too far
}
else
return NULL;
- // Ende, wenn Ref auf einer spaeteren Seite oder auf der gleichen Seite in einer
- // spaeteren Spalte liegt
+ // Done if Ref is on a subsequent page or on the same page in a subsequent column
do
{
@@ -1050,7 +1035,7 @@ SwFtnFrm *SwFtnBossFrm::FindFirstFtn()
{
pBoss = pRet->FindFtnBossFrm();
pPage = pBoss->FindPageFrm();
- lcl_NextFtnBoss( pBoss, pPage, sal_False ); // naechster FtnBoss
+ lcl_NextFtnBoss( pBoss, pPage, sal_False ); // next FtnBoss
pCont = pBoss ? pBoss->FindNearestFtnCont() : 0;
if ( pCont )
pNxt = (SwFtnFrm*)pCont->Lower();
@@ -1065,26 +1050,26 @@ SwFtnFrm *SwFtnBossFrm::FindFirstFtn()
{
nColNum = lcl_ColumnNum( pBoss );
if( nColNum == nRefCol )
- break; //hat ihn.
+ break; // found
else if( nColNum > nRefCol )
- pRet = 0; //mind. eine Spalte zu weit.
+ pRet = 0; // at least one column too far
}
else if ( nPgNum > nRefNum )
- pRet = 0; //mind. eine Seite zu weit.
+ pRet = 0; // at least one column too far
}
else
- pRet = 0; //Gibt eben keinen.
+ pRet = 0; // There is no match.
} while( pRet );
return pRet;
}
-/// Erste Fussnote zum Cnt suchen.
+/// Get the first footnote of a given content
const SwFtnFrm *SwFtnBossFrm::FindFirstFtn( SwCntntFrm *pCnt ) const
{
const SwFtnFrm *pRet = ((SwFtnBossFrm*)this)->FindFirstFtn();
if ( pRet )
{
- const sal_uInt16 nColNum = lcl_ColumnNum( this ); //Spaltennummer
+ const sal_uInt16 nColNum = lcl_ColumnNum( this );
const sal_uInt16 nPageNum = GetPhyPageNum();
while ( pRet && (pRet->GetRef() != pCnt) )
{
@@ -1096,7 +1081,7 @@ const SwFtnFrm *SwFtnBossFrm::FindFirstFtn( SwCntntFrm *pCnt ) const
else
{ SwFtnBossFrm *pBoss = (SwFtnBossFrm*)pRet->FindFtnBossFrm();
SwPageFrm *pPage = pBoss->FindPageFrm();
- lcl_NextFtnBoss( pBoss, pPage, sal_False ); // naechster FtnBoss
+ lcl_NextFtnBoss( pBoss, pPage, sal_False ); // next FtnBoss
SwFtnContFrm *pCont = pBoss ? pBoss->FindNearestFtnCont() : 0;
pRet = pCont ? (SwFtnFrm*)pCont->Lower() : 0;
}
@@ -1114,9 +1099,7 @@ const SwFtnFrm *SwFtnBossFrm::FindFirstFtn( SwCntntFrm *pCnt ) const
void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck )
{
- //Vernichten der Inkarnationen von Fussnoten zum Attribut, wenn sie nicht
- //zu pAssumed gehoeren.
- OSL_ENSURE( !pCheck->GetMaster(), "Master not an Master." );
+ OSL_ENSURE( !pCheck->GetMaster(), "given master is not a Master." );
SwNodeIndex aIdx( *pCheck->GetAttr()->GetStartNode(), 1 );
SwCntntNode *pNd = aIdx.GetNode().GetCntntNode();
@@ -1154,14 +1137,11 @@ void SwFtnBossFrm::ResetFtn( const SwFtnFrm *pCheck )
void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew )
{
- //Die Fussnote haben wir, sie muss jetzt nur noch irgendwo
- //hin und zwar vor die Fussnote, deren Attribut vor das
- //der neuen zeigt (Position wird ueber das Doc ermittelt)
- //Gibt es in diesem Fussnotenboss noch keine Fussnoten, so muss eben ein
- //Container erzeugt werden.
- //Gibt es bereits einen Container aber noch keine Fussnote zu diesem
- //Fussnotenboss, so muss die Fussnote hinter die letzte Fussnote der dichtesten
- //Vorseite/spalte.
+ // Place the footnote in front of the footnote whose attribute
+ // is in front of the new one (get position via the Doc).
+ // If there is no footnote in this footnote-boss yet, create a new container.
+ // If there is a container but no footnote for this footnote-boss yet, place
+ // the footnote behind the last footnote of the closest previous column/page.
ResetFtn( pNew );
SwFtnFrm *pSibling = FindFirstFtn();
@@ -1210,7 +1190,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew )
FindPageFrm()->IsEndNotePage() )
pSibling = NULL;
- //Damit die Position herausgefunden werden kann.
+ // use the Doc to find out the position
SwDoc *pDoc = GetFmt()->GetDoc();
const sal_uLong nStPos = ::lcl_FindFtnPos( pDoc, pNew->GetAttr() );
@@ -1228,11 +1208,9 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew )
{ pParent = FindFtnCont();
if ( !pParent )
{
- //Es gibt noch keinen FussnotenContainer, also machen wir einen.
- //HAAAAAAAALT! So einfach ist das leider mal wieder nicht: Es kann
- //sein, dass irgendeine naechste Fussnote existiert die vor der
- //einzufuegenden zu stehen hat, weil z.B. eine Fussnote ueber zig
- //Seiten aufgespalten ist usw.
+ // There is no footnote container yet. Before creating one, keep in mind that
+ // there might exist another following footnote that must be placed before the
+ // new inserted one e.g. because it was divided over multiple pages etc.
pParent = FindNearestFtnCont( bDontLeave );
if ( pParent )
{
@@ -1249,27 +1227,25 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew )
}
}
if ( !pParent )
- //Jetzt kann aber ein Fussnotencontainer gebaut werden.
+ // here, we are sure that we can create a footnote container
pParent = MakeFtnCont();
else
{
- //Ausgehend von der ersten Fussnote unterhalb des Parents wird die
- //erste Fussnote gesucht deren Index hinter dem Index der
- //einzufuegenden liegt; vor dieser kann der neue dann gepastet
- //werden.
+ // Based on the first footnote below the Parent, search for the first footnote whose
+ // index is after the index of the newly inserted, to place the new one correctly
pSibling = (SwFtnFrm*)pParent->Lower();
if ( !pSibling )
- { OSL_ENSURE( !this, "Keinen Platz fuer Fussnote gefunden.");
+ { OSL_ENSURE( !this, "No place for a footnote.");
return;
}
nCmpPos = ::lcl_FindFtnPos( pDoc, pSibling->GetAttr() );
- SwFtnBossFrm *pNxtB = this; //Immer den letzten merken, damit wir nicht
- SwFtnFrm *pLastSib = 0; //ueber das Ziel hinausschiessen.
+ SwFtnBossFrm *pNxtB = this; // remember the last one to not
+ SwFtnFrm *pLastSib = 0; // go too far.
while ( pSibling && nCmpPos <= nStPos )
{
- pLastSib = pSibling; // der kommt schon mal in Frage
+ pLastSib = pSibling; // potential candidate
nLastPos = nCmpPos;
while ( pSibling->GetFollow() )
@@ -1288,14 +1264,14 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew )
SwPageFrm *pSibPage = pNxtB->FindPageFrm();
sal_Bool bEndNote = pSibPage->IsEndNotePage();
sal_Bool bChgPage = lcl_NextFtnBoss( pNxtB, pSibPage, bDontLeave );
- // Bei Seitenwechsel muss das EndNoteFlag ueberprueft werden.
+ // When changing pages, also the endnote flag must match.
SwFtnContFrm *pCont = pNxtB && ( !bChgPage ||
pSibPage->IsEndNotePage() == bEndNote )
? pNxtB->FindNearestFtnCont( bDontLeave ) : 0;
if( pCont )
pSibling = (SwFtnFrm*)pCont->Lower();
- else // kein weiterer FtnContainer, dann werden wir uns wohl hinter
- break; // pSibling haengen
+ else // no further FtnContainer, insert after pSibling
+ break;
}
if ( pSibling )
{
@@ -1303,20 +1279,19 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew )
OSL_ENSURE( nCmpPos > nLastPos, "InsertFtn: Order of FtnFrm's buggy" );
}
}
- // pLastSib ist jetzt die letzte Fussnote vor uns,
- // pSibling leer oder die erste nach uns.
+ // pLastSib is the last footnote before the new one and
+ // pSibling is empty or the first one afterw the new one
if ( pSibling && pLastSib && (pSibling != pLastSib) )
- { //Sind wir vielleicht bereits ueber das Ziel hinausgeschossen?
+ {
+ // too far?
if ( nCmpPos > nStPos )
pSibling = pLastSib;
}
else if ( !pSibling )
- { //Eine Chance haben wir noch: wir nehmen einfach die letzte
- //Fussnote im Parent. Ein Sonderfall, der z.B. beim
- //zurueckfliessen von Absaetzen mit mehreren Fussnoten
- //vorkommt.
- //Damit wir nicht die Reihenfolge verwuerfeln muessen wir den
- //Parent der letzten Fussnote, die wir an der Hand hatten benutzen.
+ {
+ // Last chance: Take the last footnote of the parent.
+ // Special case that happens e.g. when moving paragraphs with multiple footnotes.
+ // To keep the order, use the parent of the last inspected footnote.
pSibling = pLastSib;
while( pSibling->GetFollow() )
pSibling = pSibling->GetFollow();
@@ -1325,14 +1300,13 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew )
}
}
else
- { //Die erste Fussnote der Spalte/Seite haben wir an der Hand, jetzt ausgehend
- //von dieser die erste zur selben Spalte/Seite suchen deren Index hinter
- //den uebergebenen zeigt, die letzte, die wir an der Hand hatten, ist
- //dann der Vorgaenger.
+ {
+ // First footnote of the column/page found. Now search from there for the first one on the
+ // same column/page whose index is after the given one. The last one found is the predecessor.
SwFtnBossFrm* pBoss = pNew->GetRef()->FindFtnBossFrm(
!pNew->GetAttr()->GetFtn().IsEndNote() );
- sal_uInt16 nRefNum = pBoss->GetPhyPageNum(); // Die Seiten- und
- sal_uInt16 nRefCol = lcl_ColumnNum( pBoss ); // Spaltennummer der neuen Fussnote
+ sal_uInt16 nRefNum = pBoss->GetPhyPageNum(); // page number of the new footnote
+ sal_uInt16 nRefCol = lcl_ColumnNum( pBoss ); // column number of the new footnote
bool bEnd = false;
SwFtnFrm *pLastSib = 0;
while ( pSibling && !bEnd && (nCmpPos <= nStPos) )
@@ -1362,7 +1336,7 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew )
SwPageFrm *pSibPage = pNxtB->FindPageFrm();
sal_Bool bEndNote = pSibPage->IsEndNotePage();
sal_Bool bChgPage = lcl_NextFtnBoss( pNxtB, pSibPage, bDontLeave );
- // Bei Seitenwechsel muss das EndNoteFlag ueberprueft werden.
+ // When changing pages, also the endnote flag must match.
SwFtnContFrm *pCont = pNxtB && ( !bChgPage ||
pSibPage->IsEndNotePage() == bEndNote )
? pNxtB->FindNearestFtnCont( bDontLeave ) : 0;
@@ -1374,7 +1348,8 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew )
if ( !bEnd && pSibling )
nCmpPos = ::lcl_FindFtnPos( pDoc, pSibling->GetAttr() );
if ( pSibling && pLastSib && (pSibling != pLastSib) )
- { //Sind wir vielleicht bereits ueber das Ziel hinausgeschossen?
+ {
+ // too far?
if ( (nLastPos < nCmpPos) && (nCmpPos > nStPos) )
{
pSibling = pLastSib;
@@ -1414,15 +1389,13 @@ void SwFtnBossFrm::InsertFtn( SwFtnFrm* pNew )
void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
{
- //Wenn es die Fussnote schon gibt tun wir nix.
+ // If the footnote already exists, do nothing.
if ( FindFtn( pRef, pAttr ) )
return;
- //Wenn Fussnoten am Dokumentende eingestellt sind, so brauchen wir 'eh erst
- //ab der entsprechenden Seite zu suchen.
- //Wenn es noch keine gibt, muss eben eine erzeugt werden.
- //Wenn es sich um eine Endnote handelt, muss eine Endnotenseite gesucht
- //bzw. erzeugt werden.
+ // If footnotes are placed at the document ending, search from the corresponding page.
+ // If there is no, create one.
+ // If the given one is a endnote, search/create an endnote page.
SwDoc *pDoc = GetFmt()->GetDoc();
SwFtnBossFrm *pBoss = this;
SwPageFrm *pPage = FindPageFrm();
@@ -1460,9 +1433,8 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
}
else
{
- //Wir koennen wenigstens schon mal ungefaehr die richtige Seite
- //suchen. Damit stellen wir sicher das wir auch bei hunderten
- //Fussnoten noch in endlicher Zeit fertig werden.
+ // Search roughly for the right page to ensure finishing in
+ // finite time even if there are hundereds of footnotes.
SwPageFrm *pNxt = (SwPageFrm*)pPage->GetNext();
const sal_uLong nStPos = ::lcl_FindFtnPos( pDoc, pAttr );
while ( pNxt && pNxt->IsEndNotePage() )
@@ -1470,7 +1442,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
SwFtnContFrm *pCont = pNxt->FindFtnCont();
if ( pCont && pCont->Lower() )
{
- OSL_ENSURE( pCont->Lower()->IsFtnFrm(), "Keine Ftn im Container" );
+ OSL_ENSURE( pCont->Lower()->IsFtnFrm(), "no footnote in the container" );
if ( nStPos > ::lcl_FindFtnPos( pDoc,
((SwFtnFrm*)pCont->Lower())->GetAttr()))
{
@@ -1503,9 +1475,8 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
}
else
{
- //Wir koennen wenigstens schon mal ungefaehr die richtige Seite
- //suchen. Damit stellen wir sicher das wir auch bei hunderten
- //Fussnoten noch in endlicher Zeit fertig werden.
+ // Search roughly for the right page to ensure finishing in
+ // finite time even if there are hundereds of footnotes.
SwPageFrm *pNxt = (SwPageFrm*)pPage->GetNext();
const sal_uLong nStPos = ::lcl_FindFtnPos( pDoc, pAttr );
while ( pNxt && pNxt->IsFtnPage() && !pNxt->IsEndNotePage() )
@@ -1513,7 +1484,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
SwFtnContFrm *pCont = pNxt->FindFtnCont();
if ( pCont && pCont->Lower() )
{
- OSL_ENSURE( pCont->Lower()->IsFtnFrm(), "Keine Ftn im Container" );
+ OSL_ENSURE( pCont->Lower()->IsFtnFrm(), "no footnote in the container" );
if ( nStPos > ::lcl_FindFtnPos( pDoc,
((SwFtnFrm*)pCont->Lower())->GetAttr()))
{
@@ -1527,14 +1498,15 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
}
}
- //Erstmal eine Fussnote und die benoetigten CntntFrms anlegen.
+ // For now, create a footnote and the corresponding content frames
if ( !pAttr->GetStartNode() )
- { OSL_ENSURE( !this, "Kein Fussnoteninhalt." );
+ {
+ OSL_ENSURE( !this, "no footnote content." );
return;
}
- // Wenn es auf der Seite/Spalte bereits einen FtnCont gibt,
- // kann in einen spaltigen Bereich keiner erzeugt werden.
+ // If there is already a footnote content on the column/page,
+ // another one cannot be created in a column area.
if( pBoss->IsInSct() && pBoss->IsColumnFrm() && !pPage->IsFtnPage() )
{
SwSectionFrm* pSct = pBoss->FindSctFrm();
@@ -1558,8 +1530,7 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
SwNodeIndex aIdx( *pAttr->GetStartNode(), 1 );
::_InsertCnt( pNew, pDoc, aIdx.GetIndex() );
}
- // Wenn die Seite gewechselt (oder gar neu angelegt) wurde,
- // muessen wir uns dort in die erste Spalte setzen
+ // If the page was changed (or newly created), go to the first column
if( bChgPage )
{
SwLayoutFrm* pBody = pPage->FindBodyCont();
@@ -1567,16 +1538,15 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
if( pBody->Lower() && pBody->Lower()->IsColumnFrm() )
pBoss = (SwFtnBossFrm*)pBody->Lower();
else
- pBoss = pPage; // bei nichtspaltigen Seiten auf die Seite selbst
+ pBoss = pPage; // page if no columns exist
}
pBoss->InsertFtn( pNew );
- if ( pNew->GetUpper() ) //Eingesetzt oder nicht?
+ if ( pNew->GetUpper() ) // inserted or not?
{
::RegistFlys( pNew->FindPageFrm(), pNew );
SwSectionFrm* pSect = FindSctFrm();
- // Der Inhalt des FtnContainers in einem (spaltigen) Bereich
- // braucht nur kalkuliert zu werden,
- // wenn der Bereich bereits bis zur Unterkante seines Uppers geht.
+ // The content of a FtnContainer in a (column) section only need to be calculated
+ // if the section streches already to the bottom edge of the Upper.
if( pSect && !pSect->IsJoinLocked() && ( bEnd ? !pSect->IsEndnAtEnd() :
!pSect->IsFtnAtEnd() ) && pSect->Growable() )
pSect->InvalidateSize();
@@ -1630,8 +1600,8 @@ void SwFtnBossFrm::AppendFtn( SwCntntFrm *pRef, SwTxtFtn *pAttr )
SwFtnFrm *SwFtnBossFrm::FindFtn( const SwCntntFrm *pRef, const SwTxtFtn *pAttr )
{
- //Der einfachste und sicherste Weg geht ueber das Attribut.
- OSL_ENSURE( pAttr->GetStartNode(), "FtnAtr ohne StartNode." );
+ // the easiest and savest way goes via the attribut
+ OSL_ENSURE( pAttr->GetStartNode(), "FtnAtr without StartNode." );
SwNodeIndex aIdx( *pAttr->GetStartNode(), 1 );
SwCntntNode *pNd = aIdx.GetNode().GetCntntNode();
if ( !pNd )
@@ -1715,20 +1685,19 @@ void SwFtnBossFrm::CollectFtns( const SwCntntFrm* _pRef,
while( !pFtn )
{
if( _pOld->IsColumnFrm() )
- { // Spalten abklappern
+ {
+ // visit columns
while ( !pFtn && _pOld->GetPrev() )
{
- //Wenn wir keine Fussnote gefunden haben, ist noch nicht alles zu
- //spaet. Die Schleife wird beim Aufnehmen von Follow-Zeilen durch
- //Tabellen benoetigt. Fuer alle anderen Faelle ist sie in der Lage
- //'krumme' Verhaeltnisse zu korrigieren.
+ // Still no problem if no footnote was found yet. The loop is needed to pick up
+ // following rows in tables. In all other cases it might correct bad contexts.
_pOld = (SwFtnBossFrm*)_pOld->GetPrev();
pFtn = _pOld->FindFirstFtn();
}
}
if( !pFtn )
{
- // vorherige Seite
+ // previous page
SwPageFrm* pPg;
for ( SwFrm* pTmp = _pOld;
0 != ( pPg = (SwPageFrm*)pTmp->FindPageFrm()->GetPrev())
@@ -1743,11 +1712,11 @@ void SwFtnBossFrm::CollectFtns( const SwCntntFrm* _pRef,
SwLayoutFrm* pBody = pPg->FindBodyCont();
if( pBody->Lower() && pBody->Lower()->IsColumnFrm() )
{
- // mehrspaltige Seite => letzte Spalte suchen
+ // multiple columns on one page => search last column
_pOld = static_cast<SwFtnBossFrm*>(pBody->GetLastLower());
}
else
- _pOld = pPg; // einspaltige Seite
+ _pOld = pPg; // single column page
pFtn = _pOld->FindFirstFtn();
}
}
@@ -1784,23 +1753,16 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
OSL_ENSURE( !_bCollectOnlyPreviousFtns || _pRefFtnBossFrm,
"<SwFtnBossFrm::_CollectFtns(..)> - No reference footnote boss frame for collecting only previous footnotes set.\nCrash will be caused!" );
- //Alle Fussnoten die von pRef referenziert werden nacheinander
- //einsammeln (Attribut fuer Attribut), zusammengefuegen
- //(der Inhalt zu einem Attribut kann ueber mehrere Seiten verteilt sein)
- //und ausschneiden.
-
- SwFtnFrms aNotFtnArr; //Zur Robustheit werden hier die nicht
- //dazugehoerigen Fussnoten eingetragen.
- //Wenn eine Fussnote zweimal angefasst wird
- //ists vorbei! So kommt die Funktion auch
- //noch mit einem kaputten Layout
- //einigermassen (ohne Schleife und Absturz)
- //"klar".
-
- //Hier sollte keiner mit einer Follow-Ftn ankommen, es sei denn er hat
- //ernste Absichten (:-)); spricht er kommt mit einer Ftn an die vor der
- //ersten der Referenz liegt.
- OSL_ENSURE( !_pFtn->GetMaster() || _pFtn->GetRef() != _pRef, "FollowFtn moven?" );
+ // Collect all footnotes referenced by pRef (attribute by attribute), combine them
+ // (the content might be divided over multiple pages) and cut them.
+
+ // For robustness, we do not log the corresponding footnotes here. If a footnote
+ // is touched twice, there might be a crash. This allows this function here to
+ // also handle corrupt layouts in some degrees (without loops or even crashes).
+ SwFtnFrms aNotFtnArr;
+
+ // here we have a footnote placed in front of the first one of the reference
+ OSL_ENSURE( !_pFtn->GetMaster() || _pFtn->GetRef() != _pRef, "move FollowFtn?" );
while ( _pFtn->GetMaster() )
_pFtn = _pFtn->GetMaster();
@@ -1808,8 +1770,8 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
while ( _pFtn )
{
- //Erstmal die naechste Fussnote der Spalte/Seite suchen, damit wir nicht
- //nach dem Cut jeder Fussnote von vorn anfangen muessen.
+ // Search for the next footnote in this column/page so that
+ // we do not start from zero again after cutting one footnote.
SwFtnFrm *pNxtFtn = _pFtn;
while ( pNxtFtn->GetFollow() )
pNxtFtn = pNxtFtn->GetFollow();
@@ -1874,13 +1836,14 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
if ( bCollectFoundFtn )
{
- OSL_ENSURE( !_pFtn->GetMaster(), "FollowFtn moven?" );
+ OSL_ENSURE( !_pFtn->GetMaster(), "move FollowFtn?" );
SwFtnFrm *pNxt = _pFtn->GetFollow();
while ( pNxt )
{
SwFrm *pCnt = pNxt->ContainsAny();
if ( pCnt )
- { //Unterwegs wird der Follow zerstoert weil er leer wird!
+ {
+ // destroy the follow on the way as it is empty
do
{ SwFrm *pNxtCnt = pCnt->GetNext();
pCnt->Cut();
@@ -1889,7 +1852,8 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
} while ( pCnt );
}
else
- { OSL_ENSURE( !pNxt, "Fussnote ohne Inhalt?" );
+ {
+ OSL_ENSURE( !pNxt, "footnote without content?" );
pNxt->Cut();
delete pNxt;
}
@@ -1916,9 +1880,8 @@ void SwFtnBossFrm::_CollectFtns( const SwCntntFrm* _pRef,
void SwFtnBossFrm::_MoveFtns( SwFtnFrms &rFtnArr, sal_Bool bCalc )
{
- //Alle Fussnoten die von pRef referenziert werden muessen von der
- //aktuellen Position, die sich durch die alte Spalte/Seite ergab, auf eine
- //neue Position, bestimmt durch die neue Spalte/Seite, gemoved werden.
+ // All footnotes referenced by pRef need to be moved
+ // to a new position (based on the new column/page)
const sal_uInt16 nMyNum = FindPageFrm()->GetPhyPageNum();
const sal_uInt16 nMyCol = lcl_ColumnNum( this );
SWRECTFN( this )
@@ -1940,12 +1903,11 @@ void SwFtnBossFrm::_MoveFtns( SwFtnFrms &rFtnArr, sal_Bool bCalc )
}
pRefBoss->InsertFtn( pFtn );
- if ( pFtn->GetUpper() ) //Robust, z.B. bei doppelten
+ if ( pFtn->GetUpper() ) // robust, e.g. with duplicates
{
- // Damit FtnFrms, die nicht auf die Seite passen, nicht fuer zuviel
- // Unruhe sorgen (Loop 66312), wird ihr Inhalt zunaechst zusammengestaucht.
- // Damit wird der FtnCont erst gegrowt, wenn der Inhalt formatiert wird
- // und feststellt, dass er auf die Seite passt.
+ // First condense the content so that footnote frames that do not fit on the page
+ // do not do too much harm (Loop 66312). So, the footnote content first grows as
+ // soon as the content gets formatted and it is sure that it fits on the page.
SwFrm *pCnt = pFtn->ContainsAny();
while( pCnt )
{
@@ -1999,8 +1961,8 @@ void SwFtnBossFrm::_MoveFtns( SwFtnFrms &rFtnArr, sal_Bool bCalc )
}
}
if( pCnt->IsSctFrm() )
- { // Wenn es sich um einen nichtleeren Bereich handelt,
- // iterieren wir auch ueber seinen Inhalt
+ {
+ // If the area is not empty, iterate also over the content
SwFrm* pTmp = ((SwSectionFrm*)pCnt)->ContainsAny();
if( pTmp )
pCnt = pTmp;
@@ -2033,7 +1995,7 @@ void SwFtnBossFrm::_MoveFtns( SwFtnFrms &rFtnArr, sal_Bool bCalc )
}
else
{ OSL_ENSURE( !pFtn->GetMaster() && !pFtn->GetFollow(),
- "DelFtn und Master/Follow?" );
+ "DelFtn and Master/Follow?" );
delete pFtn;
// #i21478#
pFtn = 0L;
@@ -2079,8 +2041,8 @@ void SwFtnBossFrm::_MoveFtns( SwFtnFrms &rFtnArr, sal_Bool bCalc )
}
}
if( pCnt->IsSctFrm() )
- { // Wenn es sich um einen nichtleeren Bereich handelt,
- // iterieren wir auch ueber seinen Inhalt
+ {
+ // If the area is not empty, iterate also over the content
SwFrm* pTmp = ((SwSectionFrm*)pCnt)->ContainsAny();
if( pTmp )
pCnt = pTmp;
@@ -2129,7 +2091,7 @@ void SwFtnBossFrm::MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest,
pDestBoss->_MoveFtns( aFtnArr, sal_True );
SwPageFrm* pSrcPage = FindPageFrm();
SwPageFrm* pDestPage = pDestBoss->FindPageFrm();
- // Nur beim Seitenwechsel FtnNum Updaten
+ // update FtnNum only at page change
if( pSrcPage != pDestPage )
{
if( pSrcPage->GetPhyPageNum() > pDestPage->GetPhyPageNum() )
@@ -2144,8 +2106,7 @@ void SwFtnBossFrm::MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest,
void SwFtnBossFrm::RearrangeFtns( const SwTwips nDeadLine, const sal_Bool bLock,
const SwTxtFtn *pAttr )
{
- //Alle Fussnoten der Spalte/Seite dergestalt anformatieren,
- //dass sie ggf. die Spalte/Seite wechseln.
+ // Format all footnotes of a column/page so that they might change the column/page.
SwSaveFtnHeight aSave( this, nDeadLine );
SwFtnFrm *pFtn = FindFirstFtn();
@@ -2176,7 +2137,7 @@ void SwFtnBossFrm::RearrangeFtns( const SwTwips nDeadLine, const sal_Bool bLock,
if ( pCnt )
{
bool bMore = true;
- bool bStart = pAttr == 0; // wenn kein Attribut uebergeben wird, alle bearbeiten
+ bool bStart = pAttr == 0; // if no attribute given, take all
// #i49383# - disable unlock of position of
// lower objects during format of footnote and footnote content.
SwFtnFrm* pLastFtnFrm( 0L );
@@ -2318,8 +2279,7 @@ void SwFtnBossFrm::RearrangeFtns( const SwTwips nDeadLine, const sal_Bool bLock,
}
if ( bMore )
{
- //Nicht weiter als bis zur angegebenen Fussnote, falls eine
- //angegeben wurde.
+ // Go not further than to the provided footnote (if given)
if ( pAttr &&
(::lcl_FindFtnPos( pDoc,
pCnt->FindFtnFrm()->GetAttr()) > nFtnPos ) )
@@ -2351,7 +2311,7 @@ void SwFtnBossFrm::RearrangeFtns( const SwTwips nDeadLine, const sal_Bool bLock,
void SwPageFrm::UpdateFtnNum()
{
- //Seitenweise Numerierung nur wenn es am Dokument so eingestellt ist.
+ // page numbering only if set at the document
if ( GetFmt()->GetDoc()->GetFtnInfo().eNum != FTNNUM_PAGE )
return;
@@ -2413,7 +2373,7 @@ void SwFtnBossFrm::SetFtnDeadLine( const SwTwips nDeadLine )
pBody->Calc();
SwFrm *pCont = FindFtnCont();
- const SwTwips nMax = nMaxFtnHeight;//Aktuelle MaxHeight nicht ueberschreiten.
+ const SwTwips nMax = nMaxFtnHeight; // not bigger then current MaxHeight
SWRECTFN( this )
if ( pCont )
{
@@ -2437,11 +2397,8 @@ void SwFtnBossFrm::SetFtnDeadLine( const SwTwips nDeadLine )
SwTwips SwFtnBossFrm::GetVarSpace() const
{
- //Fuer Seiten soll ein Wert von 20% der Seitenhoehe nicht unterschritten
- //werden (->AMA: was macht MS da?)
- //->AMA: Was ist da fuer Bereiche sinnvoll (und kompatibel zu MS ;-)?
- //AMA: MS kennt scheinbar kein Begrenzung, die Fussnoten nehmen durchaus
- // die ganze Seite/Spalte ein.
+ // To not fall below 20% of the page height
+ // (in contrast to MSOffice where footnotes can fill a whole column/page)
const SwPageFrm* pPg = FindPageFrm();
OSL_ENSURE( pPg || IsInSct(), "Footnote lost page" );
@@ -2507,21 +2464,24 @@ SwTwips SwFtnBossFrm::GetVarSpace() const
return nRet;
}
-/** gibt Auskunft, ob die Groessenveraenderung von pFrm von AdjustNeighbourhood(...)
-|* oder von Grow/Shrink(..) verarbeitet werden sollte.
-|*
-|* Bei einem PageFrm oder in Spalten direkt unterhalb der Seite muss AdjustNei..
-|* gerufen werden, in Rahmenspalten Grow/Shrink.
-|* Spannend sind die spaltigen Bereiche: Wenn es in der Spalte einen Fussnotencontainer
-|* gibt und die Fussnoten nicht vom Bereich eingesammelt werden, ist ein Adjust..,
-|* ansonsten ein Grow/Shrink notwendig.
-|*/
+/** Obtain if pFrm's size adjustment should be processed
+ *
+ * For a page frame of columns directly below the page AdjustNeighbourhood() needs
+ * to be called, or Grow()/ Shrink() for frame columns respectively.
+ *
+ * A column section is special, since if there is a footnote container in a column
+ * and those footnotes are not collected, it is handled like a page frame.
+ *
+ * @see AdjustNeighbourhood()
+ * @see Grow()
+ * @see Shrink()
+ */
sal_uInt8 SwFtnBossFrm::_NeighbourhoodAdjustment( const SwFrm* ) const
{
sal_uInt8 nRet = NA_ONLY_ADJUST;
if( GetUpper() && !GetUpper()->IsPageBodyFrm() )
{
- // Spaltige Rahmen erfordern Grow/Shrink
+ // column sections need grow/shrink
if( GetUpper()->IsFlyFrm() )
nRet = NA_GROW_SHRINK;
else
@@ -2632,7 +2592,7 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
}
bMoved = sal_True;
- // Nur bei einem Seitenwechsel muss die FtnNum neu berechnet werden
+ // update FtnNum only at page change
if ( bFtnNums )
{
SwPageFrm* pOldPage = pOldBoss->FindPageFrm();
@@ -2649,7 +2609,7 @@ sal_Bool SwLayoutFrm::MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
sal_Bool SwCntntFrm::MoveFtnCntFwd( sal_Bool bMakePage, SwFtnBossFrm *pOldBoss )
{
- OSL_ENSURE( IsInFtn(), "Keine Ftn." );
+ OSL_ENSURE( IsInFtn(), "no footnote." );
SwLayoutFrm *pFtn = FindFtnFrm();
// The first paragraph in the first footnote in the first column in the
@@ -2663,8 +2623,7 @@ sal_Bool SwCntntFrm::MoveFtnCntFwd( sal_Bool bMakePage, SwFtnBossFrm *pOldBoss )
return sal_True;
}
- //fix(9538): Wenn die Ftn noch Nachbarn hinter sich hat, so muessen
- //diese ersteinmal verschwinden.
+ //fix(9538): if the footnote has neighbors behind itself, remove them temporarily
SwLayoutFrm *pNxt = (SwLayoutFrm*)pFtn->GetNext();
SwLayoutFrm *pLst = 0;
while ( pNxt )
@@ -2690,32 +2649,30 @@ sal_Bool SwCntntFrm::MoveFtnCntFwd( sal_Bool bMakePage, SwFtnBossFrm *pOldBoss )
{
bool bSameBoss = true;
SwFtnBossFrm * const pNewBoss = pNewUpper->FindFtnBossFrm();
- //Wechseln wir die Spalte/Seite?
+ // column/page change?
if ( !( bSameBoss = (pNewBoss == pOldBoss) ) )
{
- bSamePage = pOldBoss->FindPageFrm() == pNewBoss->FindPageFrm(); // Seitenwechsel?
+ bSamePage = pOldBoss->FindPageFrm() == pNewBoss->FindPageFrm(); // page change?
pNewUpper->Calc();
}
- //Das Layoutblatt, dass wir fuer Fussnoten bekommen ist entweder
- //ein Fussnotencontainer oder eine Fussnote
- //Wenn es eine Fussnote ist, und sie die gleiche Fussnotenreferez
- //wie der alte Upper hat, so moven wir uns direkt hinein.
- //Ist die Referenz einen andere oder ist es ein Container, so wird
- //eine neue Fussnote erzeugt und in den Container gestellt.
- // Wenn wir in einem Bereich innerhalb der Fussnote sind, muss
- // SectionFrame noch angelegt werden.
+ // The layout leaf of the footnote is either a footnote container or a footnote.
+ // If it is a footnote and it has the same footnote reference like the old Upper,
+ // then move the content inside of it.
+ // If it is a container or the reference differs, create a new footnote and add
+ // it into the container.
+ // Create also a SectionFrame if currently in a area inside a footnote.
SwFtnFrm* pTmpFtn = pNewUpper->IsFtnFrm() ? ((SwFtnFrm*)pNewUpper) : 0;
if( !pTmpFtn )
{
OSL_ENSURE( pNewUpper->IsFtnContFrm(), "Neuer Upper kein FtnCont.");
SwFtnContFrm *pCont = (SwFtnContFrm*)pNewUpper;
- //Fussnote erzeugen.
+ // create footnote
SwFtnFrm *pOld = FindFtnFrm();
pTmpFtn = new SwFtnFrm( pOld->GetFmt()->GetDoc()->GetDfltFrmFmt(),
pOld, pOld->GetRef(), pOld->GetAttr() );
- //Verkettung der Fussnoten.
+ // chaining of footnotes
if ( pOld->GetFollow() )
{
pTmpFtn->SetFollow( pOld->GetFollow() );
@@ -2731,12 +2688,12 @@ sal_Bool SwCntntFrm::MoveFtnCntFwd( sal_Bool bMakePage, SwFtnBossFrm *pOldBoss )
pTmpFtn->Calc();
}
OSL_ENSURE( pTmpFtn->GetAttr() == FindFtnFrm()->GetAttr(), "Wrong Footnote!" );
- // Bereiche in Fussnoten beduerfen besonderer Behandlung
+ // areas inside of footnotes get a special treatment
SwLayoutFrm *pNewUp = pTmpFtn;
if( IsInSct() )
{
SwSectionFrm* pSect = FindSctFrm();
- // Bereich in Fussnote (oder nur Fussnote in Bereich)?
+ // area inside of a footnote (or only footnote in an area)?
if( pSect->IsInFtn() )
{
if( pTmpFtn->Lower() && pTmpFtn->Lower()->IsSctFrm() &&
@@ -2748,10 +2705,10 @@ sal_Bool SwCntntFrm::MoveFtnCntFwd( sal_Bool bMakePage, SwFtnBossFrm *pOldBoss )
pNewUp->InsertBefore( pTmpFtn, pTmpFtn->Lower() );
static_cast<SwSectionFrm*>(pNewUp)->Init();
pNewUp->Frm().Pos() = pTmpFtn->Frm().Pos();
- pNewUp->Frm().Pos().Y() += 1; //wg. Benachrichtigungen.
+ pNewUp->Frm().Pos().Y() += 1; // for notifications
- // Wenn unser Bereichsframe einen Nachfolger hat, so muss dieser
- // umgehaengt werden hinter den neuen Follow der Bereichsframes.
+ // If the section frame has a successor then the latter needs
+ // to be moved behind the new Follow of the section frame.
SwFrm* pTmp = pSect->GetNext();
if( pTmp )
{
@@ -2789,8 +2746,7 @@ SwSaveFtnHeight::SwSaveFtnHeight( SwFtnBossFrm *pBs, const SwTwips nDeadLine ) :
SwSaveFtnHeight::~SwSaveFtnHeight()
{
- //Wenn zwischendurch jemand an der DeadLine gedreht hat, so lassen wir
- //ihm seinen Spass!
+ // If someone changed the deadline...
if ( nNewHeight == pBoss->GetMaxFtnHeight() )
pBoss->nMaxFtnHeight = nOldHeight;
}
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 2b20ac555b26..f04ace5eacd9 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -79,12 +79,11 @@ SwBodyFrm::SwBodyFrm( SwFrmFmt *pFmt, SwFrm* pSib ):
void SwBodyFrm::Format( const SwBorderAttrs * )
{
- //Formatieren des Body ist zu einfach, deshalb bekommt er ein eigenes
- //Format; Umrandungen und dergl. sind hier nicht zu beruecksichtigen.
- //Breite ist die der PrtArea des Uppers, Hoehe ist die Hoehe der PrtArea
- //des Uppers abzueglich der Nachbarn (Wird eigentlich eingestellt aber
- //Vorsicht ist die Mutter der Robustheit).
- //Die PrtArea ist stets so gross wie der Frm itself.
+ // Formatting of the body is too simple, thus, it gets an own format method.
+ // Borders etc. are not taken into account here.
+ // With is taken from the PrtArea of the Upper, height is the height of the
+ // PrtArea of the Upper minus any neighbors (for robustness).
+ // The PrtArea has always the size of the frame.
if ( !mbValidSize )
{
@@ -200,24 +199,22 @@ SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwFrm* pSib, SwPageDesc *pPgDsc ) :
else
Frm().SSize( pFmt->GetFrmSize().GetSize() );
- //Body-Bereich erzeugen und einsetzen, aber nur wenn ich nicht gerade
- //eine Leerseite bin.
+ // create and insert body area if it is not a blank page
SwDoc *pDoc = pFmt->GetDoc();
if ( sal_False == (bEmptyPage = (pFmt == pDoc->GetEmptyPageFmt())) )
{
bEmptyPage = sal_False;
- Calc(); //Damit die PrtArea stimmt.
+ Calc(); // so that the PrtArea is correct
SwBodyFrm *pBodyFrm = new SwBodyFrm( pDoc->GetDfltFrmFmt(), this );
pBodyFrm->ChgSize( Prt().SSize() );
pBodyFrm->Paste( this );
- pBodyFrm->Calc(); //Damit die Spalten korrekt
- //eingesetzt werden koennen.
+ pBodyFrm->Calc(); // so that the columns can be inserted correctly
pBodyFrm->InvalidatePos();
if ( bBrowseMode )
- _InvalidateSize(); //Alles nur gelogen
+ _InvalidateSize();
- //Header/Footer einsetzen, nur rufen wenn aktiv.
+ // insert header/footer,, but only if active.
if ( pFmt->GetHeader().IsActive() )
PrepareHeader();
if ( pFmt->GetFooter().IsActive() )
@@ -226,8 +223,7 @@ SwPageFrm::SwPageFrm( SwFrmFmt *pFmt, SwFrm* pSib, SwPageDesc *pPgDsc ) :
const SwFmtCol &rCol = pFmt->GetCol();
if ( rCol.GetNumCols() > 1 )
{
- const SwFmtCol aOld; //ChgColumns() verlaesst sich darauf, dass ein
- //Old-Wert hereingereicht wird.
+ const SwFmtCol aOld; //ChgColumns() needs an old value
pBodyFrm->ChgColumns( aOld, rCol );
}
}
@@ -244,25 +240,23 @@ SwPageFrm::~SwPageFrm()
rEditWin.GetFrameControlsManager( ).RemoveControls( this );
}
- //FlyContainer entleeren, delete der Flys uebernimmt der Anchor
- //(Basisklasse SwFrm)
+ // empty FlyContainer, deletion of the Flys is done by the anchor (in base class SwFrm)
if ( pSortedObjs )
{
- //Objekte koennen (warum auch immer) auch an Seiten verankert sein,
- //die vor Ihren Ankern stehen. Dann wuerde auf bereits freigegebenen
- //Speicher zugegriffen.
+ // Objects can be anchored at pages that are before their anchors (why ever...).
+ // In such cases, we would access already freed memory.
for ( sal_uInt16 i = 0; i < pSortedObjs->Count(); ++i )
{
SwAnchoredObject* pAnchoredObj = (*pSortedObjs)[i];
pAnchoredObj->SetPageFrm( 0L );
}
delete pSortedObjs;
- pSortedObjs = 0; //Auf 0 setzen, sonst rauchts beim Abmdelden von Flys!
+ pSortedObjs = 0; // reset to zero to prevent problems when detaching the Flys
}
- //Damit der Zugriff auf zerstoerte Seiten verhindert werden kann.
- if ( !IsEmptyPage() ) //#59184# sollte fuer Leerseiten unnoetig sein.
+ if ( !IsEmptyPage() ) //#59184# unnessesary for empty pages
{
+ // prevent access to destroyed pages
SwDoc *pDoc = GetFmt() ? GetFmt()->GetDoc() : NULL;
if( pDoc && !pDoc->IsInDtor() )
{
@@ -351,13 +345,13 @@ void SwPageFrm::CheckDirection( sal_Bool bVert )
}
}
-/// Erzeugt die Spezifischen Flys zur Seite und formatiert generischen Cntnt
+/// create specific Flys for this page and format generic content
static void lcl_FormatLay( SwLayoutFrm *pLay )
{
- //Alle LayoutFrms - nicht aber Tables, Flys o.ae. - formatieren.
+ // format all LayoutFrms - no tables, Flys etc.
SwFrm *pTmp = pLay->Lower();
- //Erst die untergeordneten
+ // first the low-level ones
while ( pTmp )
{
if ( pTmp->GetType() & 0x00FF )
@@ -367,11 +361,10 @@ static void lcl_FormatLay( SwLayoutFrm *pLay )
pLay->Calc();
}
+/// Create Flys or register draw objects
static void lcl_MakeObjs( const SwFrmFmts &rTbl, SwPageFrm *pPage )
{
- //Anlegen bzw. registrieren von Flys und Drawobjekten.
- //Die Formate stehen in der SpzTbl (vom Dokument).
- //Flys werden angelegt, DrawObjekte werden bei der Seite angemeldet.
+ // formats are in the special table of the document
for ( sal_uInt16 i = 0; i < rTbl.size(); ++i )
{
@@ -392,7 +385,7 @@ static void lcl_MakeObjs( const SwFrmFmts &rTbl, SwPageFrm *pPage )
continue;
}
- //Wird ein Rahmen oder ein SdrObject beschrieben?
+ // is it a border or a SdrObject?
bool bSdrObj = RES_DRAWFRMFMT == pFmt->Which();
pSdrObj = 0;
if ( bSdrObj && 0 == (pSdrObj = pFmt->FindSdrObject()) )
@@ -402,13 +395,11 @@ static void lcl_MakeObjs( const SwFrmFmts &rTbl, SwPageFrm *pPage )
--i;
continue;
}
- //Das Objekt kann noch an einer anderen Seite verankert sein.
- //Z.B. beim Einfuegen einer neuen Seite aufgrund eines
- //Pagedescriptor-Wechsels. Das Objekt muss dann umgehaengt
- //werden.
- //Fuer bestimmte Faelle ist das Objekt bereits an der richtigen
- //Seite verankert. Das wird hier automatisch erledigt und braucht
- //- wenngleich performater machbar - nicht extra codiert werden.
+ // The object might be anchored to another page, e.g. when inserting
+ // a new page due to a page descriptor change. In such cases, the
+ // object needs to be moved.
+ // In some cases the object is already anchored to the correct page.
+ // This will be handled here and does not need to be coded extra.
SwPageFrm *pPg = pPage->IsEmptyPage() ? (SwPageFrm*)pPage->GetNext() : pPage;
if ( bSdrObj )
{
@@ -467,11 +458,11 @@ void SwPageFrm::PreparePage( sal_Bool bFtn )
::lcl_FormatLay( this );
}
- //Flys und DrawObjekte die noch am Dokument bereitstehen.
- //Fussnotenseiten tragen keine Seitengebundenen Flys!
- //Es kann Flys und Objekte geben, die auf Leerseiten (Seitennummernmaessig)
- //stehen wollen, diese werden jedoch von den Leerseiten ignoriert;
- //sie werden von den Folgeseiten aufgenommen.
+ // Flys and draw objects that are still attached to the document.
+ // Footnote pages do not have page-bound Flys!
+ // There might be Flys or draw objects that want to be placed on
+ // empty pages, however, the empty pages ignore that and the following
+ // pages take care of them.
if ( !bFtn && !IsEmptyPage() )
{
SwDoc *pDoc = GetFmt()->GetDoc();
@@ -480,7 +471,7 @@ void SwPageFrm::PreparePage( sal_Bool bFtn )
lcl_MakeObjs( *pDoc->GetSpzFrmFmts(), (SwPageFrm*)GetPrev() );
lcl_MakeObjs( *pDoc->GetSpzFrmFmts(), this );
- //Kopf-/Fusszeilen) formatieren.
+ // format footer/ header
SwLayoutFrm *pLow = (SwLayoutFrm*)Lower();
while ( pLow )
{
@@ -489,7 +480,7 @@ void SwPageFrm::PreparePage( sal_Bool bFtn )
SwCntntFrm *pCntnt = pLow->ContainsCntnt();
while ( pCntnt && pLow->IsAnLower( pCntnt ) )
{
- pCntnt->OptCalc(); //Nicht die Vorgaenger
+ pCntnt->OptCalc(); // not the predecessors
pCntnt = pCntnt->GetNextCntntFrm();
}
}
@@ -555,10 +546,8 @@ void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
{
case RES_FMT_CHG:
{
- //Wenn sich das FrmFmt aendert kann hier einiges passieren.
- //Abgesehen von den Grossenverhaeltnissen sind noch andere
- //Dinge betroffen.
- //1. Spaltigkeit.
+ // If the frame format is changed, several things might also change:
+ // 1. columns:
OSL_ENSURE( pOld && pNew, "FMT_CHG Missing Format." );
const SwFmt* pOldFmt = ((SwFmtChg*)pOld)->pChangedFmt;
const SwFmt* pNewFmt = ((SwFmtChg*)pNew)->pChangedFmt;
@@ -574,7 +563,7 @@ void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
rInvFlags |= 0x20;
}
- //2. Kopf- und Fusszeilen.
+ // 2. header and footer:
const SwFmtHeader &rOldH = pOldFmt->GetHeader();
const SwFmtHeader &rNewH = pNewFmt->GetHeader();
if( rOldH != rNewH )
@@ -617,7 +606,7 @@ void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
if ( GetUpper() )
static_cast<SwRootFrm*>(GetUpper())->CheckViewLayout( 0, 0 );
}
- //Window aufraeumen.
+ // cleanup Window
if( pSh && pSh->GetWin() && aOldPageFrmRect.HasArea() )
{
// OD 12.02.2003 #i9719#, #105645# - consider border and shadow of
@@ -637,7 +626,7 @@ void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
case RES_COL:
{
SwLayoutFrm *pB = FindBodyCont();
- OSL_ENSURE( pB, "Seite ohne Body." );
+ OSL_ENSURE( pB, "page without body." );
pB->ChgColumns( *(const SwFmtCol*)pOld, *(const SwFmtCol*)pNew );
rInvFlags |= 0x22;
}
@@ -655,13 +644,13 @@ void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
break;
case RES_PAGEDESC_FTNINFO:
- //Die derzeit einzig sichere Methode:
+ // currently the savest way:
((SwRootFrm*)GetUpper())->SetSuperfluous();
SetMaxFtnHeight( pDesc->GetFtnInfo().GetHeight() );
if ( !GetMaxFtnHeight() )
SetMaxFtnHeight( LONG_MAX );
SetColMaxFtnHeight();
- //Hier wird die Seite ggf. zerstoert!
+ // here, the page might be destroyed:
((SwRootFrm*)GetUpper())->RemoveFtns( 0, sal_False, sal_True );
break;
case RES_FRAMEDIR :
@@ -685,15 +674,15 @@ void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
}
}
- // erfrage vom Modify Informationen
+/// get information from Modify
bool SwPageFrm::GetInfo( SfxPoolItem & rInfo ) const
{
if( RES_AUTOFMT_DOCNODE == rInfo.Which() )
{
- // es gibt einen PageFrm also wird er benutzt
+ // a page frame exists, so use this one
return false;
}
- return true; // weiter suchen
+ return true; // continue searching
}
void SwPageFrm::SetPageDesc( SwPageDesc *pNew, SwFrmFmt *pFmt )
@@ -703,21 +692,18 @@ void SwPageFrm::SetPageDesc( SwPageDesc *pNew, SwFrmFmt *pFmt )
SetFrmFmt( pFmt );
}
-/** Der richtige PageDesc wird bestimmt:
-|* 0. Vom Dokument bei Fussnotenseiten und Endnotenseiten
-|* 1. vom ersten BodyCntnt unterhalb der Seite.
-|* 2. vom PageDesc der vorstehenden Seite.
-|* 3. bei Leerseiten vom PageDesc der vorigen Seite.
-|* 3.1 vom PageDesc der folgenden Seite wenn es keinen Vorgaenger gibt.
-|* 4. es ist der Default-PageDesc sonst.
-|* 5. Im BrowseMode ist der Pagedesc immer der vom ersten Absatz im
-|* Dokument oder Standard (der 0-te) wenn der erste Absatz keinen
-|* wuenscht.
-|* (6. Im HTML-Mode ist der Pagedesc immer die HTML-Seitenvorlage.)
-|*/
+/* determine the right PageDesc:
+ * 0. from the document for footnote and endnote pages
+ * 1. from the first BodyCntnt below a page
+ * 2. from PageDesc of the predecessor page
+ * 3. from PageDesc of the previous page if blank page
+ * 3.1 from PageDesc of the next page if no predecessor exists
+ * 4. default PageDesc
+ * 5. In BrowseMode use the first paragraph or default PageDesc.
+ */
SwPageDesc *SwPageFrm::FindPageDesc()
{
- //0.
+ // 0.
if ( IsFtnPage() )
{
SwDoc *pDoc = GetFmt()->GetDoc();
@@ -779,11 +765,11 @@ SwPageDesc *SwPageFrm::FindPageDesc()
pRet = &GetFmt()->GetDoc()->GetPageDesc( 0 );
- OSL_ENSURE( pRet, "Kein Descriptor gefunden." );
+ OSL_ENSURE( pRet, "could not find page descriptor." );
return pRet;
}
-//Wenn der RootFrm seine Groesse aendert muss benachrichtigt werden.
+// Notify if the RootFrm changes its size
void AdjustSizeChgNotify( SwRootFrm *pRoot )
{
const sal_Bool bOld = pRoot->IsSuperfluous();
@@ -818,8 +804,7 @@ void SwPageFrm::Cut()
if ( GetNext() )
GetNext()->InvalidatePos();
- //Flys deren Anker auf anderen Seiten stehen umhaengen.
- //DrawObjecte spielen hier keine Rolle.
+ // move Flys whose anchor is on a different page (draw objects are not relevant here)
if ( GetSortedObjs() )
{
for ( int i = 0; GetSortedObjs() &&
@@ -843,12 +828,12 @@ void SwPageFrm::Cut()
}
}
}
- //Window aufraeumen
+ // cleanup Window
if ( pSh && pSh->GetWin() )
pSh->InvalidateWindows( Frm() );
}
- // die Seitennummer der Root runterzaehlen.
+ // decrease the root's page number
((SwRootFrm*)GetUpper())->DecrPhyPageNums();
SwPageFrm *pPg = (SwPageFrm*)GetNext();
if ( pPg )
@@ -864,7 +849,7 @@ void SwPageFrm::Cut()
SwFrm* pRootFrm = GetUpper();
- // Alle Verbindungen kappen.
+ // cut all connections
Remove();
if ( pRootFrm )
@@ -873,17 +858,17 @@ void SwPageFrm::Cut()
void SwPageFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
{
- OSL_ENSURE( pParent->IsRootFrm(), "Parent ist keine Root." );
- OSL_ENSURE( pParent, "Kein Parent fuer Paste." );
- OSL_ENSURE( pParent != this, "Bin selbst der Parent." );
- OSL_ENSURE( pSibling != this, "Bin mein eigener Nachbar." );
+ OSL_ENSURE( pParent->IsRootFrm(), "Parent is no Root." );
+ OSL_ENSURE( pParent, "No parent for Paste()." );
+ OSL_ENSURE( pParent != this, "I'm my own parent." );
+ OSL_ENSURE( pSibling != this, "I'm my own neighbour." );
OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(),
- "Bin noch irgendwo angemeldet." );
+ "I am still registered somewhere." );
- //In den Baum einhaengen.
+ // insert into tree structure
InsertBefore( (SwLayoutFrm*)pParent, pSibling );
- // die Seitennummer am Root hochzaehlen.
+ // increase the root's page number
((SwRootFrm*)GetUpper())->IncrPhyPageNums();
if( GetPrev() )
SetPhyPageNum( ((SwPageFrm*)GetPrev())->GetPhyPageNum() + 1 );
@@ -968,15 +953,18 @@ void SwPageFrm::PrepareRegisterChg()
}
}
-/**
-|* Prueft alle Seiten ab der uebergebenen, daraufhin,
-|* ob sie das richtige FrmFmt verwenden. Wenn 'falsche' Seiten
-|* aufgespuehrt werden, so wird versucht die Situation moeglichst
-|* einfache zu bereinigen.
-|*/
+//FIXME: provide missing documentation
+/** Check all pages (starting from the given one) if they use the right frame format.
+ *
+ * If "wrong" pages are found, try to fix this as simple as possible.
+ *
+ * @param pStart the page from where to start searching
+ * @param bNotifyFields
+ * @param ppPrev
+ */
void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields, SwPageFrm** ppPrev )
{
- OSL_ENSURE( pStart, "Keine Startpage." );
+ OSL_ENSURE( pStart, "no starting page." );
SwViewShell *pSh = pStart->getRootFrm()->GetCurrShell();
SwViewImp *pImp = pSh ? pSh->Imp() : 0;
@@ -987,8 +975,8 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields, SwPageFrm
return;
}
- //Fuer das Aktualisieren der Seitennummern-Felder gibt nDocPos
- //die Seitenposition an, _ab_ der invalidiert werden soll.
+ // For the update of page numbering fields, nDocPos provides
+ // the page position from where invalidation should start.
SwTwips nDocPos = LONG_MAX;
SwRootFrm *pRoot = (SwRootFrm*)pStart->GetUpper();
@@ -1000,7 +988,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields, SwPageFrm
pPage = (SwPageFrm*)pPage->GetPrev();
while ( pPage )
{
- //gewuenschten PageDesc und FrmFmt festellen.
+ // obtain PageDesc and FrmFmt
SwPageDesc *pDesc = pPage->FindPageDesc();
sal_Bool bCheckEmpty = pPage->IsEmptyPage();
sal_Bool bActOdd = pPage->OnRightPage();
@@ -1010,39 +998,29 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields, SwPageFrm
? pDesc->GetRightFmt(bFirst) : pDesc->GetLeftFmt(bFirst);
if ( bActOdd != bOdd ||
- pDesc != pPage->GetPageDesc() || //falscher Desc
- ( pFmtWish != pPage->GetFmt() && //falsches Format und
- ( !pPage->IsEmptyPage() || pFmtWish ) //nicht Leerseite
+ pDesc != pPage->GetPageDesc() || // wrong Desc
+ ( pFmtWish != pPage->GetFmt() && // wrong format and
+ ( !pPage->IsEmptyPage() || pFmtWish ) // not blank /empty
)
)
{
- //Wenn wir schon ein Seite veraendern muessen kann das eine
- //Weile dauern, deshalb hier den WaitCrsr pruefen.
+ // Updating a page might take a while, so check the WaitCrsr
if( pImp )
pImp->CheckWaitCrsr();
- //Ab hier muessen die Felder invalidiert werden!
+ // invalidate the field, starting from here
if ( nDocPos == LONG_MAX )
nDocPos = pPage->GetPrev() ?
pPage->GetPrev()->Frm().Top() : pPage->Frm().Top();
- //Faelle:
- //1. Wir haben eine EmptyPage und wollen eine "Normalseite".
- // ->EmptyPage wegwerfen und weiter mit der naechsten.
- //2. Wir haben eine EmptyPage und wollen eine EmptyPage mit
- // anderem Descriptor.
- // ->Descriptor austauschen.
- //3. Wir haben eine "Normalseite" und wollen eine EmptyPage.
- // ->Emptypage einfuegen, nicht aber wenn die Vorseite
- // bereits eine EmptyPage ist -> 6.
- //4. Wir haben eine "Normalseite" und wollen eine "Normalseite"
- // mit anderem Descriptor
- // ->Descriptor und Format austauschen
- //5. Wir haben eine "Normalseite" und wollen eine "Normalseite"
- // mit anderem Format
- // ->Format austauschen.
- //6. Wir haben kein Wunschformat erhalten, also nehmen wir das
- // 'andere' Format (rechts/links) des PageDesc.
+ // Cases:
+ // 1. Empty page should be "normal" page -> remove empty page and take next one
+ // 2. Empty page should have different descriptor -> change
+ // 3. Normal page should be empty -> insert empty page if previous page
+ // is not empty, otherwise see (6).
+ // 4. Normal page should have different descriptor -> change
+ // 5. Normal page should have different format -> change
+ // 6. No "wish" format provided -> take the "other" format (left/right) of the PageDesc
if ( pPage->IsEmptyPage() && ( pFmtWish || //1.
( !bOdd && !pPage->GetPrev() ) ) )
@@ -1086,13 +1064,10 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields, SwPageFrm
pPage->SetPageDesc( pDesc, pFmtWish );
if ( bFtns )
{
- //Wenn sich bestimmte Werte der FtnInfo veraendert haben
- //muss etwas passieren. Wir versuchen den Schaden zu
- //begrenzen.
- //Wenn die Seiten keinen FtnCont hat, ist zwar theoretisches
- //ein Problem denkbar, aber das ignorieren wir mit aller Kraft.
- //Bei Aenderungen hoffen wir mal, dass eine Invalidierung
- //ausreicht, denn alles andere wuerde viel Kraft kosten.
+ // If specific values of the FtnInfo are changed, something has to happen.
+ // We try to limit the damage...
+ // If the page has no FtnCont it might be problematic.
+ // Let's hope that invalidation is enough.
SwFtnContFrm *pCont = pPage->FindFtnCont();
if ( pCont && !(pOld->GetFtnInfo() == pDesc->GetFtnInfo()) )
pCont->_InvalidateAll();
@@ -1104,7 +1079,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields, SwPageFrm
}
else if ( !pFmtWish ) //6.
{
- //Format mit verdrehter Logic besorgen.
+ // get format with inverted logic
if (!pFmtWish)
pFmtWish = bOdd ? pDesc->GetLeftFmt() : pDesc->GetRightFmt();
if ( pPage->GetFmt() != pFmtWish )
@@ -1119,19 +1094,13 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields, SwPageFrm
}
if ( bCheckEmpty )
{
- //Es kann noch sein, dass die Leerseite schlicht ueberflussig ist.
- //Obiger Algorithmus kann dies leider nicht feststellen.
- //Eigentlich muesste die Leerseite einfach praeventiv entfernt
- //werden; sie wuerde ja ggf. wieder eingefuegt.
- //Die EmptyPage ist genau dann ueberfluessig, wenn die Folgeseite
- //auch ohne sie auskommt. Dazu muessen wir uns die Verhaeltnisse
- //genauer ansehen. Wir bestimmen den PageDesc und die virtuelle
- //Seitennummer manuell.
+ // It also might be that an empty page is not needed at all.
+ // However, the algorithm above cannot determine that. It is not needed if the following
+ // page can live without it. Do obtain that information, we need to dig deeper...
SwPageFrm *pPg = (SwPageFrm*)pPage->GetNext();
if( !pPg || pPage->OnRightPage() == pPg->WannaRightPage() )
{
- //Die Folgeseite hat kein Problem ein FrmFmt zu finden oder keinen
- //Nachfolger, also ist die Leerseite ueberfluessig.
+ // The following page can find a FrmFmt or has no successor -> empty page not needed
SwPageFrm *pTmp = (SwPageFrm*)pPage->GetNext();
pPage->Cut();
bool bUpdatePrev = false;
@@ -1159,10 +1128,7 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields, SwPageFrm
}
#if OSL_DEBUG_LEVEL > 0
- //Ein paar Pruefungen muessen schon erlaubt sein.
-
- //1. Keine zwei EmptyPages hintereinander.
- //2. Alle PageDescs richtig?
+ //1. check if two empty pages are behind one another
bool bEmpty = false;
SwPageFrm *pPg = pStart;
while ( pPg )
@@ -1171,8 +1137,8 @@ void SwFrm::CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields, SwPageFrm
{
if ( bEmpty )
{
- OSL_FAIL( "Doppelte Leerseiten." );
- break; //Einmal reicht.
+ OSL_FAIL( "double empty pages." );
+ break; // once is enough
}
bEmpty = true;
}
@@ -1198,13 +1164,13 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn )
SwPageDesc *pDesc = pSibling->GetPageDesc();
pSibling = (SwPageFrm*)pPrevPage->GetNext();
- //Rechte (ungerade) oder linke (gerade) Seite einfuegen?
+ // insert right (odd) or left (even) page?
bool bNextOdd = !pPrevPage->OnRightPage();
bool bWishedOdd = bNextOdd;
- //Welcher PageDesc gilt?
- //Bei CntntFrm der aus dem Format wenn einer angegeben ist,
- //der Follow vom bereits in der PrevPage gueltigen sonst.
+ // Which PageDesc is relevant?
+ // For CntntFrm take the one from format if provided,
+ // otherwise from the Follow of the PrevPage
pDesc = 0;
if ( IsFlowFrm() && !SwFlowFrm::CastFlowFrm( this )->IsFollow() )
{ SwFmtPageDesc &rDesc = (SwFmtPageDesc&)GetAttrSet()->GetPageDesc();
@@ -1213,7 +1179,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn )
{
::boost::optional<sal_uInt16> oNumOffset = rDesc.GetNumOffset();
bWishedOdd = ((oNumOffset ? oNumOffset.get() : 0) % 2) ? true : false;
- //Die Gelegenheit nutzen wir um das Flag an der Root zu pflegen.
+ // use the opportunity to set the flag at root
pRoot->SetVirtPageNum( sal_True );
}
}
@@ -1227,8 +1193,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn )
SwDoc *pDoc = pPrevPage->GetFmt()->GetDoc();
bool bCheckPages = false;
- //Wenn ich kein FrmFmt fuer die Seite gefunden habe, muss ich eben eine
- //Leerseite einfuegen.
+ // If there is no FrmFmt for this page, create an empty page.
if( bWishedOdd != bNextOdd )
{
SwFrmFmt *const pEmptyFmt = pDoc->GetEmptyPageFmt();
@@ -1236,8 +1201,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn )
SwPageFrm *pPage = new SwPageFrm(pEmptyFmt, pRoot, pTmpDesc);
pPage->Paste( pRoot, pSibling );
pPage->PreparePage( bFtn );
- //Wenn der Sibling keinen Bodytext enthaelt kann ich ihn vernichten
- //Es sei denn, es ist eine Fussnotenseite
+ // If the sibling has no body text, destroy it as long as it is no footnote page.
if ( pSibling && !pSibling->IsFtnPage() &&
!pSibling->FindFirstBodyCntnt() )
{
@@ -1258,8 +1222,7 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn )
SwPageFrm *pPage = new SwPageFrm( pFmt, pRoot, pDesc );
pPage->Paste( pRoot, pSibling );
pPage->PreparePage( bFtn );
- //Wenn der Sibling keinen Bodytext enthaelt kann ich ihn vernichten
- //Es sei denn es ist eine Fussnotenseite.
+ // If the sibling has no body text, destroy it as long as it is no footnote page.
if ( pSibling && !pSibling->IsFtnPage() &&
!pSibling->FindFirstBodyCntnt() )
{
@@ -1293,8 +1256,8 @@ SwPageFrm *SwFrm::InsertPage( SwPageFrm *pPrevPage, sal_Bool bFtn )
pRoot->AssertPageFlys( pSibling );
}
- //Fuer das Aktualisieren der Seitennummern-Felder gibt nDocPos
- //die Seitenposition an, _ab_ der invalidiert werden soll.
+ // For the update of page numbering fields, nDocPos provides
+ // the page position from where invalidation should start.
SwViewShell *pSh = getRootFrm()->GetCurrShell();
if ( !pSh || !pSh->Imp()->IsUpdateExpFlds() )
{
@@ -1340,20 +1303,13 @@ SwTwips SwRootFrm::ShrinkFrm( SwTwips nDist, sal_Bool bTst, sal_Bool )
return nDist;
}
-/** Entfernung von ueberfluessigen Seiten.
-|*
-|* Arbeitet nur wenn das Flag bCheckSuperfluous gesetzt ist.
-|* Definition: Eine Seite ist genau dann leer, wenn der
-|* Body-Textbereich keinen CntntFrm enthaelt, aber nicht, wenn noch
-|* mindestens ein Fly an der Seite klebt.
-|* Die Seite ist auch dann nicht leer, wenn sie noch eine
-|* Fussnote enthaelt.
-|* Es muss zweimal angesetzt werden um leeren Seiten aufzuspueren:
-|* - einmal fuer die Endnotenseiten.
-|* - und einmal fuer die Seiten des Bodytextes.
-|*/
+/// remove pages that are not needed at all
void SwRootFrm::RemoveSuperfluous()
{
+ // A page is empty if the body text area has no CntntFrm, but not if there
+ // is at least one Fly or one footnote attached to the page. Two runs are
+ // needed: one for endnote pages and one for the pages of the body text.
+
if ( !IsSuperfluous() )
return;
bCheckSuperfluous = sal_False;
@@ -1361,16 +1317,14 @@ void SwRootFrm::RemoveSuperfluous()
SwPageFrm *pPage = GetLastPage();
long nDocPos = LONG_MAX;
- //Jetzt wird fuer die jeweils letzte Seite geprueft ob sie leer ist
- //bei der ersten nicht leeren Seite wird die Schleife beendet.
+ // Check the corresponding last page if it is empty and stop loop at the last non-empty page.
do
{
bool bExistEssentialObjs = ( 0 != pPage->GetSortedObjs() );
if ( bExistEssentialObjs )
{
- //Nur weil die Seite Flys hat sind wir noch lange nicht fertig,
- //denn wenn alle Flys an generischem Inhalt haengen, so ist sie
- //trotzdem ueberfluessig (Ueberpruefung auf DocBody sollte reichen).
+ // Only because the page has Flys does not mean that it is needed. If all Flys are
+ // attached to generic content it is also superfluous (checking DocBody should be enough)
// OD 19.06.2003 #108784# - consider that drawing objects in
// header/footer are supported now.
bool bOnlySuperfluosObjs = true;
@@ -1410,7 +1364,7 @@ void SwRootFrm::RemoveSuperfluous()
while ( pPage->IsFtnPage() )
{
pPage = (SwPageFrm*)pPage->GetPrev();
- OSL_ENSURE( pPage, "Nur noch Endnotenseiten uebrig." );
+ OSL_ENSURE( pPage, "only endnote pages remain." );
}
continue;
}
@@ -1439,8 +1393,7 @@ void SwRootFrm::RemoveSuperfluous()
}
}
-/// Stellt sicher, dass genuegend Seiten vorhanden sind, damit alle seitengebundenen
-/// Rahmen und DrawObject untergebracht sind.
+/// Ensures that enough pages exist, so that all page bound frames and draw objects can be placed
void SwRootFrm::AssertFlyPages()
{
if ( !IsAssertFlyPages() )
@@ -1450,7 +1403,7 @@ void SwRootFrm::AssertFlyPages()
SwDoc *pDoc = GetFmt()->GetDoc();
const SwFrmFmts *pTbl = pDoc->GetSpzFrmFmts();
- //Auf welche Seite will der 'letzte' Fly?
+ // what page targets the "last" Fly?
sal_uInt16 nMaxPg = 0;
sal_uInt16 i;
@@ -1460,7 +1413,7 @@ void SwRootFrm::AssertFlyPages()
if ( !rAnch.GetCntntAnchor() && nMaxPg < rAnch.GetPageNum() )
nMaxPg = rAnch.GetPageNum();
}
- //Wieviele Seiten haben wir derzeit?
+ // How many pages exist at the moment?
SwPageFrm *pPage = (SwPageFrm*)Lower();
while ( pPage && pPage->GetNext() &&
!((SwPageFrm*)pPage->GetNext())->IsFtnPage() )
@@ -1470,8 +1423,7 @@ void SwRootFrm::AssertFlyPages()
if ( nMaxPg > pPage->GetPhyPageNum() )
{
- //Die Seiten werden ausgehend von der letzten Seite konsequent
- //nach den Regeln der PageDescs weitergefuehrt.
+ // Continue pages based on the rules of the PageDesc after the last page.
sal_Bool bOdd = (pPage->GetPhyPageNum() % 2) ? sal_True : sal_False;
SwPageDesc *pDesc = pPage->GetPageDesc();
SwFrm *pSibling = pPage->GetNext();
@@ -1479,8 +1431,7 @@ void SwRootFrm::AssertFlyPages()
{
if ( !(bOdd ? pDesc->GetRightFmt() : pDesc->GetLeftFmt()) )
{
- //Leerseite einfuegen, die Flys werden aber erst von
- //der naechsten Seite aufgenommen!
+ // Insert empty page (but Flys will be stored in the next page)
pPage = new SwPageFrm( pDoc->GetEmptyPageFmt(), this, pDesc );
pPage->Paste( this, pSibling );
pPage->PreparePage( sal_False );
@@ -1495,8 +1446,7 @@ void SwRootFrm::AssertFlyPages()
bOdd = bOdd ? sal_False : sal_True;
pDesc = pDesc->GetFollow();
}
- //Jetzt koennen die Endnotenseiten natuerlich wieder krumm sein;
- //in diesem Fall werden sie vernichtet.
+ // If the endnote pages are now corrupt, destroy them.
if ( !pDoc->GetFtnIdxs().empty() )
{
pPage = (SwPageFrm*)Lower();
@@ -1515,8 +1465,7 @@ void SwRootFrm::AssertFlyPages()
}
}
-/// Stellt sicher, dass ab der uebergebenen Seite auf allen Seiten die seitengebunden
-/// Objecte auf der richtigen Seite (Seitennummer stehen).
+/// Ensure that after the given page all page-bound objects are located on the correct page
void SwRootFrm::AssertPageFlys( SwPageFrm *pPage )
{
while ( pPage )
@@ -1535,14 +1484,11 @@ void SwRootFrm::AssertPageFlys( SwPageFrm *pPage )
if ((rAnch.GetAnchorId() == FLY_AT_PAGE) &&
nPg != pPage->GetPhyPageNum() )
{
- //Das er auf der falschen Seite steht muss noch nichts
- //heissen, wenn er eigentlich auf der Vorseite
- //stehen will und diese eine EmptyPage ist.
+ // If on the wrong page, check if previous page is empty
if( nPg && !(pPage->GetPhyPageNum()-1 == nPg &&
((SwPageFrm*)pPage->GetPrev())->IsEmptyPage()) )
{
- //Umhaengen kann er sich selbst, indem wir ihm
- //einfach ein Modify mit seinem AnkerAttr schicken.
+ // It can move by itself. Just send a modify to its anchor attribute.
#if OSL_DEBUG_LEVEL > 1
const sal_uInt32 nCnt = pPage->GetSortedObjs()->Count();
rFmt.NotifyClients( 0, (SwFmtAnchor*)&rAnch );
@@ -1583,7 +1529,7 @@ void SwRootFrm::MakeAll()
maPrt.SSize( maFrm.SSize() );
}
if ( !mbValidSize )
- //SSize wird von den Seiten (Cut/Paste) eingestellt.
+ // SSize is set by the pages (Cut/Paste).
mbValidSize = sal_True;
}
@@ -1603,13 +1549,11 @@ void SwRootFrm::ImplCalcBrowseWidth()
OSL_ENSURE( GetCurrShell() && GetCurrShell()->GetViewOptions()->getBrowseMode(),
"CalcBrowseWidth and not in BrowseView" );
- //Die (minimale) Breite wird von Rahmen, Tabellen und Zeichenobjekten
- //bestimmt. Die Breite wird nicht anhand ihrer aktuellen Groessen bestimmt,
- //sondern anhand der Attribute. Es interessiert also nicht wie breit sie
- //sind, sondern wie breit sie sein wollen.
- //Rahmen und Zeichenobjekte innerhalb ander Objekte (Rahmen, Tabellen)
- //Zaehlen nicht.
- //Seitenraender und Spalten werden hier nicht beruecksichtigt.
+ // The (minimal) with is determined from borders, tables and paint objects.
+ // It is calculated based on the attributes. Thus, it is not relevant how wide they are
+ // currently but only how wide they want to be.
+ // Frames and paint objects inside other objects (frames, tables) do not count.
+ // Borders and columns are not taken into account.
SwFrm *pFrm = ContainsCntnt();
while ( pFrm && !pFrm->IsInDocBody() )
@@ -1635,8 +1579,7 @@ void SwRootFrm::ImplCalcBrowseWidth()
const SwBorderAttrs &rAttrs = *aAccess.Get();
const SwFmtHoriOrient &rHori = rAttrs.GetAttrSet().GetHoriOrient();
long nWidth = rAttrs.GetSize().Width();
- if ( nWidth < USHRT_MAX-2000 && //-2000, weil bei Randeinstellung per
- //Zuppeln das USHRT_MAX verlorengeht!
+ if ( nWidth < USHRT_MAX-2000 && //-2k, because USHRT_MAX gets missing while trying to resize!
text::HoriOrientation::FULL != rHori.GetHoriOrient() )
{
const SwHTMLTableLayout *pLayoutInfo =
@@ -1708,9 +1651,8 @@ void SwRootFrm::ImplCalcBrowseWidth()
}
}
else
- //Fuer Zeichenobjekte ist die Auswahl sehr klein,
- //weil sie keine Attribute haben, also durch ihre
- //aktuelle Groesse bestimmt werden.
+ // Paint objects to not have attributes and
+ // are defined by their current size
nWidth = pAnchoredObj->GetObjRect().Right() -
pAnchoredObj->GetDrawObj()->GetAnchorPos().X();
}
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 10cf5de5563e..d98fb0d315e4 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -300,12 +300,12 @@ void SwSectionFrm::_Cut( sal_Bool bRemove )
void SwSectionFrm::Paste( SwFrm* pParent, SwFrm* pSibling )
{
- OSL_ENSURE( pParent, "Kein Parent fuer Paste." );
- OSL_ENSURE( pParent->IsLayoutFrm(), "Parent ist CntntFrm." );
- OSL_ENSURE( pParent != this, "Bin selbst der Parent." );
- OSL_ENSURE( pSibling != this, "Bin mein eigener Nachbar." );
+ OSL_ENSURE( pParent, "No parent for Paste()." );
+ OSL_ENSURE( pParent->IsLayoutFrm(), "Parent is CntntFrm." );
+ OSL_ENSURE( pParent != this, "I'm my own parent." );
+ OSL_ENSURE( pSibling != this, "I'm my own neighbour." );
OSL_ENSURE( !GetPrev() && !GetUpper(),
- "Bin noch irgendwo angemeldet." );
+ "I am still registered somewhere." );
PROTOCOL( this, PROT_PASTE, 0, GetUpper() )
@@ -1675,7 +1675,6 @@ SwLayoutFrm *SwFrm::GetPrevSctLeaf( MakePageType )
{
pCol = (SwLayoutFrm*)pCol->GetPrev();
// Is there any content?
- // Gibt es dort Inhalt?
if( ((SwLayoutFrm*)pCol->Lower())->Lower() )
{
if( bJump ) // Did we skip a blank page?