diff options
author | Vasily Melenchuk <vasily.melenchuk@cib.de> | 2022-05-25 17:15:53 +0300 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2022-05-30 11:52:44 +0200 |
commit | e4e03e79fac598a9fafb0da8ab50da9a67c6978e (patch) | |
tree | f64a4d03619fbcd9ade907ca77a3c4dbbe0d79a2 /sw | |
parent | d471bfb1125d87f86bca3b4b4cfaf2f44728d438 (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>
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 da72f770151b..67f3c838e759 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -949,6 +949,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(testTdf135923, "tdf135923-min.docx") { uno::Reference<text::XText> xShape(getShape(1), uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f6f542ad4b39..769f120e97a8 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3184,7 +3184,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); |