[Libreoffice-commits] core.git: sfx2/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Fri Mar 12 15:03:16 UTC 2021
sfx2/source/devtools/ObjectInspectorTreeHandler.cxx | 29 ++++++++++----------
1 file changed, 15 insertions(+), 14 deletions(-)
New commits:
commit 7aec678ff4f34bfe76ac64c8be8bae944ea508a8
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Mar 4 22:36:55 2021 +0900
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Mar 12 16:02:29 2021 +0100
devtools: show expander for the sequence only if it has elements
Change-Id: Ic94881df48da63b8662484faaddc004d83756529
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112115
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
index f6a863b24aaf..5dbbb00a0844 100644
--- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
+++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
@@ -425,28 +425,34 @@ public:
class SequenceNode : public BasicValueNode
{
+ uno::Reference<reflection::XIdlArray> mxIdlArray;
+
public:
SequenceNode(OUString const& rName, uno::Any const& rAny,
uno::Reference<uno::XComponentContext> const& xContext)
: BasicValueNode(rName, rAny, xContext)
{
+ auto xReflection = reflection::theCoreReflection::get(mxContext);
+ OUString aTypeName = maAny.getValueType().getTypeName();
+ auto xClass = xReflection->forName(aTypeName);
+ mxIdlArray = xClass->getArray();
}
- bool shouldShowExpander() override { return true; }
+ bool shouldShowExpander() override
+ {
+ // Show expnder only if the sequence has elements
+ int nLength = mxIdlArray->getLen(maAny);
+ return nLength > 0;
+ }
void fillChildren(std::unique_ptr<weld::TreeView>& pTree,
const weld::TreeIter* pParent) override
{
- auto xReflection = reflection::theCoreReflection::get(mxContext);
- uno::Reference<reflection::XIdlClass> xClass
- = xReflection->forName(maAny.getValueType().getTypeName());
- uno::Reference<reflection::XIdlArray> xIdlArray = xClass->getArray();
-
- int nLength = xIdlArray->getLen(maAny);
+ int nLength = mxIdlArray->getLen(maAny);
for (int i = 0; i < nLength; i++)
{
- uno::Any aArrayValue = xIdlArray->get(maAny, i);
+ uno::Any aArrayValue = mxIdlArray->get(maAny, i);
uno::Reference<uno::XInterface> xCurrent;
auto* pObjectInspectorNode = createNodeObjectForAny(OUString::number(i), aArrayValue);
@@ -457,12 +463,7 @@ public:
std::vector<std::pair<sal_Int32, OUString>> getColumnValues() override
{
- auto xReflection = reflection::theCoreReflection::get(mxContext);
- uno::Reference<reflection::XIdlClass> xClass
- = xReflection->forName(maAny.getValueType().getTypeName());
- uno::Reference<reflection::XIdlArray> xIdlArray = xClass->getArray();
-
- int nLength = xIdlArray->getLen(maAny);
+ int nLength = mxIdlArray->getLen(maAny);
OUString aValue = "<Sequence>";
OUString aType = getAnyType(maAny).replaceAll(u"[]", u"");
More information about the Libreoffice-commits
mailing list