sw/qa/extras/layout/layout4.cxx | 3 +-- sw/qa/extras/ooxmlexport/ooxmlexport20.cxx | 3 +++ sw/source/writerfilter/dmapper/TableManager.cxx | 4 ++++ sw/source/writerfilter/dmapper/TablePropertiesHandler.cxx | 11 +++++++++-- sw/source/writerfilter/ooxml/model.xml | 1 + 5 files changed, 18 insertions(+), 4 deletions(-)
New commits: commit 467714ad00ce7996597b0e335f4ee562a9c0234f Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Mon Apr 7 15:46:08 2025 -0400 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Apr 9 10:19:25 2025 +0200 tdf#165424 writerfilter: handle row's tblPrEx tblCellMar Up till now, we have handled table margins specified at the table level and overridden at the cell level. But we have ignored any definition of the cell margins at the row level. This patch adds support for tblCellMar under w:tr's tblPrEx, make CppunitTest_sw_layoutwriter4 \ CPPUNIT_TEST_NAME=TestTdf164907_rowHeightAtLeast This also can be seen (slightly) in ooxmlexport14's tdf92472.docx and in rows 4+ of ooxmlexport20's tdf138612.docx. The patch ended up being simple, thanks to Laszlo's earlier work. (I fixed a tiny bug for him - otherwise it was missing the first cell/column - which I have captured in this unit test): make CppunitTest_sw_ooxmlexport20 CPPUNIT_TEST_NAME=testTdf138612 Change-Id: Ic98d6cb1b41096c6fd137948babc74dba7e79ccd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183753 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183822 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/layout/layout4.cxx b/sw/qa/extras/layout/layout4.cxx index c917b3ea0b85..eb9abea5a538 100644 --- a/sw/qa/extras/layout/layout4.cxx +++ b/sw/qa/extras/layout/layout4.cxx @@ -1614,8 +1614,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, TestTdf164907_rowHeightAtLeast) { createSwDoc("tdf164907_rowHeightAtLeast.docx"); - // TODO: import row top/bottom height of 0 overrides - // CPPUNIT_ASSERT_EQUAL(1, getPages()); + CPPUNIT_ASSERT_EQUAL(1, getPages()); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter4, TestTdf157829LTR) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx index 7ef3f92031cd..c1ea555a6bdb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport20.cxx @@ -185,6 +185,9 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf138612) // Row 6 Col 2 - split cell // This was w:vMerge="continue" (merged with cell in Row 5 Col 2) assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[6]/w:tc[2]/w:tcPr/w:vMerge", 0); + + // tdf#165424 - imported row tblCellMar should show up as exported cell tcMar entries + assertXPath(pXmlDocument, "//w:body/w:tbl[1]/w:tr[5]/w:tc[1]/w:tcPr/w:tcMar/w:end", "w", u"0"); } CPPUNIT_TEST_FIXTURE(Test, testTdf140597) diff --git a/sw/source/writerfilter/dmapper/TableManager.cxx b/sw/source/writerfilter/dmapper/TableManager.cxx index f73d61b145ac..e4b38033475c 100644 --- a/sw/source/writerfilter/dmapper/TableManager.cxx +++ b/sw/source/writerfilter/dmapper/TableManager.cxx @@ -206,7 +206,11 @@ void TableManager::tableExceptionProps(const TablePropertyMapPtr& pProps) #endif if (getTableExceptionProps()) + { getTableExceptionProps()->InsertProps(pProps.get()); + assert(getCellProps() && "setTableExceptionProps creates cellProps"); + getCellProps()->InsertProps(pProps.get()); + } else mState.setTableExceptionProps(pProps); diff --git a/sw/source/writerfilter/dmapper/TablePropertiesHandler.cxx b/sw/source/writerfilter/dmapper/TablePropertiesHandler.cxx index 821f093968cb..5e5f85aa2c17 100644 --- a/sw/source/writerfilter/dmapper/TablePropertiesHandler.cxx +++ b/sw/source/writerfilter/dmapper/TablePropertiesHandler.cxx @@ -252,7 +252,7 @@ namespace writerfilter::dmapper { } break; case NS_ooxml::LN_CT_TcPrBase_tcMar: - + case NS_ooxml::LN_CT_TblPrEx_tblCellMar: { writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); if (pProperties) @@ -272,7 +272,14 @@ namespace writerfilter::dmapper { pCellProperties->Insert(PROP_BOTTOM_BORDER_DISTANCE, uno::Any(pCellMarginHandler->m_nBottomMargin)); if (pCellMarginHandler->m_bRightMarginValid) pCellProperties->Insert(PROP_RIGHT_BORDER_DISTANCE, uno::Any(pCellMarginHandler->m_nRightMargin)); - cellProps(pCellProperties); + + if (nSprmId == NS_ooxml::LN_CT_TcPrBase_tcMar) + cellProps(pCellProperties); + else + { + // non-UNO row props which are applied to each cell via resetCellProps. + tableExceptionProps(pCellProperties); // i.e. tableRowExceptionProps + } } } break; diff --git a/sw/source/writerfilter/ooxml/model.xml b/sw/source/writerfilter/ooxml/model.xml index 4e1be61e14a9..2c4d3f1e510d 100644 --- a/sw/source/writerfilter/ooxml/model.xml +++ b/sw/source/writerfilter/ooxml/model.xml @@ -18740,6 +18740,7 @@ <resource name="CT_TblPrEx" resource="Properties"> <element name="tblPrExChange" tokenid="ooxml:CT_TblPrEx_tblPrExChange"/> <element name="tblBorders" tokenid="ooxml:CT_TblPrEx_tblBorders"/> + <element name="tblCellMar" tokenid="ooxml:CT_TblPrEx_tblCellMar"/> </resource> <resource name="CT_Tbl" resource="TextTable"/> <!-- tdf#111550 : allow <w:tbl> at paragraph level (despite this is illegal according to ECMA-376-1:2016) - bug-to-bug compatibility with Word -->