diff options
-rw-r--r-- | oox/source/ppt/pptshapegroupcontext.cxx | 10 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/tdf105150.pptx | bin | 0 -> 31961 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 14 |
3 files changed, 23 insertions, 1 deletions
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx index 57f0f9127a0a..5208bd49e33e 100644 --- a/oox/source/ppt/pptshapegroupcontext.cxx +++ b/oox/source/ppt/pptshapegroupcontext.cxx @@ -101,7 +101,15 @@ ContextHandlerRef PPTShapeGroupContext::onCreateContext( sal_Int32 aElementToken std::shared_ptr<PPTShape> pShape( new PPTShape( meShapeLocation, "com.sun.star.drawing.CustomShape" ) ); if( rAttribs.getBool( XML_useBgFill, false ) ) { - const oox::drawingml::FillPropertiesPtr pBackgroundPropertiesPtr = mpSlidePersistPtr->getBackgroundProperties(); + 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); + } if ( pBackgroundPropertiesPtr ) { pShape->getFillProperties().assignUsed( *pBackgroundPropertiesPtr ); } diff --git a/sd/qa/unit/data/pptx/tdf105150.pptx b/sd/qa/unit/data/pptx/tdf105150.pptx Binary files differnew file mode 100644 index 000000000000..48a2e01dc4b7 --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf105150.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index f4faf00dfd65..eb56ffb99feb 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -134,6 +134,7 @@ public: void testTdf104201(); void testTdf103477(); void testTdf104445(); + void testTdf105150(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -192,6 +193,7 @@ public: CPPUNIT_TEST(testTdf104201); CPPUNIT_TEST(testTdf103477); CPPUNIT_TEST(testTdf104445); + CPPUNIT_TEST(testTdf105150); CPPUNIT_TEST_SUITE_END(); }; @@ -1641,6 +1643,18 @@ void SdImportTest::testTdf103477() xDocShRef->DoClose(); } +void SdImportTest::testTdf105150() +{ + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf105150.pptx"), PPTX); + const SdrPage* pPage = GetPage(1, xDocShRef); + const SdrObject* pObj = pPage->GetObj(1); + auto& rFillStyleItem = dynamic_cast<const XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE)); + // This was drawing::FillStyle_NONE, <p:sp useBgFill="1"> was ignored when + // the slide didn't have an explicit background fill. + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rFillStyleItem.GetValue()); + xDocShRef->DoClose(); +} + void SdImportTest::testTdf104445() { // Extra bullets were added to the first shape |