include/oox/core/filterbase.hxx | 2 ++ include/test/unoapi_test.hxx | 2 ++ oox/source/core/filterbase.cxx | 11 ++++++++++- oox/source/ppt/pptimport.cxx | 1 + sd/qa/unit/data/ppsx/tdf114443-6.ppsx |binary sd/qa/unit/export-tests-ooxml4.cxx | 16 ++++++++++++++++ sd/source/filter/eppt/epptooxml.hxx | 3 +++ sd/source/filter/eppt/pptx-epptooxml.cxx | 9 +++++++++ 8 files changed, 43 insertions(+), 1 deletion(-)
New commits: commit b36bbe9c9a2834dc8b31fa8fb1329052a2e33728 Author: Andras Timar <[email protected]> AuthorDate: Fri Feb 20 15:43:04 2026 +0100 Commit: Andras Timar <[email protected]> CommitDate: Wed Feb 25 12:24:16 2026 +0100 tdf#114443 pptx export: write correct content type for PPSX/PPSM When saving as PPSX (PowerPoint Show), the export always wrote the content type as presentationml.presentation.main+xml (PPTX) instead of presentationml.slideshow.main+xml (PPSX). This caused: - Impress not auto-playing its own PPSX files on re-open - PowerPoint rejecting PPSX files created by Impress - Re-saved PPSX files from other apps losing their autoplay ability Propagate the STARTPRESENTATION filter flag through the export chain (FilterBase -> PowerPointImport -> PowerPointExport) and use it to select the correct slideshow content type, following the same pattern already used for template export. Change-Id: Idcf6222d3855c587d0dabffe3a345c9ef2bfdcf2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199883 Reviewed-by: Andras Timar <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx index b080fe5e2238..e94b0c4ba364 100644 --- a/include/oox/core/filterbase.hxx +++ b/include/oox/core/filterbase.hxx @@ -239,6 +239,8 @@ public: bool isExportTemplate() const; + bool isExportSlideShow() const; + protected: virtual css::uno::Reference< css::io::XInputStream > implGetInputStream( utl::MediaDescriptor& rMediaDesc ) const; diff --git a/include/test/unoapi_test.hxx b/include/test/unoapi_test.hxx index 32719a2af52a..d589e2e59c36 100644 --- a/include/test/unoapi_test.hxx +++ b/include/test/unoapi_test.hxx @@ -52,6 +52,7 @@ enum class TestFilter POTX, PPT, PPTM, + PPSX, PPTX, PPTX_2007, RTF, @@ -97,6 +98,7 @@ const std::unordered_map<TestFilter, OUString> TestFilterNames{ { TestFilter::POTX, u"Impress Office Open XML Template"_ustr }, { TestFilter::PPT, u"MS PowerPoint 97"_ustr }, { TestFilter::PPTM, u"Impress MS PowerPoint 2007 XML VBA"_ustr }, + { TestFilter::PPSX, u"Impress MS PowerPoint 2007 XML AutoPlay"_ustr }, { TestFilter::PPTX, u"Impress Office Open XML"_ustr }, { TestFilter::PPTX_2007, u"Impress MS PowerPoint 2007 XML"_ustr }, { TestFilter::RTF, u"Rich Text Format"_ustr }, diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx index 849665bbd4cf..f62a0beea041 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -157,6 +157,8 @@ struct FilterBaseImpl bool mbExportTemplate; + bool mbExportSlideShow; + /// @throws RuntimeException explicit FilterBaseImpl( const Reference< XComponentContext >& rxContext ); @@ -169,7 +171,8 @@ FilterBaseImpl::FilterBaseImpl( const Reference< XComponentContext >& rxContext meVersion(ECMA_376_1ST_EDITION), mxComponentContext( rxContext, UNO_SET_THROW ), mbExportVBA(false), - mbExportTemplate(false) + mbExportTemplate(false), + mbExportSlideShow(false) { } @@ -436,6 +439,7 @@ void SAL_CALL FilterBase::initialize( const Sequence< Any >& rArgs ) sal_Int32 nFlags(0); rVal.Value >>= nFlags; mxImpl->mbExportTemplate = bool(static_cast<SfxFilterFlags>(nFlags) & SfxFilterFlags::TEMPLATE); + mxImpl->mbExportSlideShow = bool(static_cast<SfxFilterFlags>(nFlags) & SfxFilterFlags::STARTPRESENTATION); } } } @@ -587,6 +591,11 @@ bool FilterBase::isExportTemplate() const return mxImpl->mbExportTemplate; } +bool FilterBase::isExportSlideShow() const +{ + return mxImpl->mbExportSlideShow; +} + } // namespace oox::core /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx index b721e7c37f77..8aaeee6977b1 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -221,6 +221,7 @@ sal_Bool SAL_CALL PowerPointImport::filter( const Sequence< PropertyValue >& rDe { {"IsPPTM", uno::Any(exportVBA())}, {"IsTemplate", uno::Any(isExportTemplate())}, + {"IsSlideShow", uno::Any(isExportSlideShow())}, })); Reference<css::lang::XMultiServiceFactory> aFactory(getComponentContext()->getServiceManager(), UNO_QUERY_THROW); diff --git a/sd/qa/unit/data/ppsx/tdf114443-6.ppsx b/sd/qa/unit/data/ppsx/tdf114443-6.ppsx new file mode 100644 index 000000000000..3f1765c6df40 Binary files /dev/null and b/sd/qa/unit/data/ppsx/tdf114443-6.ppsx differ diff --git a/sd/qa/unit/export-tests-ooxml4.cxx b/sd/qa/unit/export-tests-ooxml4.cxx index d44afda796b3..f9333ecb32cb 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -1915,6 +1915,22 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testOmitCanvasSlideExport) assertXPath(pXmlDocContent, "/p:presentation/p:sldIdLst/p:sldId", 1); } +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf114443_PPSX) +{ + createSdImpressDoc("ppsx/tdf114443-6.ppsx"); + save(TestFilter::PPSX); + + xmlDocUniquePtr pXmlDoc = parseExport(u"[Content_Types].xml"_ustr); + + // Without the fix, this would have been: + // application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml + // which means the file loses its slideshow/autoplay nature and PowerPoint rejects it. + assertXPath(pXmlDoc, + "/ContentType:Types/ContentType:Override[@PartName='/ppt/presentation.xml']", + "ContentType", + u"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml"); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/filter/eppt/epptooxml.hxx b/sd/source/filter/eppt/epptooxml.hxx index 55d106be70b5..6a1860f60d93 100644 --- a/sd/source/filter/eppt/epptooxml.hxx +++ b/sd/source/filter/eppt/epptooxml.hxx @@ -146,6 +146,9 @@ private: // Export as a template bool mbExportTemplate; + // Export as a slideshow (PPSX/PPSM) + bool mbSlideShow; + ::sax_fastparser::FSHelperPtr mPresentationFS; LayoutInfo mLayoutInfo[AUTOLAYOUT_END]; diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index f9b3faab3b69..dd250d3bf8c2 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -401,6 +401,7 @@ PowerPointExport::PowerPointExport(const Reference< XComponentContext >& rContex comphelper::SequenceAsHashMap aArgumentsMap(rArguments); mbPptm = aArgumentsMap.getUnpackedValueOrDefault(u"IsPPTM"_ustr, false); mbExportTemplate = aArgumentsMap.getUnpackedValueOrDefault(u"IsTemplate"_ustr, false); + mbSlideShow = aArgumentsMap.getUnpackedValueOrDefault(u"IsSlideShow"_ustr, false); } PowerPointExport::~PowerPointExport() @@ -463,6 +464,10 @@ bool PowerPointExport::exportDocument() { aMediaType = "application/vnd.ms-powerpoint.template.macroEnabled.main+xml"; } + else if (mbSlideShow) + { + aMediaType = "application/vnd.ms-powerpoint.slideshow.macroEnabled.main+xml"; + } else { aMediaType = "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml"; @@ -474,6 +479,10 @@ bool PowerPointExport::exportDocument() { aMediaType = "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml"; } + else if (mbSlideShow) + { + aMediaType = "application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml"; + } else { aMediaType = "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml";
