diff options
author | László Németh <nemeth@numbertext.org> | 2019-11-26 16:42:15 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2019-11-27 07:52:01 +0100 |
commit | 001e11c8f4a52a2eb308562bdee8516efb77b96b (patch) | |
tree | 90a7a52d75302cee1d39c736267904e8c180d6e9 | |
parent | 28ea418a3f1905d8a4a8e5813e8ed737960c62d2 (diff) |
tdf#76586 fix table width of auto-width nested tables
when they have (sometimes incorrect) fixed cell widths.
Change-Id: I98bf37bfce72b84eed14e354520e4741ae2ddada
Reviewed-on: https://gerrit.libreoffice.org/83787
Reviewed-by: László Németh <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 11 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableManager.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/TableManager.hxx | 2 |
3 files changed, 19 insertions, 6 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index dada93a93b0f..b62d49a72730 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -374,10 +374,13 @@ DECLARE_OOXMLEXPORT_TEST(testFdo69649, "fdo69649.docx") DECLARE_OOXMLEXPORT_TEST(testFdo73389,"fdo73389.docx") { - uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); - // This was 9340, i.e. the width of the inner table was too large. - CPPUNIT_ASSERT_EQUAL(sal_Int32(2842), getProperty<sal_Int32>(xTables->getByIndex(0), "Width")); + // 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. + xmlDocPtr pXmlDoc = parseExport(); + if (!pXmlDoc) + return; + 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"); } DECLARE_OOXMLEXPORT_TEST(testDMLGroupshapeSdt, "dml-groupshape-sdt.docx") diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx index e29637583631..3a3b713723ee 100644 --- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx @@ -644,8 +644,16 @@ void DomainMapperTableManager::endOfRowAction() { if(nTableWidth > 100 || nTableWidth <= 0) { - pTablePropMap->setValue(TablePropertyMap::TABLE_WIDTH, m_nTableWidth); - pTablePropMap->setValue(TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::FIX); + if(getTableDepth() > 1 && !m_bTableSizeTypeInserted) + { + pTablePropMap->setValue(TablePropertyMap::TABLE_WIDTH, sal_Int32(100)); + pTablePropMap->setValue(TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE); + } + else + { + pTablePropMap->setValue(TablePropertyMap::TABLE_WIDTH, m_nTableWidth); + pTablePropMap->setValue(TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::FIX); + } } } uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell.back( ) - 1 ); diff --git a/writerfilter/source/dmapper/TableManager.hxx b/writerfilter/source/dmapper/TableManager.hxx index 6c7a9ea1e21e..47947ee724ee 100644 --- a/writerfilter/source/dmapper/TableManager.hxx +++ b/writerfilter/source/dmapper/TableManager.hxx @@ -328,6 +328,8 @@ protected: */ sal_uInt32 getTableDepthDifference() const { return mnTableDepthNew - mnTableDepth; } + sal_uInt32 getTableDepth() const { return mnTableDepthNew; } + /** Action to be carried out at the end of the last paragraph of a cell. |