svx/source/devtools/DevelopmentToolDockingWindow.cxx | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-)
New commits: commit 00aada5051e11e70f0da023fbb57c76ff3f0cba2 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Fri Feb 5 16:17:47 2021 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Feb 11 00:31:47 2021 +0100 devtools: use xInvocation to get values of all property types Without XInvocation we could only get the values of XPropertySet type of properties. XInvocation however supports getting values of all types of properties as it can invoke any kind of methods. Change-Id: I1f6c7b932b8bc554bcf6600a8c9eef81b7b2cfa5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110464 Tested-by: Tomaž Vajngerl <qui...@gmail.com> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/svx/source/devtools/DevelopmentToolDockingWindow.cxx b/svx/source/devtools/DevelopmentToolDockingWindow.cxx index 113b1b05baea..f32d974a42dd 100644 --- a/svx/source/devtools/DevelopmentToolDockingWindow.cxx +++ b/svx/source/devtools/DevelopmentToolDockingWindow.cxx @@ -27,6 +27,9 @@ #include <com/sun/star/reflection/XIdlReflection.hpp> #include <com/sun/star/reflection/XIdlMethod.hpp> +#include <com/sun/star/script/XInvocation.hpp> +#include <com/sun/star/script/Invocation.hpp> + #include <comphelper/processfactory.hxx> #include <sfx2/dispatch.hxx> @@ -362,29 +365,33 @@ public: 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); - uno::Reference<beans::XPropertySet> xPropertySet(mxObject, uno::UNO_QUERY); - for (auto const& xProperty : xProperties) { OUString aValue; uno::Any aAny; uno::Reference<uno::XInterface> xCurrent = mxObject; - if (xPropertySet.is()) + + try { - try + if (xInvocation->hasProperty(xProperty.Name)) { - aAny = xPropertySet->getPropertyValue(xProperty.Name); + aAny = xInvocation->getValue(xProperty.Name); aValue = AnyToString(aAny, mxContext); } - catch (const beans::UnknownPropertyException&) - { - aValue = "UnknownPropertyException"; - } } + catch (...) + { + aValue = "<?>"; + } + bool bComplex = false; if (aAny.hasValue()) { @@ -409,6 +416,7 @@ public: pTree, rParent, *pCurrent, new ObjectInspectorNamedNode(xProperty.Name, xCurrent), false); } + if (!aValue.isEmpty()) { pTree->set_text(*pCurrent, aValue, 1); @@ -652,4 +660,5 @@ void DevelopmentToolDockingWindow::introspect(uno::Reference<uno::XInterface> co mpClassListBox->thaw(); } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits