tdf#131819 DOCX import: fix fixed size nested table

Auto width nested table with fixed width cells
is imported as fixed width table to keep the
original cell widths, which define the width of
the table, too.

Partial revert of commit bed818c5d5e92a0b189f25e18495fc205d949128
(tdf#104876 writerfilter: m_bTableSizeTypeInserted = false here).

Change-Id: If58c58a792853e1084ff1d8f9bf6ef74a593b1bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91764
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
This commit is contained in:
László Németh
2020-04-06 12:02:10 +02:00
parent 6a6c6b9242
commit f1c7aa5267
3 changed files with 19 additions and 3 deletions

View File

@@ -371,11 +371,12 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69649, "fdo69649.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73389,"fdo73389.docx")
{
// The width of the inner table was too large. The first fix still converted
// the "auto" table width to a fixed one. The recent fix uses variable width.
// the "auto" table width to a fixed one. The second fix used variable width.
// The recent fix uses fixed width again, according to the fixed width cells.
xmlDocPtr pXmlDoc = parseExport();
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tblPr/w:tblW","type","pct");
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tblPr/w:tblW","w","5000");
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tblPr/w:tblW","type","dxa");
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tblPr/w:tblW","w","1611");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf59274, "tdf59274.docx")

View File

@@ -226,6 +226,15 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testNumberedList,"NumberedList.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[1]/w:tc[1]/w:p[3]/w:pPr[1]/w:numPr/w:numId","val", "0");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131819, "NumberedList.docx")
{
// keep width of fixed size cells in the nested table
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
// These were 4030 and 4249.
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblGrid/w:gridCol[1]", "w", "3841");
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tbl/w:tblGrid/w:gridCol[2]", "w", "4049");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO76597, "fdo76597.docx")
{
// check XML

View File

@@ -180,6 +180,12 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, 0 );
m_bTableSizeTypeInserted = true;
}
else if (getTableDepth() > 1)
{
// tdf#131819 limiting the fix for nested tables temporarily
// TODO revert the fix for tdf#104876 and reopen it
m_bTableSizeTypeInserted = true;
}
}
}
#ifdef DBG_UTIL