summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-01-22 17:13:59 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-01-22 19:47:33 +0100
commit6b15a8658f369e4144251854bcdb736acb595f47 (patch)
tree67b925c396bf8468a42b8ee420d1482d53fc21cd /sd
parent61d2014254a6bf1da68e2f13d3de2c099fcb8883 (diff)
PPTX filter: fix playFrom command handling for slide narrations
The import side went wrong in commit 812ee7a6dc29b55acfbeaa1a43e632adbaf72e6b (Removal rtl and string cleanup, 2012-12-31), which turned a prefix check into an equality check. The export side ignored the command parameters, now we write 'playFrom' instead of 'play' in case we have a start timestamp. Change-Id: Ia7e058e17400b1efbf7a6254355a70c4a5e15dbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109825 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/export-tests-ooxml1.cxx5
-rw-r--r--sd/source/filter/eppt/pptx-animations.cxx30
2 files changed, 29 insertions, 6 deletions
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx
index e6b32ff357ca..e87c04a06cbb 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -1342,6 +1342,11 @@ void SdOOXMLExportTest1::testNarrationMimeType()
// i.e. p:blipFill was missing its a:stretch child element, so the shape was invisible.
assertXPath(pSlideDoc, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:stretch/a:fillRect", 1);
+ // Without the accompanying fix in place, this test would have failed with:
+ // - ... no attribute 'cmd' exist
+ // i.e. '<p:cmd type="call">' was written instead of '<p:cmd type="call" cmd="playFrom(0.0)">'.
+ assertXPath(pSlideDoc, "//p:cmd", "cmd", "playFrom(0.0)");
+
xDocShRef->DoClose();
}
diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx
index bc36afb1283a..533f4804df81 100644
--- a/sd/source/filter/eppt/pptx-animations.cxx
+++ b/sd/source/filter/eppt/pptx-animations.cxx
@@ -22,6 +22,8 @@
#include "epptooxml.hxx"
#include <sax/fshelper.hxx>
#include <sal/log.hxx>
+#include <rtl/math.hxx>
+#include <comphelper/sequenceashashmap.hxx>
#include <com/sun/star/animations/AnimationAdditiveMode.hpp>
#include <com/sun/star/animations/AnimationCalcMode.hpp>
@@ -60,6 +62,7 @@
#include "pptx-animations.hxx"
#include "../ppt/pptanimations.hxx"
+using namespace ::com::sun::star;
using namespace ::com::sun::star::animations;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::presentation;
@@ -1137,28 +1140,43 @@ void PPTXAnimationExport::WriteAnimationNodeCommand()
return;
const char* pType = "call";
- const char* pCommand = nullptr;
+ OString aCommand;
switch (xCommand->getCommand())
{
case EffectCommands::VERB:
pType = "verb";
- pCommand = "1"; /* FIXME hardcoded viewing */
+ aCommand = "1"; /* FIXME hardcoded viewing */
break;
case EffectCommands::PLAY:
- pCommand = "play";
+ {
+ aCommand = "play";
+ uno::Sequence<beans::NamedValue> aParamSeq;
+ xCommand->getParameter() >>= aParamSeq;
+ comphelper::SequenceAsHashMap aMap(aParamSeq);
+ auto it = aMap.find("MediaTime");
+ if (it != aMap.end())
+ {
+ double fMediaTime = 0;
+ it->second >>= fMediaTime;
+ // PowerPoint represents 0 as 0.0, so just use a single decimal.
+ OString aMediaTime
+ = rtl::math::doubleToString(fMediaTime, rtl_math_StringFormat_F, 1, '.');
+ aCommand += "From(" + aMediaTime + ")";
+ }
break;
+ }
case EffectCommands::TOGGLEPAUSE:
- pCommand = "togglePause";
+ aCommand = "togglePause";
break;
case EffectCommands::STOP:
- pCommand = "stop";
+ aCommand = "stop";
break;
default:
SAL_WARN("sd.eppt", "unknown command: " << xCommand->getCommand());
break;
}
- mpFS->startElementNS(XML_p, XML_cmd, XML_type, pType, XML_cmd, pCommand);
+ mpFS->startElementNS(XML_p, XML_cmd, XML_type, pType, XML_cmd, aCommand.getStr());
WriteAnimationNodeAnimateInside(false);
mpFS->startElementNS(XML_p, XML_cBhvr);