oox/source/export/shapes.cxx                |    5 ++++-
 sw/qa/extras/ooxmlexport/data/tdf155903.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx  |    6 ++++++
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 863a32171ed8efdf1aaee59918e49613e7ccd7a9
Author:     Tünde Tóth <toth.tu...@nisz.hu>
AuthorDate: Mon Jun 26 15:01:26 2023 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Wed Jun 28 13:38:22 2023 +0200

    tdf155903 DOCX export: fix corrupt file with embedded media
    
    Regression from commit bc72514f90d90e1ab3fed8167663e835edf03508
    "tdf#53970 PPTX: fix export of embedded media files".
    
    Change-Id: I04521227346817d91f720b1f6a77beb7f4a01f83
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153619
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    Tested-by: Jenkins

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index dceb4ee706f8..efde8de56f72 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1272,7 +1272,10 @@ void ShapeExport::WriteGraphicObjectShapePart( const 
Reference< XShape >& xShape
         xShapeProps->getPropertyValue("Graphic") >>= xGraphic;
     }
 
-    bool bHasMediaURL = xShapeProps.is() && 
xShapeProps->getPropertySetInfo()->hasPropertyByName("MediaURL") && 
(xShapeProps->getPropertyValue("MediaURL") >>= sMediaURL);
+    // tdf#155903 Only for PPTX, Microsoft does not support this feature in 
Word and Excel.
+    bool bHasMediaURL = GetDocumentType() == DOCUMENT_PPTX && xShapeProps.is()
+                        && 
xShapeProps->getPropertySetInfo()->hasPropertyByName("MediaURL")
+                        && (xShapeProps->getPropertyValue("MediaURL") >>= 
sMediaURL);
 
     if (!xGraphic.is() && !bHasMediaURL)
     {
diff --git a/sw/qa/extras/ooxmlexport/data/tdf155903.odt 
b/sw/qa/extras/ooxmlexport/data/tdf155903.odt
new file mode 100644
index 000000000000..97ba58d892dd
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf155903.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 9183863c8af7..4d1136f24c42 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -864,6 +864,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf155736, 
"tdf155736_PageNumbers_footer.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("Page * of *"), 
parseDump("/root/page[2]/footer/txt/text()"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf155903, "tdf155903.odt")
+{
+    // Without the accompanying fix in place, this test would have crashed,
+    // because the exported file was corrupted.
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to