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

Szabolcs Toth (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 16 16:19:56 UTC 2019


 sw/qa/extras/ooxmlexport/data/tdf112103_tablebgnofill.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlw14export.cxx                |    8 ++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx               |    5 ++++-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit d0a7ed1052d0affe067e534b72a61461ca7058f1
Author:     Szabolcs Toth <szabolcs450 at gmail.com>
AuthorDate: Thu Oct 10 13:22:11 2019 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Wed Oct 16 18:19:13 2019 +0200

    tdf#112103 DOCX cleanup: don't export redundant table bkground color "auto"
    
    because this is the default value of table cells.
    
    Change-Id: I4f45f32f24474f4d9c6bbc91fcd62cb66f008e5d
    Reviewed-on: https://gerrit.libreoffice.org/80601
    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/tdf112103_tablebgnofill.docx b/sw/qa/extras/ooxmlexport/data/tdf112103_tablebgnofill.docx
new file mode 100644
index 000000000000..cee8756ec3b8
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf112103_tablebgnofill.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx
index d6f13dfc55a7..f6939083c456 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlw14export.cxx
@@ -642,6 +642,14 @@ DECLARE_OOXMLEXPORT_TEST(Test_TextEffects_InStyleXml, "TextEffects_InStyle.docx"
     }
 }
 
+DECLARE_OOXMLEXPORT_TEST(Test_no_tag_if_no_fill, "tdf112103_tablebgnofill.docx")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:shd", 0);
+}
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index e7468c1c8d6d..866cc7f0c863 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4083,9 +4083,12 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
     if ( sOriginalColor != sColor )
     {
         // color changed by the user, or no grab bag: write sColor
-        m_pSerializer->singleElementNS( XML_w, XML_shd,
+        if ( sColor != "auto" )
+        {
+            m_pSerializer->singleElementNS( XML_w, XML_shd,
                 FSNS( XML_w, XML_fill ), sColor,
                 FSNS( XML_w, XML_val ), "clear" );
+        }
     }
     else
     {


More information about the Libreoffice-commits mailing list