Debian Codegraph @

chart2/source/controller/main/ToolbarController.cxx

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
10 #include <ChartToolbarController.hxx>
11
12 #include <com/sun/star/frame/XFrame.hpp>
13 #include <com/sun/star/frame/XDispatch.hpp>
14 #include <com/sun/star/frame/XFramesSupplier.hpp>
15 #include <cppuhelper/supportsservice.hxx>
16 #include <sal/log.hxx>
17
18 namespace com::sun::star::uno { class XComponentContext; }
19
20 namespace chart {
21
22 ChartToolbarController::ChartToolbarController(const css::uno::Sequence<css::uno::Any>& rProperties)
23 {
24 for (const auto& rProperty : rProperties)
25 {
26 css::beans::PropertyValue aPropValue;
27 rProperty >>= aPropValue;
28 if (aPropValue.Name == "Frame")
29 {
30 mxFramesSupplier.set(aPropValue.Value, css::uno::UNO_QUERY);
31 break;
32 }
33 }
34 }
35
36 ChartToolbarController::~ChartToolbarController()
37 {
38 }
39
40 void ChartToolbarController::execute(sal_Int16 /*nKeyModifier*/)
41 {
42 }
43
44 void ChartToolbarController::click()
45 {
46 css::uno::Reference<css::frame::XFrame> xActiveFrame = mxFramesSupplier->getActiveFrame();
47 if (!xActiveFrame.is())
48 return;
49
50 css::uno::Reference<css::frame::XController> xActiveController = xActiveFrame->getController();
51 if (!xActiveController.is())
52 return;
53
54 css::uno::Reference<css::frame::XDispatch> xDispatch(xActiveController, css::uno::UNO_QUERY);
55 if (!xDispatch.is())
56 return;
57
58 css::util::URL aURL;
59 aURL.Path = "FormatSelection";
60 xDispatch->dispatch(aURL, css::uno::Sequence<css::beans::PropertyValue>());
61 }
62
63 void ChartToolbarController::doubleClick()
64 {
65 SAL_INFO("chart2", "double clicked");
66 }
67
68
69 css::uno::Reference<css::awt::XWindow> ChartToolbarController::createPopupWindow()
70 {
71 return css::uno::Reference<css::awt::XWindow>();
72 }
73
74 css::uno::Reference<css::awt::XWindow> ChartToolbarController::createItemWindow(
75 const css::uno::Reference<css::awt::XWindow>& /*rParent*/)
76 {
77 return css::uno::Reference<css::awt::XWindow>();
78 }
79
80 void ChartToolbarController::statusChanged(const css::frame::FeatureStateEvent& /*rEvent*/)
81 {
82
83 }
84
85 void ChartToolbarController::disposing(const css::lang::EventObject& /*rSource*/)
86 {
87 }
88
89 void ChartToolbarController::initialize(const css::uno::Sequence<css::uno::Any>& /*rAny*/)
90 {
91 }
92
93 void ChartToolbarController::update()
94 {
95 }
96
97
98 OUString ChartToolbarController::getImplementationName()
99 {
100 return u"org.libreoffice.chart2.Chart2ToolboxController"_ustr;
101 }
102
103 sal_Bool ChartToolbarController::supportsService(OUString const & ServiceName)
104 {
105 return cppu::supportsService(this, ServiceName);
106 }
107
108 css::uno::Sequence<OUString> ChartToolbarController::getSupportedServiceNames()
109 {
110 return { u"com.sun.star.frame.ToolbarController"_ustr };
111 }
112
113 }
114
115 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
116 org_libreoffice_chart2_Chart2ToolboxController(css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const & rProperties)
117 {
118 return cppu::acquire(new ::chart::ChartToolbarController(rProperties));
119 }
120
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */