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-07-01 15:17:12 +0200
commit67f12a2b49179f1f4e655d80942e4aef22e1f37c (patch)
tree9b1b9fcf71fcd07541bc37925cf1bbe7004958cb /oox
parent9f7587debb684688ddb29a90a172e9a3067d2ba1 (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. (cherry picked from commit 109debb0ca0c864296ad7f557cfbc2b05c9ec3c2) Conflicts: oox/qa/unit/export.cxx Change-Id: Ib50c3128b971a388f14ad721ed7f73043916a736 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136732 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> 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 009e63d23e85..05735d0c8d61 100644
--- a/oox/qa/unit/export.cxx
+++ b/oox/qa/unit/export.cxx
@@ -630,6 +630,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");
}
}
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 23d67eb1c713..57199b4a0d24 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -555,7 +555,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);
}
@@ -590,7 +590,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;