summaryrefslogtreecommitdiff
path: root/sfx2/source/devtools
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-03-05 19:53:28 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-03-12 16:03:12 +0100
commit9f72f662d7ac2fbd5131ecf65be93aa001b720c9 (patch)
tree096335e7ee06b026f59f7405f969a616a0304bea /sfx2/source/devtools
parent7aec678ff4f34bfe76ac64c8be8bae944ea508a8 (diff)
devtools: use XInvocation2 to get the available properties
XIntrospection is not needed as XInvocation can provide a list of available properties by itself and we need XInvocation to get the property value. So this change removes XIntrospection and simplifies the code a bit. Change-Id: Ic274c87c9c274a05537715b5f19662a7ceaeb2b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112116 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sfx2/source/devtools')
-rw-r--r--sfx2/source/devtools/ObjectInspectorTreeHandler.cxx46
1 files changed, 21 insertions, 25 deletions
diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
index 5dbbb00a0844..0466f252166e 100644
--- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
+++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
@@ -34,8 +34,9 @@
#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>
+#include <com/sun/star/script/XInvocation2.hpp>
+#include <com/sun/star/script/MemberType.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
@@ -522,40 +523,35 @@ void GenericPropertiesNode::fillChildren(std::unique_ptr<weld::TreeView>& pTree,
}
}
- uno::Reference<beans::XIntrospection> xIntrospection = beans::theIntrospection::get(mxContext);
- if (!xIntrospection.is())
- return;
-
- auto xIntrospectionAccess = xIntrospection->inspect(maAny);
- if (!xIntrospectionAccess.is())
- return;
-
auto xInvocationFactory = css::script::Invocation::create(mxContext);
uno::Sequence<uno::Any> aParameters = { maAny };
auto xInvocationInterface = xInvocationFactory->createInstanceWithArguments(aParameters);
- uno::Reference<script::XInvocation> xInvocation(xInvocationInterface, uno::UNO_QUERY);
+ if (!xInvocationInterface.is())
+ return;
- const auto xProperties = xIntrospectionAccess->getProperties(
- beans::PropertyConcept::ALL - beans::PropertyConcept::DANGEROUS);
+ uno::Reference<script::XInvocation2> xInvocation(xInvocationInterface, uno::UNO_QUERY);
+ if (!xInvocation.is())
+ return;
- for (auto const& xProperty : xProperties)
+ const auto aInvocationInfoSequence = xInvocation->getInfo();
+ for (auto const& aInvocationInfo : aInvocationInfoSequence)
{
- uno::Any aCurrentAny;
-
- try
+ if (aInvocationInfo.eMemberType == script::MemberType_PROPERTY)
{
- if (xInvocation->hasProperty(xProperty.Name))
+ uno::Any aCurrentAny;
+ auto const& aPropertyName = aInvocationInfo.aName;
+ try
+ {
+ aCurrentAny = xInvocation->getValue(aPropertyName);
+ }
+ catch (...)
{
- aCurrentAny = xInvocation->getValue(xProperty.Name);
}
- }
- catch (...)
- {
- }
- auto* pObjectInspectorNode = createNodeObjectForAny(xProperty.Name, aCurrentAny);
- if (pObjectInspectorNode)
- lclAppendNodeToParent(pTree, pParent, pObjectInspectorNode);
+ auto* pObjectInspectorNode = createNodeObjectForAny(aPropertyName, aCurrentAny);
+ if (pObjectInspectorNode)
+ lclAppendNodeToParent(pTree, pParent, pObjectInspectorNode);
+ }
}
}