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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204105
Tested-by: Jenkins
This commit is contained in:
Andras Timar
2026-04-22 18:02:33 +02:00
committed by Xisco Fauli
parent 45e22b1e6a
commit 6284d6d8ca
8 changed files with 43 additions and 1 deletions
+2
View File
@@ -236,6 +236,8 @@ public:
bool isExportTemplate() const;
bool isExportSlideShow() const;
protected:
virtual css::uno::Reference< css::io::XInputStream >
implGetInputStream( comphelper::SequenceAsHashMap& rMediaDesc ) const;
+2
View File
@@ -64,6 +64,7 @@ enum class TestFilter
POTX,
PPT,
PPTM,
PPSX,
PPTX,
PPTX_2007,
RTF,
@@ -111,6 +112,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 },
+10 -1
View File
@@ -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);
}
}
}
@@ -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: */
+1
View File
@@ -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<css::lang::XMultiServiceFactory> aFactory(getComponentContext()->getServiceManager(), UNO_QUERY_THROW);
Binary file not shown.
+16
View File
@@ -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: */
+3
View File
@@ -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];
+9
View File
@@ -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";