From 0546af3643114b5adf6e33f49d6834eb74ae793b Mon Sep 17 00:00:00 2001 From: Mark Hung Date: Sat, 16 Mar 2019 23:17:31 +0800 Subject: tdf#123909 fix event source that refers to a timenode. p:tn (see below) were treated as delay value instead of timenode id. Just convert the timenode id to XAnimationNode and set the event source properly. Change-Id: Ib408be6714c6ac70dad7018e544e560cf59a40c0 Reviewed-on: https://gerrit.libreoffice.org/69340 Tested-by: Jenkins Reviewed-by: Mark Hung --- oox/source/ppt/animationspersist.cxx | 14 ++++++++++++++ oox/source/ppt/conditioncontext.cxx | 6 +++--- oox/source/ppt/slidepersist.cxx | 10 ++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) (limited to 'oox') diff --git a/oox/source/ppt/animationspersist.cxx b/oox/source/ppt/animationspersist.cxx index bcfc4f2ba494..3546c047c835 100644 --- a/oox/source/ppt/animationspersist.cxx +++ b/oox/source/ppt/animationspersist.cxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -183,6 +184,19 @@ namespace oox { namespace ppt { aEvent.Source = aAny; aAny <<= aEvent; } + else if (mnType == PPT_TOKEN(tn) && (maValue >>= aEvent)) + { + OUString sId; + aEvent.Source >>= sId; + css::uno::Reference xNode = pSlide->getAnimationNode(sId); + if (xNode.is()) + { + aEvent.Source <<= xNode; + } + else + aEvent.Source.clear(); + aAny <<= aEvent; + } else { aAny = maValue; diff --git a/oox/source/ppt/conditioncontext.cxx b/oox/source/ppt/conditioncontext.cxx index cdecaa120891..f32f8c490c5c 100644 --- a/oox/source/ppt/conditioncontext.cxx +++ b/oox/source/ppt/conditioncontext.cxx @@ -98,7 +98,7 @@ namespace oox { namespace ppt { CondContext::~CondContext( ) throw( ) { - if( maCond.mnType == 0 ) + if( maCond.mnType == 0 || maCond.mnType == PPT_TOKEN(tn)) { maCond.maValue = (maEvent.Trigger == EventTrigger::NONE) ? maEvent.Offset : makeAny( maEvent ); } @@ -135,8 +135,8 @@ namespace oox { namespace ppt { case PPT_TOKEN( tn ): { maCond.mnType = aElementToken; - sal_uInt32 nId = rAttribs.getUnsigned( XML_val, 0 ); - maCond.maValue <<= nId; + // Convert the node id string to XAnimationNode later + maEvent.Source <<= rAttribs.getString(XML_val, OUString()); return this; } case PPT_TOKEN( tgtEl ): diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index b25d00ed3529..5c5d61f5640b 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -318,6 +318,16 @@ void SlidePersist::hideShapesAsMasterShapes() } } +Reference SlidePersist::getAnimationNode(const OUString& sId) const +{ + const auto& pIter = maAnimNodesMap.find(sId); + if (pIter != maAnimNodesMap.end()) + return pIter->second; + + Reference aResult; + return aResult; +} + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit