summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-05-11 20:17:16 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-05-12 08:07:30 +0200
commit109debb0ca0c864296ad7f557cfbc2b05c9ec3c2 (patch)
tree29df8550307fef20f39be2b1dff6a793e48a17e7 /oox
parentd45315c8eb91862958b29ead09cec58e03a80096 (diff)
tdf#148961 sd theme: add PPTX export for shape fill color effects
Which allows taking the fill color theme index from the model even in case there are effects. Previously effects meant reading from the grab-bag, and only the no-effect case read the color theme index from the doc model. Change-Id: Ib50c3128b971a388f14ad721ed7f73043916a736 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134208 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/qa/unit/data/refer-to-theme-shape-fill.odpbin15506 -> 14638 bytes
-rw-r--r--oox/qa/unit/export.cxx5
-rw-r--r--oox/source/export/drawingml.cxx20
3 files changed, 23 insertions, 2 deletions
diff --git a/oox/qa/unit/data/refer-to-theme-shape-fill.odp b/oox/qa/unit/data/refer-to-theme-shape-fill.odp
index b12772e111e3..3a32aa71690a 100644
--- a/oox/qa/unit/data/refer-to-theme-shape-fill.odp
+++ b/oox/qa/unit/data/refer-to-theme-shape-fill.odp
Binary files differ
diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx
index 4c6c013dcb81..90089a994fa2 100644
--- a/oox/qa/unit/export.cxx
+++ b/oox/qa/unit/export.cxx
@@ -413,6 +413,11 @@ CPPUNIT_TEST_FIXTURE(Test, testReferToThemeShapeFill)
std::unique_ptr<SvStream> pStream = parseExportStream(getTempFile(), "ppt/slides/slide1.xml");
xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:solidFill/a:schemeClr", "val", "accent1");
+ // Without the accompanying fix in place, this test would have failed with:
+ // - XPath '//p:sp[1]/p:spPr/a:solidFill/a:schemeClr/a:lumMod' number of nodes is incorrect
+ // i.e. the effects of the themed color were lost.
+ assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:solidFill/a:schemeClr/a:lumMod", "val", "40000");
+ assertXPath(pXmlDoc, "//p:sp[1]/p:spPr/a:solidFill/a:schemeClr/a:lumOff", "val", "60000");
}
CPPUNIT_TEST_FIXTURE(Test, testTdf146690_endParagraphRunPropertiesNewLinesTextSize)
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 1c5d34ac3e4a..eb588076e213 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -563,7 +563,7 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet )
else if ( nFillColor != nOriginalColor )
{
// the user has set a different color for the shape
- if (aTransformations.hasElements() || !WriteFillColor(rXPropSet))
+ if (!WriteFillColor(rXPropSet))
{
WriteSolidFill(::Color(ColorTransparency, nFillColor & 0xffffff), nAlpha);
}
@@ -598,7 +598,23 @@ bool DrawingML::WriteFillColor(const uno::Reference<beans::XPropertySet>& xPrope
const char* pColorName = g_aPredefinedClrNames[nFillColorTheme];
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 nFillColorLumMod{};
+ xPropertySet->getPropertyValue("FillColorLumMod") >>= nFillColorLumMod;
+ if (nFillColorLumMod != 10000)
+ {
+ mpFS->singleElementNS(XML_a, XML_lumMod, XML_val, OString::number(nFillColorLumMod * 10));
+ }
+
+ sal_Int32 nFillColorLumOff{};
+ xPropertySet->getPropertyValue("FillColorLumOff") >>= nFillColorLumOff;
+ if (nFillColorLumOff != 0)
+ {
+ mpFS->singleElementNS(XML_a, XML_lumOff, XML_val, OString::number(nFillColorLumOff * 10));
+ }
+
+ mpFS->endElementNS(XML_a, XML_schemeClr);
mpFS->endElementNS(XML_a, XML_solidFill);
return true;