summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-04-23 09:09:21 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-04-23 09:58:03 +0200
commit943a534ac7cb3df513583e226c986dafd8ba246b (patch)
treee2c0aa46f6b81f7ca16e72e5d9b31ac953a44c44 /oox
parent1ea226c6d247c349d87df3deb382052cd619e9bc (diff)
tdf#123684 PPTX import: fix wrong background color for <p:sp useBgFill="1">
Regression from commit 59339dec1ce56213dc74a06af2f0d35ac1c534d7 (tdf#105150 PPTX import: try harder to handle <p:sp useBgFill="1">, 2017-01-06), the problem was that we gave a white solid fill to a shape which is meant to be transparent. Fix the problem by limiting the scope of the mentioned commit to solid colors only, and also extend to code to look for background fill from the masterpage as well. This allows not hardcoding the white solid fill and leaves the fill style of shapes as transparent where the slide background is a bitmap or other more complex fill type. Change-Id: I0063e88d510250652d2b14856df3bd431681422d Reviewed-on: https://gerrit.libreoffice.org/71107 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'oox')
-rw-r--r--oox/source/ppt/pptshapegroupcontext.cxx26
1 files changed, 20 insertions, 6 deletions
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx
index c2e5f2f2c9b4..6535e12d3f81 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -106,13 +106,27 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( sal_Int32 aElementToken
oox::drawingml::FillPropertiesPtr pBackgroundPropertiesPtr = mpSlidePersistPtr->getBackgroundProperties();
if (!pBackgroundPropertiesPtr)
{
- // The shape wants a background, but the slide doesn't have
- // one: default to white.
- pBackgroundPropertiesPtr.reset(new oox::drawingml::FillProperties);
- pBackgroundPropertiesPtr->moFillType = XML_solidFill;
- pBackgroundPropertiesPtr->maFillColor.setSrgbClr(0xFFFFFF);
+ // The shape wants a background, but the slide doesn't have one.
+ SlidePersistPtr pMaster = mpSlidePersistPtr->getMasterPersist();
+ if (pMaster)
+ {
+ oox::drawingml::FillPropertiesPtr pMasterBackground
+ = pMaster->getBackgroundProperties();
+ if (pMasterBackground)
+ {
+ if (pMasterBackground->moFillType.has()
+ && pMasterBackground->moFillType.get() == XML_solidFill)
+ {
+ // Master has a solid background, use that.
+ pBackgroundPropertiesPtr = pMasterBackground;
+ }
+ }
+ }
+ }
+ if (pBackgroundPropertiesPtr)
+ {
+ pShape->getFillProperties().assignUsed(*pBackgroundPropertiesPtr);
}
- pShape->getFillProperties().assignUsed( *pBackgroundPropertiesPtr );
}
pShape->setModelId(rAttribs.getString( XML_modelId ).get());
return new PPTShapeContext( *this, mpSlidePersistPtr, mpGroupShapePtr, pShape );