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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
27 namespace com::sun::star::awt
{ class XWindow
; }
31 using namespace ::com::sun::star
;
32 ChartTypeUnoDlg::ChartTypeUnoDlg( const uno::Reference
< uno::XComponentContext
>& _xContext
)
33 : ChartTypeUnoDlg_BASE( _xContext
)
36 ChartTypeUnoDlg::~ChartTypeUnoDlg()
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...
42 ::osl::MutexGuard
aGuard(m_aMutex
);
48 OUString SAL_CALL
ChartTypeUnoDlg::getImplementationName()
50 return CHART_TYPE_DIALOG_SERVICE_IMPLEMENTATION_NAME
;
53 css::uno::Sequence
<OUString
> SAL_CALL
ChartTypeUnoDlg::getSupportedServiceNames()
55 return { CHART_TYPE_DIALOG_SERVICE_NAME
};
57 uno::Sequence
< sal_Int8
> SAL_CALL
ChartTypeUnoDlg::getImplementationId()
59 return css::uno::Sequence
<sal_Int8
>();
61 void ChartTypeUnoDlg::implInitialize(const uno::Any
& _rValue
)
63 beans::PropertyValue aProperty
;
64 if (_rValue
>>= aProperty
)
66 if (aProperty
.Name
== "ChartModel")
68 uno::Reference
<XInterface
> xInt
;
69 aProperty
.Value
>>= xInt
;
70 assert(dynamic_cast<::chart::ChartModel
*>(xInt
.get()));
71 m_xChartModel
= dynamic_cast<::chart::ChartModel
*>(xInt
.get());
74 ChartTypeUnoDlg_BASE::implInitialize(_rValue
);
77 ChartTypeUnoDlg_BASE::implInitialize(_rValue
);
80 std::unique_ptr
<weld::DialogController
> ChartTypeUnoDlg::createDialog(const css::uno::Reference
<css::awt::XWindow
>& rParent
)
82 ChartModel
* pChartModel
= dynamic_cast<ChartModel
*>(rParent
.get());
84 return std::make_unique
<ChartTypeDialog
>(Application::GetFrameWeld(rParent
), pChartModel
);
87 uno::Reference
<beans::XPropertySetInfo
> SAL_CALL
ChartTypeUnoDlg::getPropertySetInfo()
89 return createPropertySetInfo( getInfoHelper() );
92 ::cppu::IPropertyArrayHelper
& ChartTypeUnoDlg::getInfoHelper()
94 return *getArrayHelper();
97 ::cppu::IPropertyArrayHelper
* ChartTypeUnoDlg::createArrayHelper( ) const
99 uno::Sequence
< beans::Property
> aProps
;
100 describeProperties(aProps
);
101 return new ::cppu::OPropertyArrayHelper(aProps
);
106 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
107 com_sun_star_comp_chart2_ChartTypeDialog_get_implementation(css::uno::XComponentContext
*context
,
108 css::uno::Sequence
<css::uno::Any
> const &)
110 return cppu::acquire(new chart::ChartTypeUnoDlg(context
));
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */