summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-02-10 16:50:26 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-02-11 15:46:27 +0100
commit763168bde2c3b48a2849b4c917e09b559468c434 (patch)
tree879802d98f3c49857d5fc27cbff0bd0e9cb11da4 /sfx2/source
parent07f8efa33fb61b256d0a2578e6f3ff0d17cf2610 (diff)
devtools: move impl. of GenericPropertiesNode::fillChildren out
Cyclic references will become problem, so move the implementation of fillChildren out of GenericPropertiesNode class definition. Change-Id: I222d7c09c3ce71cbe552abcef5cc0c7e86935d34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110737 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/devtools/ObjectInspectorTreeHandler.cxx141
1 files changed, 71 insertions, 70 deletions
diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
index 6c2105cbc63e..24e41318059f 100644
--- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
+++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
@@ -240,76 +240,7 @@ public:
}
void fillChildren(std::unique_ptr<weld::TreeView>& pTree,
- weld::TreeIter const& rParent) override
- {
- uno::Reference<beans::XIntrospection> xIntrospection
- = beans::theIntrospection::get(mxContext);
- auto xIntrospectionAccess = xIntrospection->inspect(uno::makeAny(mxObject));
- auto xInvocationFactory = css::script::Invocation::create(mxContext);
- uno::Sequence<uno::Any> aParameters = { uno::Any(mxObject) };
- auto xInvocationInterface = xInvocationFactory->createInstanceWithArguments(aParameters);
- uno::Reference<script::XInvocation> xInvocation(xInvocationInterface, uno::UNO_QUERY);
-
- const auto xProperties = xIntrospectionAccess->getProperties(
- beans::PropertyConcept::ALL - beans::PropertyConcept::DANGEROUS);
-
- for (auto const& xProperty : xProperties)
- {
- OUString aValue;
- OUString aType;
- uno::Any aAny;
- uno::Reference<uno::XInterface> xCurrent = mxObject;
-
- try
- {
- if (xInvocation->hasProperty(xProperty.Name))
- {
- aAny = xInvocation->getValue(xProperty.Name);
- aValue = AnyToString(aAny);
- aType = getAnyType(aAny, mxContext);
- }
- }
- catch (...)
- {
- aValue = "<?>";
- aType = "?";
- }
-
- 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);
- }
- if (!aType.isEmpty())
- {
- pTree->set_text(*pCurrent, aType, 2);
- }
- }
- }
+ weld::TreeIter const& rParent) override;
};
class PropertiesNode : public GenericPropertiesNode
@@ -377,6 +308,76 @@ public:
}
};
+void GenericPropertiesNode::fillChildren(std::unique_ptr<weld::TreeView>& pTree,
+ weld::TreeIter const& rParent)
+{
+ uno::Reference<beans::XIntrospection> xIntrospection = beans::theIntrospection::get(mxContext);
+ auto xIntrospectionAccess = xIntrospection->inspect(uno::makeAny(mxObject));
+ auto xInvocationFactory = css::script::Invocation::create(mxContext);
+ uno::Sequence<uno::Any> aParameters = { uno::Any(mxObject) };
+ auto xInvocationInterface = xInvocationFactory->createInstanceWithArguments(aParameters);
+ uno::Reference<script::XInvocation> xInvocation(xInvocationInterface, uno::UNO_QUERY);
+
+ const auto xProperties = xIntrospectionAccess->getProperties(
+ beans::PropertyConcept::ALL - beans::PropertyConcept::DANGEROUS);
+
+ for (auto const& xProperty : xProperties)
+ {
+ OUString aValue;
+ OUString aType;
+ uno::Any aAny;
+ uno::Reference<uno::XInterface> xCurrent = mxObject;
+
+ try
+ {
+ if (xInvocation->hasProperty(xProperty.Name))
+ {
+ aAny = xInvocation->getValue(xProperty.Name);
+ aValue = AnyToString(aAny);
+ aType = getAnyType(aAny, mxContext);
+ }
+ }
+ catch (...)
+ {
+ aValue = "<?>";
+ aType = "?";
+ }
+
+ 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);
+ }
+ if (!aType.isEmpty())
+ {
+ pTree->set_text(*pCurrent, aType, 2);
+ }
+ }
+}
} // end anonymous namespace
ObjectInspectorTreeHandler::ObjectInspectorTreeHandler(