From 07f8efa33fb61b256d0a2578e6f3ff0d17cf2610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Vajngerl?= Date: Tue, 9 Feb 2021 19:29:50 +0900 Subject: [PATCH] devtools: add "Type" column to object inspector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I45a9efbf8f99ba86e0fa6f2e6fb9c74ac11b5aeb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110736 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl --- .../devtools/ObjectInspectorTreeHandler.cxx | 81 ++++--------------- sfx2/uiconfig/ui/developmenttool.ui | 21 +++-- 2 files changed, 32 insertions(+), 70 deletions(-) diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx index 98e92fb46cbf..6c2105cbc63e 100644 --- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx +++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx @@ -55,7 +55,7 @@ TypeToIdlClass(const uno::Type& rType, const uno::Reference& xContext) +OUString AnyToString(const uno::Any& aValue) { uno::Type aValType = aValue.getValueType(); uno::TypeClass eType = aValType.getTypeClass(); @@ -63,69 +63,6 @@ OUString AnyToString(const uno::Any& aValue, const uno::ReferencegetName() + " "; - break; - } - case uno::TypeClass_INTERFACE: - { - auto xIdlClass = TypeToIdlClass(aValType, xContext); - aRetStr = xIdlClass->getName() + " "; - break; - } - case uno::TypeClass_SERVICE: - { - auto xIdlClass = TypeToIdlClass(aValType, xContext); - aRetStr = xIdlClass->getName() + " "; - break; - } - case uno::TypeClass_STRUCT: - { - auto xIdlClass = TypeToIdlClass(aValType, xContext); - aRetStr = xIdlClass->getName() + " "; - break; - } - case uno::TypeClass_TYPEDEF: - { - auto xIdlClass = TypeToIdlClass(aValType, xContext); - aRetStr = xIdlClass->getName() + " "; - break; - } - case uno::TypeClass_ENUM: - { - auto xIdlClass = TypeToIdlClass(aValType, xContext); - aRetStr = xIdlClass->getName() + " "; - break; - } - case uno::TypeClass_EXCEPTION: - { - auto xIdlClass = TypeToIdlClass(aValType, xContext); - aRetStr = xIdlClass->getName() + " "; - break; - } - case uno::TypeClass_SEQUENCE: - { - auto xIdlClass = TypeToIdlClass(aValType, xContext); - aRetStr = xIdlClass->getName() + " "; - break; - } - case uno::TypeClass_VOID: - { - auto xIdlClass = TypeToIdlClass(aValType, xContext); - aRetStr = xIdlClass->getName() + " "; - break; - } - case uno::TypeClass_ANY: - { - auto xIdlClass = TypeToIdlClass(aValType, xContext); - aRetStr = xIdlClass->getName() + " "; - break; - } - case uno::TypeClass_UNKNOWN: - aRetStr = ""; - break; case uno::TypeClass_BOOLEAN: { bool bBool = aValue.get(); @@ -186,6 +123,13 @@ OUString AnyToString(const uno::Any& aValue, const uno::Reference& xContext) +{ + uno::Type aValType = aValue.getValueType(); + auto xIdlClass = TypeToIdlClass(aValType, xContext); + return xIdlClass->getName(); +} + // Object inspector nodes class ObjectInspectorNode @@ -312,6 +256,7 @@ public: for (auto const& xProperty : xProperties) { OUString aValue; + OUString aType; uno::Any aAny; uno::Reference xCurrent = mxObject; @@ -320,12 +265,14 @@ public: if (xInvocation->hasProperty(xProperty.Name)) { aAny = xInvocation->getValue(xProperty.Name); - aValue = AnyToString(aAny, mxContext); + aValue = AnyToString(aAny); + aType = getAnyType(aAny, mxContext); } } catch (...) { aValue = ""; + aType = "?"; } bool bComplex = false; @@ -357,6 +304,10 @@ public: { pTree->set_text(*pCurrent, aValue, 1); } + if (!aType.isEmpty()) + { + pTree->set_text(*pCurrent, aType, 2); + } } } }; diff --git a/sfx2/uiconfig/ui/developmenttool.ui b/sfx2/uiconfig/ui/developmenttool.ui index e3f3bc78e9e8..d65542b00167 100644 --- a/sfx2/uiconfig/ui/developmenttool.ui +++ b/sfx2/uiconfig/ui/developmenttool.ui @@ -16,6 +16,8 @@ + + @@ -31,7 +33,7 @@ True True True - 800 + 250 True @@ -169,12 +171,9 @@ True Object - - end - + 0 - 2 @@ -191,6 +190,18 @@ + + + True + Type + + + + 2 + + + +