LibreOffice Module chart2 (master) 1
ToolbarController.cxx
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
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>
16#include <sal/log.hxx>
17
18namespace com::sun::star::uno { class XComponentContext; }
19
20namespace chart {
21
22ChartToolbarController::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
37{
38}
39
40void ChartToolbarController::execute(sal_Int16 /*nKeyModifier*/)
41{
42}
43
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
64{
65 SAL_INFO("chart2", "double clicked");
66}
67
68
69css::uno::Reference<css::awt::XWindow> ChartToolbarController::createPopupWindow()
70{
71 return css::uno::Reference<css::awt::XWindow>();
72}
73
74css::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
80void ChartToolbarController::statusChanged(const css::frame::FeatureStateEvent& /*rEvent*/)
81{
82
83}
84
85void ChartToolbarController::disposing(const css::lang::EventObject& /*rSource*/)
86{
87}
88
89void ChartToolbarController::initialize(const css::uno::Sequence<css::uno::Any>& /*rAny*/)
90{
91}
92
94{
95}
96
97
99{
100 return "org.libreoffice.chart2.Chart2ToolboxController";
101}
102
104{
106}
107
109{
110 return { "com.sun.star.frame.ToolbarController" };
111}
112
113}
114
115extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
116org_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: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * org_libreoffice_chart2_Chart2ToolboxController(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &rProperties)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow(const css::uno::Reference< css::awt::XWindow > &rParent) override
virtual sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rAny) override
ChartToolbarController(const css::uno::Sequence< css::uno::Any > &rProperties)
virtual void SAL_CALL doubleClick() override
virtual void SAL_CALL update() override
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override
virtual ~ChartToolbarController() override
css::uno::Reference< css::frame::XFramesSupplier > mxFramesSupplier
virtual void SAL_CALL click() override
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &rEvent) override
virtual void SAL_CALL disposing(const css::lang::EventObject &rSource) override
virtual void SAL_CALL execute(sal_Int16 nKeyModifier) override
virtual OUString SAL_CALL getImplementationName() override
Reference< XDispatch > xDispatch
URL aURL
#define SAL_INFO(area, stream)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool