1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_chart2.hxx"
26
27 #include "dlg_ChartType_UNO.hxx"
28 #include "dlg_ChartType.hxx"
29 #include "servicenames.hxx"
30 #include <osl/mutex.hxx>
31
32 //.............................................................................
33 namespace chart
34 {
35 //.............................................................................
36 using namespace ::com::sun::star;
37 uno::Reference< uno::XInterface >
Create(const uno::Reference<uno::XComponentContext> & _xContext)38 SAL_CALL ChartTypeUnoDlg::Create(const uno::Reference< uno::XComponentContext >& _xContext)
39 {
40 return *(new ChartTypeUnoDlg(_xContext));
41 }
42 // -----------------------------------------------------------------------------
ChartTypeUnoDlg(const uno::Reference<uno::XComponentContext> & _xContext)43 ChartTypeUnoDlg::ChartTypeUnoDlg( const uno::Reference< uno::XComponentContext >& _xContext )
44 : ChartTypeUnoDlg_BASE( _xContext )
45 {
46 }
47 // -----------------------------------------------------------------------------
~ChartTypeUnoDlg()48 ChartTypeUnoDlg::~ChartTypeUnoDlg()
49 {
50 // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor,
51 // so this virtual-method-call the base class does does not work, we're already dead then ...
52 if (m_pDialog)
53 {
54 ::osl::MutexGuard aGuard(m_aMutex);
55 if (m_pDialog)
56 destroyDialog();
57 }
58 }
59 //-------------------------------------------------------------------------
60 // lang::XServiceInfo
61 //-------------------------------------------------------------------------
getImplementationName()62 ::rtl::OUString SAL_CALL ChartTypeUnoDlg::getImplementationName() throw(uno::RuntimeException)
63 {
64 return getImplementationName_Static();
65 }
66
67 //-------------------------------------------------------------------------
getImplementationName_Static()68 ::rtl::OUString ChartTypeUnoDlg::getImplementationName_Static() throw(uno::RuntimeException)
69 {
70 return CHART_TYPE_DIALOG_SERVICE_IMPLEMENTATION_NAME;
71 }
72
73 //-------------------------------------------------------------------------
getSupportedServiceNames()74 ::comphelper::StringSequence SAL_CALL ChartTypeUnoDlg::getSupportedServiceNames() throw(uno::RuntimeException)
75 {
76 return getSupportedServiceNames_Static();
77 }
78
79 //-------------------------------------------------------------------------
80
getSupportedServiceNames_Static()81 uno::Sequence< rtl::OUString > ChartTypeUnoDlg::getSupportedServiceNames_Static()
82 {
83 uno::Sequence< rtl::OUString > aSNS( 1 );
84 aSNS.getArray()[ 0 ] = CHART_TYPE_DIALOG_SERVICE_NAME;
85 return aSNS;
86 }
87 //-------------------------------------------------------------------------
getImplementationId(void)88 uno::Sequence< sal_Int8 > SAL_CALL ChartTypeUnoDlg::getImplementationId( void ) throw( uno::RuntimeException )
89 {
90 static ::cppu::OImplementationId aId;
91 return aId.getImplementationId();
92 }
93 //------------------------------------------------------------------------------
implInitialize(const uno::Any & _rValue)94 void ChartTypeUnoDlg::implInitialize(const uno::Any& _rValue)
95 {
96 beans::PropertyValue aProperty;
97 if (_rValue >>= aProperty)
98 {
99 if (0 == aProperty.Name.compareToAscii("ChartModel"))
100 m_xChartModel.set(aProperty.Value,uno::UNO_QUERY);
101 else
102 ChartTypeUnoDlg_BASE::implInitialize(_rValue);
103 }
104 else
105 ChartTypeUnoDlg_BASE::implInitialize(_rValue);
106 }
107 //------------------------------------------------------------------------------
createDialog(Window * _pParent)108 Dialog* ChartTypeUnoDlg::createDialog(Window* _pParent)
109 {
110 return new ChartTypeDialog( _pParent, m_xChartModel, m_aContext.getUNOContext() );
111 }
112 //-------------------------------------------------------------------------
113 //-------------------------------------------------------------------------
getPropertySetInfo()114 uno::Reference<beans::XPropertySetInfo> SAL_CALL ChartTypeUnoDlg::getPropertySetInfo() throw(uno::RuntimeException)
115 {
116 return createPropertySetInfo( getInfoHelper() );
117 }
118
119 //-------------------------------------------------------------------------
getInfoHelper()120 ::cppu::IPropertyArrayHelper& ChartTypeUnoDlg::getInfoHelper()
121 {
122 return *const_cast<ChartTypeUnoDlg*>(this)->getArrayHelper();
123 }
124
125 //------------------------------------------------------------------------------
createArrayHelper() const126 ::cppu::IPropertyArrayHelper* ChartTypeUnoDlg::createArrayHelper( ) const
127 {
128 uno::Sequence< beans::Property > aProps;
129 describeProperties(aProps);
130 return new ::cppu::OPropertyArrayHelper(aProps);
131 }
132
133 //.............................................................................
134 } //namespace chart
135 //.............................................................................
136