sd/qa/unit/data/pptx/tdf143129.pptx |binary sd/qa/unit/export-tests-ooxml1.cxx | 15 +++++++++++++++ sd/source/filter/eppt/pptx-epptooxml.cxx | 22 ++++++++++++++++++++++ 3 files changed, 37 insertions(+)
New commits: commit 569cb54f1d82e993dcf1fd11d92d4cbd4f224a2d Author: Tibor Nagy <nagy.tib...@nisz.hu> AuthorDate: Tue Jul 27 16:17:37 2021 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Thu Aug 12 11:53:05 2021 +0200 tdf#143129 PPTX: custom slide show use as default is not exported. Follow-up to commit 11ef976624dce8a8e50a1eb20e9c586519fd7ec8 "tdf#142590 PPTX import: fix custom slide show use as default" Change-Id: Ie8a53a79bd531cfe2c3b3559b70d28770ca8b960 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119564 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sd/qa/unit/data/pptx/tdf143129.pptx b/sd/qa/unit/data/pptx/tdf143129.pptx new file mode 100644 index 000000000000..77377c212be8 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf143129.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index cf757d35f0ff..59848719adf0 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -119,6 +119,7 @@ public: void testTdf124457(); void testPlaceholderFillAndOutlineExport(); void testTdf143126(); + void testTdf143129(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); @@ -180,6 +181,7 @@ public: CPPUNIT_TEST(testTdf124457); CPPUNIT_TEST(testPlaceholderFillAndOutlineExport); CPPUNIT_TEST(testTdf143126); + CPPUNIT_TEST(testTdf143129); CPPUNIT_TEST_SUITE_END(); @@ -1594,6 +1596,19 @@ void SdOOXMLExportTest1::testTdf143126() assertXPath(pXmlDoc, "/p:presentationPr/p:showPr/p:sldRg", "end", "3" ); } +void SdOOXMLExportTest1::testTdf143129() +{ + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf143129.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:custShow", "id", "0" ); +} + 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 4ee219d2a38c..bacfc54dc583 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -1105,6 +1105,7 @@ void PowerPointExport::WritePresentationProps() uno::UNO_QUERY); bool bEndlessVal = xPresentationProps->getPropertyValue("IsEndless").get<bool>(); OUString sFirstPage = xPresentationProps->getPropertyValue("FirstPage").get<OUString>(); + OUString sCustomShow = xPresentationProps->getPropertyValue("CustomShow").get<OUString>(); FSHelperPtr pFS = openFragmentStreamWithSerializer( "ppt/presProps.xml", @@ -1140,6 +1141,27 @@ void PowerPointExport::WritePresentationProps() OUString::number(nEndSlide)); } + if (!sCustomShow.isEmpty()) + { + css::uno::Reference<css::presentation::XCustomPresentationSupplier> + XCustPresentationSupplier(mXModel, css::uno::UNO_QUERY_THROW); + css::uno::Reference<css::container::XNameContainer> mxCustShows; + mxCustShows = XCustPresentationSupplier->getCustomPresentations(); + const css::uno::Sequence<OUString> aNameSeq(mxCustShows->getElementNames()); + + sal_Int32 nCustShowIndex = 0; + for (sal_Int32 i = 0; i < aNameSeq.getLength(); i++) + { + if (aNameSeq[i] == sCustomShow) + { + nCustShowIndex = i; + break; + } + } + + pFS->singleElementNS(XML_p, XML_custShow, XML_id, OUString::number(nCustShowIndex)); + } + pFS->endElementNS(XML_p, XML_showPr); pFS->endElementNS(XML_p, XML_presentationPr);