diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2022-05-25 17:15:53 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-06-01 12:30:35 +0200 |
commit | f012cecd786c03e1210d4d9ba3aab9f1f8decc7b (patch) | |
tree | 6f3a730e66288722b794cb4329d77a841d9a96d1 /sw | |
parent | 7e0e28dfbf01351b796b230ffc9498521c3eea90 (diff) |
tdf#149200: docx export: transparent color fix
If there is no color value we should not also try to write
transparency information: otherwise w:srgbClr will have no
parameter value and MS Word won't open such documents.
Change-Id: Id67f174c5ae9aadf90ae54c126aef9a43ff3ba17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134945
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135121
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf149200.docx | bin | 0 -> 2880 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 15 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf149200.docx b/sw/qa/extras/ooxmlexport/data/tdf149200.docx Binary files differnew file mode 100644 index 000000000000..811f594b64f4 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf149200.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 2432f6112511..9f8c4c0b5c5d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -631,6 +631,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148132, "tdf148132.docx") } } +CPPUNIT_TEST_FIXTURE(Test, testTdf149200) +{ + loadAndSave("tdf149200.docx"); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + + // Ensure there is no unexpected invalid structure <w14:textFill> + // There is just one run property + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "count(/w:document/w:body/w:p[1]/w:r[1]/w:rPr/*)"); + CPPUNIT_ASSERT(pXmlObj); + CPPUNIT_ASSERT_EQUAL(double(1), pXmlObj->floatval); + // And it is a color definition with themeColor + CPPUNIT_ASSERT_EQUAL(OUString("dark1"), getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w:color", "themeColor")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf148273_sectionBulletFormatLeak, "tdf148273_sectionBulletFormatLeak.docx") { // get a paragraph with bullet point after section break diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index aa3b1392b1d4..e74ea397c40a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3192,7 +3192,7 @@ void DocxAttributeOutput::WriteCollectedRunProperties() { const char* pVal = nullptr; m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pVal); - if (pVal == nullptr || std::string_view("auto") != pVal) + if (pVal != nullptr && std::string_view("auto") != pVal) { m_pSerializer->startElementNS(XML_w14, XML_textFill); m_pSerializer->startElementNS(XML_w14, XML_solidFill); |