diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-03-23 20:06:49 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-07-01 08:46:48 +0200 |
commit | 54272b950525fd6462006cb3624635e17b6008ae (patch) | |
tree | 4823efb2c0abefe83a43a23c38ef94353fec0e9d /oox/source | |
parent | 1e93905e5136149d09b5c591e0fe2366d759f429 (diff) |
sd theme: add PPTX export for shape fill color
Do this only in case there are no effects on the color, as that is not
yet handled.
Note that the theme color was already stored in the grab-bag, so this is
primarily interesting in case the theme color was changed or the source
format was ODP.
(cherry picked from commit 37c41f2c445ecf519f4137c23fb36f3942328b6b)
Conflicts:
oox/qa/unit/export.cxx
Change-Id: Ia4995be68d5f243875632eec4aaf8afbb8f4d5cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136677
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/export/drawingml.cxx | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 46098e9d04a3..23d67eb1c713 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -555,7 +555,10 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet ) else if ( nFillColor != nOriginalColor ) { // the user has set a different color for the shape - WriteSolidFill( ::Color(ColorTransparency, nFillColor & 0xffffff), nAlpha ); + if (aTransformations.hasElements() || !WriteFillColor(rXPropSet)) + { + WriteSolidFill(::Color(ColorTransparency, nFillColor & 0xffffff), nAlpha); + } } else if ( !sColorFillScheme.isEmpty() ) { @@ -570,6 +573,29 @@ void DrawingML::WriteSolidFill( const Reference< XPropertySet >& rXPropSet ) } } +bool DrawingML::WriteFillColor(const uno::Reference<beans::XPropertySet>& xPropertySet) +{ + if (!xPropertySet->getPropertySetInfo()->hasPropertyByName("FillColorTheme")) + { + return false; + } + + sal_Int32 nFillColorTheme = -1; + xPropertySet->getPropertyValue("FillColorTheme") >>= nFillColorTheme; + if (nFillColorTheme < 0 || nFillColorTheme > 11) + { + return false; + } + + const char* pColorName = g_aPredefinedClrNames[nFillColorTheme]; + + mpFS->startElementNS(XML_a, XML_solidFill); + mpFS->singleElementNS(XML_a, XML_schemeClr, XML_val, pColorName); + mpFS->endElementNS(XML_a, XML_solidFill); + + return true; +} + void DrawingML::WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha) { mpFS->startElementNS(XML_a, XML_gs, XML_pos, OString::number(nStop * 1000)); |