1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
13 #include <vcl/weld.hxx>
14 #include <vcl/commandevent.hxx>
15 #include <comphelper/string.hxx>
17 #include <com/sun/star/uno/Reference.hxx>
18 #include <com/sun/star/uno/XInterface.hpp>
19 #include <com/sun/star/uno/XComponentContext.hpp>
21 #include <sfx2/devtools/ObjectInspectorWidgets.hxx>
26 /** Object inspector tree handler
28 * Handles the object inspector part of DevTools - mainly interaction
29 * between UI objects that consist of the object inspector.
32 class ObjectInspectorTreeHandler
35 std::unique_ptr
<ObjectInspectorWidgets
>& mpObjectInspectorWidgets
;
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
;
41 // just the current context
42 css::uno::Reference
<css::uno::XComponentContext
> mxContext
;
44 // treeview sort and compare
45 comphelper::string::NaturalStringSorter mxSorter
;
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
);
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
);
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
);
62 void inspectObject(css::uno::Reference
<css::uno::XInterface
> const& xInterface
);
64 // Object stack handling
66 void addToStack(css::uno::Any
const& rAny
);
67 css::uno::Any
popFromStack();
69 void updateBackButtonState();
72 ObjectInspectorTreeHandler(std::unique_ptr
<ObjectInspectorWidgets
>& pObjectInspectorWidgets
);
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);
80 // callback when the tree view selection changed to a different node
81 DECL_LINK(SelectionChanged
, weld::TreeView
&, void);
83 // callback when a pop-up is triggered on a tree view node
84 DECL_LINK(PopupMenuHandler
, const CommandEvent
&, bool);
86 // callback when a button is clicked on a toolbar
87 DECL_LINK(ToolbarButtonClicked
, const OUString
&, void);
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);
94 DECL_LINK(HeaderBarClick
, int, void);
96 void introspect(css::uno::Reference
<css::uno::XInterface
> const& xInterface
);
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */