oox/source/export/drawingml.cxx | 4 ++-- sd/qa/unit/data/odp/tdf53970_linked.odp |binary sd/qa/unit/export-tests-ooxml2.cxx | 27 +++++++++++++++++++++------ 3 files changed, 23 insertions(+), 8 deletions(-)
New commits: commit 85adc43540f75f2e3ce51fb438e5efd777a5b8f7 Author: Tünde Tóth <toth.tu...@nisz.hu> AuthorDate: Thu Mar 31 13:11:04 2022 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Apr 4 17:05:04 2022 +0200 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 <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit c2e8a96a8107a37901e475c65a8e61211fc3b132) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132383 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 4d0317be921d..d4dbef899b96 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1378,8 +1378,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 000000000000..3ddb7933463f Binary files /dev/null and b/sd/qa/unit/data/odp/tdf53970_linked.odp differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 6afe97292ea8..dc6498ec614d 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -1814,15 +1814,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);