[Libreoffice-commits] core.git: sw/qa writerfilter/source

Szabolcs Toth (via logerrit) logerrit at kemper.freedesktop.org
Wed Nov 20 12:18:10 UTC 2019


 sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx                           |   11 ++++++++++
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx            |    7 ++++++
 3 files changed, 18 insertions(+)

New commits:
commit 8a59f18b6eb22c43ec10cdc29ba5a13d5feba4f0
Author:     Szabolcs Toth <szabolcs450 at gmail.com>
AuthorDate: Thu Nov 14 13:32:00 2019 +0100
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Nov 20 13:16:57 2019 +0100

    tdf#124399 DOCX import: don't apply inside borders to 1-cell tables
    
    Extra cell borders appeared on the bottom, top, left or right
    of the 1-cell tables when only the "inside borders" option was selected.
    The extra borders were the ones that would normally have appeared as
    inside borders if there were more than one cells in the table.
    
    Change-Id: I05d5f2a5a0168989f220d20a95b6dacf5152f9f7
    Reviewed-on: https://gerrit.libreoffice.org/82675
    Reviewed-by: László Németh <nemeth at numbertext.org>
    Tested-by: László Németh <nemeth at numbertext.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx b/sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx
new file mode 100755
index 000000000000..edb93b76e1df
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124399_SingleCellTableBorders.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index ec87951cdeec..c78ecb5aff38 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1001,6 +1001,17 @@ DECLARE_OOXMLEXPORT_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula.
     assertXPathContent(pXmlDoc, "//w:tbl/w:tr/w:tc[2]/w:p/m:oMath/m:sSubSup/m:e/m:r/m:t", u"\u03C3");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testSingleCellTableBorders, "tdf124399_SingleCellTableBorders.docx")
+{
+    // tdf#124399: Extra borders on single cell tables fixed.
+
+    xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+    if (!pXmlDocument)
+        return;
+    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:top    [@w:val = 'nil']", 1);
+    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:tcBorders/w:bottom [@w:val = 'nil']", 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 3996df51d8e4..d6be09fbd4e4 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -823,6 +823,13 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
                 TagLogger::getInstance().attribute("row", nRow);
 #endif
 
+                // Do not apply horizontal and vertical borders to a one cell table.
+                if (m_aCellProperties.size() <= 1)
+                {
+                    rInfo.pTableBorders->Erase(META_PROP_HORIZONTAL_BORDER);
+                    rInfo.pTableBorders->Erase(META_PROP_VERTICAL_BORDER);
+                }
+
                 lcl_computeCellBorders( rInfo.pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow );
 
                 //now set the default left+right border distance TODO: there's an sprm containing the default distance!


More information about the Libreoffice-commits mailing list