[Libreoffice-commits] core.git: svx/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 10 13:21:29 UTC 2021


 svx/source/devtools/DevelopmentToolDockingWindow.cxx |   54 +++++++++++++++----
 1 file changed, 44 insertions(+), 10 deletions(-)

New commits:
commit d6a35250140d9b698a3ded4972025ae385021eab
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Feb 4 22:35:47 2021 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed Feb 10 14:18:59 2021 +0100

    devtools: show properties nested if the the property is an object
    
    If the property value is an object, show the expander and allow
    to show properties of that object nested.
    
    Change-Id: I93edf1a47738b9d6f15949dd4116b92ee54c8f12
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110463
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/svx/source/devtools/DevelopmentToolDockingWindow.cxx b/svx/source/devtools/DevelopmentToolDockingWindow.cxx
index 8c519e807125..113b1b05baea 100644
--- a/svx/source/devtools/DevelopmentToolDockingWindow.cxx
+++ b/svx/source/devtools/DevelopmentToolDockingWindow.cxx
@@ -344,14 +344,14 @@ public:
     }
 };
 
-class PropertiesNode : public ObjectInspectorNamedNode
+class GenericPropertiesNode : public ObjectInspectorNamedNode
 {
 public:
     uno::Reference<uno::XComponentContext> mxContext;
 
-    PropertiesNode(css::uno::Reference<css::uno::XInterface> const& xObject,
-                   uno::Reference<uno::XComponentContext> const& xContext)
-        : ObjectInspectorNamedNode("Properties", xObject)
+    GenericPropertiesNode(OUString const& rName, uno::Reference<uno::XInterface> const& xObject,
+                          uno::Reference<uno::XComponentContext> const& xContext)
+        : ObjectInspectorNamedNode(rName, xObject)
         , mxContext(xContext)
     {
     }
@@ -370,29 +370,63 @@ public:
 
         for (auto const& xProperty : xProperties)
         {
-            std::unique_ptr<weld::TreeIter> pCurrent = pTree->make_iterator();
-            lclAppendNodeWithIterToParent(pTree, rParent, *pCurrent,
-                                          new ObjectInspectorNamedNode(xProperty.Name, mxObject));
-
+            OUString aValue;
+            uno::Any aAny;
+            uno::Reference<uno::XInterface> xCurrent = mxObject;
             if (xPropertySet.is())
             {
-                OUString aValue;
                 try
                 {
-                    uno::Any aAny = xPropertySet->getPropertyValue(xProperty.Name);
+                    aAny = xPropertySet->getPropertyValue(xProperty.Name);
                     aValue = AnyToString(aAny, mxContext);
                 }
                 catch (const beans::UnknownPropertyException&)
                 {
                     aValue = "UnknownPropertyException";
                 }
+            }
+            bool bComplex = false;
+            if (aAny.hasValue())
+            {
+                auto xInterface = uno::Reference<uno::XInterface>(aAny, uno::UNO_QUERY);
+                if (xInterface.is())
+                {
+                    xCurrent = xInterface;
+                    bComplex = true;
+                }
+            }
 
+            std::unique_ptr<weld::TreeIter> pCurrent = pTree->make_iterator();
+            if (bComplex)
+            {
+                lclAppendNodeWithIterToParent(
+                    pTree, rParent, *pCurrent,
+                    new GenericPropertiesNode(xProperty.Name, xCurrent, mxContext), true);
+            }
+            else
+            {
+                lclAppendNodeWithIterToParent(
+                    pTree, rParent, *pCurrent,
+                    new ObjectInspectorNamedNode(xProperty.Name, xCurrent), false);
+            }
+            if (!aValue.isEmpty())
+            {
                 pTree->set_text(*pCurrent, aValue, 1);
             }
         }
     }
 };
 
+class PropertiesNode : public GenericPropertiesNode
+{
+public:
+    PropertiesNode(uno::Reference<uno::XInterface> const& xObject,
+                   uno::Reference<uno::XComponentContext> const& xContext)
+        : GenericPropertiesNode("Properties", xObject, xContext)
+    {
+    }
+};
+
 class InterfacesNode : public ObjectInspectorNamedNode
 {
 public:


More information about the Libreoffice-commits mailing list