diff options
-rw-r--r-- | oox/source/ppt/timenodelistcontext.cxx | 2 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml1.cxx | 5 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-animations.cxx | 30 |
3 files changed, 30 insertions, 7 deletions
diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx index 017b95673c84..3b40af62f2d0 100644 --- a/oox/source/ppt/timenodelistcontext.cxx +++ b/oox/source/ppt/timenodelistcontext.cxx @@ -297,7 +297,7 @@ namespace oox::ppt { { nCommand = EffectCommands::PLAY; } - else if( msCommand == "playFrom" ) + else if (msCommand.startsWith("playFrom")) { const OUString aMediaTime( msCommand.copy( 9, msCommand.getLength() - 10 ) ); rtl_math_ConversionStatus eStatus; 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); |