summaryrefslogtreecommitdiffstats
path: root/include/sfx2/devtools
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/sfx2/devtools/DevelopmentToolChildWindow.hxx27
-rw-r--r--include/sfx2/devtools/DevelopmentToolDockingWindow.hxx72
-rw-r--r--include/sfx2/devtools/DocumentModelTreeHandler.hxx52
-rw-r--r--include/sfx2/devtools/ObjectInspectorTreeHandler.hxx101
-rw-r--r--include/sfx2/devtools/ObjectInspectorWidgets.hxx55
5 files changed, 307 insertions, 0 deletions
diff --git a/include/sfx2/devtools/DevelopmentToolChildWindow.hxx b/include/sfx2/devtools/DevelopmentToolChildWindow.hxx
new file mode 100644
index 000000000..d78ac5c2e
--- /dev/null
+++ b/include/sfx2/devtools/DevelopmentToolChildWindow.hxx
@@ -0,0 +1,27 @@
+/* -*- 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 <sfx2/dllapi.h>
+#include <sfx2/childwin.hxx>
+
+/**
+ * Necessary child window for the development tools docking window
+ */
+class SAL_WARN_UNUSED SFX2_DLLPUBLIC DevelopmentToolChildWindow final : public SfxChildWindow
+{
+ SFX_DECL_CHILDWINDOW_WITHID(DevelopmentToolChildWindow);
+
+ DevelopmentToolChildWindow(vcl::Window* pParentWindow, sal_uInt16 nId, SfxBindings* pBindings,
+ SfxChildWinInfo* pInfo);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx b/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx
new file mode 100644
index 000000000..4da9fccd9
--- /dev/null
+++ b/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx
@@ -0,0 +1,72 @@
+/* -*- 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 <sfx2/dllapi.h>
+#include <sfx2/dockwin.hxx>
+#include <vcl/weld.hxx>
+
+#include <sfx2/devtools/ObjectInspectorWidgets.hxx>
+#include <sfx2/devtools/DocumentModelTreeHandler.hxx>
+#include <sfx2/devtools/ObjectInspectorTreeHandler.hxx>
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+
+/** Development tool main docking window
+ *
+ * Contains two sides. Left side contains the simplified DOM tree and
+ * the right side the object inspector tree.
+ */
+class SFX2_DLLPUBLIC DevelopmentToolDockingWindow final : public SfxDockingWindow
+{
+private:
+ std::unique_ptr<ObjectInspectorWidgets> mpObjectInspectorWidgets;
+ std::unique_ptr<weld::TreeView> mpDocumentModelTreeView;
+ std::unique_ptr<weld::Toolbar> mpDomToolbar;
+
+ // Reference to the root object for the current document
+ css::uno::Reference<css::uno::XInterface> mxRoot;
+ // Stores the current selected object in the document
+ css::uno::Reference<css::uno::XInterface> mxCurrentSelection;
+ css::uno::Reference<css::view::XSelectionChangeListener> mxSelectionListener;
+ css::uno::Reference<css::view::XSelectionSupplier> mxSelectionSupplier;
+
+ // Handler for the DOM tree
+ DocumentModelTreeHandler maDocumentModelTreeHandler;
+ // Handler for the object inspector tree
+ ObjectInspectorTreeHandler maObjectInspectorTreeHandler;
+
+ DECL_DLLPRIVATE_LINK(DocumentModelTreeViewSelectionHandler, weld::TreeView&, void);
+ DECL_DLLPRIVATE_LINK(DomToolbarButtonClicked, const OString&, void);
+
+ void updateSelection();
+
+public:
+ DevelopmentToolDockingWindow(SfxBindings* pBindings, SfxChildWindow* pChildWindow,
+ vcl::Window* pParent);
+
+ virtual ~DevelopmentToolDockingWindow() override;
+
+ void dispose() override;
+
+ void ToggleFloatingMode() override;
+
+ // Signals that the selected object in the document changes
+ void selectionChanged(css::uno::Reference<css::uno::XInterface> const& xInterface);
+
+ // Signals to change to the current selected object in the object inspector
+ void changeToCurrentSelection();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/devtools/DocumentModelTreeHandler.hxx b/include/sfx2/devtools/DocumentModelTreeHandler.hxx
new file mode 100644
index 000000000..47294d527
--- /dev/null
+++ b/include/sfx2/devtools/DocumentModelTreeHandler.hxx
@@ -0,0 +1,52 @@
+/* -*- 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>
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+/** Document model tree handler
+ *
+ * Handles the DOM tree part of DevTools, which includes interaction with
+ * the DOM tree view UI elements and the DOM model.
+ */
+class DocumentModelTreeHandler
+{
+private:
+ std::unique_ptr<weld::TreeView>& mpDocumentModelTree;
+ css::uno::Reference<css::uno::XInterface> mxDocument;
+
+ // Clears all children of a tree node, where the parent is
+ // identified by the input tree iter.
+ void clearChildren(weld::TreeIter const& rParent);
+
+ // Clear all tree view nodes.
+ void clearAll();
+
+public:
+ DocumentModelTreeHandler(std::unique_ptr<weld::TreeView>& pDocumentModelTree,
+ css::uno::Reference<css::uno::XInterface> const& xDocument);
+
+ DECL_LINK(ExpandingHandler, const weld::TreeIter&, bool);
+
+ void inspectDocument();
+
+ static css::uno::Reference<css::uno::XInterface> getObjectByID(OUString const& rID);
+
+ void dispose();
+
+ // selects the input object if it exists in the DOM tree view
+ void selectObject(css::uno::Reference<css::uno::XInterface> const& xInterface);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx b/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx
new file mode 100644
index 000000000..b6fa678de
--- /dev/null
+++ b/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx
@@ -0,0 +1,101 @@
+/* -*- 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>
+#include <vcl/commandevent.hxx>
+#include <comphelper/string.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <sfx2/devtools/ObjectInspectorWidgets.hxx>
+
+#include <memory>
+#include <deque>
+
+/** Object inspector tree handler
+ *
+ * Handles the object inspector part of DevTools - mainly interaction
+ * between UI objects that consist of the object inspector.
+ *
+ */
+class ObjectInspectorTreeHandler
+{
+private:
+ std::unique_ptr<ObjectInspectorWidgets>& mpObjectInspectorWidgets;
+
+ // object stack to remember previously inspected objects so it is
+ // possible to return back to them
+ std::deque<css::uno::Any> maInspectionStack;
+
+ // just the current context
+ css::uno::Reference<css::uno::XComponentContext> mxContext;
+
+ // treeview sort and compare
+ comphelper::string::NaturalStringSorter mxSorter;
+ void setSortFunction(std::unique_ptr<weld::TreeView>& pTreeView);
+ sal_Int32 compare(std::unique_ptr<weld::TreeView>& pTreeView, const weld::TreeIter& rLeft,
+ const weld::TreeIter& rRight);
+
+ // treeview manipulation
+ static void clearObjectInspectorChildren(std::unique_ptr<weld::TreeView>& pTreeView,
+ weld::TreeIter const& rParent);
+ static void handleExpanding(std::unique_ptr<weld::TreeView>& pTreeView,
+ weld::TreeIter const& rParent);
+ static void clearAll(std::unique_ptr<weld::TreeView>& pTreeView);
+
+ void appendInterfaces(css::uno::Reference<css::uno::XInterface> const& xInterface);
+ void appendServices(css::uno::Reference<css::uno::XInterface> const& xInterface);
+ void appendProperties(css::uno::Reference<css::uno::XInterface> const& xInterface);
+ void appendMethods(css::uno::Reference<css::uno::XInterface> const& xInterface);
+
+ void inspectObject(css::uno::Reference<css::uno::XInterface> const& xInterface);
+
+ // Object stack handling
+ void clearStack();
+ void addToStack(css::uno::Any const& rAny);
+ css::uno::Any popFromStack();
+
+ void updateBackButtonState();
+
+public:
+ ObjectInspectorTreeHandler(std::unique_ptr<ObjectInspectorWidgets>& pObjectInspectorWidgets);
+
+ // callbacks when a node in the tree view is expanded
+ DECL_LINK(ExpandingHandlerInterfaces, const weld::TreeIter&, bool);
+ DECL_LINK(ExpandingHandlerServices, const weld::TreeIter&, bool);
+ DECL_LINK(ExpandingHandlerProperties, const weld::TreeIter&, bool);
+ DECL_LINK(ExpandingHandlerMethods, const weld::TreeIter&, bool);
+
+ // callback when the tree view selection changed to a different node
+ DECL_LINK(SelectionChanged, weld::TreeView&, void);
+
+ // callback when a pop-up is triggered on a tree view node
+ DECL_LINK(PopupMenuHandler, const CommandEvent&, bool);
+
+ // callback when a button is clicked on a toolbar
+ DECL_LINK(ToolbarButtonClicked, const OString&, void);
+
+ // callback when a page is entered or left on the notebook bar for
+ // different categories
+ DECL_LINK(NotebookEnterPage, const OString&, void);
+ DECL_LINK(NotebookLeavePage, const OString&, bool);
+
+ DECL_LINK(HeaderBarClick, int, void);
+
+ void introspect(css::uno::Reference<css::uno::XInterface> const& xInterface);
+
+ void dispose();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sfx2/devtools/ObjectInspectorWidgets.hxx b/include/sfx2/devtools/ObjectInspectorWidgets.hxx
new file mode 100644
index 000000000..9c719d2aa
--- /dev/null
+++ b/include/sfx2/devtools/ObjectInspectorWidgets.hxx
@@ -0,0 +1,55 @@
+/* -*- 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(const 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"))
+ , mpTextView(rxBuilder->weld_text_view("object_inspector_text_view"))
+ , mpPaned(rxBuilder->weld_paned("object_inspector_paned"))
+ {
+ }
+
+ ~ObjectInspectorWidgets()
+ {
+ // dispose welded objects
+ mpClassNameLabel.reset();
+ mpInterfacesTreeView.reset();
+ mpServicesTreeView.reset();
+ mpPropertiesTreeView.reset();
+ mpMethodsTreeView.reset();
+ mpToolbar.reset();
+ mpNotebook.reset();
+ mpTextView.reset();
+ mpPaned.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;
+ std::unique_ptr<weld::TextView> mpTextView;
+ std::unique_ptr<weld::Paned> mpPaned;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */