summaryrefslogtreecommitdiff
path: root/include/sfx2
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-03-15 14:56:57 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-03-16 03:41:15 +0100
commit173697822d6a598461f79da2e2f77f24723d40ab (patch)
tree67683957607cd6fba927ee2d24fd55c83baa3929 /include/sfx2
parent5b84eae0c10aa33bb8ef3a9a0d1336bcc9e9163c (diff)
devtools: put ObjectInspector widgets into it's own class
This is needed so they can be shared between ObjectInspectorHandler and DevelopmentToolDockingWindow, otherwise we have to add each widget as a parameter to the constructor and for each make a referenced member. This worked for a while but with more a nd ore widgets it is becoming ugly. Change-Id: I8f17e4593b04efaf85ef50d0639c306c204ce92a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112547 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include/sfx2')
-rw-r--r--include/sfx2/devtools/DevelopmentToolDockingWindow.hxx9
-rw-r--r--include/sfx2/devtools/ObjectInspectorTreeHandler.hxx18
-rw-r--r--include/sfx2/devtools/ObjectInspectorWidgets.hxx49
3 files changed, 55 insertions, 21 deletions
diff --git a/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx b/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx
index 1d05948cd51f..656e46fedada 100644
--- a/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx
+++ b/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx
@@ -15,6 +15,7 @@
#include <vcl/customweld.hxx>
#include <vcl/weld.hxx>
+#include <sfx2/devtools/ObjectInspectorWidgets.hxx>
#include <sfx2/devtools/DocumentModelTreeHandler.hxx>
#include <sfx2/devtools/ObjectInspectorTreeHandler.hxx>
@@ -34,15 +35,9 @@
class SFX2_DLLPUBLIC DevelopmentToolDockingWindow final : public SfxDockingWindow
{
private:
- std::unique_ptr<weld::Label> mpClassNameLabel;
- std::unique_ptr<weld::TreeView> mpInterfacesTreeView;
- std::unique_ptr<weld::TreeView> mpServicesTreeView;
- std::unique_ptr<weld::TreeView> mpPropertiesTreeView;
- std::unique_ptr<weld::TreeView> mpMethodsTreeView;
+ std::unique_ptr<ObjectInspectorWidgets> mpObjectInspectorWidgets;
std::unique_ptr<weld::TreeView> mpDocumentModelTreeView;
std::unique_ptr<weld::ToggleButton> mpSelectionToggle;
- std::unique_ptr<weld::Toolbar> mpObjectInspectorToolbar;
- std::unique_ptr<weld::Notebook> mpObjectInspectorNotebook;
// Reference to the root object for the current document
css::uno::Reference<css::uno::XInterface> mxRoot;
diff --git a/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx b/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx
index 1d7000371eba..2cfb572eb3a2 100644
--- a/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx
+++ b/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx
@@ -19,6 +19,8 @@
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <sfx2/devtools/ObjectInspectorWidgets.hxx>
+
#include <memory>
#include <deque>
@@ -31,13 +33,7 @@
class ObjectInspectorTreeHandler
{
private:
- std::unique_ptr<weld::TreeView>& mpInterfacesTreeView;
- std::unique_ptr<weld::TreeView>& mpServicesTreeView;
- std::unique_ptr<weld::TreeView>& mpPropertiesTreeView;
- std::unique_ptr<weld::TreeView>& mpMethodsTreeView;
- std::unique_ptr<weld::Label>& mpClassNameLabel;
- std::unique_ptr<weld::Toolbar>& mpObjectInspectorToolbar;
- std::unique_ptr<weld::Notebook>& mpObjectInspectorNotebook;
+ std::unique_ptr<ObjectInspectorWidgets>& mpObjectInspectorWidgets;
// object stack to remember previously inspected objects so it is
// possible to return back to them
@@ -67,13 +63,7 @@ private:
void updateBackButtonState();
public:
- ObjectInspectorTreeHandler(std::unique_ptr<weld::TreeView>& pInterfacesTreeView,
- std::unique_ptr<weld::TreeView>& pServicesTreeView,
- std::unique_ptr<weld::TreeView>& pPropertiesTreeView,
- std::unique_ptr<weld::TreeView>& pMethodsTreeView,
- std::unique_ptr<weld::Label>& pClassNameLabel,
- std::unique_ptr<weld::Toolbar>& pObjectInspectorToolbar,
- std::unique_ptr<weld::Notebook>& pObjectInspectorNotebook);
+ ObjectInspectorTreeHandler(std::unique_ptr<ObjectInspectorWidgets>& pObjectInspectorWidgets);
// callbacks when a node in the tree view is expanded
DECL_LINK(ExpandingHandlerInterfaces, const weld::TreeIter&, bool);
diff --git a/include/sfx2/devtools/ObjectInspectorWidgets.hxx b/include/sfx2/devtools/ObjectInspectorWidgets.hxx
new file mode 100644
index 000000000000..6d7bf8cf9e9f
--- /dev/null
+++ b/include/sfx2/devtools/ObjectInspectorWidgets.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#pragma once
+
+#include <vcl/weld.hxx>
+
+struct ObjectInspectorWidgets
+{
+ ObjectInspectorWidgets(std::unique_ptr<weld::Builder>& rxBuilder)
+ : mpClassNameLabel(rxBuilder->weld_label("class_name_value_id"))
+ , mpInterfacesTreeView(rxBuilder->weld_tree_view("interfaces_treeview_id"))
+ , mpServicesTreeView(rxBuilder->weld_tree_view("services_treeview_id"))
+ , mpPropertiesTreeView(rxBuilder->weld_tree_view("properties_treeview_id"))
+ , mpMethodsTreeView(rxBuilder->weld_tree_view("methods_treeview_id"))
+ , mpToolbar(rxBuilder->weld_toolbar("object_inspector_toolbar"))
+ , mpNotebook(rxBuilder->weld_notebook("object_inspector_notebookbar"))
+ {
+ }
+
+ ~ObjectInspectorWidgets()
+ {
+ // dispose welded objects
+ mpClassNameLabel.reset();
+ mpInterfacesTreeView.reset();
+ mpServicesTreeView.reset();
+ mpPropertiesTreeView.reset();
+ mpMethodsTreeView.reset();
+ mpToolbar.reset();
+ mpNotebook.reset();
+ }
+
+ std::unique_ptr<weld::Label> mpClassNameLabel;
+ std::unique_ptr<weld::TreeView> mpInterfacesTreeView;
+ std::unique_ptr<weld::TreeView> mpServicesTreeView;
+ std::unique_ptr<weld::TreeView> mpPropertiesTreeView;
+ std::unique_ptr<weld::TreeView> mpMethodsTreeView;
+ std::unique_ptr<weld::Toolbar> mpToolbar;
+ std::unique_ptr<weld::Notebook> mpNotebook;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */