summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-04-07 08:31:28 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-04-07 09:45:13 +0200
commit9ac1d3ac65b198f739421f39ab3adc65d35a0908 (patch)
treef0de5664a0d9d46cbd057bba8022558eba5d3cf0 /sd
parentc5153e90784af25890487dd00bcd1f8ac28cc346 (diff)
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 <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/narration-non-media-shape.pptxbin0 -> 30952 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx13
-rw-r--r--sd/source/filter/eppt/pptx-animations.cxx7
3 files changed, 18 insertions, 2 deletions
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
--- /dev/null
+++ b/sd/qa/unit/data/pptx/narration-non-media-shape.pptx
Binary files 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);
}