diff options
author | Szabolcs Toth <szabolcs450@gmail.com> | 2019-12-17 14:54:39 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-03-04 18:25:02 +0100 |
commit | 6ead8536c69091fa0ce533cc72ddb3164760850a (patch) | |
tree | 6563a163a9d63208447eb2b6831f78c8713070d0 | |
parent | tdf#124399 DOCX import: don't apply inside borders to 1-cell tables (diff) | |
download | core-6ead8536c69091fa0ce533cc72ddb3164760850a.tar.gz core-6ead8536c69091fa0ce533cc72ddb3164760850a.zip |
tdf#129442 DOCX import: fix right border of 1-column tables
Right border was missing in a 1-column table with disabled
inside borders. This happened because LO applied the empty
vertical borders to the right border of the table.
(cherry picked from commit 8a2eb40abbd52d960dd21308157186be0ca9dd3d)
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
Change-Id: Ib190689bf5059bfd7dbf07b07808cd761015f37e
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx | bin | 0 -> 12167 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 5 |
3 files changed, 17 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx b/sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx Binary files differnew file mode 100644 index 000000000000..57ad24b61435 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf129442_RightBorder.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 6b4fe358bff2..f965e21674b0 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1011,6 +1011,18 @@ DECLARE_OOXMLEXPORT_TEST(testSingleCellTableBorders, "tdf124399_SingleCellTableB assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 1); } +DECLARE_OOXMLEXPORT_TEST(testRightBorder, "tdf129442_RightBorder.docx") +{ + // tdf#129442: Right border of a one column table was missing. + + xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + if (!pXmlDocument) + return; + + // If the right border is missing like in the bug, then there is a <w:right w:val="nil" /> tag in tcBorders. + assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[1]/w:tc/w:tcPr/w:tcBorders/w:end [@w:val = 'nil']", 0); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 3e17e8fa65d5..bad791b6af8e 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -823,6 +823,11 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER); rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); } + // Do not apply vertical borders to a one column table. + else if (m_aCellProperties.size() > 1 && aRowOfCellsIterator->size() <= 1) + { + rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER); + } lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow ); |