LibreOffice Module sfx2 (master) 1
ObjectInspectorTreeHandler.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 */
10
11#pragma once
12
13#include <vcl/weld.hxx>
14#include <vcl/commandevent.hxx>
15#include <comphelper/string.hxx>
16
17#include <com/sun/star/uno/Reference.hxx>
18#include <com/sun/star/uno/XInterface.hpp>
19#include <com/sun/star/uno/XComponentContext.hpp>
20
22
23#include <memory>
24#include <deque>
25
33{
34private:
35 std::unique_ptr<ObjectInspectorWidgets>& mpObjectInspectorWidgets;
36
37 // object stack to remember previously inspected objects so it is
38 // possible to return back to them
39 std::deque<css::uno::Any> maInspectionStack;
40
41 // just the current context
42 css::uno::Reference<css::uno::XComponentContext> mxContext;
43
44 // treeview sort and compare
46 void setSortFunction(std::unique_ptr<weld::TreeView>& pTreeView);
47 sal_Int32 compare(std::unique_ptr<weld::TreeView>& pTreeView, const weld::TreeIter& rLeft,
48 const weld::TreeIter& rRight);
49
50 // treeview manipulation
51 static void clearObjectInspectorChildren(std::unique_ptr<weld::TreeView>& pTreeView,
52 weld::TreeIter const& rParent);
53 static void handleExpanding(std::unique_ptr<weld::TreeView>& pTreeView,
54 weld::TreeIter const& rParent);
55 static void clearAll(std::unique_ptr<weld::TreeView>& pTreeView);
56
57 void appendInterfaces(css::uno::Reference<css::uno::XInterface> const& xInterface);
58 void appendServices(css::uno::Reference<css::uno::XInterface> const& xInterface);
59 void appendProperties(css::uno::Reference<css::uno::XInterface> const& xInterface);
60 void appendMethods(css::uno::Reference<css::uno::XInterface> const& xInterface);
61
62 void inspectObject(css::uno::Reference<css::uno::XInterface> const& xInterface);
63
64 // Object stack handling
65 void clearStack();
66 void addToStack(css::uno::Any const& rAny);
67 css::uno::Any popFromStack();
68
70
71public:
72 ObjectInspectorTreeHandler(std::unique_ptr<ObjectInspectorWidgets>& pObjectInspectorWidgets);
73
74 // callbacks when a node in the tree view is expanded
75 DECL_LINK(ExpandingHandlerInterfaces, const weld::TreeIter&, bool);
76 DECL_LINK(ExpandingHandlerServices, const weld::TreeIter&, bool);
77 DECL_LINK(ExpandingHandlerProperties, const weld::TreeIter&, bool);
78 DECL_LINK(ExpandingHandlerMethods, const weld::TreeIter&, bool);
79
80 // callback when the tree view selection changed to a different node
81 DECL_LINK(SelectionChanged, weld::TreeView&, void);
82
83 // callback when a pop-up is triggered on a tree view node
84 DECL_LINK(PopupMenuHandler, const CommandEvent&, bool);
85
86 // callback when a button is clicked on a toolbar
87 DECL_LINK(ToolbarButtonClicked, const OUString&, void);
88
89 // callback when a page is entered or left on the notebook bar for
90 // different categories
91 DECL_LINK(NotebookEnterPage, const OUString&, void);
92 DECL_LINK(NotebookLeavePage, const OUString&, bool);
93
94 DECL_LINK(HeaderBarClick, int, void);
95
96 void introspect(css::uno::Reference<css::uno::XInterface> const& xInterface);
97
98 void dispose();
99};
100
101/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Object inspector tree handler.
DECL_LINK(ExpandingHandlerServices, const weld::TreeIter &, bool)
std::deque< css::uno::Any > maInspectionStack
DECL_LINK(ExpandingHandlerProperties, const weld::TreeIter &, bool)
void inspectObject(css::uno::Reference< css::uno::XInterface > const &xInterface)
static void handleExpanding(std::unique_ptr< weld::TreeView > &pTreeView, weld::TreeIter const &rParent)
css::uno::Reference< css::uno::XComponentContext > mxContext
void appendProperties(css::uno::Reference< css::uno::XInterface > const &xInterface)
Append properties to the "properties" tree view.
DECL_LINK(PopupMenuHandler, const CommandEvent &, bool)
DECL_LINK(SelectionChanged, weld::TreeView &, void)
DECL_LINK(NotebookLeavePage, const OUString &, bool)
void introspect(css::uno::Reference< css::uno::XInterface > const &xInterface)
DECL_LINK(ToolbarButtonClicked, const OUString &, void)
DECL_LINK(ExpandingHandlerMethods, const weld::TreeIter &, bool)
std::unique_ptr< ObjectInspectorWidgets > & mpObjectInspectorWidgets
static void clearAll(std::unique_ptr< weld::TreeView > &pTreeView)
Deletes all the node objects in a tree view.
void appendMethods(css::uno::Reference< css::uno::XInterface > const &xInterface)
Append methods to the "methods" tree view.
sal_Int32 compare(std::unique_ptr< weld::TreeView > &pTreeView, const weld::TreeIter &rLeft, const weld::TreeIter &rRight)
ObjectInspectorTreeHandler(std::unique_ptr< ObjectInspectorWidgets > &pObjectInspectorWidgets)
comphelper::string::NaturalStringSorter mxSorter
DECL_LINK(HeaderBarClick, int, void)
DECL_LINK(ExpandingHandlerInterfaces, const weld::TreeIter &, bool)
void appendInterfaces(css::uno::Reference< css::uno::XInterface > const &xInterface)
Append interfaces to the "interfaces" tree view.
DECL_LINK(NotebookEnterPage, const OUString &, void)
void setSortFunction(std::unique_ptr< weld::TreeView > &pTreeView)
void appendServices(css::uno::Reference< css::uno::XInterface > const &xInterface)
Append services to the "services" tree view.
static void clearObjectInspectorChildren(std::unique_ptr< weld::TreeView > &pTreeView, weld::TreeIter const &rParent)
void addToStack(css::uno::Any const &rAny)