diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-01-06 17:44:11 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-01-06 19:06:08 +0100 |
commit | b9648deb1d99cde1c085767433242d6e1b834e2d (patch) | |
tree | 6dfe14efe46b721dba1ef46cfc02400f22983654 | |
parent | 75d963bc7bb87429f304d29138c27178880c039a (diff) |
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
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 21 | ||||
-rw-r--r-- | sd/qa/unit/data/ppt/tdf105150.ppt | bin | 0 -> 138752 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 14 |
3 files changed, 35 insertions, 0 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index b5e8a5385361..2fab16ad2b7d 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 Binary files differnew file mode 100644 index 000000000000..c832371e93b3 --- /dev/null +++ b/sd/qa/unit/data/ppt/tdf105150.ppt diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index eb56ffb99feb..dd5f2e0ee670 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 |