sd/source/ui/unoidl/unomodel.cxx |   34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)

New commits:
commit a983af222ef3c227b22101578a5dba2c18688df0
Author:     Marco Cecchetti <marco.cecche...@collabora.com>
AuthorDate: Tue Jul 23 23:03:02 2024 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Oct 4 11:53:29 2024 +0200

    fix-up slideshow: provide animations info
    
    Avoid to export json node with the same name
    node name moved to nodeName property
    
    Change-Id: Ibefc6689e6af22e9d2a27b39fd1e08ced6756051
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174464
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index b5e2bb9dbf0b..0242b2530e37 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -475,6 +475,7 @@ public:
 
 private:
     void exportNode(const Reference<XAnimationNode>& xNode);
+    void exportNodeImpl(const Reference<XAnimationNode>& xNode);
     void exportContainer(const Reference<XTimeContainer>& xContainer);
 
     void exportAnimate(const Reference<XAnimate>& xAnimate);
@@ -574,24 +575,43 @@ void convertColor(OStringBuffer& rBuffer, sal_Int32 
nColor)
     rBuffer.append(aUBuffer.makeStringAndClear().toUtf8());
 }
 
+bool isValidNode(const Reference<XAnimationNode>& xNode)
+{
+    if (xNode.is())
+    {
+        sal_Int16 nNodeType = xNode->getType();
+        auto iterator = constAnimationNodeTypeToString.find(nNodeType);
+        return iterator != constAnimationNodeTypeToString.end();
+    }
+    return false;
+}
+
 void AnimationsExporter::exportAnimations()
 {
     if (!mxDrawPage.is() || !mxPageProps.is() || !mxRootNode.is() || 
!hasEffects())
         return;
 
-    exportNode(mxRootNode);
+    if (isValidNode(mxRootNode))
+    {
+        auto aNode = mrWriter.startNode("root");
+        exportNodeImpl(mxRootNode);
+    }
 }
-
 void AnimationsExporter::exportNode(const Reference<XAnimationNode>& xNode)
+{
+     if (!isValidNode(mxRootNode))
+         return;
+     auto aStruct = mrWriter.startStruct();
+     exportNodeImpl(xNode);
+}
+
+void AnimationsExporter::exportNodeImpl(const Reference<XAnimationNode>& xNode)
 {
     try
     {
         sal_Int16 nNodeType = xNode->getType();
         auto iterator = constAnimationNodeTypeToString.find(nNodeType);
-        if (iterator == constAnimationNodeTypeToString.end())
-            return;
-
-        auto aNode = mrWriter.startNode(iterator->second);
+        mrWriter.put("nodeName", iterator->second);
 
         // common properties
         OStringBuffer sTmp;
@@ -851,6 +871,8 @@ void AnimationsExporter::exportContainer(const 
Reference<XTimeContainer>& xConta
 {
     try
     {
+        auto anArray = mrWriter.startArray("children");
+
         Reference<XEnumerationAccess> xEnumerationAccess(xContainer, 
UNO_QUERY_THROW);
         Reference<XEnumeration> 
xEnumeration(xEnumerationAccess->createEnumeration(),
                                              css::uno::UNO_SET_THROW);

Reply via email to