[Libreoffice-commits] core.git: sfx2/source sfx2/uiconfig
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Feb 11 14:46:03 UTC 2021
sfx2/source/devtools/ObjectInspectorTreeHandler.cxx | 81 +++-----------------
sfx2/uiconfig/ui/developmenttool.ui | 21 +++--
2 files changed, 32 insertions(+), 70 deletions(-)
New commits:
commit 07f8efa33fb61b256d0a2578e6f3ff0d17cf2610
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Feb 9 19:29:50 2021 +0900
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Feb 11 15:45:17 2021 +0100
devtools: add "Type" column to object inspector
Change-Id: I45a9efbf8f99ba86e0fa6f2e6fb9c74ac11b5aeb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110736
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
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<uno::XComponentConte
return xRetClass;
}
-OUString AnyToString(const uno::Any& aValue, const uno::Reference<uno::XComponentContext>& 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::Reference<uno::XComponen
OUString aRetStr;
switch (eType)
{
- case uno::TypeClass_TYPE:
- {
- auto xIdlClass = TypeToIdlClass(aValType, xContext);
- aRetStr = xIdlClass->getName() + " <TYPE>";
- break;
- }
- case uno::TypeClass_INTERFACE:
- {
- auto xIdlClass = TypeToIdlClass(aValType, xContext);
- aRetStr = xIdlClass->getName() + " <INTERFACE>";
- break;
- }
- case uno::TypeClass_SERVICE:
- {
- auto xIdlClass = TypeToIdlClass(aValType, xContext);
- aRetStr = xIdlClass->getName() + " <SERVICE>";
- break;
- }
- case uno::TypeClass_STRUCT:
- {
- auto xIdlClass = TypeToIdlClass(aValType, xContext);
- aRetStr = xIdlClass->getName() + " <STRUCT>";
- break;
- }
- case uno::TypeClass_TYPEDEF:
- {
- auto xIdlClass = TypeToIdlClass(aValType, xContext);
- aRetStr = xIdlClass->getName() + " <TYPEDEF>";
- break;
- }
- case uno::TypeClass_ENUM:
- {
- auto xIdlClass = TypeToIdlClass(aValType, xContext);
- aRetStr = xIdlClass->getName() + " <ENUM>";
- break;
- }
- case uno::TypeClass_EXCEPTION:
- {
- auto xIdlClass = TypeToIdlClass(aValType, xContext);
- aRetStr = xIdlClass->getName() + " <EXCEPTION>";
- break;
- }
- case uno::TypeClass_SEQUENCE:
- {
- auto xIdlClass = TypeToIdlClass(aValType, xContext);
- aRetStr = xIdlClass->getName() + " <SEQUENCE>";
- break;
- }
- case uno::TypeClass_VOID:
- {
- auto xIdlClass = TypeToIdlClass(aValType, xContext);
- aRetStr = xIdlClass->getName() + " <VOID>";
- break;
- }
- case uno::TypeClass_ANY:
- {
- auto xIdlClass = TypeToIdlClass(aValType, xContext);
- aRetStr = xIdlClass->getName() + " <ANY>";
- break;
- }
- case uno::TypeClass_UNKNOWN:
- aRetStr = "<Unknown>";
- break;
case uno::TypeClass_BOOLEAN:
{
bool bBool = aValue.get<bool>();
@@ -186,6 +123,13 @@ OUString AnyToString(const uno::Any& aValue, const uno::Reference<uno::XComponen
return aRetStr;
}
+OUString getAnyType(const uno::Any& aValue, const uno::Reference<uno::XComponentContext>& 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<uno::XInterface> 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 @@
<column type="gchararray"/>
<!-- column-name value -->
<column type="gchararray"/>
+ <!-- column-name type -->
+ <column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
</columns>
@@ -31,7 +33,7 @@
<property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="position">800</property>
+ <property name="position">250</property>
<property name="wide-handle">True</property>
<child>
<!-- n-columns=1 n-rows=2 -->
@@ -169,12 +171,9 @@
<property name="resizable">True</property>
<property name="title" translatable="yes" context="developmenttool|object">Object</property>
<child>
- <object class="GtkCellRendererText" id="obj_insp_cellrenderertext1">
- <property name="ellipsize">end</property>
- </object>
+ <object class="GtkCellRendererText" id="obj_insp_cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
- <attribute name="weight">2</attribute>
</attributes>
</child>
</object>
@@ -191,6 +190,18 @@
</child>
</object>
</child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+ <property name="resizable">True</property>
+ <property name="title" translatable="yes" context="developmenttool|type">Type</property>
+ <child>
+ <object class="GtkCellRendererText" id="obj_insp_cellrenderertext3"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
</object>
</child>
</object>
More information about the Libreoffice-commits
mailing list