sd/qa/unit/data/pptx/narration-non-media-shape.pptx |binary sd/qa/unit/export-tests-ooxml1.cxx | 13 +++++++++++++ sd/source/filter/eppt/pptx-animations.cxx | 7 +++++-- 3 files changed, 18 insertions(+), 2 deletions(-)
New commits: commit 9ac1d3ac65b198f739421f39ab3adc65d35a0908 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Wed Apr 7 08:31:28 2021 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Apr 7 09:45:13 2021 +0200 tdf#141267 PPTX export: fix handling of audio nodes with non-media source Regression from commit cf5fa358a6bf6e7c0aae2dca1e8fa3334d95ebdb (PPTX export: fix missing audio anim node for slide narrations, 2021-01-25), the problem was that the audio source can be any kind of shape, not only a media shape. Fix the problem by explicitly checking of the shape has a media URL. Change-Id: I2bdde0f9ed3576f307aabff5e39d441f295c203f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113715 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/sd/qa/unit/data/pptx/narration-non-media-shape.pptx b/sd/qa/unit/data/pptx/narration-non-media-shape.pptx new file mode 100644 index 000000000000..e7a527485f36 Binary files /dev/null and b/sd/qa/unit/data/pptx/narration-non-media-shape.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 4972669e4b82..f12140f1a07f 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -98,6 +98,7 @@ public: void testRoundtripOwnLineStyles(); void testRoundtripPrstDash(); void testDashOnHairline(); + void testNarrationNonMediaShape(); void testCustomshapeBitmapfillSrcrect(); void testTdf100348FontworkBitmapFill(); void testTdf100348FontworkGradientGlow(); @@ -150,6 +151,7 @@ public: CPPUNIT_TEST(testRoundtripOwnLineStyles); CPPUNIT_TEST(testRoundtripPrstDash); CPPUNIT_TEST(testDashOnHairline); + CPPUNIT_TEST(testNarrationNonMediaShape); CPPUNIT_TEST(testCustomshapeBitmapfillSrcrect); CPPUNIT_TEST(testTdf100348FontworkBitmapFill); CPPUNIT_TEST(testTdf100348FontworkGradientGlow); @@ -1144,6 +1146,17 @@ void SdOOXMLExportTest1::testDashOnHairline() assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:ln/a:custDash/a:ds", 11); } +void SdOOXMLExportTest1::testNarrationNonMediaShape() +{ + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/narration-non-media-shape.pptx"), PPTX); + utl::TempFile aTempFile; + // Without the accompanying fix in place, this test would have failed, + // beans::UnknownPropertyException was thrown. + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &aTempFile); + xDocShRef->DoClose(); +} + void SdOOXMLExportTest1::testCustomshapeBitmapfillSrcrect() { ::sd::DrawDocShellRef xDocShRef = loadURL( diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx index 5de9475857d3..63423c8489c0 100644 --- a/sd/source/filter/eppt/pptx-animations.cxx +++ b/sd/source/filter/eppt/pptx-animations.cxx @@ -1220,7 +1220,8 @@ void PPTXAnimationExport::WriteAnimationNodeAudio() if (xAudio->getSource() >>= xShape) { uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); - if (xShapeProps->getPropertyValue("MediaURL") >>= sUrl) + bool bHasMediaURL = xShapeProps->getPropertySetInfo()->hasPropertyByName("MediaURL"); + if (bHasMediaURL && (xShapeProps->getPropertyValue("MediaURL") >>= sUrl)) { bValid = IsAudioURL(sUrl); } @@ -1431,7 +1432,9 @@ void NodeContext::initValid(bool bHasValidChild, bool bIsIterateChild) else if (xAudio->getSource() >>= xShape) { uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); - if (xShapeProps->getPropertyValue("MediaURL") >>= sURL) + bool bHasMediaURL + = xShapeProps->getPropertySetInfo()->hasPropertyByName("MediaURL"); + if (bHasMediaURL && (xShapeProps->getPropertyValue("MediaURL") >>= sURL)) { mbValid = IsAudioURL(sURL); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits