diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx index 73af247ae6a2..2877246a8714 100644 --- a/include/oox/core/filterbase.hxx +++ b/include/oox/core/filterbase.hxx @@ -236,6 +236,8 @@ public: bool isExportTemplate() const; + bool isExportSlideShow() const; + protected: virtual css::uno::Reference< css::io::XInputStream > implGetInputStream( comphelper::SequenceAsHashMap& rMediaDesc ) const; diff --git a/include/test/unoapi_test.hxx b/include/test/unoapi_test.hxx index 151ce29247cf..cc51439af17d 100644 --- a/include/test/unoapi_test.hxx +++ b/include/test/unoapi_test.hxx @@ -64,6 +64,7 @@ enum class TestFilter POTX, PPT, PPTM, + PPSX, PPTX, PPTX_2007, RTF, @@ -111,6 +112,7 @@ const std::unordered_map 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 5542b7de26fa..76538d670ecd 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(nFlags) & SfxFilterFlags::TEMPLATE); + mxImpl->mbExportSlideShow = bool(static_cast(nFlags) & SfxFilterFlags::STARTPRESENTATION); } } } @@ -590,6 +594,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 0bab6e8b8f23..82e24f75119c 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -223,6 +223,7 @@ sal_Bool SAL_CALL PowerPointImport::filter( const Sequence< PropertyValue >& rDe { {"IsPPTM", uno::Any(exportVBA())}, {"IsTemplate", uno::Any(isExportTemplate())}, + {"IsSlideShow", uno::Any(isExportSlideShow())}, })); Reference 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 bb4ff075e941..7c43efdf74df 100644 --- a/sd/qa/unit/export-tests-ooxml4.cxx +++ b/sd/qa/unit/export-tests-ooxml4.cxx @@ -2023,6 +2023,22 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testTdf169559) "val", u"1701"); } +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 d1b3ec72f833..effb658ef0a2 100644 --- a/sd/source/filter/eppt/epptooxml.hxx +++ b/sd/source/filter/eppt/epptooxml.hxx @@ -142,6 +142,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 d4a41b0ceefb..25038717efc4 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -403,6 +403,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";