summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2023-09-04 14:54:38 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-10-09 11:13:49 +0200
commit4825616aa2700601778183d67ba1d89e32f61b04 (patch)
treef35c0eceb5d72982831049d60aa0759cd8e96f22
parenta9d6b6ef049dd41c91a30c03df0ba38ba8dcada8 (diff)
tdf#48083 Import mso_fillBackground from ppt
Change-Id: Ic60fbc5fcfd7b38e7dd594690e5cfe784061a3d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156517 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> (cherry picked from commit 7f8218aaaa4e7216810c3ddf6fd5f319495413f8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156533 Reviewed-by: Patrick Luby <plubius@neooffice.org> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--filter/source/msfilter/msdffimp.cxx13
-rw-r--r--filter/source/msfilter/svdfppt.cxx17
-rw-r--r--sd/qa/unit/data/ppt/tdf48083.pptbin0 -> 18944 bytes
-rw-r--r--sd/qa/unit/import-tests2.cxx16
4 files changed, 34 insertions, 12 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 1b4d214035fe..a6503cc3ff6b 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 400b9716127f..32337d63393a 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
new file mode 100644
index 000000000000..97ca371d7a55
--- /dev/null
+++ b/sd/qa/unit/data/ppt/tdf48083.ppt
Binary files differ
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");