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

Tibor Nagy (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 27 10:00:24 UTC 2021


 sd/qa/unit/data/pptx/tdf143126.pptx      |binary
 sd/qa/unit/export-tests-ooxml1.cxx       |   16 ++++++++++++++++
 sd/source/filter/eppt/pptx-epptooxml.cxx |   29 +++++++++++++++++++++++++++--
 3 files changed, 43 insertions(+), 2 deletions(-)

New commits:
commit d2c2985024ee085796a21ef9c3226dde10311c80
Author:     Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Thu Jul 8 16:12:05 2021 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Tue Jul 27 11:59:49 2021 +0200

    tdf#143126 PPTX: slideshow setting “Start from” not exported
    
    Follow-up to commit 3d55149dcf19cffefcc19c16a3abbe8851453c5e
    (tdf#142913 PPTX: slideshow setting “Start from” not imported).
    
    Change-Id: I4124e528f8af61c3b87978c2f3d2b96d983ec056
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118648
    Tested-by: Jenkins
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/sd/qa/unit/data/pptx/tdf143126.pptx b/sd/qa/unit/data/pptx/tdf143126.pptx
new file mode 100644
index 000000000000..f5799b60f26b
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf143126.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index 15832942c2a8..cf757d35f0ff 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -118,6 +118,7 @@ public:
     void testTdf140865Wordart3D();
     void testTdf124457();
     void testPlaceholderFillAndOutlineExport();
+    void testTdf143126();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest1);
 
@@ -178,6 +179,7 @@ public:
     CPPUNIT_TEST(testTdf140865Wordart3D);
     CPPUNIT_TEST(testTdf124457);
     CPPUNIT_TEST(testPlaceholderFillAndOutlineExport);
+    CPPUNIT_TEST(testTdf143126);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1578,6 +1580,20 @@ void SdOOXMLExportTest1::testTdf124457()
                 "repeatCount", "indefinite");
 }
 
+void SdOOXMLExportTest1::testTdf143126()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf143126.pptx"), PPTX);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+    xDocShRef->DoClose();
+
+    xmlDocUniquePtr pXmlDoc = parseExport(tempFile, "ppt/presProps.xml");
+
+    assertXPath(pXmlDoc, "/p:presentationPr/p:showPr", "showNarration", "1");
+    assertXPath(pXmlDoc, "/p:presentationPr/p:showPr/p:sldRg", "st", "2" );
+    assertXPath(pXmlDoc, "/p:presentationPr/p:showPr/p:sldRg", "end", "3" );
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 7d9a3f72cd49..4ee219d2a38c 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1104,6 +1104,7 @@ void PowerPointExport::WritePresentationProps()
         Reference<beans::XPropertySet> xPresentationProps(xPresentationSupplier->getPresentation(),
                                                           uno::UNO_QUERY);
         bool bEndlessVal = xPresentationProps->getPropertyValue("IsEndless").get<bool>();
+        OUString sFirstPage = xPresentationProps->getPropertyValue("FirstPage").get<OUString>();
 
         FSHelperPtr pFS = openFragmentStreamWithSerializer(
             "ppt/presProps.xml",
@@ -1114,8 +1115,32 @@ void PowerPointExport::WritePresentationProps()
 
         pFS->startElementNS(XML_p, XML_presentationPr, PPRNMSS);
 
-        pFS->singleElementNS(XML_p, XML_showPr, XML_loop, sax_fastparser::UseIf("1", bEndlessVal),
-                             XML_showNarration, sax_fastparser::UseIf("1", bEndlessVal));
+        pFS->startElementNS(XML_p, XML_showPr, XML_loop, sax_fastparser::UseIf("1", bEndlessVal),
+                            XML_showNarration, "1");
+
+        Reference<drawing::XDrawPagesSupplier> xDPS(mXModel, uno::UNO_QUERY_THROW);
+        Reference<drawing::XDrawPages> xDrawPages(xDPS->getDrawPages(), uno::UNO_SET_THROW);
+        if (!sFirstPage.isEmpty())
+        {
+            sal_Int32 nStartSlide = 1;
+            sal_Int32 nEndSlide = xDrawPages->getCount();
+            for (sal_Int32 i = 0; i < nEndSlide; i++)
+            {
+                Reference<drawing::XDrawPage> xDrawPage;
+                xDrawPages->getByIndex(i) >>= xDrawPage;
+                Reference<container::XNamed> xNamed(xDrawPage, uno::UNO_QUERY_THROW);
+                if (xNamed->getName() == sFirstPage)
+                {
+                    nStartSlide = i + 1;
+                    break;
+                }
+            }
+
+            pFS->singleElementNS(XML_p, XML_sldRg, XML_st, OUString::number(nStartSlide), XML_end,
+                                 OUString::number(nEndSlide));
+        }
+
+        pFS->endElementNS(XML_p, XML_showPr);
 
         pFS->endElementNS(XML_p, XML_presentationPr);
     }


More information about the Libreoffice-commits mailing list