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

Tibor Nagy (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 27 09:50:59 UTC 2021


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

New commits:
commit f8ddaaf0f5e1fb61e0d4404ea28757bc652ae4be
Author:     Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Wed Jul 21 12:48:46 2021 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Tue Jul 27 11:50:25 2021 +0200

    tdf#142915 PPTX import: support for presentation's timing attribute
    
    See Slide Show->Slide Show Settings...->Change slides manually,
    which is disabled by default. Now <p:showPr useTimings="false">
    is imported correctly, i.e. with enabled "Change slides manually".
    
    Note: it seems, com::sun::star::presentation::IsAutomatic
    UNO attribute has got a bad name and documentation: if it's
    value is TRUE, "Change slides manually" is enabled, and vice versa.
    Check with the following Basic code:
    
    ' show presentation-level automatic transition (IsAutomatic = False)
    print ThisComponent.getPresentation().IsAutomatic
    ' show slide-level automatic transition (Change = 1)
    Dim oDrawPages as Object, oDrawPage as Object
    oDrawPages = ThisComponent.getDrawPages()
    oDrawPage = oDrawPages.getByIndex(0)
    print oDrawPage.Change
    
    Change-Id: Ie4a687a29077cad89f11e77b856c28a1fe09376b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119321
    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 5125ee3357c7..18a2a97aa9cd 100644
--- a/include/oox/ppt/presPropsfragmenthandler.hxx
+++ b/include/oox/ppt/presPropsfragmenthandler.hxx
@@ -32,6 +32,7 @@ public:
 
 private:
     bool m_bLoop = false;
+    bool m_bTiming = true;
     OUString m_sId;
     OUString m_sSt;
 };
diff --git a/oox/source/ppt/presPropsfragmenthandler.cxx b/oox/source/ppt/presPropsfragmenthandler.cxx
index ca466177e944..708f194853fb 100644
--- a/oox/source/ppt/presPropsfragmenthandler.cxx
+++ b/oox/source/ppt/presPropsfragmenthandler.cxx
@@ -41,6 +41,7 @@ void PresPropsFragmentHandler::finalizeImport()
     css::uno::Reference<css::beans::XPropertySet> xPresentationProps(
         xPresentationSupplier->getPresentation(), css::uno::UNO_QUERY_THROW);
     xPresentationProps->setPropertyValue("IsEndless", css::uno::Any(m_bLoop));
+    xPresentationProps->setPropertyValue("IsAutomatic", css::uno::Any(!m_bTiming));
 
     if (!m_sId.isEmpty())
     {
@@ -73,6 +74,7 @@ core::ContextHandlerRef PresPropsFragmentHandler::onCreateContext(sal_Int32 aEle
             return this;
         case PPT_TOKEN(showPr):
             m_bLoop = rAttribs.getBool(XML_loop, false);
+            m_bTiming = rAttribs.getBool(XML_useTimings, true);
             return this;
         case PPT_TOKEN(custShow):
             m_sId = rAttribs.getString(XML_id).get();
diff --git a/sd/qa/unit/data/pptx/tdf142915.pptx b/sd/qa/unit/data/pptx/tdf142915.pptx
new file mode 100644
index 000000000000..889a08fd50a1
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf142915.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 708c8a375482..77f7c90b34c9 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 testTdf142915();
     void testTdf142913();
     void testTdf142590();
     void testCustomSlideShow();
@@ -243,6 +244,7 @@ public:
     CPPUNIT_TEST_SUITE(SdImportTest);
 
     CPPUNIT_TEST(testDocumentLayout);
+    CPPUNIT_TEST(testTdf142915);
     CPPUNIT_TEST(testTdf142913);
     CPPUNIT_TEST(testTdf142590);
     CPPUNIT_TEST(testCustomSlideShow);
@@ -440,6 +442,23 @@ void SdImportTest::testDocumentLayout()
     }
 }
 
+void SdImportTest::testTdf142915()
+{
+    ::sd::DrawDocShellRef xDocShRef
+        = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf142915.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);
+
+    bool bChangeManually = xPresentationProps->getPropertyValue("IsAutomatic").get<bool>();
+
+    CPPUNIT_ASSERT_EQUAL(true, bChangeManually);
+
+    xDocShRef->DoClose();
+}
+
 void SdImportTest::testTdf142913()
 {
     ::sd::DrawDocShellRef xDocShRef


More information about the Libreoffice-commits mailing list