[Libreoffice-commits] core.git: include/oox oox/source sd/qa

Tibor Nagy (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 29 07:50:57 UTC 2021


 include/oox/ppt/presPropsfragmenthandler.hxx |    1 +
 oox/source/ppt/presPropsfragmenthandler.cxx  |   18 ++++++++++++++++++
 sd/qa/unit/data/pptx/tdf142913.pptx          |binary
 sd/qa/unit/import-tests.cxx                  |   19 +++++++++++++++++++
 4 files changed, 38 insertions(+)

New commits:
commit 3d55149dcf19cffefcc19c16a3abbe8851453c5e
Author:     Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Wed Jun 23 13:15:57 2021 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Tue Jun 29 09:50:25 2021 +0200

    tdf#142913 PPTX: slideshow setting “Start from” not imported
    
    Note: see Slide Show->Slide Show Settings...->Range->From:
    on the UI, or press Shift-F5 after loading the unit test
    document sd/qa/unit/data/pptx/tdf142913.pptx.
    
    Change-Id: I2e10a4353c26600bf405475cb89990413c81dc1e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117705
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/include/oox/ppt/presPropsfragmenthandler.hxx b/include/oox/ppt/presPropsfragmenthandler.hxx
index 3edf60cf3273..5125ee3357c7 100644
--- a/include/oox/ppt/presPropsfragmenthandler.hxx
+++ b/include/oox/ppt/presPropsfragmenthandler.hxx
@@ -33,6 +33,7 @@ public:
 private:
     bool m_bLoop = false;
     OUString m_sId;
+    OUString m_sSt;
 };
 } // namespace ppt
 } // namespace oox
diff --git a/oox/source/ppt/presPropsfragmenthandler.cxx b/oox/source/ppt/presPropsfragmenthandler.cxx
index 47965050b164..ca466177e944 100644
--- a/oox/source/ppt/presPropsfragmenthandler.cxx
+++ b/oox/source/ppt/presPropsfragmenthandler.cxx
@@ -13,12 +13,17 @@
 #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
 #include <com/sun/star/container/XNamed.hpp>
 #include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
 
 #include <oox/core/xmlfilterbase.hxx>
 #include <oox/helper/attributelist.hxx>
 #include <oox/ppt/presPropsfragmenthandler.hxx>
 #include <oox/token/namespaces.hxx>
 
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
 namespace oox::ppt
 {
 PresPropsFragmentHandler::PresPropsFragmentHandler(core::XmlFilterBase& rFilter,
@@ -47,6 +52,16 @@ void PresPropsFragmentHandler::finalizeImport()
         xPresentationProps->setPropertyValue("CustomShow",
                                              css::uno::Any(aNameSeq[m_sId.toInt32()]));
     }
+
+    if (!m_sSt.isEmpty())
+    {
+        Reference<drawing::XDrawPagesSupplier> xDPS(getFilter().getModel(), uno::UNO_QUERY_THROW);
+        Reference<drawing::XDrawPages> xDrawPages(xDPS->getDrawPages(), uno::UNO_SET_THROW);
+        Reference<drawing::XDrawPage> xDrawPage;
+        xDrawPages->getByIndex(m_sSt.toInt32() - 1) >>= xDrawPage;
+        Reference<container::XNamed> xNamed(xDrawPage, uno::UNO_QUERY_THROW);
+        xPresentationProps->setPropertyValue("FirstPage", uno::Any(xNamed->getName()));
+    }
 }
 
 core::ContextHandlerRef PresPropsFragmentHandler::onCreateContext(sal_Int32 aElementToken,
@@ -62,6 +77,9 @@ core::ContextHandlerRef PresPropsFragmentHandler::onCreateContext(sal_Int32 aEle
         case PPT_TOKEN(custShow):
             m_sId = rAttribs.getString(XML_id).get();
             return this;
+        case PPT_TOKEN(sldRg):
+            m_sSt = rAttribs.getString(XML_st).get();
+            return this;
     }
     return this;
 }
diff --git a/sd/qa/unit/data/pptx/tdf142913.pptx b/sd/qa/unit/data/pptx/tdf142913.pptx
new file mode 100644
index 000000000000..4fd938de1e41
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf142913.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 8723c0ee53b8..708c8a375482 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -122,6 +122,7 @@ public:
     virtual void setUp() override;
 
     void testDocumentLayout();
+    void testTdf142913();
     void testTdf142590();
     void testCustomSlideShow();
     void testInternalHyperlink();
@@ -242,6 +243,7 @@ public:
     CPPUNIT_TEST_SUITE(SdImportTest);
 
     CPPUNIT_TEST(testDocumentLayout);
+    CPPUNIT_TEST(testTdf142913);
     CPPUNIT_TEST(testTdf142590);
     CPPUNIT_TEST(testCustomSlideShow);
     CPPUNIT_TEST(testInternalHyperlink);
@@ -438,6 +440,23 @@ void SdImportTest::testDocumentLayout()
     }
 }
 
+void SdImportTest::testTdf142913()
+{
+    ::sd::DrawDocShellRef xDocShRef
+        = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf142913.pptx"), PPTX);
+
+    uno::Reference<presentation::XPresentationSupplier> xPresentationSupplier(
+        xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+    uno::Reference<beans::XPropertySet> xPresentationProps(xPresentationSupplier->getPresentation(),
+        uno::UNO_QUERY_THROW);
+
+    OUString sFirstPage = xPresentationProps->getPropertyValue("FirstPage").get<OUString>();
+
+    CPPUNIT_ASSERT_EQUAL(OUString("Second"), sFirstPage);
+
+    xDocShRef->DoClose();
+}
+
 void SdImportTest::testTdf142590()
 {
     ::sd::DrawDocShellRef xDocShRef


More information about the Libreoffice-commits mailing list