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
{ namespace sun
{ namespace star
{ namespace uno
{ class XComponentContext
; } } } }
22 ChartToolbarController::ChartToolbarController(const css::uno::Sequence
<css::uno::Any
>& rProperties
):
23 ChartToolbarControllerBase(m_aMutex
)
25 css::uno::Reference
<css::frame::XFrame
> xFrame
;
26 sal_Int32 nLength
= rProperties
.getLength();
27 for (sal_Int32 i
= 0; i
< nLength
; ++i
)
29 css::beans::PropertyValue aPropValue
;
30 rProperties
[i
] >>= aPropValue
;
31 if (aPropValue
.Name
== "Frame")
32 aPropValue
.Value
>>= xFrame
;
35 css::uno::Reference
<css::frame::XFramesSupplier
> xFramesSupplier(xFrame
, css::uno::UNO_QUERY
);
36 mxFramesSupplier
= xFramesSupplier
;
39 ChartToolbarController::~ChartToolbarController()
43 void ChartToolbarController::execute(sal_Int16
/*nKeyModifier*/)
47 void ChartToolbarController::click()
49 css::uno::Reference
<css::frame::XFrame
> xActiveFrame
= mxFramesSupplier
->getActiveFrame();
50 if (!xActiveFrame
.is())
53 css::uno::Reference
<css::frame::XController
> xActiveController
= xActiveFrame
->getController();
54 if (!xActiveController
.is())
57 css::uno::Reference
<css::frame::XDispatch
> xDispatch(xActiveController
, css::uno::UNO_QUERY
);
62 aURL
.Path
= "FormatSelection";
63 xDispatch
->dispatch(aURL
, css::uno::Sequence
<css::beans::PropertyValue
>());
66 void ChartToolbarController::doubleClick()
68 SAL_INFO("chart2", "double clicked");
72 css::uno::Reference
<css::awt::XWindow
> ChartToolbarController::createPopupWindow()
74 return css::uno::Reference
<css::awt::XWindow
>();
77 css::uno::Reference
<css::awt::XWindow
> ChartToolbarController::createItemWindow(
78 const css::uno::Reference
<css::awt::XWindow
>& /*rParent*/)
80 return css::uno::Reference
<css::awt::XWindow
>();
83 void ChartToolbarController::statusChanged(const css::frame::FeatureStateEvent
& /*rEvent*/)
88 void ChartToolbarController::disposing(const css::lang::EventObject
& /*rSource*/)
92 void ChartToolbarController::initialize(const css::uno::Sequence
<css::uno::Any
>& /*rAny*/)
96 void ChartToolbarController::update()
101 OUString
ChartToolbarController::getImplementationName()
103 return "org.libreoffice.chart2.Chart2ToolboxController";
106 sal_Bool
ChartToolbarController::supportsService(OUString
const & ServiceName
)
108 return cppu::supportsService(this, ServiceName
);
111 css::uno::Sequence
<OUString
> ChartToolbarController::getSupportedServiceNames()
113 return { "com.sun.star.frame.ToolbarController" };
118 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
119 org_libreoffice_chart2_Chart2ToolboxController(css::uno::XComponentContext
*, css::uno::Sequence
<css::uno::Any
> const & rProperties
)
121 return cppu::acquire(new ::chart::ChartToolbarController(rProperties
));
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */