[Libreoffice-commits] core.git: include/oox oox/source sd/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Mar 20 11:42:26 UTC 2019


 include/oox/ppt/slidepersist.hxx     |    1 +
 oox/source/ppt/animationspersist.cxx |   14 ++++++++++++++
 oox/source/ppt/conditioncontext.cxx  |    6 +++---
 oox/source/ppt/slidepersist.cxx      |   10 ++++++++++
 sd/qa/unit/export-tests-ooxml2.cxx   |    4 +++-
 5 files changed, 31 insertions(+), 4 deletions(-)

New commits:
commit 0546af3643114b5adf6e33f49d6834eb74ae793b
Author:     Mark Hung <marklh9 at gmail.com>
AuthorDate: Sat Mar 16 23:17:31 2019 +0800
Commit:     Mark Hung <marklh9 at gmail.com>
CommitDate: Wed Mar 20 12:42:02 2019 +0100

    tdf#123909 fix event source that refers to a timenode.
    
    p:tn (see below) were treated as delay value instead of timenode id.
    
      <p:stCondLst>
        <p:cond evt="begin" delay="0">
          <p:tn val="5"/>
        </p:cond>
      </p:stCondLst>
    
    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 <marklh9 at gmail.com>

diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx
index 4d4c4d3cf4f8..5708775c25bd 100644
--- a/include/oox/ppt/slidepersist.hxx
+++ b/include/oox/ppt/slidepersist.hxx
@@ -117,6 +117,7 @@ public:
     void applyTextStyles( const oox::core::XmlFilterBase& rFilterBase );
 
     std::map< OUString, css::uno::Reference< css::animations::XAnimationNode > >& getAnimNodesMap() { return maAnimNodesMap; };
+    css::uno::Reference<css::animations::XAnimationNode> getAnimationNode(const OUString& sId) const;
     ::oox::drawingml::ShapePtr getShape( const OUString & id ) { return maShapeMap[ id ]; }
     ::oox::drawingml::ShapeIdMap& getShapeMap() { return maShapeMap; }
 
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 <com/sun/star/presentation/ParagraphTarget.hpp>
 #include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
 #include <com/sun/star/animations/Event.hpp>
+#include <com/sun/star/animations/XAnimationNode.hpp>
 
 #include <oox/drawingml/shape.hxx>
 #include <oox/helper/attributelist.hxx>
@@ -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<XAnimationNode> 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<XAnimationNode> SlidePersist::getAnimationNode(const OUString& sId) const
+{
+    const auto& pIter = maAnimNodesMap.find(sId);
+    if (pIter != maAnimNodesMap.end())
+        return pIter->second;
+
+    Reference<XAnimationNode> aResult;
+    return aResult;
+}
+
 } }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 157e9029b75e..06330de5101b 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -2095,7 +2095,9 @@ void SdOOXMLExportTest2::testTdf44223()
                 "audio/x-wav");
 
     xmlDocPtr pDoc1 = parseExport(tempFile, "ppt/slides/slide1.xml");
-    assertXPath(pDoc1 , "//p:audio/p:cMediaNode/p:tgtEl/p:sndTgt[@r:embed]", 1);
+
+    assertXPath(pDoc1 , "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "evt", "begin");
+    assertXPath(pDoc1 , "//p:audio/p:cMediaNode/p:cTn/p:stCondLst/p:cond", "delay", "0");
 
     xmlDocPtr pDoc2 = parseExport(tempFile, "ppt/slides/slide2.xml");
     assertXPath(pDoc2 , "//p:transition/p:sndAc/p:stSnd/p:snd[@r:embed]", 2);


More information about the Libreoffice-commits mailing list