sfx2/source/devtools/ObjectInspectorTreeHandler.cxx |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

New commits:
commit a443e4e3d96bf51313451e254a8aada2bad05c52
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed Mar 3 21:28:32 2021 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Thu Mar 11 12:46:26 2021 +0100

    devtools: also support XEnumerationAccess in object inspector
    
    Similar like XIndexAccess is XEnumerationAccess, which is like
    an iterator over elements, but unlike XIndexAccess the elements
    can't be accessed direclty by an index.
    
    In the object inspector the elements of a XEnumeration are
    presented as @{number} at the top of the properties.
    
    Change-Id: I61d71859ed065d4e72f8dff99b1aa0fda3546800
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112108
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx 
b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
index c00ddc645a10..5d3d8049d467 100644
--- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
+++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
@@ -32,6 +32,7 @@
 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
 
 #include <com/sun/star/script/XInvocation.hpp>
 #include <com/sun/star/script/Invocation.hpp>
@@ -517,6 +518,22 @@ void 
GenericPropertiesNode::fillChildren(std::unique_ptr<weld::TreeView>& pTree,
         }
     }
 
+    const auto xEnumAccess = 
uno::Reference<container::XEnumerationAccess>(maAny, uno::UNO_QUERY);
+    if (xEnumAccess.is())
+    {
+        uno::Reference<container::XEnumeration> xEnumeration = 
xEnumAccess->createEnumeration();
+        if (xEnumeration.is())
+        {
+            for (sal_Int32 nIndex = 0; xEnumeration->hasMoreElements(); 
nIndex++)
+            {
+                uno::Any aAny = xEnumeration->nextElement();
+                auto* pObjectInspectorNode
+                    = createNodeObjectForAny("@{" + OUString::number(nIndex) + 
"}", aAny);
+                lclAppendNodeToParent(pTree, pParent, pObjectInspectorNode);
+            }
+        }
+    }
+
     uno::Reference<beans::XIntrospection> xIntrospection = 
beans::theIntrospection::get(mxContext);
     auto xIntrospectionAccess = xIntrospection->inspect(maAny);
     auto xInvocationFactory = css::script::Invocation::create(mxContext);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to