filter/source/msfilter/svdfppt.cxx | 21 +++++++++++++++++++++ sd/qa/unit/data/ppt/tdf105150.ppt |binary sd/qa/unit/import-tests.cxx | 14 ++++++++++++++ 3 files changed, 35 insertions(+)
New commits: commit b9648deb1d99cde1c085767433242d6e1b834e2d Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Jan 6 17:44:11 2017 +0100 Related: tdf#105150 PPT import: handle mso_fillBackground fill type of shapes Equivalent OOXML markup is <p:sp useBgFill="1">. For now only handle the case when the slide doesn't have an explicit background, and assume that in that case we can default to white solid fill. This partially restores the code removed in 6137b5f72f5ec491ea6bd6631a65484fa24d2973 (coverity#735432 Logically dead code, 2014-03-25), so that ProcessData::aBackgroundColoredObjects is actually read. Change-Id: I9e7a9a41965db50638e9d9d1b2361af9fd7a98ca diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index b5e8a53..2fab16a 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -2898,6 +2898,27 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* break; } + // Handle shapes where the fill matches the background + // fill (mso_fillBackground). + if (rSlidePersist.ePageKind == PPT_SLIDEPAGE) + { + if (!aProcessData.aBackgroundColoredObjects.empty()) + { + if (!rSlidePersist.pBObj) + { + for (auto pObject : aProcessData.aBackgroundColoredObjects) + { + // The shape wants a background, but the slide doesn't have + // one: default to white. + SfxItemSet aNewSet(*pObject->GetMergedItemSet().GetPool()); + aNewSet.Put(XFillStyleItem(css::drawing::FillStyle_SOLID)); + aNewSet.Put(XFillColorItem(OUString(), Color(COL_WHITE))); + pObject->SetMergedItemSet(aNewSet); + } + } + } + } + if ( rSlidePersist.pBObj ) { // #i99386# transfer the attributes from the temporary BackgroundObject diff --git a/sd/qa/unit/data/ppt/tdf105150.ppt b/sd/qa/unit/data/ppt/tdf105150.ppt new file mode 100644 index 0000000..c832371 Binary files /dev/null and b/sd/qa/unit/data/ppt/tdf105150.ppt differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index eb56ffb..dd5f2e0 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -135,6 +135,7 @@ public: void testTdf103477(); void testTdf104445(); void testTdf105150(); + void testTdf105150PPT(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -194,6 +195,7 @@ public: CPPUNIT_TEST(testTdf103477); CPPUNIT_TEST(testTdf104445); CPPUNIT_TEST(testTdf105150); + CPPUNIT_TEST(testTdf105150PPT); CPPUNIT_TEST_SUITE_END(); }; @@ -1655,6 +1657,18 @@ void SdImportTest::testTdf105150() xDocShRef->DoClose(); } +void SdImportTest::testTdf105150PPT() +{ + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/ppt/tdf105150.ppt"), PPT); + const SdrPage* pPage = GetPage(1, xDocShRef); + const SdrObject* pObj = pPage->GetObj(1); + // This was drawing::FillStyle_NONE, the shape's mso_fillBackground was + // ignored when the slide didn't have an explicit background fill. + auto& rFillStyleItem = dynamic_cast<const XFillStyleItem&>(pObj->GetMergedItem(XATTR_FILLSTYLE)); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rFillStyleItem.GetValue()); + xDocShRef->DoClose(); +} + void SdImportTest::testTdf104445() { // Extra bullets were added to the first shape _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits