summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-02-10 16:54:59 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-02-11 15:47:01 +0100
commitf641858aeee3f16f75d79a121033659583569479 (patch)
tree73097a820cbd95c7cfb3d5fc6d9e1f576e3e9e32 /sfx2
parent763168bde2c3b48a2849b4c917e09b559468c434 (diff)
devtools: ObjectInspectorNodeInterface as the toplevel root class
This adds ObjectInspectorNodeInterface as the toplevel root class which doesn't take an object as the input parameter, which is not needed in some cases. Change-Id: I6a5cc4f9108cbd2dcab6d1b32e0a7a83cd838779 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110738 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/devtools/ObjectInspectorTreeHandler.cxx37
1 files changed, 22 insertions, 15 deletions
diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
index 24e41318059f..c5f48bfd9b32 100644
--- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
+++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
@@ -132,7 +132,20 @@ OUString getAnyType(const uno::Any& aValue, const uno::Reference<uno::XComponent
// Object inspector nodes
-class ObjectInspectorNode
+class ObjectInspectorNodeInterface
+{
+public:
+ ObjectInspectorNodeInterface() = default;
+
+ virtual ~ObjectInspectorNodeInterface() {}
+
+ virtual OUString getObjectName() = 0;
+
+ virtual void fillChildren(std::unique_ptr<weld::TreeView>& rTree, weld::TreeIter const& rParent)
+ = 0;
+};
+
+class ObjectInspectorNode : public ObjectInspectorNodeInterface
{
public:
css::uno::Reference<css::uno::XInterface> mxObject;
@@ -143,16 +156,9 @@ public:
: mxObject(xObject)
{
}
-
- virtual ~ObjectInspectorNode() {}
-
- virtual OUString getObjectName() = 0;
-
- virtual void fillChildren(std::unique_ptr<weld::TreeView>& rTree, weld::TreeIter const& rParent)
- = 0;
};
-OUString lclAppendNode(std::unique_ptr<weld::TreeView>& pTree, ObjectInspectorNode* pEntry,
+OUString lclAppendNode(std::unique_ptr<weld::TreeView>& pTree, ObjectInspectorNodeInterface* pEntry,
bool bChildrenOnDemand = false)
{
OUString sName = pEntry->getObjectName();
@@ -164,20 +170,21 @@ OUString lclAppendNode(std::unique_ptr<weld::TreeView>& pTree, ObjectInspectorNo
}
OUString lclAppendNodeToParent(std::unique_ptr<weld::TreeView>& pTree,
- weld::TreeIter const& rParent, ObjectInspectorNode* pEntry,
+ weld::TreeIter const& rParent, ObjectInspectorNodeInterface* pEntry,
bool bChildrenOnDemand = false)
{
OUString sName = pEntry->getObjectName();
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
std::unique_ptr<weld::TreeIter> pCurrent = pTree->make_iterator();
- pTree->insert(&rParent, -1, &sName, &sId, nullptr, nullptr, bChildrenOnDemand, nullptr);
+ pTree->insert(&rParent, -1, &sName, &sId, nullptr, nullptr, bChildrenOnDemand, pCurrent.get());
pTree->set_text_emphasis(*pCurrent, true, 0);
return sId;
}
OUString lclAppendNodeWithIterToParent(std::unique_ptr<weld::TreeView>& pTree,
weld::TreeIter const& rParent, weld::TreeIter& rCurrent,
- ObjectInspectorNode* pEntry, bool bChildrenOnDemand = false)
+ ObjectInspectorNodeInterface* pEntry,
+ bool bChildrenOnDemand = false)
{
OUString sName = pEntry->getObjectName();
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pEntry)));
@@ -397,7 +404,7 @@ IMPL_LINK(ObjectInspectorTreeHandler, ExpandingHandler, weld::TreeIter const&, r
return true;
clearObjectInspectorChildren(rParent);
- auto* pNode = reinterpret_cast<ObjectInspectorNode*>(sID.toInt64());
+ auto* pNode = reinterpret_cast<ObjectInspectorNodeInterface*>(sID.toInt64());
pNode->fillChildren(mpObjectInspectorTree, rParent);
return true;
@@ -417,7 +424,7 @@ void ObjectInspectorTreeHandler::clearObjectInspectorChildren(weld::TreeIter con
{
clearObjectInspectorChildren(*pChild);
OUString sID = mpObjectInspectorTree->get_id(*pChild);
- auto* pEntry = reinterpret_cast<ObjectInspectorNode*>(sID.toInt64());
+ auto* pEntry = reinterpret_cast<ObjectInspectorNodeInterface*>(sID.toInt64());
delete pEntry;
mpObjectInspectorTree->remove(*pChild);
}
@@ -456,7 +463,7 @@ void ObjectInspectorTreeHandler::dispose()
// destroy all ObjectInspectorNodes from the tree
mpObjectInspectorTree->all_foreach([this](weld::TreeIter& rEntry) {
OUString sID = mpObjectInspectorTree->get_id(rEntry);
- auto* pEntry = reinterpret_cast<ObjectInspectorNode*>(sID.toInt64());
+ auto* pEntry = reinterpret_cast<ObjectInspectorNodeInterface*>(sID.toInt64());
delete pEntry;
return false;
});