From 46d630f98f1c07ec2048da35d1a4804181148ac5 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 14 Oct 2019 21:49:32 +0200 Subject: tdf#127964 PPTX import: fix shape fill handling: style vs slide background Regression from commit 943a534ac7cb3df513583e226c986dafd8ba246b (tdf#123684 PPTX import: fix wrong background color for , 2019-04-23), the problem was that we didn't handle the case when a shape had an XML fragment like this: i.e. the shape both wants to use background fill and it has a style declaring how to fill it as well. We gave the style a priority, while PowerPoint gives the background fill a priority. Fix the problem by not setting the fill from the style in case the background fill is already set. Change-Id: Ie1b56e5615219138a5b7ddd7a2b25295b991bc05 Reviewed-on: https://gerrit.libreoffice.org/80804 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- oox/source/drawingml/shape.cxx | 6 +++++- oox/source/ppt/pptshapegroupcontext.cxx | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'oox') diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index be8153ef155a..25d94efee180 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -189,6 +189,7 @@ Shape::Shape( const ShapePtr& pSourceShape ) , mnZOrderOff(pSourceShape->mnZOrderOff) , mnDataNodeType(pSourceShape->mnDataNodeType) , mfAspectRatio(pSourceShape->mfAspectRatio) +, mbUseBgFill(pSourceShape->mbUseBgFill) {} Shape::~Shape() @@ -983,7 +984,10 @@ Reference< XShape > const & Shape::createAndInsert( } if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) ) { - nFillPhClr = pFillRef->maPhClr.getColor( rGraphicHelper ); + if (!mbUseBgFill) + { + nFillPhClr = pFillRef->maPhClr.getColor(rGraphicHelper); + } OUString sColorScheme = pFillRef->maPhClr.getSchemeName(); if( !sColorScheme.isEmpty() ) diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx index 6535e12d3f81..745a9b8e847e 100644 --- a/oox/source/ppt/pptshapegroupcontext.cxx +++ b/oox/source/ppt/pptshapegroupcontext.cxx @@ -101,7 +101,9 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( sal_Int32 aElementToken case PPT_TOKEN( sp ): // Shape { std::shared_ptr pShape( new PPTShape( meShapeLocation, "com.sun.star.drawing.CustomShape" ) ); - if( rAttribs.getBool( XML_useBgFill, false ) ) + bool bUseBgFill = rAttribs.getBool(XML_useBgFill, false); + pShape->setUseBgFill(bUseBgFill); + if (bUseBgFill) { oox::drawingml::FillPropertiesPtr pBackgroundPropertiesPtr = mpSlidePersistPtr->getBackgroundProperties(); if (!pBackgroundPropertiesPtr) -- cgit