diff options
-rw-r--r-- | include/oox/drawingml/shape.hxx | 5 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 6 | ||||
-rw-r--r-- | oox/source/ppt/pptshapegroupcontext.cxx | 4 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/tdf127964.pptx | bin | 0 -> 34018 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 23 |
5 files changed, 36 insertions, 2 deletions
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx index 19b619251339..1895c2f2aad6 100644 --- a/include/oox/drawingml/shape.hxx +++ b/include/oox/drawingml/shape.hxx @@ -232,6 +232,8 @@ public: void setVerticalShapesCount(sal_Int32 nVerticalShapesCount) { mnVerticalShapesCount = nVerticalShapesCount; } sal_Int32 getVerticalShapesCount() const { return mnVerticalShapesCount; } + void setUseBgFill(bool bUseBgFill) { mbUseBgFill = bUseBgFill; } + /// Changes reference semantics to value semantics for fill properties. void cloneFillProperties(); @@ -372,6 +374,9 @@ private: /// Number of child shapes to be layouted vertically inside org chart in-diagram shape. sal_Int32 mnVerticalShapesCount = 0; + + /// The shape fill should be set to that of the slide background surface. + bool mbUseBgFill = false; }; } } 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<PPTShape> 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) diff --git a/sd/qa/unit/data/pptx/tdf127964.pptx b/sd/qa/unit/data/pptx/tdf127964.pptx Binary files differnew file mode 100644 index 000000000000..89482a4ce99c --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf127964.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index f46da0b2aa89..298fc53c14a1 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -208,6 +208,7 @@ public: void testTdf122899(); void testOOXTheme(); void testCropToShape(); + void testTdf127964(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -304,6 +305,7 @@ public: CPPUNIT_TEST(testTdf122899); CPPUNIT_TEST(testOOXTheme); CPPUNIT_TEST(testCropToShape); + CPPUNIT_TEST(testTdf127964); CPPUNIT_TEST_SUITE_END(); }; @@ -2942,6 +2944,27 @@ void SdImportTest::testCropToShape() CPPUNIT_ASSERT_EQUAL(css::drawing::BitmapMode_STRETCH, bitmapmode); } +void SdImportTest::testTdf127964() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf127964.pptx"), PPTX); + const SdrPage* pPage = GetPage(1, xDocShRef); + const SdrObject* pObj = pPage->GetObj(0); + auto& rFillStyleItem + = dynamic_cast<const XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE)); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rFillStyleItem.GetValue()); + + auto& rFillColorItem + = dynamic_cast<const XFillColorItem&>(pObj->GetMergedItem(XATTR_FILLCOLOR)); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 4294967295 + // - Actual : 5210557 + // i.e. instead of transparent (which then got rendered as white), the shape fill color was + // blue. + CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT, rFillColorItem.GetColorValue()); + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |