diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-02-04 22:35:47 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-02-10 14:18:59 +0100 |
commit | d6a35250140d9b698a3ded4972025ae385021eab (patch) | |
tree | aceb57921cec2c8b3f62ed70818b9446bee1daae /svx/source | |
parent | 570df33b75298b7c7c3e7afd233d36d0cdf7e0a3 (diff) |
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@gmail.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/devtools/DevelopmentToolDockingWindow.cxx | 54 |
1 files changed, 44 insertions, 10 deletions
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: |