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/.
10 #include <ChartToolbarController.hxx>
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>
18 namespace com::sun::star::uno
{ class XComponentContext
; }
22 ChartToolbarController::ChartToolbarController(const css::uno::Sequence
<css::uno::Any
>& rProperties
)
24 for (const auto& rProperty
: rProperties
)
26 css::beans::PropertyValue aPropValue
;
27 rProperty
>>= aPropValue
;
28 if (aPropValue
.Name
== "Frame")
30 mxFramesSupplier
.set(aPropValue
.Value
, css::uno::UNO_QUERY
);
36 ChartToolbarController::~ChartToolbarController()
40 void ChartToolbarController::execute(sal_Int16
/*nKeyModifier*/)
44 void ChartToolbarController::click()
46 css::uno::Reference
<css::frame::XFrame
> xActiveFrame
= mxFramesSupplier
->getActiveFrame();
47 if (!xActiveFrame
.is())
50 css::uno::Reference
<css::frame::XController
> xActiveController
= xActiveFrame
->getController();
51 if (!xActiveController
.is())
54 css::uno::Reference
<css::frame::XDispatch
> xDispatch(xActiveController
, css::uno::UNO_QUERY
);
59 aURL
.Path
= "FormatSelection";
60 xDispatch
->dispatch(aURL
, css::uno::Sequence
<css::beans::PropertyValue
>());
63 void ChartToolbarController::doubleClick()
65 SAL_INFO("chart2", "double clicked");
69 css::uno::Reference
<css::awt::XWindow
> ChartToolbarController::createPopupWindow()
71 return css::uno::Reference
<css::awt::XWindow
>();
74 css::uno::Reference
<css::awt::XWindow
> ChartToolbarController::createItemWindow(
75 const css::uno::Reference
<css::awt::XWindow
>& /*rParent*/)
77 return css::uno::Reference
<css::awt::XWindow
>();
80 void ChartToolbarController::statusChanged(const css::frame::FeatureStateEvent
& /*rEvent*/)
85 void ChartToolbarController::disposing(const css::lang::EventObject
& /*rSource*/)
89 void ChartToolbarController::initialize(const css::uno::Sequence
<css::uno::Any
>& /*rAny*/)
93 void ChartToolbarController::update()
98 OUString
ChartToolbarController::getImplementationName()
100 return u
"org.libreoffice.chart2.Chart2ToolboxController"_ustr
;
103 sal_Bool
ChartToolbarController::supportsService(OUString
const & ServiceName
)
105 return cppu::supportsService(this, ServiceName
);
108 css::uno::Sequence
<OUString
> ChartToolbarController::getSupportedServiceNames()
110 return { u
"com.sun.star.frame.ToolbarController"_ustr
};
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
)
118 return cppu::acquire(new ::chart::ChartToolbarController(rProperties
));
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */