summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/filter/html/htmltab.cxx803
1 files changed, 346 insertions, 457 deletions
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index f0705e586555..e3d7f982b74c 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -442,7 +442,7 @@ class HTMLTable
// the following parameters are from the <TABLE>-Tag
sal_uInt16 m_nWidth; // width of the table
sal_uInt16 m_nHeight; // absolute height of the table
- SvxAdjust m_eTableAdjust; // drawing::Alignment of the table
+ SvxAdjust m_eTableAdjust; // drawing::Alignment of the table
sal_Int16 m_eVertOrientation; // Default vertical direction of the cells
sal_uInt16 m_nBorder; // width of the external border
HTMLTableFrame m_eFrame; // frame around the table
@@ -515,7 +515,7 @@ class HTMLTable
public:
- bool m_bFirstCell; // wurde schon eine Zelle angelegt?
+ bool m_bFirstCell; // is there a cell created already?
HTMLTable( SwHTMLParser* pPars, HTMLTable *pTopTab,
bool bParHead, bool bHasParentSec,
@@ -568,10 +568,10 @@ public:
void InsertCol( sal_uInt16 nSpan, sal_uInt16 nWidth, bool bRelWidth,
SvxAdjust eAdjust, sal_Int16 eVertOri );
- // Beenden einer Tab-Definition (MUSS fuer ALLE Tabs aufgerufen werden)
+ // End a table definition (needs to be called for every table)
void CloseTable();
- // SwTable konstruieren (inkl. der Child-Tabellen)
+ // Construct a SwTable (including child tables)
void MakeTable( SwTableBox *pUpper, sal_uInt16 nAbsAvail,
sal_uInt16 nRelAvail=0, sal_uInt16 nAbsLeftSpace=0,
sal_uInt16 nAbsRightSpace=0, sal_uInt16 nInhAbsSpace=0 );
@@ -639,7 +639,7 @@ HTMLTableCnts::HTMLTableCnts( HTMLTable* pTab ):
HTMLTableCnts::~HTMLTableCnts()
{
- delete m_pTable; // die Tabellen brauchen wir nicht mehr
+ delete m_pTable; // we don't need the tables anymore
delete m_pNext;
}
@@ -693,8 +693,7 @@ HTMLTableCell::HTMLTableCell():
HTMLTableCell::~HTMLTableCell()
{
- // der Inhalt ist in mehrere Zellen eingetragen, darf aber nur einmal
- // geloescht werden
+ // the content is in multiple cells but mustn't be deleted more than once
if( 1==nRowSpan && 1==nColSpan )
{
delete pContents;
@@ -733,13 +732,12 @@ inline void HTMLTableCell::SetWidth( sal_uInt16 nWdth, bool bRelWdth )
void HTMLTableCell::SetProtected()
{
- // Die Inhalte dieser Zelle mussen nich irgenwo anders verankert
- // sein, weil sie nicht geloescht werden!!!
+ // The content of this cell doesn't have to be anchored anywhere else,
+ // since they're not gonna be deleted
- // Inhalt loeschen
pContents = nullptr;
- // Hintergrundfarbe kopieren.
+ // Copy background color
if( pBGBrush )
pBGBrush = new SvxBrushItem( *pBGBrush );
@@ -808,9 +806,8 @@ inline HTMLTableCell *HTMLTableRow::GetCell( sal_uInt16 nCell ) const
void HTMLTableRow::Expand( sal_uInt16 nCells, bool bOneCell )
{
- // die Zeile wird mit einer einzigen Zelle aufgefuellt, wenn
- // bOneCell gesetzt ist. Das geht, nur fuer Zeilen, in die keine
- // Zellen mehr eingefuegt werden!
+ // This row will be filled with a single cell if bOneCell is set.
+ // This will only work for rows that don't allow adding cells!
sal_uInt16 nColSpan = nCells - m_pCells->size();
for (sal_uInt16 i = m_pCells->size(); i < nCells; ++i)
@@ -957,16 +954,14 @@ void HTMLTable::InitCtor( const HTMLTableOptions *pOptions )
long nPHeight = nBorderOpt==USHRT_MAX ? 0 : nBorderOpt;
SvxCSS1Parser::PixelToTwip( nPWidth, nPHeight );
- // nBorder gibt die Breite der Umrandung an, wie sie in die
- // Breitenberechnung in Netscape einfliesst. Wenn pOption->nBorder
- // == USHRT_MAX, wurde keine BORDER-Option angegeben. Trotzdem fliesst
- // eine 1 Pixel breite Umrandung in die Breitenberechnung mit ein.
+ // nBorder tells the width of the border as it's used in the width calculation of NetScape
+ // If pOption->nBorder == USHRT_MAX, there wasn't a BORDER option given
+ // Nonetheless, a 1 pixel wide border will be used for width calculation
m_nBorder = (sal_uInt16)nPWidth;
if( nBorderOpt==USHRT_MAX )
nPWidth = 0;
- // HACK: ein Pixel-breite Linien sollen zur Haarlinie werden, wenn
- // wir mit doppelter Umrandung arbeiten
+ // HACK: one pixel wide lines should be hairlines when we'll use double bordering
if( pOptions->nCellSpacing!=0 && nBorderOpt==1 )
{
nPWidth = 1;
@@ -1092,8 +1087,7 @@ HTMLTable::~HTMLTable()
delete m_pContext;
- // pLayoutInfo wurde entweder bereits geloescht oder muss aber es
- // in den Besitz der SwTable uebergegangen.
+ // pLayoutInfo has either already been deleted or is now owned by SwTable
}
SwHTMLTableLayout *HTMLTable::CreateLayoutInfo()
@@ -1180,28 +1174,28 @@ void HTMLTable::ProtectRowSpan( sal_uInt16 nRow, sal_uInt16 nCol, sal_uInt16 nRo
}
}
-// Suchen des SwStartNodes der letzten belegten Vorgaengerbox
+// Search the SwStartNode of the last used predecessor box
const SwStartNode* HTMLTable::GetPrevBoxStartNode( sal_uInt16 nRow, sal_uInt16 nCol ) const
{
const HTMLTableCnts *pPrevCnts = nullptr;
if( 0==nRow )
{
- // immer die Vorgaenger-Zelle
+ // always the predecessor cell
if( nCol>0 )
pPrevCnts = GetCell( 0, nCol-1 )->GetContents();
else
return m_pPrevStartNode;
}
else if( USHRT_MAX==nRow && USHRT_MAX==nCol )
- // der Contents der letzten Zelle
+ // contents of preceding cell
pPrevCnts = GetCell( m_nRows-1, m_nCols-1 )->GetContents();
else
{
sal_uInt16 i;
HTMLTableRow *const pPrevRow = (*m_pRows)[nRow-1].get();
- // evtl. eine Zelle in der aktuellen Zeile
+ // maybe a cell in the current row
i = nCol;
while( i )
{
@@ -1213,7 +1207,7 @@ const SwStartNode* HTMLTable::GetPrevBoxStartNode( sal_uInt16 nRow, sal_uInt16 n
}
}
- // sonst die letzte gefuellte Zelle der Zeile davor suchen
+ // otherwise the last filled cell of the row before
if( !pPrevCnts )
{
i = m_nCols;
@@ -1283,12 +1277,12 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
sal_uInt16 nRowSpan, sal_uInt16 nColSpan,
bool bFirstPara, bool bLastPara ) const
{
- SwFrameFormat *pFrameFormat = nullptr; // frame::Frame-Format
+ SwFrameFormat *pFrameFormat = nullptr; // frame::Frame format
sal_Int16 eVOri = text::VertOrientation::NONE;
- const SvxBrushItem *pBGBrushItem = nullptr; // Hintergrund
+ const SvxBrushItem *pBGBrushItem = nullptr; // background
std::shared_ptr<SvxBoxItem> pBoxItem;
bool bTopLine = false, bBottomLine = false, bLastBottomLine = false;
- bool bReUsable = false; // Format nochmals verwendbar?
+ bool bReUsable = false; // Format reusable?
sal_uInt16 nEmptyRows = 0;
bool bHasNumFormat = false;
bool bHasValue = false;
@@ -1299,19 +1293,16 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
if( pBox->GetSttNd() )
{
- // die Hintergrundfarbe/-grafik bestimmen
+ // Determine background color/graphic
const HTMLTableCell *pCell = GetCell( nRow, nCol );
pBoxItem = pCell->GetBoxItem();
pBGBrushItem = pCell->GetBGBrush();
if( !pBGBrushItem )
{
- // Wenn die Zelle ueber mehrere Zeilen geht muss ein evtl.
- // an der Zeile gesetzter Hintergrund an die Zelle uebernommen
- // werden.
- // Wenn es sich um eine Tabelle in der Tabelle handelt und
- // die Zelle ueber die gesamte Heoehe der Tabelle geht muss
- // ebenfalls der Hintergrund der Zeile uebernommen werden, weil
- // die Line von der GC (zu Recht) wegoptimiert wird.
+ // If a cell spans multiple rows, a background to that row should be copied to the cell.
+ // If it's a table in a table and that cell goes over the whole height of that table,
+ // the row's background has to be copied to the cell aswell,
+ // since the line is gonna be GC-ed (correctly).
if( nRowSpan > 1 || (this != m_pTopTable && nRowSpan==m_nRows) )
{
pBGBrushItem = (*m_pRows)[nRow]->GetBGBrush();
@@ -1351,16 +1342,16 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
{
pFrameFormat = pBox->ClaimFrameFormat();
- // die Breite der Box berechnen
+ // calculate width of the box
SwTwips nFrameWidth = (SwTwips)m_pLayoutInfo->GetColumn(nCol)
->GetRelColWidth();
for( sal_uInt16 i=1; i<nColSpan; i++ )
nFrameWidth += (SwTwips)m_pLayoutInfo->GetColumn(nCol+i)
->GetRelColWidth();
- // die Umrandung nur an Edit-Boxen setzen (bei der oberen und unteren
- // Umrandung muss beruecks. werden, ob es sich um den ersten oder
- // letzen Absatz der Zelle handelt)
+ // Only set the border on edit boxes.
+ // On setting the upper and lower border, keep in mind if
+ // it's the first or the last paragraph of the cell
if( pBox->GetSttNd() )
{
bool bSet = (m_nCellPadding > 0);
@@ -1382,9 +1373,7 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
{
if( nEmptyRows && !m_aBorderLine.GetInWidth() )
{
- // Leere Zeilen koennen zur Zeit nur dann ueber
- // dicke Linien simuliert werden, wenn die Linie
- // einfach ist.
+ // For now, empty rows can only be emulated by thick lines, if it's a single line
SvxBorderLine aThickBorderLine( m_aBorderLine );
sal_uInt16 nBorderWidth = m_aBorderLine.GetOutWidth();
@@ -1421,14 +1410,12 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
}
else if (bSet)
{
- // BorderDist nicht mehr Bestandteil einer Zelle mit fixer Breite
+ // BorderDist is not part of a cell with fixed width
sal_uInt16 nBDist = static_cast< sal_uInt16 >(
(2*m_nCellPadding <= nInnerFrameWidth) ? m_nCellPadding
: (nInnerFrameWidth / 2) );
- // wir setzen das Item nur, wenn es eine Umrandung gibt
- // oder eine Border-Distanz vorgegeben ist. Fehlt letztere,
- // dann gibt es eine Umrandung, und wir muessen die Distanz
- // setzen
+ // We only set the item if there's a border or a border distance
+ // If the latter is missing, there's gonna be a border and we'll have to set the distance
aBoxItem.SetAllDistances((nBDist) ? nBDist : MIN_BORDER_DIST);
pFrameFormat->SetFormatAttr( aBoxItem );
}
@@ -1442,7 +1429,7 @@ void HTMLTable::FixFrameFormat( SwTableBox *pBox,
else
pFrameFormat->ResetFormatAttr( RES_BACKGROUND );
- // Format nur setzten, wenn es auch einen Value gibt oder die Box leer ist.
+ // Only set format if there's a value or the box is empty
if( bHasNumFormat && (bHasValue || IsBoxEmpty(pBox)) )
{
bool bLock = pFrameFormat->GetDoc()->GetNumberFormatter()
@@ -1554,8 +1541,7 @@ SwTableBox *HTMLTable::NewTableBox( const SwStartNode *pStNd,
if( m_pTopTable->m_pBox1 &&
m_pTopTable->m_pBox1->GetSttNd() == pStNd )
{
- // wenn der StartNode dem StartNode der initial angelegten Box
- // entspricht nehmen wir diese Box
+ // If the StartNode is the StartNode of the initially created box, we take that box
pBox = m_pTopTable->m_pBox1;
pBox->SetUpper( pUpper );
m_pTopTable->m_pBox1 = nullptr;
@@ -1575,7 +1561,7 @@ static void ResetLineFrameFormatAttrs( SwFrameFormat *pFrameFormat )
"Zeile hat vertikale Ausrichtung" );
}
-// !!! kann noch vereinfacht werden
+// !!! could be simplified
SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper,
sal_uInt16 nTopRow, sal_uInt16 nLeftCol,
sal_uInt16 nBottomRow, sal_uInt16 nRightCol )
@@ -1593,16 +1579,14 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper,
const SvxBrushItem *pBGBrushItem = nullptr;
if( this == m_pTopTable || nTopRow>0 || nBottomRow<m_nRows )
{
- // An der Line eine Frabe zu setzen macht keinen Sinn, wenn sie
- // die auesserste und gleichzeitig einzige Zeile einer Tabelle in
- // der Tabelle ist.
+ // It doesn't make sense to set a color on a line,
+ // if it's the outermost and simultaneously sole line of a table in a table
pBGBrushItem = pTopRow->GetBGBrush();
if( !pBGBrushItem && this != m_pTopTable )
{
- // Ein an einer Tabellen in der Tabelle gesetzter Hintergrund
- // wird an den Rows gesetzt. Das gilt auch fuer den Hintergrund
- // der Zelle, in dem die Tabelle vorkommt.
+ // A background that's set on a table in a table is set on the rows.
+ // It's the same for the background of the cell where that table is
pBGBrushItem = GetBGBrush();
if( !pBGBrushItem )
pBGBrushItem = GetInhBGBrush();
@@ -1615,10 +1599,8 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper,
if( nRowHeight )
{
- // Tabellenhoehe einstellen. Da es sich um eine
- // Mindesthoehe handelt, kann sie genauso wie in
- // Netscape berechnet werden, also ohne Beruecksichtigung
- // der tatsaechlichen Umrandungsbreite.
+ // set table height. Since it's a minimum height it can be calculated like in Netscape,
+ // so without considering the actual border width
nRowHeight += GetTopCellSpace( nTopRow ) +
GetBottomCellSpace( nTopRow, 1 );
@@ -1633,8 +1615,7 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper,
}
else if( !m_pLineFrameFormatNoHeight )
{
- // sonst muessen wir die Hoehe aus dem Attribut entfernen
- // und koennen uns das Format merken
+ // else, we'll have to remove the height from the attribute and remember the formatx
m_pLineFrameFormatNoHeight = static_cast<SwTableLineFormat*>(pLine->ClaimFrameFormat());
ResetLineFrameFormatAttrs( m_pLineFrameFormatNoHeight );
@@ -1662,8 +1643,7 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper,
HTMLTableCell *pCell2 = GetCell( nTopRow, nStartCol );
if( pCell2->GetColSpan() == (nCol+1-nStartCol) )
{
- // Die HTML-Tabellen-Zellen bilden genau eine Box.
- // Dann muss hinter der Box gesplittet werden
+ // The HTML tables represent a box. So we need to split behind that box
nSplitCol = nCol + 1;
long nBoxRowSpan = pCell2->GetRowSpan();
@@ -1685,7 +1665,7 @@ SwTableLine *HTMLTable::MakeTableLine( SwTableBox *pUpper,
if( nBoxRowSpan < 0 )
pCurrCell->SetRowSpan( 0 );
- // ggf. COLSPAN beachten
+ // check COLSPAN if needed
for( sal_uInt16 j=nStartCol+1; j<nSplitCol; j++ )
{
GetCell(nTopRow,j)->SetContents( pCnts );
@@ -1728,10 +1708,10 @@ SwTableBox *HTMLTable::MakeTableBox( SwTableLine *pUpper,
if( !pCnts->Next() )
{
- // nur eine Inhalts-Section
+ // just one content section
if( pCnts->GetStartNode() )
{
- // und die ist keine Tabelle
+ // ... that's not a table
pBox = NewTableBox( pCnts->GetStartNode(), pUpper );
pCnts->SetTableBox( pBox );
}
@@ -1739,9 +1719,8 @@ SwTableBox *HTMLTable::MakeTableBox( SwTableLine *pUpper,
{
pCnts->GetTable()->InheritVertBorders( this, nLeftCol,
nRightCol-nLeftCol );
- // und die ist eine Tabelle: dann bauen wir eine neue
- // Box und fuegen die Zeilen der Tabelle in die Zeilen
- // der Box ein
+ // ... that's a table. We'll build a new box and put the rows of the table
+ // in the rows of the box
pBox = new SwTableBox( m_pBoxFormat, 0, pUpper );
sal_uInt16 nAbs, nRel;
m_pLayoutInfo->GetAvail( nLeftCol, nColSpan, nAbs, nRel );
@@ -1754,7 +1733,7 @@ SwTableBox *HTMLTable::MakeTableBox( SwTableLine *pUpper,
}
else
{
- // mehrere Inhalts Sections: dann brauchen wir eine Box mit Zeilen
+ // multiple content sections: we'll build a box with rows
pBox = new SwTableBox( m_pBoxFormat, 0, pUpper );
SwTableLines& rLines = pBox->GetTabLines();
bool bFirstPara = true;
@@ -1763,14 +1742,13 @@ SwTableBox *HTMLTable::MakeTableBox( SwTableLine *pUpper,
{
if( pCnts->GetStartNode() )
{
- // normale Absaetze werden zu einer Box in einer Zeile
+ // normal paragraphs are gonna be boxes in a row
SwTableLine *pLine =
new SwTableLine( m_pLineFrameFormatNoHeight ? m_pLineFrameFormatNoHeight
: m_pLineFormat, 0, pBox );
if( !m_pLineFrameFormatNoHeight )
{
- // Wenn es noch kein Line-Format ohne Hoehe gibt, koennen
- // wir uns dieses her als soleches merken
+ // If there's no line format without height yet, we can use that one
m_pLineFrameFormatNoHeight = static_cast<SwTableLineFormat*>(pLine->ClaimFrameFormat());
ResetLineFrameFormatAttrs( m_pLineFrameFormatNoHeight );
@@ -1789,7 +1767,7 @@ SwTableBox *HTMLTable::MakeTableBox( SwTableLine *pUpper,
{
pCnts->GetTable()->InheritVertBorders( this, nLeftCol,
nRightCol-nLeftCol );
- // Tabellen werden direkt eingetragen
+ // Tables are entered directly
sal_uInt16 nAbs, nRel;
m_pLayoutInfo->GetAvail( nLeftCol, nColSpan, nAbs, nRel );
sal_uInt16 nLSpace = m_pLayoutInfo->GetLeftCellSpace( nLeftCol,
@@ -1819,47 +1797,38 @@ void HTMLTable::InheritBorders( const HTMLTable *pParent,
OSL_ENSURE( m_nRows>0 && m_nCols>0 && m_nCurrentRow==m_nRows,
"Wurde CloseTable nicht aufgerufen?" );
- // Die Child-Tabelle muss einen Rahmen bekommen, wenn die umgebende
- // Zelle einen Rand an der betreffenden Seite besitzt.
- // Der obere bzw. untere Rand wird nur gesetzt, wenn die Tabelle
- // ale erster bzw. letzter Absatz in der Zelle vorkommt. Ansonsten
- // Fuer den linken/rechten Rand kann noch nicht entschieden werden,
- // ob eine Umrandung der Tabelle noetig/moeglich ist, weil das davon
- // abhaengt, ob "Filler"-Zellen eingefuegt werden. Hier werden deshalb
- // erstmal nur Informationen gesammelt
+ // The child table needs a border, if the surrounding cell has a margin on that side.
+ // The upper/lower border is only set if the table is the first/last paragraph in that cell
+ // It can't be determined if a border for that table is needed or possible for the left or right side,
+ // since that's depending on if filler cells are gonna be added. We'll only collect info for now
if( 0==nRow && pParent->m_bTopBorder && bFirstPara )
{
m_bTopBorder = true;
- m_bFillerTopBorder = true; // auch Filler bekommt eine Umrandung
+ m_bFillerTopBorder = true; // fillers get a border too
m_aTopBorderLine = pParent->m_aTopBorderLine;
}
if ((*pParent->m_pRows)[nRow+nRowSpan-1]->bBottomBorder && bLastPara)
{
(*m_pRows)[m_nRows-1]->bBottomBorder = true;
- m_bFillerBottomBorder = true; // auch Filler bekommt eine Umrandung
+ m_bFillerBottomBorder = true; // fillers get a border too
m_aBottomBorderLine =
nRow+nRowSpan==pParent->m_nRows ? pParent->m_aBottomBorderLine
: pParent->m_aBorderLine;
}
- // Die Child Tabelle darf keinen oberen oder linken Rahmen bekommen,
- // wenn der bereits durch die umgebende Tabelle gesetzt ist.
- // Sie darf jedoch immer einen oberen Rand bekommen, wenn die Tabelle
- // nicht der erste Absatz in der Zelle ist.
+ // The child table mustn't get an upper or lower border, if that's already done by the surrounding table
+ // It can get an upper border if the table is not the first paragraph in that cell
m_bTopAllowed = ( !bFirstPara || (pParent->m_bTopAllowed &&
(0==nRow || !((*pParent->m_pRows)[nRow-1])->bBottomBorder)) );
- // die Child-Tabelle muss die Farbe der Zelle erben, in der sie
- // vorkommt, wenn sie keine eigene besitzt
+ // The child table has to inherit the color of the cell it's contained in, if it doesn't have one
const SvxBrushItem *pInhBG = pParent->GetCell(nRow,nCol)->GetBGBrush();
if( !pInhBG && pParent != m_pTopTable &&
pParent->GetCell(nRow,nCol)->GetRowSpan() == pParent->m_nRows )
{
- // die ganze umgebende Tabelle ist eine Tabelle in der Tabelle
- // und besteht nur aus einer Line, die bei der GC (zu Recht)
- // wegoptimiert wird. Deshalb muss der Hintergrund der Line in
- // diese Tabelle uebernommen werden.
+ // the whole surrounding table is a table in a table and consists only of a single line
+ // that's gonna be GC-ed (correctly). That's why the background of that line is copied.
pInhBG = (*pParent->m_pRows)[nRow]->GetBGBrush();
if( !pInhBG )
pInhBG = pParent->GetBGBrush();
@@ -1878,7 +1847,7 @@ void HTMLTable::InheritVertBorders( const HTMLTable *pParent,
if( nCol+nColSpan==pParent->m_nCols && pParent->m_bRightBorder )
{
- m_bInheritedRightBorder = true; // erstmal nur merken
+ m_bInheritedRightBorder = true; // just remember for now
m_aInheritedRightBorderLine = pParent->m_aRightBorderLine;
nInhRightBorderWidth =
GetBorderWidth( m_aInheritedRightBorderLine, true ) + MIN_BORDER_DIST;
@@ -1886,7 +1855,7 @@ void HTMLTable::InheritVertBorders( const HTMLTable *pParent,
if (((*pParent->m_pColumns)[nCol])->bLeftBorder)
{
- m_bInheritedLeftBorder = true; // erstmal nur merken
+ m_bInheritedLeftBorder = true; // just remember for now
m_aInheritedLeftBorderLine = 0==nCol ? pParent->m_aLeftBorderLine
: pParent->m_aBorderLine;
nInhLeftBorderWidth =
@@ -2006,7 +1975,7 @@ SvxAdjust HTMLTable::GetInheritedAdjust() const
sal_Int16 HTMLTable::GetInheritedVertOri() const
{
- // text::VertOrientation::TOP ist der default!
+ // text::VertOrientation::TOP is default!
sal_Int16 eVOri = (*m_pRows)[m_nCurrentRow]->GetVertOri();
if( text::VertOrientation::TOP==eVOri && m_nCurrentColumn<m_nCols )
eVOri = ((*m_pColumns)[m_nCurrentColumn])->GetVertOri();
@@ -2031,12 +2000,11 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
if( !nColSpan || (sal_uInt32)m_nCurrentColumn + nColSpan > USHRT_MAX )
nColSpan = 1;
- sal_uInt16 nColsReq = m_nCurrentColumn + nColSpan; // benoetigte Spalten
- sal_uInt16 nRowsReq = m_nCurrentRow + nRowSpan; // benoetigte Zeilen
+ sal_uInt16 nColsReq = m_nCurrentColumn + nColSpan;
+ sal_uInt16 nRowsReq = m_nCurrentRow + nRowSpan;
sal_uInt16 i, j;
- // falls wir mehr Spalten benoetigen als wir zur Zeit haben,
- // muessen wir in allen Zeilen noch Zellen hinzufuegen
+ // if we need more colums than we currently have, we need to add cells for all rows
if( m_nCols < nColsReq )
{
for( i=m_nCols; i<nColsReq; i++ )
@@ -2050,8 +2018,7 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
if( nColsReq > m_nFilledColumns )
m_nFilledColumns = nColsReq;
- // falls wir mehr Zeilen benoetigen als wir zur Zeit haben,
- // muessen wir noch neue Zeilen hinzufuegen
+ // if we need more rows than we currently have, we need to add cells
if( m_nRows < nRowsReq )
{
for( i=m_nRows; i<nRowsReq; i++ )
@@ -2060,8 +2027,7 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
OSL_ENSURE(m_nRows == m_pRows->size(), "wrong number of rows in Insert");
}
- // Testen, ob eine Ueberschneidung vorliegt und diese
- // gegebenfalls beseitigen
+ // Check if we have an overlap and could remove that
sal_uInt16 nSpanedCols = 0;
if( m_nCurrentRow>0 )
{
@@ -2071,11 +2037,9 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
HTMLTableCell *pCell = pCurRow->GetCell(i);
if( pCell->GetContents() )
{
- // Der Inhalt reicht von einer weiter oben stehenden Zelle
- // hier herein. Inhalt und Farbe der Zelle sind deshalb in
- // jedem Fall noch dort verankert und koennen deshalb
- // ueberschrieben werden bzw. von ProtectRowSpan geloescht
- // (Inhalt) oder kopiert (Farbe) werden.
+ // A cell from a row further above overlaps this one.
+ // Content and colors are coming from that cell and can be overwritten
+ // or deleted (content) or copied (color) by ProtectRowSpan
nSpanedCols = i + pCell->GetColSpan();
FixRowSpan( m_nCurrentRow-1, i, pCell->GetContents() );
if( pCell->GetRowSpan() > nRowSpan )
@@ -2085,8 +2049,7 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
}
for( i=nColsReq; i<nSpanedCols; i++ )
{
- // Auch diese Inhalte sind in jedem Fall nich in der Zeile
- // darueber verankert.
+ // These contents are anchored in the row above in any case
HTMLTableCell *pCell = pCurRow->GetCell(i);
FixRowSpan( m_nCurrentRow-1, i, pCell->GetContents() );
ProtectRowSpan( m_nCurrentRow, i, pCell->GetRowSpan() );
@@ -2112,32 +2075,32 @@ void HTMLTable::InsertCell( HTMLTableCnts *pCnts,
->PixelToLogic( aTwipSz, MapMode( MapUnit::MapTwip ) );
}
- // die Breite nur in die erste Zelle setzen!
+ // Only set width on the first cell!
if( nCellWidth )
{
sal_uInt16 nTmp = bRelWidth ? nCellWidth : (sal_uInt16)aTwipSz.Width();
GetCell( m_nCurrentRow, m_nCurrentColumn )->SetWidth( nTmp, bRelWidth );
}
- // Ausserdem noch die Hoehe merken
+ // Remember height
if( nCellHeight && 1==nRowSpan )
{
(*m_pRows)[m_nCurrentRow]->SetHeight(static_cast<sal_uInt16>(aTwipSz.Height()));
}
- // den Spaltenzaehler hinter die neuen Zellen setzen
+ // Set the column counter behind the new cells
m_nCurrentColumn = nColsReq;
if( nSpanedCols > m_nCurrentColumn )
m_nCurrentColumn = nSpanedCols;
- // und die naechste freie Zelle suchen
+ // and search for the next free cell
while( m_nCurrentColumn<m_nCols && GetCell(m_nCurrentRow,m_nCurrentColumn)->IsUsed() )
m_nCurrentColumn++;
}
inline void HTMLTable::CloseSection( bool bHead )
{
- // die vorhergende Section beenden, falls es schon eine Zeile gibt
+ // Close the preceding sections if there's already a row
OSL_ENSURE( m_nCurrentRow<=m_nRows, "ungeultige aktuelle Zeile" );
if( m_nCurrentRow>0 && m_nCurrentRow<=m_nRows )
(*m_pRows)[m_nCurrentRow-1]->SetEndOfGroup();
@@ -2148,9 +2111,9 @@ inline void HTMLTable::CloseSection( bool bHead )
void HTMLTable::OpenRow( SvxAdjust eAdjust, sal_Int16 eVertOrient,
SvxBrushItem *pBGBrushItem )
{
- sal_uInt16 nRowsReq = m_nCurrentRow+1; // Anzahl benoetigter Zeilen;
+ sal_uInt16 nRowsReq = m_nCurrentRow+1;
- // die naechste Zeile anlegen, falls sie nicht schon da ist
+ // create the next row if it's not there already
if( m_nRows<nRowsReq )
{
for( sal_uInt16 i=m_nRows; i<nRowsReq; i++ )
@@ -2166,10 +2129,10 @@ void HTMLTable::OpenRow( SvxAdjust eAdjust, sal_Int16 eVertOrient,
if( pBGBrushItem )
(*m_pRows)[m_nCurrentRow]->SetBGBrush( pBGBrushItem );
- // den Spaltenzaehler wieder an den Anfang setzen
+ // reset the column counter
m_nCurrentColumn=0;
- // und die naechste freie Zelle suchen
+ // and search for the next free cell
while( m_nCurrentColumn<m_nCols && GetCell(m_nCurrentRow,m_nCurrentColumn)->IsUsed() )
m_nCurrentColumn++;
}
@@ -2178,7 +2141,7 @@ void HTMLTable::CloseRow( bool bEmpty )
{
OSL_ENSURE( m_nCurrentRow<m_nRows, "aktulle Zeile hinter dem Tabellenende" );
- // leere Zellen bekommen einfach einen etwas dickeren unteren Rand!
+ // empty cells just get a slightly thicker lower border!
if( bEmpty )
{
if( m_nCurrentRow > 0 )
@@ -2188,10 +2151,8 @@ void HTMLTable::CloseRow( bool bEmpty )
HTMLTableRow *const pRow = (*m_pRows)[m_nCurrentRow].get();
- // den COLSPAN aller leeren Zellen am Zeilenende so anpassen, dass
- // eine Zelle daraus wird. Das kann man hier machen (und auf keinen
- // Fall frueher), weill jetzt keine Zellen mehr in die Zeile eingefuegt
- // werden.
+ // modify the COLSPAN of all empty cells at the row end in a way, that they're forming a single cell
+ // that can be done here (and not earlier) since there's no more cells in that row
sal_uInt16 i=m_nCols;
while( i )
{
@@ -2233,7 +2194,7 @@ void HTMLTable::InsertCol( sal_uInt16 nSpan, sal_uInt16 nColWidth, bool bRelWidt
if( !nSpan )
nSpan = 1;
- sal_uInt16 nColsReq = m_nCurrentColumn + nSpan; // benoetigte Spalten
+ sal_uInt16 nColsReq = m_nCurrentColumn + nSpan;
if( m_nCols < nColsReq )
{
@@ -2267,11 +2228,9 @@ void HTMLTable::CloseTable()
{
sal_uInt16 i;
- // Die Anzahl der Tabellenzeilen richtet sich nur nach den
- // <TR>-Elementen (d.h. nach nCurRow). Durch ROWSPAN aufgespannte
- // Zeilen hinter Zeile nCurRow muessen wir deshalb loeschen
- // und vor allem aber den ROWSPAN in den darueberliegenden Zeilen
- // anpassen.
+ // The number of table rows is only dependent on the <TR> elements (i.e. nCurRow).
+ // Rows that are spanned via ROWSPAN behind nCurRow need to be deleted
+ // and we need to adjust the ROWSPAN in the rows above
if( m_nRows>m_nCurrentRow )
{
HTMLTableRow *const pPrevRow = (*m_pRows)[m_nCurrentRow-1].get();
@@ -2287,7 +2246,7 @@ void HTMLTable::CloseTable()
m_nRows = m_nCurrentRow;
}
- // falls die Tabelle keine Spalte hat, muessen wir eine hinzufuegen
+ // if the table has no column, we need to add one
if( 0==m_nCols )
{
m_pColumns->push_back(o3tl::make_unique<HTMLTableColumn>());
@@ -2297,7 +2256,7 @@ void HTMLTable::CloseTable()
m_nFilledColumns = 1;
}
- // falls die Tabelle keine Zeile hat, muessen wir eine hinzufuegen
+ // if the table has no row, we need to add one
if( 0==m_nRows )
{
m_pRows->push_back(o3tl::make_unique<HTMLTableRow>(m_nCols));
@@ -2319,8 +2278,6 @@ void HTMLTable::MakeTable_( SwTableBox *pBox )
SwTableLines& rLines = (pBox ? pBox->GetTabLines()
: const_cast<SwTable *>(m_pSwTable)->GetTabLines() );
- // jetzt geht's richtig los ...
-
for( sal_uInt16 i=0; i<m_nRows; i++ )
{
SwTableLine *pLine = MakeTableLine( pBox, i, 0, i+1, m_nCols );
@@ -2371,35 +2328,32 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
if( this==m_pTopTable )
{
- // Umrandung der Tabelle und aller in ihr enthaltenen berechnen
+ // Calculate borders of the table and all contained tables
SetBorders();
- // Schritt 1: Die benoetigten Layout-Strukturen werden angelegt
- // (inklusive Tabellen in Tabellen).
+ // Step 1: needed layout structures are created (including tables in tables)
CreateLayoutInfo();
- // Schritt 2: Die minimalen und maximalen Spaltenbreiten werden
- // berechnet (inklusive Tabellen in Tabellen). Da wir noch keine
- // Boxen haben, arabeiten wir noch auf den Start-Nodes.
+ // Step 2: the mininal and maximal column width is calculated
+ // (including tables in tables). Since we don't have boxes yet,
+ // we'll work on the start nodes
m_pLayoutInfo->AutoLayoutPass1();
}
- // Schritt 3: Die tatsaechlichen Spaltenbreiten dieser Tabelle werden
- // berechnet (nicht von Tabellen in Tabellen). Dies muss jetzt schon
- // sein, damit wir entscheiden koennen ob Filler-Zellen benoetigt werden
- // oder nicht (deshalb war auch Pass1 schon noetig).
+ // Step 3: the actual column widths of this table are calculated (not tables in tables)
+ // We need this now to decide if we need filler cells
+ // (Pass1 was needed because of this aswell)
m_pLayoutInfo->AutoLayoutPass2( nAbsAvail, nRelAvail, nAbsLeftSpace,
nAbsRightSpace, nInhAbsSpace );
if( this!=m_pTopTable )
{
- // die linke und rechte Umrandung der Tabelle kann jetzt entgueltig
- // festgelegt werden
+ // the right and left border of this table can be finally defined
if( m_pLayoutInfo->GetRelRightFill() == 0 )
{
if( !m_bRightBorder )
{
- // linke Umrandung von auesserer Tabelle uebernehmen
+ // inherit left border of the outer table
if( m_bInheritedRightBorder )
{
m_bRightBorder = true;
@@ -2408,7 +2362,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
}
else
{
- // Umrandung nur setzen, wenn es erlaubt ist
+ // Only set border if allowed
m_bRightBorder = m_bRightAllowed;
}
}
@@ -2417,47 +2371,43 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
!((*m_pColumns)[0])->bLeftBorder &&
m_bInheritedLeftBorder )
{
- // ggf. rechte Umrandung von auesserer Tabelle uebernehmen
+ // If applicable, inherit right border of outer table
((*m_pColumns)[0])->bLeftBorder = true;
m_aLeftBorderLine = m_aInheritedLeftBorderLine;
}
}
- // Fuer die Top-Table muss die Ausrichtung gesetzt werden
+ // Set adjustment for the top table
if( this==m_pTopTable )
{
sal_Int16 eHoriOri;
if( m_bForceFrame )
{
- // Die Tabelle soll in einen Rahmen und ist auch schmaler
- // als der verfuegbare Platz und nicht 100% breit.
- // Dann kommt sie in einen Rahmen
+ // The table should go in a text frame and it's narrower than the
+ // available space and not 100% wide. So it gets a border
eHoriOri = m_bPrcWidth ? text::HoriOrientation::FULL : text::HoriOrientation::LEFT;
}
else switch( m_eTableAdjust )
{
- // Die Tabelle passt entweder auf die Seite, soll aber in keinen
- // Rahmen oder sie ist Breiter als die Seite und soll deshalb
- // in keinen Rahmen
+ // The table either fits the page but shouldn't get a text frame,
+ // or it's wider than the page so it doesn't need a text frame
case SVX_ADJUST_RIGHT:
- // in rechtsbuendigen Tabellen kann nicht auf den rechten
- // Rand Ruecksicht genommen werden
+ // Don't be considerate of the right margin in right-adjusted tables
eHoriOri = text::HoriOrientation::RIGHT;
break;
case SVX_ADJUST_CENTER:
- // zentrierte Tabellen nehmen keine Ruecksicht auf Raender!
+ // Centred tables are not considerate of margins
eHoriOri = text::HoriOrientation::CENTER;
break;
case SVX_ADJUST_LEFT:
default:
- // linksbuendige Tabellen nehmen nur auf den linken Rand
- // Ruecksicht
+ // left-adjusted tables are only considerate of the left margin
eHoriOri = m_nLeftMargin ? text::HoriOrientation::LEFT_AND_WIDTH : text::HoriOrientation::LEFT;
break;
}
- // das Tabellenform holen und anpassen
+ // get the table format and adapt it
SwFrameFormat *pFrameFormat = m_pSwTable->GetFrameFormat();
pFrameFormat->SetFormatAttr( SwFormatHoriOrient(0,eHoriOri) );
if( text::HoriOrientation::LEFT_AND_WIDTH==eHoriOri )
@@ -2482,10 +2432,10 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
}
}
- // die Default Line- und Box-Formate holen
+ // get the default line and box format
if( this==m_pTopTable )
{
- // die erste Box merken und aus der ersten Zeile ausketten
+ // remember the first box and unlist it from the first row
SwTableLine *pLine1 = (m_pSwTable->GetTabLines())[0];
m_pBox1 = (pLine1->GetTabBoxes())[0];
pLine1->GetTabBoxes().erase(pLine1->GetTabBoxes().begin());
@@ -2499,8 +2449,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
m_pBoxFormat = m_pTopTable->m_pBoxFormat;
}
- // ggf. muessen fuer Tabellen in Tabellen "Filler"-Zellen eingefuegt
- // werden
+ // If applicable, add filler cells for tables in tables
if( this != m_pTopTable &&
( m_pLayoutInfo->GetRelLeftFill() > 0 ||
m_pLayoutInfo->GetRelRightFill() > 0 ) )
@@ -2509,17 +2458,17 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
SwTableLines& rLines = pBox->GetTabLines();
- // dazu brauchen wir erstmal ein eine neue Table-Line in der Box
+ // first, we need a new table line in the box
SwTableLine *pLine =
new SwTableLine( m_pLineFrameFormatNoHeight ? m_pLineFrameFormatNoHeight
: m_pLineFormat, 0, pBox );
rLines.push_back( pLine );
- // Sicherstellen, dass wie ein Format ohne Hoehe erwischt haben
+ // Check that we have a format without height
if( !m_pLineFrameFormatNoHeight )
{
- // sonst muessen wir die Hoehe aus dem Attribut entfernen
- // und koennen uns das Format merken
+ // Otherwise, we need to remove the height from the attributes
+ // and remember that format
m_pLineFrameFormatNoHeight = static_cast<SwTableLineFormat*>(pLine->ClaimFrameFormat());
ResetLineFrameFormatAttrs( m_pLineFrameFormatNoHeight );
@@ -2528,11 +2477,11 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
SwTableBoxes& rBoxes = pLine->GetTabBoxes();
SwTableBox *pNewBox;
- // ggf. links eine Zelle einfuegen
+ // If applicable, add a cell to the left
if( m_pLayoutInfo->GetRelLeftFill() > 0 )
{
- // pPrevStNd ist der Vorgaenger-Start-Node der Tabelle. Den
- // "Filler"-Node fuegen wir einfach dahinter ein ...
+ // pPrevStNd is the predecessor start node of the table
+ // We'll add the filler node just behind
m_pPrevStartNode = m_pParser->InsertTableSection( m_pPrevStartNode );
pNewBox = NewTableBox( m_pPrevStartNode, pLine );
@@ -2541,7 +2490,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
m_pLayoutInfo->SetLeftFillerBox( pNewBox );
}
- // jetzt die Tabelle bearbeiten
+ // modify the table now
pNewBox = new SwTableBox( m_pBoxFormat, 0, pLine );
rBoxes.push_back( pNewBox );
@@ -2553,7 +2502,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
MakeTable_( pNewBox );
- // und noch ggf. rechts eine Zelle einfuegen
+ // and add a cell to the right if applicable
if( m_pLayoutInfo->GetRelRightFill() > 0 )
{
const SwStartNode *pStNd =
@@ -2572,16 +2521,14 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
MakeTable_( pBox );
}
- // zum Schluss fuehren wir noch eine Garbage-Collection fuer die
- // Top-Level-Tabelle durch
+ // Finally, we'll do a garbage collection for the top level table
if( this==m_pTopTable )
{
if( 1==m_nRows && m_nHeight && 1==m_pSwTable->GetTabLines().size() )
{
- // Hoehe einer einzeiligen Tabelle als Mindesthoehe der
- // Zeile setzen. (War mal fixe Hoehe, aber das gibt manchmal
- // Probleme (fix #34972#) und ist auch nicht Netscape 4.0
- // konform
+ // Set height of a one-row table as the minimum width of the row
+ // Was originally a fixed height, but that made problems
+ // and is not Netscape 4.0 compliant
m_nHeight = SwHTMLParser::ToTwips( m_nHeight );
if( m_nHeight < MINLAY )
m_nHeight = MINLAY;
@@ -2604,10 +2551,9 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
if (eAdjust != SVX_ADJUST_LEFT &&
eAdjust != SVX_ADJUST_RIGHT)
{
- // Wenn eine Tabelle ohne Breitenangabe nicht links oder
- // rechts umflossen werden soll, dann stacken wir sie
- // in einem Rahmen mit 100%-Breite, damit ihre Groesse
- // angepasst wird. Der Rahmen darf nicht angepasst werden.
+ // If a table with a width attribute isn't flowed around left or right
+ // we'll stack it with a border of 100% width, so its size will
+ // be adapted. That text frame mustn't be modified
OSL_ENSURE( HasToFly(), "Warum ist die Tabelle in einem Rahmen?" );
sal_uInt32 nMin = m_pLayoutInfo->GetMin();
if( nMin > USHRT_MAX )
@@ -2619,9 +2565,8 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
}
else
{
- // Links und rechts ausgerichtete Tabellen ohne Breite
- // duerfen leider nicht in der Breite angepasst werden, denn
- // sie wuerden nur schrumpfen aber nie wachsen.
+ // left or right adjusted table without width mustn't be adjusted in width
+ // as they would only shrink but never grow
m_pLayoutInfo->SetMustNotRecalc( true );
if( m_pContext->GetFrameFormat()->GetAnchor().GetContentAnchor()
->nNode.GetNode().FindTableNode() )
@@ -2641,8 +2586,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
}
m_pLayoutInfo->SetMayBeInFlyFrame( bIsInFlyFrame );
- // Nur Tabellen mit relativer Breite oder ohne Breite muessen
- // angepasst werden.
+ // Only tables with relative width or without width should be modifed
m_pLayoutInfo->SetMustResize( m_bPrcWidth || !m_nWidth );
m_pLayoutInfo->SetWidths();
@@ -2855,15 +2799,12 @@ sal_Int32 SwHTMLParser::StripTrailingLF()
{
if( nLFCount > 2 )
{
- // Bei Netscape entspricht ein Absatz-Ende zwei LFs
- // (mit einem kommt man in die naechste Zeile, das
- // zweite erzeugt eine Leerzeile) Diesen Abstand
- // erreichen wie aber schon mit dem unteren
- // Absatz-Abstand. Wenn nach den <BR> ein neuer
- // Absatz aufgemacht wird, wird das Maximum des Abstands,
- // der sich aus den BR und dem P ergibt genommen.
- // Deshalb muessen wir 2 bzw. alle bei weniger
- // als zweien loeschen
+ // On Netscape, a paragraph end matches 2 LFs
+ // (1 is just a newline, 2 creates a blank line)
+ // We already have this space with the lower paragraph gap
+ // If there's a paragraph after the <BR>, we take the maximum
+ // of the gap that results from the <BR> and <P>
+ // That's why we need to delete 2 respectively all if less than 2
nLFCount = 2;
}
@@ -2958,7 +2899,7 @@ SectionSaveStruct::SectionSaveStruct( SwHTMLParser& rParser ) :
m_nDefListDeepSave(0), m_nContextStMinSave(0), m_nContextStAttrMinSave(0),
m_pTable( nullptr )
{
- // Font-Stacks einfrieren
+ // Freeze font stacks
m_nBaseFontStMinSave = rParser.m_nBaseFontStMin;
rParser.m_nBaseFontStMin = rParser.m_aBaseFontStack.size();
@@ -2966,20 +2907,20 @@ SectionSaveStruct::SectionSaveStruct( SwHTMLParser& rParser ) :
m_nFontStHeadStartSave = rParser.m_nFontStHeadStart;
rParser.m_nFontStMin = rParser.m_aFontStack.size();
- // Kontext-Stack einfrieren
+ // Freeze context stack
m_nContextStMinSave = rParser.m_nContextStMin;
m_nContextStAttrMinSave = rParser.m_nContextStAttrMin;
rParser.m_nContextStMin = rParser.m_aContexts.size();
rParser.m_nContextStAttrMin = rParser.m_nContextStMin;
- // und noch ein par Zaehler retten
+ // And remember a few counters
m_nDefListDeepSave = rParser.m_nDefListDeep;
rParser.m_nDefListDeep = 0;
}
void SectionSaveStruct::Restore( SwHTMLParser& rParser )
{
- // Font-Stacks wieder auftauen
+ // Unfreeze font stacks
sal_uInt16 nMin = rParser.m_nBaseFontStMin;
if( rParser.m_aBaseFontStack.size() > nMin )
rParser.m_aBaseFontStack.erase( rParser.m_aBaseFontStack.begin() + nMin,
@@ -2999,10 +2940,10 @@ void SectionSaveStruct::Restore( SwHTMLParser& rParser )
rParser.m_nContextStMin = m_nContextStMinSave;
rParser.m_nContextStAttrMin = m_nContextStAttrMinSave;
- // und noch ein par Zaehler rekonstruieren
+ // Reconstruct a few counters
rParser.m_nDefListDeep = m_nDefListDeepSave;
- // und ein par Flags zuruecksetzen
+ // Reset a few flags
rParser.m_bNoParSpace = false;
rParser.m_nOpenParaToken = 0;
@@ -3017,16 +2958,16 @@ class CellSaveStruct : public SectionSaveStruct
Color m_aBGColor;
std::shared_ptr<SvxBoxItem> m_pBoxItem;
- HTMLTableCnts* m_pCnts; // Liste aller Inhalte
- HTMLTableCnts* m_pCurrCnts; // der aktuelle Inhalt oder 0
- std::unique_ptr<SwNodeIndex> m_pNoBreakEndNodeIndex;// Absatz-Index eines </NOBR>
+ HTMLTableCnts* m_pCnts; // List of all contents
+ HTMLTableCnts* m_pCurrCnts; // current content or 0
+ std::unique_ptr<SwNodeIndex> m_pNoBreakEndNodeIndex;// Paragraph index of a <NOBR>
double m_nValue;
sal_uInt32 m_nNumFormat;
sal_uInt16 m_nRowSpan, m_nColSpan, m_nWidth, m_nHeight;
- sal_Int32 m_nNoBreakEndContentPos; // Zeichen-Index eines </NOBR>
+ sal_Int32 m_nNoBreakEndContentPos; // Character index of a <NOBR>
SvxAdjust m_eAdjust;
sal_Int16 m_eVertOri;
@@ -3036,8 +2977,8 @@ class CellSaveStruct : public SectionSaveStruct
bool m_bHasNumFormat : 1;
bool m_bHasValue : 1;
bool m_bBGColor : 1;
- bool m_bNoWrap : 1; // NOWRAP-Option
- bool m_bNoBreak : 1; // NOBREAK-Tag
+ bool m_bNoWrap : 1; // NOWRAP option
+ bool m_bNoBreak : 1; // NOBREAK tag
public:
@@ -3110,19 +3051,19 @@ CellSaveStruct::CellSaveStruct( SwHTMLParser& rParser, HTMLTable *pCurTable,
aHTMLTableVAlignTable, m_eVertOri );
break;
case HTML_O_WIDTH:
- m_nWidth = (sal_uInt16)rOption.GetNumber(); // nur fuer Netscape
+ m_nWidth = (sal_uInt16)rOption.GetNumber(); // Just for Netscape
m_bPrcWidth = (rOption.GetString().indexOf('%') != -1);
if( m_bPrcWidth && m_nWidth>100 )
m_nWidth = 100;
break;
case HTML_O_HEIGHT:
- m_nHeight = (sal_uInt16)rOption.GetNumber(); // nur fuer Netscape
+ m_nHeight = (sal_uInt16)rOption.GetNumber(); // Just for Netscape
if( rOption.GetString().indexOf('%') != -1)
- m_nHeight = 0; // keine %-Angaben beruecksichtigen
+ m_nHeight = 0; // don't consider % attributes
break;
case HTML_O_BGCOLOR:
- // Leere BGCOLOR bei <TABLE>, <TR> und <TD>/<TH> wie Netscape
- // ignorieren, bei allen anderen Tags *wirklich* nicht.
+ // Ignore empty BGCOLOR on <TABLE>, <TR> and <TD>/<TH> like Netscape
+ // *really* not on other tags
if( !rOption.GetString().isEmpty() )
{
rOption.GetColor( m_aBGColor );
@@ -3170,9 +3111,8 @@ CellSaveStruct::CellSaveStruct( SwHTMLParser& rParser, HTMLTable *pCurTable,
*rParser.m_xDoc->GetNumberFormatter() );
}
- // einen neuen Kontext anlegen, aber das drawing::Alignment-Attribut
- // nicht dort verankern, weil es noch ger keine Section gibt, in der
- // es gibt.
+ // Create a new context but don't anchor the drawing::Alignment attribute there,
+ // since there's no section yet
sal_uInt16 nToken, nColl;
if( m_bHead )
{
@@ -3227,20 +3167,18 @@ void CellSaveStruct::InsertCell( SwHTMLParser& rParser,
HTMLTable *pCurTable )
{
#if OSL_DEBUG_LEVEL > 0
- // Die Attribute muessen schon beim Auefrauemen des Kontext-Stacks
- // entfernt worden sein, sonst ist etwas schiefgelaufen. Das
- // Checken wir mal eben ...
- // MIB 8.1.98: Wenn ausserhalb einer Zelle Attribute geoeffnet
- // wurden stehen diese noch in der Attribut-Tabelle und werden erst
- // ganz zum Schluss durch die CleanContext-Aufrufe in BuildTable
- // geloescht. Damit es in diesem Fall keine Asserts gibt findet dann
- // keine Ueberpruefung statt. Erkennen tut man diesen Fall an
- // nContextStAttrMin: Der gemerkte Wert nContextStAttrMinSave ist der
- // Wert, den nContextStAttrMin beim Start der Tabelle hatte. Und
- // der aktuelle Wert von nContextStAttrMin entspricht der Anzahl der
- // Kontexte, die beim Start der Zelle vorgefunden wurden. Sind beide
- // Werte unterschiedlich, wurden ausserhalb der Zelle Kontexte
- // angelegt und wir ueberpruefen nichts.
+ // The attributes need to have been removed when tidying up the context stack,
+ // Otherwise something's wrong. Let's check that...
+
+ // MIB 8.1.98: When attributes were opened outside of a cell,
+ // they're still in the attribut table and will only be deleted at the end
+ // through the CleanContext calls in BuildTable. We don't check that there
+ // so that we get no assert [violations, by translator]
+ // We can see this on nContextStAttrMin: the remembered value of nContextStAttrMinSave
+ // is the value that nContextStAttrMin had at the start of the table. And the
+ // current value of nContextStAttrMin corresponds to the number of contexts
+ // we found at the start of the cell. If the values differ, contexts
+ // were created and we don't check anything.
if( rParser.m_nContextStAttrMin == GetContextStAttrMin() )
{
@@ -3254,7 +3192,7 @@ void CellSaveStruct::InsertCell( SwHTMLParser& rParser,
}
#endif
- // jetzt muessen wir noch die Zelle an der aktuellen Position einfuegen
+ // we need to add the cell on the current position
SvxBrushItem *pBrushItem =
rParser.CreateBrushItem( m_bBGColor ? &m_aBGColor : nullptr, m_aBGImage,
m_aStyle, m_aId, m_aClass );
@@ -3293,7 +3231,7 @@ void CellSaveStruct::CheckNoBreak( const SwPosition& rPos, SwDoc * /*pDoc*/ )
{
if( m_bNoBreak )
{
- // <NOBR> wurde nicht beendet
+ // <NOBR> wasn't closed
m_pCnts->SetNoBreak();
}
else if( m_pNoBreakEndNodeIndex &&
@@ -3301,7 +3239,7 @@ void CellSaveStruct::CheckNoBreak( const SwPosition& rPos, SwDoc * /*pDoc*/ )
{
if( m_nNoBreakEndContentPos == rPos.nContent.GetIndex() )
{
- // <NOBR> wurde unmittelbar vor dem Zellen-Ende beendet
+ // <NOBR> was closed immediately before the cell end
m_pCnts->SetNoBreak();
}
else if( m_nNoBreakEndContentPos + 1 == rPos.nContent.GetIndex() )
@@ -3313,8 +3251,7 @@ void CellSaveStruct::CheckNoBreak( const SwPosition& rPos, SwDoc * /*pDoc*/ )
pTextNd->GetText()[m_nNoBreakEndContentPos];
if( ' '==cLast || '\x0a'==cLast )
{
- // Zwischem dem </NOBR> und dem Zellen-Ende gibt es nur
- // ein Blank oder einen Zeilenumbruch.
+ // There's just a blank or a newline between the <NOBR> and the cell end
m_pCnts->SetNoBreak();
}
}
@@ -3326,20 +3263,20 @@ void CellSaveStruct::CheckNoBreak( const SwPosition& rPos, SwDoc * /*pDoc*/ )
HTMLTableCnts *SwHTMLParser::InsertTableContents(
bool bHead )
{
- // eine neue Section anlegen, der PaM steht dann darin
+ // create a new section, the PaM is gonna be there
const SwStartNode *pStNd =
InsertTableSection( static_cast< sal_uInt16 >(bHead ? RES_POOLCOLL_TABLE_HDLN
: RES_POOLCOLL_TABLE) );
if( GetNumInfo().GetNumRule() )
{
- // 1. Absatz auf nicht numeriert setzen
+ // Set the first paragraph to non-enumerated
sal_uInt8 nLvl = GetNumInfo().GetLevel();
SetNodeNum( nLvl );
}
- // Attributierungs-Anfang neu setzen
+ // Reset attributation start
const SwNodeIndex& rSttPara = m_pPam->GetPoint()->nNode;
sal_Int32 nSttCnt = m_pPam->GetPoint()->nContent.GetIndex();
@@ -3397,7 +3334,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
}
else
{
- // <TH> bzw. <TD> wurde bereits gelesen
+ // <TH> resp. <TD> were already read
if( m_pTable->IsOverflowing() )
{
SaveState( 0 );
@@ -3408,8 +3345,8 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
{
bool bTopTable = m_pTable==pCurTable;
- // die Tabelle besitzt noch keinen Inhalt, d.h. die eigentliche
- // Tabelle muss erst noch angelegt werden
+ // the table has no content yet, this means the actual table needs
+ // to be created first
static sal_uInt16 aWhichIds[] =
{
@@ -3450,13 +3387,12 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
}
}
- // Den linken/rechten Absatzeinzug ermitteln
sal_uInt16 nLeftSpace = 0;
sal_uInt16 nRightSpace = 0;
short nIndent;
GetMarginsFromContextWithNumBul( nLeftSpace, nRightSpace, nIndent );
- // die aktuelle Position an die wir irgendwann zurueckkehren
+ // save the current position we'll get back to some time
SwPosition *pSavePos = nullptr;
bool bForceFrame = false;
bool bAppended = false;
@@ -3465,32 +3401,29 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
{
SvxAdjust eTableAdjust = m_pTable->GetTableAdjust(false);
- // Wenn die Tabelle links oder rechts ausgerivchtet ist,
- // oder in einen Rahmen soll, dann kommt sie auch in einen
- // solchen.
+ // If the table is left or right adjusted or should be in a text frame,
+ // it'll get one
bForceFrame = eTableAdjust == SVX_ADJUST_LEFT ||
eTableAdjust == SVX_ADJUST_RIGHT ||
pCurTable->HasToFly();
- // Entweder kommt die Tabelle in keinen Rahmen und befindet
- // sich in keinem Rahmen (wird also durch Zellen simuliert),
- // oder es gibt bereits Inhalt an der entsprechenden Stelle.
+ // The table either shouldn't get in a text frame and isn't in one
+ // (it gets simulated through cells),
+ // or there's already content at that position
OSL_ENSURE( !bForceFrame || pCurTable->HasParentSection(),
"Tabelle im Rahmen hat keine Umgebung!" );
bool bAppend = false;
if( bForceFrame )
{
- // Wenn die Tabelle in einen Rahmen kommt, muss
- // nur ein neuer Absatz aufgemacht werden, wenn
- // der Absatz Rahmen ohne Umlauf enthaelt.
+ // If the table gets in a border, we only need to open a new
+ //paragraph if the paragraph has text frames that don't fly
bAppend = HasCurrentParaFlys(true);
}
else
{
- // Sonst muss ein neuer Absatz aufgemacht werden,
- // wenn der Absatz nicht leer ist, oder Rahmen
- // oder text::Bookmarks enthaelt.
+ // Otherwise, we need to open a new paragraph if the paragraph
+ // is empty or contains text frames or bookmarks
bAppend =
m_pPam->GetPoint()->nContent.GetIndex() ||
HasCurrentParaFlys() ||
@@ -3521,9 +3454,9 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
pTmp = new HTMLAttr( *m_pPam->GetPoint(),
SvxULSpaceItem( 0, 0, RES_UL_SPACE ) );
- m_aSetAttrTab.push_front( pTmp ); // ja, 0, weil schon
- // vom Tabellenende vorher
- // was gesetzt sein kann.
+ m_aSetAttrTab.push_front( pTmp ); // Position 0, since
+ // something can be set by
+ // the table end before
}
AppendTextNode( AM_NOSPACE );
bAppended = true;
@@ -3532,9 +3465,8 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
{
if( !bForceFrame )
{
- // Der Absatz wird gleich hinter die Tabelle
- // verschoben. Deshalb entfernen wir alle harten
- // Attribute des Absatzes
+ // The paragraph will be moved right behind the table.
+ // That's why we remove all hard attributes of that paragraph
for(HTMLAttr* i : m_aParaAttrs)
i->Invalidate();
@@ -3549,33 +3481,30 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
{
bParentLFStripped = StripTrailingLF() > 0;
- // Absaetze bzw. ueberschriften beeenden
+ // Close paragraph resp. headers
m_nOpenParaToken = 0;
m_nFontStHeadStart = m_nFontStMin;
- // die harten Attribute an diesem Absatz werden nie mehr ungueltig
+ // The hard attributes on that paragraph are never gonna be invalid anymore
if( !m_aParaAttrs.empty() )
m_aParaAttrs.clear();
}
- // einen Tabellen Kontext anlegen
+ // create a table context
HTMLTableContext *pTCntxt =
new HTMLTableContext( pSavePos, m_nContextStMin,
m_nContextStAttrMin );
- // alle noch offenen Attribute beenden und hinter der Tabelle
- // neu aufspannen
+ // end all open attributes and open them again behind the table
HTMLAttrs *pPostIts = nullptr;
if( !bForceFrame && (bTopTable || pCurTable->HasParentSection()) )
{
SplitAttrTab( pTCntxt->aAttrTab, bTopTable );
- // Wenn wir einen schon vorhandenen Absatz verwenden, duerfen
- // in den keine PostIts eingefuegt werden, weil der Absatz
- // ja hinter die Tabelle wandert. Sie werden deshalb in den
- // ersten Absatz der Tabelle verschoben.
- // Bei Tabellen in Tabellen duerfen ebenfalls keine PostIts
- // in einen noch leeren Absatz eingefuegt werden, weil
- // der sonat nicht geloescht wird.
+ // If we reuse a already existing paragraph, we can't add
+ // PostIts since the paragraph gets behind that table.
+ // They're gonna be moved into the first paragraph of the table
+ // If we have tables in tables, we also can't add PostIts to a
+ // still empty paragraph, since it's not gonna be deleted that way
if( (bTopTable && !bAppended) ||
(!bTopTable && !bParentLFStripped &&
!m_pPam->GetPoint()->nContent.GetIndex()) )
@@ -3593,7 +3522,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
}
m_bNoParSpace = false;
- // Aktuelle Numerierung retten und auschalten.
+ // Save current numbering and turn it off
pTCntxt->SetNumInfo( GetNumInfo() );
GetNumInfo().Clear();
pTCntxt->SavePREListingXMP( *this );
@@ -3602,7 +3531,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
{
if( bForceFrame )
{
- // Die Tabelle soll in einen Rahmen geschaufelt werden.
+ // the table should be put in a text frame
SfxItemSet aFrameSet( m_xDoc->GetAttrPool(),
RES_FRMATR_BEGIN, RES_FRMATR_END-1 );
@@ -3658,10 +3587,9 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
}
- // eine SwTable mit einer Box anlegen und den PaM in den
- // Inhalt der Box-Section bewegen (der Ausrichtungs-Parameter
- // ist erstmal nur ein Dummy und wird spaeter noch richtig
- // gesetzt)
+ // create a SwTable with a box and set the PaM to the content of
+ // the box section (the adjustment parameter is a dummy for now
+ // and will be corrected later)
OSL_ENSURE( !m_pPam->GetPoint()->nContent.GetIndex(),
"Der Absatz hinter der Tabelle ist nicht leer!" );
const SwTable* pSwTable = m_xDoc->InsertTable(
@@ -3719,8 +3647,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
if( !bAppended && pPostIts )
{
- // noch vorhandene PostIts in den ersten Absatz
- // der Tabelle setzen
+ // set still-existing PostIts to the first paragraph of the table
InsertAttrs( *pPostIts );
delete pPostIts;
pPostIts = nullptr;
@@ -3736,22 +3663,20 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
}
else
{
- // noch offene Bereiche muessen noch entfernt werden
+ // still open sections need to be deleted
if( EndSections( bParentLFStripped ) )
bParentLFStripped = false;
if( pCurTable->HasParentSection() )
{
- // dannach entfernen wir ein ggf. zu viel vorhandenen
- // leeren Absatz, aber nur, wenn er schon vor dem
- // entfernen von LFs leer war
+ // after that, we remove a possibly redundant empty paragraph,
+ // but only if it was empty before we stripped the LFs
if( !bParentLFStripped )
StripTrailingPara();
if( pPostIts )
{
- // noch vorhandene PostIts an das Ende des jetzt
- // aktuellen Absatzes schieben
+ // move still existing PostIts to the end of the current paragraph
InsertAttrs( *pPostIts );
delete pPostIts;
pPostIts = nullptr;
@@ -3765,10 +3690,9 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
pCurTable->SetTable( pStNd, pTCntxt, nLeftSpace, nRightSpace );
}
- // Den Kontext-Stack einfrieren, denn es koennen auch mal
- // irgendwo ausserhalb von Zellen Attribute gesetzt werden.
- // Darf nicht frueher passieren, weil eventuell noch im
- // Stack gesucht wird!!!
+ // Freeze the context stack, since there could be attributes set
+ // outside of cells. Can't happen earlier, since there may be
+ // searches in the stack
m_nContextStMin = m_aContexts.size();
m_nContextStAttrMin = m_nContextStMin;
}
@@ -3776,13 +3700,12 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
pSaveStruct = new CellSaveStruct( *this, pCurTable, bHead,
bReadOptions );
- // ist beim ersten GetNextToken schon pending, muss bei
- // wiederaufsetzen auf jedenfall neu gelesen werden!
+ // If the first GetNextToken() doesn't succeed (pending input), must re-read from the beginning.
SaveState( 0 );
}
if( !nToken )
- nToken = GetNextToken(); // Token nach <TABLE>
+ nToken = GetNextToken(); // Token after <TABLE>
bool bDone = false;
while( (IsParserWorking() && !bDone) || bPending )
@@ -3795,8 +3718,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
"Wo ist die Section gebieben?" );
if( !m_pPendStack && m_bCallNextToken && pSaveStruct->IsInSection() )
{
- // NextToken direkt aufrufen (z.B. um den Inhalt von
- // Floating-Frames oder Applets zu ignorieren)
+ // Call NextToken directly (e.g. ignore the content of floating frames or applets)
NextToken( nToken );
}
else switch( nToken )
@@ -3824,17 +3746,15 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
SvxAdjust eTabAdjust = SVX_ADJUST_END;
if( !m_pPendStack )
{
- // nur wenn eine neue Tabelle aufgemacht wird, aber
- // nicht wenn nach einem Pending in der Tabelle
- // weitergelesen wird!
+ // only if we create a new table, but not if we're still
+ // reading in the table after a Pending
pSaveStruct->m_pTable = m_pTable;
- // HACK: Eine Section fuer eine Tabelle anlegen, die
- // in einen Rahmen kommt.
+ // HACK: create a section for a table that goes in a text frame
if( !pSaveStruct->IsInSection() )
{
- // Diese Schleife muss vorwartes sein, weil die
- // erste Option immer gewinnt.
+ // The loop needs to be forward, since the
+ // first option always wins
bool bNeedsSection = false;
const HTMLOptions& rHTMLOptions = GetOptions();
for (const auto & rOption : rHTMLOptions)
@@ -3857,12 +3777,12 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
}
else
{
- // Wenn im aktuellen Absatz Flys verankert sind,
- // muss die neue Tabelle in einen Rahmen.
+ // If Flys are anchored in the current paragraph,
+ // the table needs to get in a text frame
bHasToFly = HasCurrentParaFlys(false,true);
}
- // in der Zelle kann sich ein Bereich befinden!
+ // There could be a section in the cell
eTabAdjust = m_aAttrTab.pAdjust
? static_cast<const SvxAdjustItem&>(m_aAttrTab.pAdjust->GetItem()).
GetAdjust()
@@ -3875,7 +3795,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
bHasToFly );
if( SvParserState::Pending != GetStatus() )
{
- // nur wenn die Tabelle wirklich zu Ende ist!
+ // Only if the table is really complete
if( pSubTable )
{
OSL_ENSURE( pSubTable->GetTableAdjust(false)!= SVX_ADJUST_LEFT &&
@@ -3889,8 +3809,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
OSL_ENSURE( !pSaveStruct->IsInSection(),
"Wo ist die Section geblieben" );
- // Wenn jetzt keine Tabelle kommt haben wir eine
- // Section
+ // If there's no table coming, we have a section
pSaveStruct->AddContents( pParentContents );
}
@@ -3917,18 +3836,17 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
new HTMLTableCnts(pCapStNd) );
}
- // Jetzt haben wir keine Section mehr
+ // We don't have a section anymore
pSaveStruct->ClearIsInSection();
}
else if( pCapStNd )
{
- // Da wir diese Section nicht mehr loeschen
- // koennen (sie koeente zur erster Box
- // gehoeren), fuegen wir sie ein.
+ // Since we can't delete this section (it might
+ // belong to the first box), we'll add it
pSaveStruct->AddContents(
new HTMLTableCnts(pCapStNd) );
- // Jetzt haben wir keine Section mehr
+ // We don't have a section anymore
pSaveStruct->ClearIsInSection();
}
}
@@ -3939,7 +3857,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
break;
case HTML_NOBR_ON:
- // HACK fuer MS: Steht das <NOBR> zu beginn der Zelle?
+ // HACK for MS: Is the <NOBR> at the start of the cell?
pSaveStruct->StartNoBreak( *m_pPam->GetPoint() );
break;
@@ -3948,16 +3866,15 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
break;
case HTML_COMMENT:
- // Mit Kommentar-Feldern werden Spaces nicht mehr geloescht
- // ausserdem wollen wir fuer einen Kommentar keine neue Zelle
- // anlegen !!!
+ // Spaces are not gonna be deleted with comment fields,
+ // and we don't want a new cell for a comment
NextToken( nToken );
break;
case HTML_MARQUEE_ON:
if( !pSaveStruct->IsInSection() )
{
- // eine neue Section anlegen, der PaM steht dann darin
+ // create a new section, the PaM is gonna be there
pSaveStruct->AddContents(
InsertTableContents( bHead ) );
}
@@ -3966,7 +3883,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
break;
case HTML_TEXTTOKEN:
- // keine Section fuer einen leeren String anlegen
+ // Don't add a section for an empty string
if( !pSaveStruct->IsInSection() && 1==aToken.getLength() &&
' '==aToken[0] )
break;
@@ -3974,7 +3891,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
default:
if( !pSaveStruct->IsInSection() )
{
- // eine neue Section anlegen, der PaM steht dann darin
+ // add a new section, the PaM's gonna be there
pSaveStruct->AddContents(
InsertTableContents( bHead ) );
}
@@ -4003,11 +3920,10 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
return;
}
- // Falls der Inhalt der Zelle leer war, muessen wir noch einen
- // leeren Inhalt anlegen. Ausserdem legen wir einen leeren Inhalt
- // an, wenn die Zelle mit einer Tabelle aufgehoert hat und keine
- // COL-Tags hatte (sonst wurde sie wahrscheinlich von uns exportiert,
- // und dann wollen wir natuerlich keinen zusaetzlichen Absatz haben).
+ // If the content of the cell was empty, we need to create an epty content
+ // We also create an empty content if the cell ended with a table and had no
+ // COL tags. Otherwise, it was probably exported by us and we don't
+ // want to have an additional paragraph
if( !pSaveStruct->GetFirstContents() ||
(!pSaveStruct->IsInSection() && !pCurTable->HasColTags()) )
{
@@ -4036,9 +3952,8 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
{
pSaveStruct->CheckNoBreak( *m_pPam->GetPoint(), m_xDoc.get() );
- // Alle noch offenen Kontexte beenden. Wir nehmen hier
- // AttrMin, weil nContxtStMin evtl. veraendert wurde.
- // Da es durch EndContext wieder restauriert wird, geht das.
+ // End all open contexts. We'll take AttrMin because nContextStMin might
+ // have been modified. Since it's gonna be restored by EndContext, it's okay
while( m_aContexts.size() > m_nContextStAttrMin+1 )
{
HTMLAttrContext *pCntxt = PopContext();
@@ -4046,19 +3961,18 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
delete pCntxt;
}
- // LFs am Absatz-Ende entfernen
+ // Remove LFs at the paragraph end
if( StripTrailingLF()==0 && !m_pPam->GetPoint()->nContent.GetIndex() )
StripTrailingPara();
- // falls fuer die Zelle eine Ausrichtung gesetzt wurde, muessen
- // wir die beenden
+ // If there was an adjustment set for the cell, we need to close it
HTMLAttrContext *pCntxt = PopContext();
EndContext( pCntxt );
delete pCntxt;
}
else
{
- // Alle noch offenen Kontexte beenden
+ // Close all still open contexts
while( m_aContexts.size() > m_nContextStAttrMin )
{
HTMLAttrContext *pCntxt = PopContext();
@@ -4067,14 +3981,14 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
}
}
- // auch eine Numerierung muss beendet werden
+ // end an enumeration
GetNumInfo().Clear();
SetAttr( false );
pSaveStruct->InsertCell( *this, pCurTable );
- // wir stehen jetzt (wahrschenlich) vor <TH>, <TD>, <TR> oder </TABLE>
+ // we're probably before a <TH>, <TD>, <TR> or </TABLE>
delete pSaveStruct;
}
@@ -4094,7 +4008,7 @@ void SwHTMLParser::BuildTableRow( HTMLTable *pCurTable, bool bReadOptions,
SvxAdjust eGrpAdjust,
sal_Int16 eGrpVertOri )
{
- // <TR> wurde bereist gelesen
+ // <TR> was already read
if( !IsParserWorking() && !m_pPendStack )
return;
@@ -4144,8 +4058,8 @@ void SwHTMLParser::BuildTableRow( HTMLTable *pCurTable, bool bReadOptions,
aHTMLTableVAlignTable, eVertOri );
break;
case HTML_O_BGCOLOR:
- // Leere BGCOLOR bei <TABLE>, <TR> und <TD>/<TH> wie Netsc.
- // ignorieren, bei allen anderen Tags *wirklich* nicht.
+ // Ignore empty BGCOLOR on <TABLE>, <TR> and <TD>/>TH> like Netscape
+ // *really* not on other tags
if( !rOption.GetString().isEmpty() )
{
rOption.GetColor( aBGColor );
@@ -4172,13 +4086,12 @@ void SwHTMLParser::BuildTableRow( HTMLTable *pCurTable, bool bReadOptions,
CreateBrushItem( bBGColor ? &aBGColor : nullptr, aBGImage, aStyle,
aId, aClass );
pCurTable->OpenRow( eAdjust, eVertOri, pBrushItem );
- // ist beim ersten GetNextToken schon pending, muss bei
- // wiederaufsetzen auf jedenfall neu gelesen werden!
+ // If the first GetNextToken() doesn't succeed (pending input), must re-read from the beginning.
SaveState( 0 );
}
if( !nToken )
- nToken = GetNextToken(); // naechstes Token
+ nToken = GetNextToken();
bool bDone = false;
while( (IsParserWorking() && !bDone) || bPending )
@@ -4193,8 +4106,7 @@ void SwHTMLParser::BuildTableRow( HTMLTable *pCurTable, bool bReadOptions,
if( !m_pPendStack && m_bCallNextToken &&
(pCurTable->GetContext() || pCurTable->HasParentSection()) )
{
- // NextToken direkt aufrufen (z.B. um den Inhalt von
- // Floating-Frames oder Applets zu ignorieren)
+ /// Call NextToken directly (e.g. ignore the content of floating frames or applets)
NextToken( nToken );
}
else switch( nToken )
@@ -4240,25 +4152,23 @@ void SwHTMLParser::BuildTableRow( HTMLTable *pCurTable, bool bReadOptions,
case HTML_COLGROUP_OFF:
case HTML_COL_ON:
case HTML_COL_OFF:
- // wo keine Zelle anfing kann auch keine aufhoehren, oder?
- // und die ganzen anderen Tokens haben hier auch nicht zu
- // suchen und machen nur die Tabelle kaputt
+ // Where no cell started, there can't be a cell ending
+ // all the other tokens are bogus anyway and only break the table
break;
case HTML_MULTICOL_ON:
- // spaltige Rahmen koennen wir hier leider nicht einguegen
+ // we can't add columned text frames here
break;
case HTML_FORM_ON:
- NewForm( false ); // keinen neuen Absatz aufmachen!
+ NewForm( false ); // don't create a new paragraph
break;
case HTML_FORM_OFF:
- EndForm( false ); // keinen neuen Absatz aufmachen!
+ EndForm( false ); // don't create a new paragraph
break;
case HTML_COMMENT:
NextToken( nToken );
break;
case HTML_MAP_ON:
- // eine Image-Map fuegt nichts ein, deshalb koennen wir sie
- // problemlos auch ohne Zelle parsen
+ // an image map doesn't add anything, so we can parse it without a cell
NextToken( nToken );
break;
case HTML_TEXTTOKEN:
@@ -4294,14 +4204,14 @@ void SwHTMLParser::BuildTableRow( HTMLTable *pCurTable, bool bReadOptions,
delete pSaveStruct;
}
- // wir stehen jetzt (wahrscheinlich) vor <TR> oder </TABLE>
+ // we're probably before <TR> or </TABLE>
}
void SwHTMLParser::BuildTableSection( HTMLTable *pCurTable,
bool bReadOptions,
bool bHead )
{
- // <THEAD>, <TBODY> bzw. <TFOOT> wurde bereits gelesen
+ // <THEAD>, <TBODY> resp. <TFOOT> were read already
if( !IsParserWorking() && !m_pPendStack )
return;
@@ -4350,13 +4260,12 @@ void SwHTMLParser::BuildTableSection( HTMLTable *pCurTable,
}
}
- // ist beim ersten GetNextToken schon pending, muss bei
- // wiederaufsetzen auf jedenfall neu gelesen werden!
+ // If the first GetNextToken() doesn't succeed (pending input), must re-read from the beginning.
SaveState( 0 );
}
if( !nToken )
- nToken = GetNextToken(); // naechstes Token
+ nToken = GetNextToken();
bool bDone = false;
while( (IsParserWorking() && !bDone) || bPending )
@@ -4371,8 +4280,7 @@ void SwHTMLParser::BuildTableSection( HTMLTable *pCurTable,
if( !m_pPendStack && m_bCallNextToken &&
(pCurTable->GetContext() || pCurTable->HasParentSection()) )
{
- // NextToken direkt aufrufen (z.B. um den Inhalt von
- // Floating-Frames oder Applets zu ignorieren)
+ // Call NextToken directly (e.g. ignore the content of floating frames or applets)
NextToken( nToken );
}
else switch( nToken )
@@ -4415,16 +4323,16 @@ void SwHTMLParser::BuildTableSection( HTMLTable *pCurTable,
bDone = m_pTable->IsOverflowing();
break;
case HTML_MULTICOL_ON:
- // spaltige Rahmen koennen wir hier leider nicht einguegen
+ // we can't add columned text frames here
break;
case HTML_FORM_ON:
- NewForm( false ); // keinen neuen Absatz aufmachen!
+ NewForm( false ); // don't create a new paragraph
break;
case HTML_FORM_OFF:
- EndForm( false ); // keinen neuen Absatz aufmachen!
+ EndForm( false ); // don't create a new paragraph
break;
case HTML_TEXTTOKEN:
- // Blank-Strings sind Folge von CR+LF und kein Text
+ // blank strings may be a series of CR+LF and no text
if( (pCurTable->GetContext() ||
!pCurTable->HasParentSection()) &&
1==aToken.getLength() && ' ' == aToken[0] )
@@ -4488,7 +4396,7 @@ inline void TableColGrpSaveStruct::CloseColGroup( HTMLTable *pTable )
void SwHTMLParser::BuildTableColGroup( HTMLTable *pCurTable,
bool bReadOptions )
{
- // <COLGROUP> wurde bereits gelesen, wenn bReadOptions
+ // <COLGROUP> was read already if bReadOptions is set
if( !IsParserWorking() && !m_pPendStack )
return;
@@ -4545,8 +4453,7 @@ void SwHTMLParser::BuildTableColGroup( HTMLTable *pCurTable,
}
}
}
- // ist beim ersten GetNextToken schon pending, muss bei
- // wiederaufsetzen auf jedenfall neu gelesen werden!
+ // If the first GetNextToken() doesn't succeed (pending input), must re-read from the beginning.
SaveState( 0 );
}
@@ -4566,8 +4473,7 @@ void SwHTMLParser::BuildTableColGroup( HTMLTable *pCurTable,
if( !m_pPendStack && m_bCallNextToken &&
(pCurTable->GetContext() || pCurTable->HasParentSection()) )
{
- // NextToken direkt aufrufen (z.B. um den Inhalt von
- // Floating-Frames oder Applets zu ignorieren)
+ // Call NextToken directly (e.g. ignore the content of floating frames or applets)
NextToken( nToken );
}
else switch( nToken )
@@ -4631,15 +4537,14 @@ void SwHTMLParser::BuildTableColGroup( HTMLTable *pCurTable,
pCurTable->InsertCol( nColSpan, nColWidth, bRelColWidth,
eColAdjust, eColVertOri );
- // die Angaben in <COLGRP> sollen ignoriert werden, wenn
- // <COL>-Elemente existieren
+ // the attributes in <COLGRP> should be ignored, if there are <COL> elements
pSaveStruct->nColGrpSpan = 0;
}
break;
case HTML_COL_OFF:
- break; // Ignorieren
+ break; // Ignore
case HTML_MULTICOL_ON:
- // spaltige Rahmen koennen wir hier leider nicht einguegen
+ // we can't add columned text frames here
break;
case HTML_TEXTTOKEN:
if( (pCurTable->GetContext() ||
@@ -4677,19 +4582,18 @@ void SwHTMLParser::BuildTableColGroup( HTMLTable *pCurTable,
class CaptionSaveStruct : public SectionSaveStruct
{
SwPosition aSavePos;
- SwHTMLNumRuleInfo aNumRuleInfo; // gueltige Numerierung
+ SwHTMLNumRuleInfo aNumRuleInfo; // valid numbering
public:
- HTMLAttrTable aAttrTab; // und die Attribute
+ HTMLAttrTable aAttrTab; // attributes
CaptionSaveStruct( SwHTMLParser& rParser, const SwPosition& rPos ) :
SectionSaveStruct( rParser ), aSavePos( rPos )
{
rParser.SaveAttrTab( aAttrTab );
- // Die aktuelle Numerierung wurde gerettet und muss nur
- // noch beendet werden.
+ // The current numbering was remembered and just needs to be closed
aNumRuleInfo.Set( rParser.GetNumInfo() );
rParser.GetNumInfo().Clear();
}
@@ -4698,20 +4602,20 @@ public:
void RestoreAll( SwHTMLParser& rParser )
{
- // Die alten Stack wiederherstellen
+ // Recover the old stack
Restore( rParser );
- // Die alte Attribut-Tabelle wiederherstellen
+ // Recover the old attribute tables
rParser.RestoreAttrTab( aAttrTab );
- // Die alte Numerierung wieder aufspannen
+ // Re-open the old numbering
rParser.GetNumInfo().Set( aNumRuleInfo );
}
};
void SwHTMLParser::BuildTableCaption( HTMLTable *pCurTable )
{
- // <CAPTION> wurde bereits gelesen
+ // <CAPTION> was read already
if( !IsParserWorking() && !m_pPendStack )
return;
@@ -4754,11 +4658,11 @@ void SwHTMLParser::BuildTableCaption( HTMLTable *pCurTable )
}
}
- // Alte PaM-Position retten.
+ // Remember old PaM position
pSaveStruct = new CaptionSaveStruct( *this, *m_pPam->GetPoint() );
- // Eine Text-Section im Icons-Bereich als Container fuer die
- // Ueberschrift anlegen und PaM dort reinstellen.
+ // Add a text section in the icon section as a container for the header
+ // and set the PaM there
const SwStartNode *pStNd;
if( m_pTable == pCurTable )
pStNd = InsertTempTableCaptionSection();
@@ -4767,7 +4671,7 @@ void SwHTMLParser::BuildTableCaption( HTMLTable *pCurTable )
HTMLAttrContext *pCntxt = new HTMLAttrContext( HTML_CAPTION_ON );
- // Tabellen-Ueberschriften sind immer zentriert.
+ // Table headers are always centered
NewAttr( &m_aAttrTab.pAdjust, SvxAdjustItem(SVX_ADJUST_CENTER, RES_PARATR_ADJUST) );
HTMLAttrs &rAttrs = pCntxt->GetAttrs();
@@ -4775,18 +4679,17 @@ void SwHTMLParser::BuildTableCaption( HTMLTable *pCurTable )
PushContext( pCntxt );
- // StartNode der Section an der Tabelle merken.
+ // Remember the start node of the section at the table
pCurTable->SetCaption( pStNd, bTop );
- // ist beim ersten GetNextToken schon pending, muss bei
- // wiederaufsetzen auf jedenfall neu gelesen werden!
+ // If the first GetNextToken() doesn't succeed (pending input), must re-read from the beginning.
SaveState( 0 );
}
if( !nToken )
- nToken = GetNextToken(); // naechstes Token
+ nToken = GetNextToken();
- // </CAPTION> wird laut DTD benoetigt
+ // </CAPTION> is needed according to DTD
bool bDone = false;
while( IsParserWorking() && !bDone )
{
@@ -4863,37 +4766,33 @@ void SwHTMLParser::BuildTableCaption( HTMLTable *pCurTable )
delete pCntxt;
}
- // LF am Absatz-Ende entfernen
bool bLFStripped = StripTrailingLF() > 0;
if( m_pTable==pCurTable )
{
- // Beim spaeteren verschieben der Beschriftung vor oder hinter
- // die Tabelle wird der letzte Absatz nicht mitverschoben.
- // Deshalb muss sich am Ende der Section immer ein leerer
- // Absatz befinden.
+ // On moving the caption later, the last paragraph isn't moved aswell.
+ // That means, there has to be an empty paragraph at the end of the section
if( m_pPam->GetPoint()->nContent.GetIndex() || bLFStripped )
AppendTextNode( AM_NOSPACE );
}
else
{
- // LFs am Absatz-Ende entfernen
+ // Strip LFs at the end of the paragraph
if( !m_pPam->GetPoint()->nContent.GetIndex() && !bLFStripped )
StripTrailingPara();
}
- // falls fuer die Zelle eine Ausrichtung gesetzt wurde, muessen
- // wir die beenden
+ // If there's an adjustment for the cell, we need to close it
HTMLAttrContext *pCntxt = PopContext();
EndContext( pCntxt );
delete pCntxt;
SetAttr( false );
- // Stacks und Attribut-Tabelle wiederherstellen
+ // Recover stack and attribute table
pSaveStruct->RestoreAll( *this );
- // PaM wiederherstellen.
+ // Recover PaM
*m_pPam->GetPoint() = pSaveStruct->GetPos();
delete pSaveStruct;
@@ -4908,9 +4807,8 @@ public:
m_pCurrentTable( pCurTable )
{}
- // Aufbau der Tabelle anstossen und die Tabelle ggf. in einen
- // Rahmen packen. Wenn true zurueckgegeben wird muss noch ein
- // Absatz eingefuegt werden!
+ // Initiate creation of the table and put the table in a text frame if
+ // needed. If it returns true, we need to insert a paragraph.
void MakeTable( sal_uInt16 nWidth, SwPosition& rPos, SwDoc *pDoc );
};
@@ -4926,8 +4824,7 @@ void TableSaveStruct::MakeTable( sal_uInt16 nWidth, SwPosition& rPos, SwDoc *pDo
if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && pTableNd )
{
- // Existiert schon ein Layout, dann muss an dieser Tabelle die
- // BoxFrames neu erzeugt werden.
+ // If there's already a layout, the BoxFrames need to be regenerated at this table
if( pTCntxt->GetFrameFormat() )
{
@@ -4985,7 +4882,7 @@ HTMLTableOptions::HTMLTableOptions( const HTMLOptions& rOptions,
case HTML_O_HEIGHT:
nHeight = (sal_uInt16)rOption.GetNumber();
if( rOption.GetString().indexOf('%') != -1 )
- nHeight = 0; // keine %-Anagben benutzen!!!
+ nHeight = 0; // don't use % attributes
break;
case HTML_O_CELLPADDING:
nCellPadding = (sal_uInt16)rOption.GetNumber();
@@ -5007,7 +4904,7 @@ HTMLTableOptions::HTMLTableOptions( const HTMLOptions& rOptions,
eVertOri = rOption.GetEnum( aHTMLTableVAlignTable, eVertOri );
break;
case HTML_O_BORDER:
- // BORDER und BORDER=BORDER wie BORDER=1 behandeln
+ // Handle BORDER and BORDER=BORDER like BORDER=1
if (!rOption.GetString().isEmpty() &&
!rOption.GetString().equalsIgnoreAsciiCase(
OOO_STRING_SVTOOLS_HTML_O_border))
@@ -5031,8 +4928,8 @@ HTMLTableOptions::HTMLTableOptions( const HTMLOptions& rOptions,
bHasRules = true;
break;
case HTML_O_BGCOLOR:
- // Leere BGCOLOR bei <TABLE>, <TR> und <TD>/<TH> wie Netscape
- // ignorieren, bei allen anderen Tags *wirklich* nicht.
+ // Ignore empty BGCOLOR on <TABLE>, <TR> and <TD>/<TH> like Netscape
+ // *really* not on other tags
if( !rOption.GetString().isEmpty() )
{
rOption.GetColor( aBGColor );
@@ -5074,8 +4971,7 @@ HTMLTableOptions::HTMLTableOptions( const HTMLOptions& rOptions,
bPrcWidth = true;
}
- // Wenn BORDER=0 oder kein BORDER gegeben ist, daan darf es auch
- // keine Umrandung geben
+ // If BORDER=0 or no BORDER given, then there shouldn't be a border
if( 0==nBorder || USHRT_MAX==nBorder )
{
eFrame = HTML_TF_VOID;
@@ -5128,16 +5024,15 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
delete pTableOptions;
- // ist beim ersten GetNextToken schon pending, muss bei
- // wiederaufsetzen auf jedenfall neu gelesen werden!
+ // Is pending on the first GetNextToken, needs to be re-read on each construction
SaveState( 0 );
}
HTMLTable *pCurTable = pSaveStruct->m_pCurrentTable;
- // </TABLE> wird laut DTD benoetigt
+ // </TABLE> is needed according to DTD
if( !nToken )
- nToken = GetNextToken(); // naechstes Token
+ nToken = GetNextToken();
bool bDone = false;
while( (IsParserWorking() && !bDone) || bPending )
@@ -5152,8 +5047,7 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
if( !m_pPendStack && m_bCallNextToken &&
(pCurTable->GetContext() || pCurTable->HasParentSection()) )
{
- // NextToken direkt aufrufen (z.B. um den Inhalt von
- // Floating-Frames oder Applets zu ignorieren)
+ /// Call NextToken directly (e.g. ignore the content of floating frames or applets)
NextToken( nToken );
}
else switch( nToken )
@@ -5161,8 +5055,7 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
case HTML_TABLE_ON:
if( !pCurTable->GetContext() )
{
- // Wenn noch keine Tabelle eingefuegt wurde,
- // die naechste Tabelle lesen
+ // If there's no table added, read the next table'
SkipToken();
bDone = true;
}
@@ -5196,16 +5089,16 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
bDone = m_pTable->IsOverflowing();
break;
case HTML_MULTICOL_ON:
- // spaltige Rahmen koennen wir hier leider nicht einguegen
+ // we can't add columned text frames here
break;
case HTML_FORM_ON:
- NewForm( false ); // keinen neuen Absatz aufmachen!
+ NewForm( false ); // don't add a new paragraph
break;
case HTML_FORM_OFF:
- EndForm( false ); // keinen neuen Absatz aufmachen!
+ EndForm( false ); // don't add a new paragraph
break;
case HTML_TEXTTOKEN:
- // Blank-Strings sind u. U. eine Folge von CR+LF und kein Text
+ // blank strings may be a series of CR+LF and no text
if( (pCurTable->GetContext() ||
!pCurTable->HasParentSection()) &&
1==aToken.getLength() && ' '==aToken[0] )
@@ -5237,14 +5130,12 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
HTMLTableContext *pTCntxt = pCurTable->GetContext();
if( pTCntxt )
{
- // Die Tabelle wurde auch angelegt
- // Tabellen-Struktur anpassen
+ // Modify table structure
pCurTable->CloseTable();
- // ausserhalb von Zellen begonnene Kontexte beenden
- // muss vor(!) dem Umsetzten der Attribut Tabelle existieren,
- // weil die aktuelle danach nicht mehr existiert
+ // end contexts that began out of cells. Needs to exist before (!) we move the table,
+ // since the current one doesn't exist anymore afterwards
while( m_aContexts.size() > m_nContextStAttrMin )
{
HTMLAttrContext *pCntxt = PopContext();
@@ -5257,16 +5148,16 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
if( m_pTable==pCurTable )
{
- // Tabellen-Beschriftung setzen
+ // Set table caption
const SwStartNode *pCapStNd = m_pTable->GetCaptionStartNode();
if( pCapStNd )
{
- // Der letzte Absatz der Section wird nie mitkopiert. Deshalb
- // muss die Section mindestens zwei Absaetze enthalten.
+ // The last paragraph of the section is never part of the copy.
+ // That's why the section needs to contain at least two paragraphs
if( pCapStNd->EndOfSectionIndex() - pCapStNd->GetIndex() > 2 )
{
- // Start-Node und letzten Absatz nicht mitkopieren.
+ // Don't copy start node and the last paragraph
SwNodeRange aSrcRg( *pCapStNd, 1,
*pCapStNd->EndOfSectionNode(), -1 );
@@ -5287,11 +5178,10 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
m_xDoc->getIDocumentContentOperations().MoveNodeRange( aSrcRg, aDstIdx,
SwMoveFlags::DEFAULT );
- // Wenn die Caption vor der Tabelle eingefuegt wurde muss
- // eine an der Tabelle gestzte Seitenvorlage noch in den
- // ersten Absatz der Ueberschrift verschoben werden.
- // Ausserdem muessen alle gemerkten Indizes, die auf den
- // Tabellen-Node zeigen noch verschoben werden.
+ // If the caption was added before the table, a page style on that table
+ // needs to be moved to the first paragraph of the header.
+ // Additionally, all remembered indices that point to the table node
+ // need to be moved
if( bTop )
{
MovePageDescAttrs( pTableStNd, aSrcRg.aStart.GetIndex(),
@@ -5299,14 +5189,14 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
}
}
- // Die Section wird jetzt nicht mehr gebraucht.
+ // The section isn't needed anymore
m_pPam->SetMark();
m_pPam->DeleteMark();
m_xDoc->getIDocumentContentOperations().DeleteSection( const_cast<SwStartNode *>(pCapStNd) );
m_pTable->SetCaption( nullptr, false );
}
- // SwTable aufbereiten
+ // Process SwTable
sal_uInt16 nBrowseWidth = (sal_uInt16)GetCurrentBrowseWidth();
pSaveStruct->MakeTable( nBrowseWidth, *m_pPam->GetPoint(), m_xDoc.get() );
}
@@ -5317,14 +5207,14 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
if( m_pTable==pCurTable )
{
- // oberen Absatz-Abstand einstellen
+ // Set upper paragraph spacing
m_bUpperSpace = true;
SetTextCollAttrs();
m_nParaCnt = m_nParaCnt - std::min(m_nParaCnt,
pTCntxt->GetTableNode()->GetTable().GetTabSortBoxes().size());
- // ggfs. eine Tabelle anspringen
+ // Jump to a table if needed
if( JUMPTO_TABLE == m_eJumpTo && m_pTable->GetSwTable() &&
m_pTable->GetSwTable()->GetFrameFormat()->GetName() == m_sJmpMark )
{
@@ -5332,21 +5222,20 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
m_eJumpTo = JUMPTO_NONE;
}
- // Wenn Import abgebrochen wurde kein erneutes Show
- // aufrufen, weil die SwViewShell schon geloescht wurde!
- // Genuegt nicht. Auch im ACCEPTING_STATE darf
- // kein Show aufgerufen werden, weil sonst waehrend des
- // Reschedules der Parser zerstoert wird, wenn noch ein
- // DataAvailable-Link kommt. Deshalb: Nur im WORKING-State.
+ // If the import was canceled, don't call Show again here since
+ // the SwViewShell was already deleted
+ // That's not enough. Even in the ACCEPTING_STATE, a Show mustn't be called
+ // because otherwise the parser's gonna be destroyed on the reschedule,
+ // if there's still a DataAvailable link coming. So: only in the WORKING state
if( !m_nParaCnt && SvParserState::Working == GetStatus() )
Show();
}
}
else if( m_pTable==pCurTable )
{
- // Es wurde gar keine Tabelle gelesen.
+ // There was no table read
- // Dann muss eine evtl gelesene Beschriftung noch geloescht werden.
+ // We maybe need to delete a read caption
const SwStartNode *pCapStNd = pCurTable->GetCaptionStartNode();
if( pCapStNd )
{