oox/source/ppt/timenodelistcontext.cxx | 2 +- sd/qa/unit/export-tests-ooxml1.cxx | 5 +++++ sd/source/filter/eppt/pptx-animations.cxx | 30 ++++++++++++++++++++++++------ 3 files changed, 30 insertions(+), 7 deletions(-)
New commits: commit 6b15a8658f369e4144251854bcdb736acb595f47 Author: Miklos Vajna <[email protected]> AuthorDate: Fri Jan 22 17:13:59 2021 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Jan 22 19:47:33 2021 +0100 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 <[email protected]> Tested-by: Jenkins 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); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
