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 7a2bd59a016b873ac93927833af0a212a0142ef4 Author: Andras Timar <[email protected]> AuthorDate: Fri Feb 20 15:43:04 2026 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Tue Feb 24 09:45:44 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/+/199884 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx index eec0d6a19cef..7baafb038241 100644 --- a/include/oox/core/filterbase.hxx +++ b/include/oox/core/filterbase.hxx @@ -242,6 +242,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 27f86881cf89..bb447979770f 100644 --- a/include/test/unoapi_test.hxx +++ b/include/test/unoapi_test.hxx @@ -53,6 +53,7 @@ enum class TestFilter POTX, PPT, PPTM, + PPSX, PPTX, PPTX_2007, RTF, @@ -98,6 +99,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 c71c85f49a17..6c5d6c6c2e91 100644 --- a/oox/source/core/filterbase.cxx +++ b/oox/source/core/filterbase.cxx @@ -158,6 +158,8 @@ struct FilterBaseImpl bool mbExportTemplate; + bool mbExportSlideShow; + /// @throws RuntimeException explicit FilterBaseImpl( const Reference< XComponentContext >& rxContext ); @@ -170,7 +172,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) { } @@ -437,6 +440,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); } } } @@ -592,6 +596,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 1744b617c5ad..2e4738a0b812 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -220,6 +220,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 764f70bdab68..38b4297ff3ad 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -1870,6 +1870,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 c8359ecd0316..4ba6d291a123 100644 --- a/sd/source/filter/eppt/epptooxml.hxx +++ b/sd/source/filter/eppt/epptooxml.hxx @@ -147,6 +147,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 bd61ad14bfc9..5657803cf386 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";
