summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-09-24 09:21:11 (GMT)
committerMichael Stahl <mstahl@redhat.com>2012-09-24 11:50:11 (GMT)
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 a39e015..22e44f5 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1386,6 +1386,20 @@ SwTableNode* SwNodes::TextToTable( const SwNodes::TableRanges_t & rTableNodes,
// 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();