summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-09-24 11:21:11 +0200
committerMichael Stahl <mstahl@redhat.com>2012-09-24 13:50:11 +0200
commit6d2e09db4a677068095b0bebd08fbbb96620d60c (patch)
treead684dcaf44586ed073448baaaa14efb5c297bad
parent53c91152ea52d053fa85df9868b29524739ab0b7 (diff)
rhbz#820283: fix crashes in DOCX table import:
It is apparently possible that writerfilter creates a table with irregular structure, where the lines have varying numbers of boxes in them. This may cause crashes on later editing operations, e.g. when SwTable::NewInsertCol() is unable to find boxes covering a particular column. To prevent this, add missing boxes in SwNodes::TextToTable(). Change-Id: I423821645baeaf55595e4933e1ab8fb89b2099f3
-rw-r--r--sw/source/core/docnode/ndtbl.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index a39e0154f708..22e44f5a4358 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1383,12 +1383,26 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes,
nMaxBoxes = nBoxes;
}
// die Tabelle ausgleichen, leere Sections einfuegen
sal_uInt16 n;
+ for (n = 0; n < pTable->GetTabLines().size(); ++n )
+ {
+ // rhbz#820283: balance the cells in table rows
+ SwTableLine *const pCurrLine = pTable->GetTabLines()[ n ];
+ nBoxes = pCurrLine->GetTabBoxes().size();
+ SwTxtFmtColl *const pTxtColl(const_cast<SwTxtFmtColl*>(
+ GetDoc()->GetDfltTxtFmtColl()));
+ if (nMaxBoxes != nBoxes)
+ {
+ InsBoxen( pTblNd, pCurrLine, pBoxFmt, pTxtColl, 0,
+ nBoxes, nMaxBoxes - nBoxes );
+ }
+ }
+
if( !aPosArr.empty() )
{
SwTableLines& rLns = pTable->GetTabLines();
sal_uInt16 nLastPos = 0;
for( n = 0; n < aPosArr.size(); ++n )
{