tdf#53970 PPTX: fix broken export of linked media files
Missing TargetMode="External" in the export of
linked media files resulted corrupted PPTX.
Change-Id: I76246db331d199810a5b413d44bec95283e88e47
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132402
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index a99a047..54f9427 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1490,8 +1490,8 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::dra
}
else
{
aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(eMediaType), rURL);
aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::MEDIA), rURL);
aVideoFileRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(eMediaType), rURL, true);
aMediaRelId = mpFB->addRelation(mpFS->getOutputStream(), oox::getRelationship(Relationship::MEDIA), rURL, true);
}
GetFS()->startElementNS(XML_p, XML_nvPr);
diff --git a/sd/qa/unit/data/odp/tdf53970_linked.odp b/sd/qa/unit/data/odp/tdf53970_linked.odp
new file mode 100644
index 0000000..3ddb793
--- /dev/null
+++ b/sd/qa/unit/data/odp/tdf53970_linked.odp
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index a620386..5fac35e 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1804,15 +1804,30 @@ void SdOOXMLExportTest2::testTdf59323_slideFooters()
void SdOOXMLExportTest2::testTdf53970()
{
::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP);
xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
// Embedded media file
{
::sd::DrawDocShellRef xDocShRef
= loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970.odp"), ODP);
xDocShRef = saveAndReload(xDocShRef.get(), PPTX);
// Without fix in place, the media shape was lost on export.
CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements());
// Without fix in place, the media shape was lost on export.
CPPUNIT_ASSERT(getPage(0, xDocShRef)->hasElements());
xDocShRef->DoClose();
}
xDocShRef->DoClose();
// Linked media file
{
::sd::DrawDocShellRef xDocShRef = loadURL(
m_directories.getURLFromSrc(u"/sd/qa/unit/data/odp/tdf53970_linked.odp"), ODP);
utl::TempFile tempFile;
xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
xDocShRef->DoClose();
xmlDocUniquePtr pXmlRels = parseExport(tempFile, "ppt/slides/_rels/slide1.xml.rels");
CPPUNIT_ASSERT(pXmlRels);
assertXPath(pXmlRels, "/rels:Relationships/rels:Relationship[@TargetMode='External']", 2);
}
}
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);