diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2024-07-23 23:03:02 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-10-04 11:53:29 +0200 |
commit | a983af222ef3c227b22101578a5dba2c18688df0 (patch) | |
tree | 19334c5dfe386a28f4b9dc7091c834d66ab67793 /sd/source/ui | |
parent | 37d3e978c95a99bffda6d6d2c6b76cbf7521b185 (diff) |
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 <vmiklos@collabora.com>
Diffstat (limited to 'sd/source/ui')
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 34 |
1 files changed, 28 insertions, 6 deletions
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); |