LibreOffice Module chart2 (master) 1
dlg_ChartType_UNO.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 * 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
20#include <dlg_ChartType_UNO.hxx>
21#include <dlg_ChartType.hxx>
22#include <ChartModel.hxx>
23#include <servicenames.hxx>
24#include <osl/mutex.hxx>
25#include <vcl/svapp.hxx>
26
27namespace com::sun::star::awt { class XWindow; }
28
29namespace chart
30{
31using namespace ::com::sun::star;
32ChartTypeUnoDlg::ChartTypeUnoDlg( const uno::Reference< uno::XComponentContext >& _xContext )
34{
35}
36ChartTypeUnoDlg::~ChartTypeUnoDlg()
37{
38 // we do this here cause the base class' call to destroyDialog won't reach us anymore: we're within a dtor,
39 // so this virtual-method-call the base class does not work, we're already dead then...
40 if (m_xDialog)
41 {
42 ::osl::MutexGuard aGuard(m_aMutex);
43 if (m_xDialog)
44 destroyDialog();
45 }
46}
47// lang::XServiceInfo
48OUString SAL_CALL ChartTypeUnoDlg::getImplementationName()
49{
51}
52
53css::uno::Sequence<OUString> SAL_CALL ChartTypeUnoDlg::getSupportedServiceNames()
54{
56}
57uno::Sequence< sal_Int8 > SAL_CALL ChartTypeUnoDlg::getImplementationId()
58{
59 return css::uno::Sequence<sal_Int8>();
60}
61void ChartTypeUnoDlg::implInitialize(const uno::Any& _rValue)
62{
63 beans::PropertyValue aProperty;
64 if (_rValue >>= aProperty)
65 {
66 if (aProperty.Name == "ChartModel")
67 {
69 aProperty.Value >>= xInt;
70 assert(dynamic_cast<::chart::ChartModel*>(xInt.get()));
71 m_xChartModel = dynamic_cast<::chart::ChartModel*>(xInt.get());
72 }
73 else
74 ChartTypeUnoDlg_BASE::implInitialize(_rValue);
75 }
76 else
77 ChartTypeUnoDlg_BASE::implInitialize(_rValue);
78}
79
80std::unique_ptr<weld::DialogController> ChartTypeUnoDlg::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
81{
82 ChartModel* pChartModel = dynamic_cast<ChartModel*>(rParent.get());
83 assert(pChartModel);
84 return std::make_unique<ChartTypeDialog>(Application::GetFrameWeld(rParent), pChartModel);
85}
86
87uno::Reference<beans::XPropertySetInfo> SAL_CALL ChartTypeUnoDlg::getPropertySetInfo()
88{
89 return createPropertySetInfo( getInfoHelper() );
90}
91
92::cppu::IPropertyArrayHelper& ChartTypeUnoDlg::getInfoHelper()
93{
94 return *getArrayHelper();
95}
96
97::cppu::IPropertyArrayHelper* ChartTypeUnoDlg::createArrayHelper( ) const
98{
100 describeProperties(aProps);
101 return new ::cppu::OPropertyArrayHelper(aProps);
102}
103
104} //namespace chart
105
106extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
108 css::uno::Sequence<css::uno::Any> const &)
109{
110 return cppu::acquire(new chart::ChartTypeUnoDlg(context));
111}
112
113/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
static weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
ChartTypeUnoDlg(const css::uno::Reference< css::uno::XComponentContext > &xContext)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_chart2_ChartTypeDialog_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
std::mutex m_aMutex
::svt::OGenericUnoDialog ChartTypeUnoDlg_BASE
constexpr OUStringLiteral CHART_TYPE_DIALOG_SERVICE_IMPLEMENTATION_NAME
constexpr OUStringLiteral CHART_TYPE_DIALOG_SERVICE_NAME
Reference< XComponentContext > _xContext