diff options
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 13 | ||||
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 17 | ||||
-rw-r--r-- | sd/qa/unit/data/ppt/tdf48083.ppt | bin | 0 -> 18944 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests2.cxx | 16 |
4 files changed, 34 insertions, 12 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 8d6f9023ad16..bc28e62e2b16 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -74,6 +74,7 @@ #include <sfx2/fcontnr.hxx> #include <svx/xbtmpit.hxx> #include <svx/xsflclit.hxx> +#include <svx/xfilluseslidebackgrounditem.hxx> #include <svx/xflgrit.hxx> #include <svx/xflftrit.hxx> #include <svx/sdgcpitm.hxx> @@ -1338,6 +1339,7 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co if ( nFillFlags & 0x10 ) { auto eMSO_FillType = GetPropertyValue(DFF_Prop_fillType, mso_fillSolid); + bool bUseSlideBackground = false; drawing::FillStyle eXFill = drawing::FillStyle_NONE; switch( eMSO_FillType ) { @@ -1366,7 +1368,10 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co case mso_fillShadeTitle : // special type - shade to title --- for PP eXFill = drawing::FillStyle_GRADIENT; break; -// case mso_fillBackground : // Use the background fill color/pattern + case mso_fillBackground : // Use the background fill color/pattern + eXFill = drawing::FillStyle_NONE; + bUseSlideBackground = true; + break; default: break; } rSet.Put( XFillStyleItem( eXFill ) ); @@ -1466,6 +1471,12 @@ void DffPropertyReader::ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, co } } } + else if (eXFill == drawing::FillStyle_BITMAP && bUseSlideBackground) + { + rSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) ); + XFillUseSlideBackgroundItem aFillBgItem(true); + rSet.Put(aFillBgItem); + } } else rSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) ); diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index fa4c9c55d7dc..a4442cfb2393 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -53,6 +53,7 @@ #include <svx/svdopath.hxx> #include <svx/svdotable.hxx> #include <svx/xfillit0.hxx> +#include <svx/xfilluseslidebackgrounditem.hxx> #include <svx/xflbstit.hxx> #include <svx/xflbmtit.hxx> #include <svx/xflclit.hxx> @@ -2930,17 +2931,13 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* { if (!aProcessData.aBackgroundColoredObjects.empty()) { - if (!rSlidePersist.pBObj) + for (auto const & pObject : aProcessData.aBackgroundColoredObjects) { - for (auto const & 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(), COL_WHITE)); - pObject->SetMergedItemSet(aNewSet); - } + SfxItemSet aNewSet(*pObject->GetMergedItemSet().GetPool()); + aNewSet.Put(XFillStyleItem(css::drawing::FillStyle_NONE)); + XFillUseSlideBackgroundItem aFillBgItem(true); + aNewSet.Put(aFillBgItem); + pObject->SetMergedItemSet(aNewSet); } } } diff --git a/sd/qa/unit/data/ppt/tdf48083.ppt b/sd/qa/unit/data/ppt/tdf48083.ppt Binary files differnew file mode 100644 index 000000000000..97ca371d7a55 --- /dev/null +++ b/sd/qa/unit/data/ppt/tdf48083.ppt diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index 7702e27d715e..525177ba44da 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -581,7 +581,9 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf105150PPT) // This was drawing::FillStyle_NONE, the shape's mso_fillBackground was // ignored when the slide didn't have an explicit background fill. auto& rFillStyleItem = pObj->GetMergedItem(XATTR_FILLSTYLE); - CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rFillStyleItem.GetValue()); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, rFillStyleItem.GetValue()); + auto& rFillBackgroundItem = pObj->GetMergedItem(XATTR_FILLUSESLIDEBACKGROUND); + CPPUNIT_ASSERT_EQUAL(true, rFillBackgroundItem.GetValue()); } CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf104445) @@ -1488,6 +1490,18 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf127964) } } +CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf48083) +{ + createSdImpressDoc("ppt/tdf48083.ppt"); + const SdrPage* pPage = GetPage(1); + CPPUNIT_ASSERT_EQUAL(size_t(2), pPage->GetObjCount()); + const SdrObject* pObj = pPage->GetObj(1); + auto& rFillStyleItem = pObj->GetMergedItem(XATTR_FILLSTYLE); + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, rFillStyleItem.GetValue()); + auto& rFillBackgroundItem = pObj->GetMergedItem(XATTR_FILLUSESLIDEBACKGROUND); + CPPUNIT_ASSERT_EQUAL(true, rFillBackgroundItem.GetValue()); +} + CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf106638) { createSdImpressDoc("pptx/tdf106638.pptx"); |