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 <sfx2/dllapi.h>
14 #include <sfx2/dockwin.hxx>
15 #include <vcl/weld.hxx>
16 
17 #include <sfx2/devtools/ObjectInspectorWidgets.hxx>
18 #include <sfx2/devtools/DocumentModelTreeHandler.hxx>
19 #include <sfx2/devtools/ObjectInspectorTreeHandler.hxx>
20 
21 #include <com/sun/star/uno/XInterface.hpp>
22 #include <com/sun/star/uno/Reference.hxx>
23 #include <com/sun/star/view/XSelectionChangeListener.hpp>
24 #include <com/sun/star/view/XSelectionSupplier.hpp>
25 
26 /** Development tool main docking window
27  *
28  * Contains two sides. Left side contains the simplified DOM tree and
29  * the right side the object inspector tree.
30  */
31 class SFX2_DLLPUBLIC DevelopmentToolDockingWindow final : public SfxDockingWindow
32 {
33 private:
34     std::unique_ptr<ObjectInspectorWidgets> mpObjectInspectorWidgets;
35     std::unique_ptr<weld::TreeView> mpDocumentModelTreeView;
36     std::unique_ptr<weld::Toolbar> mpDomToolbar;
37 
38     // Reference to the root object for the current document
39     css::uno::Reference<css::uno::XInterface> mxRoot;
40     // Stores the current selected object in the document
41     css::uno::Reference<css::uno::XInterface> mxCurrentSelection;
42     css::uno::Reference<css::view::XSelectionChangeListener> mxSelectionListener;
43     css::uno::Reference<css::view::XSelectionSupplier> mxSelectionSupplier;
44 
45     // Handler for the DOM tree
46     DocumentModelTreeHandler maDocumentModelTreeHandler;
47     // Handler for the object inspector tree
48     ObjectInspectorTreeHandler maObjectInspectorTreeHandler;
49 
50     DECL_LINK(DocumentModelTreeViewSelectionHandler, weld::TreeView&, void);
51     DECL_LINK(DomToolbarButtonClicked, const OString&, void);
52 
53     void updateSelection();
54 
55 public:
56     DevelopmentToolDockingWindow(SfxBindings* pBindings, SfxChildWindow* pChildWindow,
57                                  vcl::Window* pParent);
58 
59     virtual ~DevelopmentToolDockingWindow() override;
60 
61     void dispose() override;
62 
63     void ToggleFloatingMode() override;
64 
65     // Signals that the selected object in the document changes
66     void selectionChanged(css::uno::Reference<css::uno::XInterface> const& xInterface);
67 
68     // Signals to change to the current selected object in the object inspector
69     void changeToCurrentSelection();
70 };
71 
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
73