summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2021-12-14 14:44:15 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-01-04 10:45:58 +0100
commit3698a523d7ce3278ac4e285e32d737951f317978 (patch)
tree1ecf6e65b31fe7368ad3969037840ca0e7dc0e76
parentddfd6e7b93b906f16149608bfe86e859a28226bd (diff)
tdf#146223 PPTX import: fix master objects visible property
Master objects were always visible after the import, which could change the background of the slides. Change-Id: Idc5260718f2916e207f751286044e9a7fabdee89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126833 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 4574a1ea408c2ac30042dca32d02207ec7add4da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127777 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--oox/source/ppt/slidefragmenthandler.cxx5
-rw-r--r--sd/qa/unit/data/pptx/tdf146223.pptxbin0 -> 37210 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx20
3 files changed, 25 insertions, 0 deletions
diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx
index 4512ee156261..79ea427b5227 100644
--- a/oox/source/ppt/slidefragmenthandler.cxx
+++ b/oox/source/ppt/slidefragmenthandler.cxx
@@ -78,9 +78,14 @@ SlideFragmentHandler::~SlideFragmentHandler()
case PPT_TOKEN( sld ): // CT_CommonSlideData
{
Reference< XDrawPage > xSlide( mpSlidePersistPtr->getPage() );
+ Reference< css::beans::XPropertySet > xSet(xSlide, UNO_QUERY);
PropertyMap aPropMap;
PropertySet aSlideProp( xSlide );
+ OptValue<bool> aShowMasterShapes = rAttribs.getBool(XML_showMasterSp);
+ if (aShowMasterShapes.has() && !aShowMasterShapes.get())
+ xSet->setPropertyValue("IsBackgroundObjectsVisible", Any(false));
+
aPropMap.setProperty( PROP_Visible, rAttribs.getBool( XML_show, true ));
aSlideProp.setProperties( aPropMap );
diff --git a/sd/qa/unit/data/pptx/tdf146223.pptx b/sd/qa/unit/data/pptx/tdf146223.pptx
new file mode 100644
index 000000000000..73d5eea144cc
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf146223.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 92b08ef32094..303ab76bed7b 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -123,6 +123,7 @@ public:
virtual void setUp() override;
void testDocumentLayout();
+ void testTdf146223();
void testTdf144918();
void testTdf144917();
void testHyperlinkOnImage();
@@ -190,6 +191,7 @@ public:
CPPUNIT_TEST_SUITE(SdImportTest);
CPPUNIT_TEST(testDocumentLayout);
+ CPPUNIT_TEST(testTdf146223);
CPPUNIT_TEST(testTdf144918);
CPPUNIT_TEST(testTdf144917);
CPPUNIT_TEST(testHyperlinkOnImage);
@@ -335,6 +337,24 @@ void SdImportTest::testDocumentLayout()
}
}
+void SdImportTest::testTdf146223()
+{
+ sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf146223.pptx"), PPTX);
+
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY_THROW);
+
+ uno::Reference<drawing::XDrawPage> xPage1(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xSet(xPage1, uno::UNO_QUERY_THROW);
+
+ bool bBackgroundObjectsVisible;
+ xSet->getPropertyValue("IsBackgroundObjectsVisible") >>= bBackgroundObjectsVisible;
+ CPPUNIT_ASSERT_EQUAL(false, bBackgroundObjectsVisible);
+
+ xDocShRef->DoClose();
+}
+
void SdImportTest::testTdf144918()
{
sd::DrawDocShellRef xDocShRef