Debian Codegraph @

chart2/source/controller/main/ElementSelector.hxx

raw
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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19 #pragma once
20
21 #include <ObjectIdentifier.hxx>
22 #include <com/sun/star/lang/XServiceInfo.hpp>
23 #include <cppuhelper/implbase1.hxx>
24 #include <svtools/toolboxcontroller.hxx>
25
26 #include <vcl/InterimItemWindow.hxx>
27 #include <unotools/weakref.hxx>
28
29 namespace chart
30 {
31 class ChartController;
32
33 struct ListBoxEntryData
34 {
35 OUString UIName;
36 ObjectIdentifier OID;
37 sal_Int32 nHierarchyDepth;
38
39 ListBoxEntryData() : nHierarchyDepth(0)
40 {
41 }
42 };
43
44 class SelectorListBox final : public InterimItemWindow
45 {
46 public:
47 SelectorListBox(vcl::Window* pParent);
48 virtual void dispose() override;
49 virtual ~SelectorListBox() override;
50
51 void ReleaseFocus_Impl();
52
53 void SetChartController( const rtl::Reference< ::chart::ChartController >& xChartController );
54 void UpdateChartElementsListAndSelection();
55
56 private:
57 unotools::WeakReference<::chart::ChartController> m_xChartController;
58 std::unique_ptr<weld::ComboBox> m_xWidget;
59
60 std::vector<ListBoxEntryData> m_aEntries;
61
62 bool m_bReleaseFocus;
63
64 DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
65 DECL_LINK(SelectHdl, weld::ComboBox&, void);
66 DECL_LINK(FocusOutHdl, weld::Widget&, void);
67 };
68
69 typedef ::cppu::ImplHelper1 < css::lang::XServiceInfo> ElementSelectorToolbarController_BASE;
70
71 class ElementSelectorToolbarController : public ::svt::ToolboxController
72 , public ElementSelectorToolbarController_BASE
73 {
74 public:
75 explicit ElementSelectorToolbarController();
76 virtual ~ElementSelectorToolbarController() override;
77
78 // XServiceInfo
79 virtual OUString SAL_CALL getImplementationName() override;
80 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
81 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
82
83 // XInterface
84 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
85 virtual void SAL_CALL acquire() noexcept override;
86 virtual void SAL_CALL release() noexcept override;
87
88 // XStatusListener
89 virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
90 // XToolbarController
91 virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) override;
92
93 private:
94 VclPtr< SelectorListBox > m_apSelectorListBox;
95 };
96
97 } //namespace chart
98
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */