oox/source/ppt/slidefragmenthandler.cxx |    5 +++++
 sd/qa/unit/data/pptx/tdf146223.pptx     |binary
 sd/qa/unit/import-tests.cxx             |   20 ++++++++++++++++++++
 3 files changed, 25 insertions(+)

New commits:
commit 3698a523d7ce3278ac4e285e32d737951f317978
Author:     Tibor Nagy <nagy.tib...@nisz.hu>
AuthorDate: Tue Dec 14 14:44:15 2021 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jan 4 10:45:58 2022 +0100

    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 <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    (cherry picked from commit 4574a1ea408c2ac30042dca32d02207ec7add4da)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127777
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

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
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf146223.pptx 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

Reply via email to