summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/ppt/pptshapegroupcontext.cxx26
-rw-r--r--sd/qa/unit/data/pptx/tdf123684.pptxbin0 -> 142961 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx16
3 files changed, 36 insertions, 6 deletions
diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx
index 4caa76b1c1c7..1180af3f10fb 100644
--- a/oox/source/ppt/pptshapegroupcontext.cxx
+++ b/oox/source/ppt/pptshapegroupcontext.cxx
@@ -103,13 +103,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 );
diff --git a/sd/qa/unit/data/pptx/tdf123684.pptx b/sd/qa/unit/data/pptx/tdf123684.pptx
new file mode 100644
index 000000000000..87243422753b
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf123684.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 2c5295abcd36..879e13d8f90f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -166,6 +166,7 @@ public:
void testTdf104445();
void testTdf105150();
void testTdf105150PPT();
+ void testTdf123684();
void testTdf100926();
void testTdf89064();
void testTdf108925();
@@ -252,6 +253,7 @@ public:
CPPUNIT_TEST(testTdf104445);
CPPUNIT_TEST(testTdf105150);
CPPUNIT_TEST(testTdf105150PPT);
+ CPPUNIT_TEST(testTdf123684);
CPPUNIT_TEST(testTdf100926);
CPPUNIT_TEST(testPatternImport);
CPPUNIT_TEST(testTdf89064);
@@ -1768,6 +1770,20 @@ void SdImportTest::testTdf105150()
xDocShRef->DoClose();
}
+void SdImportTest::testTdf123684()
+{
+ sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf123684.pptx"), PPTX);
+ const SdrPage* pPage = GetPage(1, xDocShRef);
+ const SdrObject* pObj = pPage->GetObj(0);
+ auto& rFillStyleItem
+ = dynamic_cast<const XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE));
+ // Without the accompanying fix in place, this test would have failed with 'Expected: 0; Actual:
+ // 1', i.e. the shape's fill was FillStyle_SOLID, making the text of the shape unreadable.
+ CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, rFillStyleItem.GetValue());
+ xDocShRef->DoClose();
+}
+
void SdImportTest::testTdf105150PPT()
{
sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/ppt/tdf105150.ppt"), PPT);