diff options
-rw-r--r-- | oox/qa/unit/data/refer-to-theme.pptx | bin | 32686 -> 33853 bytes | |||
-rw-r--r-- | oox/qa/unit/export.cxx | 25 | ||||
-rw-r--r-- | oox/source/export/drawingml.cxx | 24 |
3 files changed, 42 insertions, 7 deletions
diff --git a/oox/qa/unit/data/refer-to-theme.pptx b/oox/qa/unit/data/refer-to-theme.pptx Binary files differindex 9a45799ab977..9f05bf7b07e5 100644 --- a/oox/qa/unit/data/refer-to-theme.pptx +++ b/oox/qa/unit/data/refer-to-theme.pptx diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx index 58169c558e48..960df6dd43e7 100644 --- a/oox/qa/unit/export.cxx +++ b/oox/qa/unit/export.cxx @@ -587,7 +587,30 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToTheme) // - Actual : 0 // - XPath '//p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr' number of nodes is incorrect // i.e. the <a:schemeClr> element was not written. - assertXPath(pXmlDoc, "//p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr", "val", "accent1"); + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr", "val", + "accent1"); + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumMod", 0); + assertXPath(pXmlDoc, "//p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff", 0); + + // Second shape: lighter color: + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 0 + // - XPath '//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr' number of nodes is incorrect + // i.e. the effects case did not write scheme colors. + assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr", "val", + "accent1"); + assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumMod", "val", + "40000"); + assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff", "val", + "60000"); + + // Third shape, darker color: + assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr", "val", + "accent1"); + assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumMod", "val", + "75000"); + assertXPath(pXmlDoc, "//p:sp[3]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:schemeClr/a:lumOff", 0); } } diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 45274efa9315..46098e9d04a3 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -433,19 +433,31 @@ bool DrawingML::WriteCharColor(const css::uno::Reference<css::beans::XPropertySe const char* pColorName = g_aPredefinedClrNames[nCharColorTheme]; - sal_Int32 nCharColorLumMod{}; - xPropertySet->getPropertyValue("CharColorLumMod") >>= nCharColorLumMod; - sal_Int32 nCharColorLumOff{}; - xPropertySet->getPropertyValue("CharColorLumOff") >>= nCharColorLumOff; sal_Int32 nCharColorTintOrShade{}; xPropertySet->getPropertyValue("CharColorTintOrShade") >>= nCharColorTintOrShade; - if (nCharColorLumMod != 10000 || nCharColorLumOff != 0 || nCharColorTintOrShade != 0) + if (nCharColorTintOrShade != 0) { return false; } mpFS->startElementNS(XML_a, XML_solidFill); - mpFS->singleElementNS(XML_a, XML_schemeClr, XML_val, pColorName); + mpFS->startElementNS(XML_a, XML_schemeClr, XML_val, pColorName); + + sal_Int32 nCharColorLumMod{}; + xPropertySet->getPropertyValue("CharColorLumMod") >>= nCharColorLumMod; + if (nCharColorLumMod != 10000) + { + mpFS->singleElementNS(XML_a, XML_lumMod, XML_val, OString::number(nCharColorLumMod * 10)); + } + + sal_Int32 nCharColorLumOff{}; + xPropertySet->getPropertyValue("CharColorLumOff") >>= nCharColorLumOff; + if (nCharColorLumOff != 0) + { + mpFS->singleElementNS(XML_a, XML_lumOff, XML_val, OString::number(nCharColorLumOff * 10)); + } + + mpFS->endElementNS(XML_a, XML_schemeClr); mpFS->endElementNS(XML_a, XML_solidFill); return true; |