1*cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*cde9e8dcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*cde9e8dcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*cde9e8dcSAndrew Rist  * distributed with this work for additional information
6*cde9e8dcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*cde9e8dcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*cde9e8dcSAndrew Rist  * "License"); you may not use this file except in compliance
9*cde9e8dcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*cde9e8dcSAndrew Rist  *
11*cde9e8dcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*cde9e8dcSAndrew Rist  *
13*cde9e8dcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*cde9e8dcSAndrew Rist  * software distributed under the License is distributed on an
15*cde9e8dcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*cde9e8dcSAndrew Rist  * KIND, either express or implied.  See the License for the
17*cde9e8dcSAndrew Rist  * specific language governing permissions and limitations
18*cde9e8dcSAndrew Rist  * under the License.
19*cde9e8dcSAndrew Rist  *
20*cde9e8dcSAndrew Rist  *************************************************************/
21*cde9e8dcSAndrew Rist 
22*cde9e8dcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "BaseCoordinateSystem.hxx"
28cdf0e10cSrcweir #include "macros.hxx"
29cdf0e10cSrcweir #include "PropertyHelper.hxx"
30cdf0e10cSrcweir #include "UserDefinedProperties.hxx"
31cdf0e10cSrcweir #include "ContainerHelper.hxx"
32cdf0e10cSrcweir #include "CloneHelper.hxx"
33cdf0e10cSrcweir #include "Axis.hxx"
34cdf0e10cSrcweir #include "AxisHelper.hxx"
35cdf0e10cSrcweir #include <com/sun/star/chart2/AxisType.hpp>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <algorithm>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
40cdf0e10cSrcweir #include <rtl/math.hxx>
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir using namespace ::com::sun::star;
45cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
46cdf0e10cSrcweir using ::com::sun::star::uno::Sequence;
47cdf0e10cSrcweir using ::rtl::OUString;
48cdf0e10cSrcweir using ::com::sun::star::beans::Property;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir namespace
51cdf0e10cSrcweir {
52cdf0e10cSrcweir enum
53cdf0e10cSrcweir {
54cdf0e10cSrcweir     PROP_COORDINATESYSTEM_SWAPXANDYAXIS
55cdf0e10cSrcweir };
56cdf0e10cSrcweir 
lcl_AddPropertiesToVector(::std::vector<Property> & rOutProperties)57cdf0e10cSrcweir void lcl_AddPropertiesToVector(
58cdf0e10cSrcweir     ::std::vector< Property > & rOutProperties )
59cdf0e10cSrcweir {
60cdf0e10cSrcweir     rOutProperties.push_back(
61cdf0e10cSrcweir         Property( C2U( "SwapXAndYAxis" ),
62cdf0e10cSrcweir                   PROP_COORDINATESYSTEM_SWAPXANDYAXIS,
63cdf0e10cSrcweir                   ::getBooleanCppuType(),
64cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
65cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID ));
66cdf0e10cSrcweir }
67cdf0e10cSrcweir 
68cdf0e10cSrcweir struct StaticCooSysDefaults_Initializer
69cdf0e10cSrcweir {
operator ()__anon8e8bb0c70111::StaticCooSysDefaults_Initializer70cdf0e10cSrcweir     ::chart::tPropertyValueMap* operator()()
71cdf0e10cSrcweir     {
72cdf0e10cSrcweir         static ::chart::tPropertyValueMap aStaticDefaults;
73cdf0e10cSrcweir         lcl_AddDefaultsToMap( aStaticDefaults );
74cdf0e10cSrcweir         return &aStaticDefaults;
75cdf0e10cSrcweir     }
76cdf0e10cSrcweir private:
lcl_AddDefaultsToMap__anon8e8bb0c70111::StaticCooSysDefaults_Initializer77cdf0e10cSrcweir     void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
78cdf0e10cSrcweir     {
79cdf0e10cSrcweir         ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_COORDINATESYSTEM_SWAPXANDYAXIS, false );
80cdf0e10cSrcweir     }
81cdf0e10cSrcweir };
82cdf0e10cSrcweir 
83cdf0e10cSrcweir struct StaticCooSysDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticCooSysDefaults_Initializer >
84cdf0e10cSrcweir {
85cdf0e10cSrcweir };
86cdf0e10cSrcweir 
87cdf0e10cSrcweir struct StaticCooSysInfoHelper_Initializer
88cdf0e10cSrcweir {
operator ()__anon8e8bb0c70111::StaticCooSysInfoHelper_Initializer89cdf0e10cSrcweir     ::cppu::OPropertyArrayHelper* operator()()
90cdf0e10cSrcweir     {
91cdf0e10cSrcweir         static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
92cdf0e10cSrcweir         return &aPropHelper;
93cdf0e10cSrcweir     }
94cdf0e10cSrcweir 
95cdf0e10cSrcweir private:
lcl_GetPropertySequence__anon8e8bb0c70111::StaticCooSysInfoHelper_Initializer96cdf0e10cSrcweir     Sequence< Property > lcl_GetPropertySequence()
97cdf0e10cSrcweir     {
98cdf0e10cSrcweir         ::std::vector< ::com::sun::star::beans::Property > aProperties;
99cdf0e10cSrcweir         lcl_AddPropertiesToVector( aProperties );
100cdf0e10cSrcweir         ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
101cdf0e10cSrcweir 
102cdf0e10cSrcweir         ::std::sort( aProperties.begin(), aProperties.end(),
103cdf0e10cSrcweir                      ::chart::PropertyNameLess() );
104cdf0e10cSrcweir 
105cdf0e10cSrcweir         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
106cdf0e10cSrcweir     }
107cdf0e10cSrcweir };
108cdf0e10cSrcweir 
109cdf0e10cSrcweir struct StaticCooSysInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticCooSysInfoHelper_Initializer >
110cdf0e10cSrcweir {
111cdf0e10cSrcweir };
112cdf0e10cSrcweir 
113cdf0e10cSrcweir struct StaticCooSysInfo_Initializer
114cdf0e10cSrcweir {
operator ()__anon8e8bb0c70111::StaticCooSysInfo_Initializer115cdf0e10cSrcweir     uno::Reference< beans::XPropertySetInfo >* operator()()
116cdf0e10cSrcweir     {
117cdf0e10cSrcweir         static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
118cdf0e10cSrcweir             ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticCooSysInfoHelper::get() ) );
119cdf0e10cSrcweir         return &xPropertySetInfo;
120cdf0e10cSrcweir     }
121cdf0e10cSrcweir };
122cdf0e10cSrcweir 
123cdf0e10cSrcweir struct StaticCooSysInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticCooSysInfo_Initializer >
124cdf0e10cSrcweir {
125cdf0e10cSrcweir };
126cdf0e10cSrcweir 
127cdf0e10cSrcweir } // anonymous namespace
128cdf0e10cSrcweir 
129cdf0e10cSrcweir namespace chart
130cdf0e10cSrcweir {
131cdf0e10cSrcweir 
BaseCoordinateSystem(const Reference<uno::XComponentContext> & xContext,sal_Int32 nDimensionCount,sal_Bool bSwapXAndYAxis)132cdf0e10cSrcweir BaseCoordinateSystem::BaseCoordinateSystem(
133cdf0e10cSrcweir     const Reference< uno::XComponentContext > & xContext,
134cdf0e10cSrcweir     sal_Int32 nDimensionCount /* = 2 */,
135cdf0e10cSrcweir     sal_Bool bSwapXAndYAxis /* = sal_False */ ) :
136cdf0e10cSrcweir         ::property::OPropertySet( m_aMutex ),
137cdf0e10cSrcweir         m_xContext( xContext ),
138cdf0e10cSrcweir         m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
139cdf0e10cSrcweir         m_nDimensionCount( nDimensionCount )
140cdf0e10cSrcweir  {
141cdf0e10cSrcweir     m_aAllAxis.resize( m_nDimensionCount );
142cdf0e10cSrcweir     for( sal_Int32 nN=0; nN<m_nDimensionCount; nN++ )
143cdf0e10cSrcweir     {
144cdf0e10cSrcweir         m_aAllAxis[nN].resize( 1 );
145cdf0e10cSrcweir         Reference< chart2::XAxis > xAxis( new Axis(m_xContext) );
146cdf0e10cSrcweir         m_aAllAxis[nN][0] = xAxis;
147cdf0e10cSrcweir 
148cdf0e10cSrcweir         ModifyListenerHelper::addListenerToAllElements( m_aAllAxis[nN], m_xModifyEventForwarder );
149cdf0e10cSrcweir         chart2::ScaleData aScaleData( xAxis->getScaleData() );
150cdf0e10cSrcweir         if(nN==0)
151cdf0e10cSrcweir         {
152cdf0e10cSrcweir             aScaleData.AxisType = chart2::AxisType::CATEGORY;
153cdf0e10cSrcweir         }
154cdf0e10cSrcweir         else if( nN==1)
155cdf0e10cSrcweir         {
156cdf0e10cSrcweir             aScaleData.AxisType = chart2::AxisType::REALNUMBER;
157cdf0e10cSrcweir         }
158cdf0e10cSrcweir         else if( nN==2)
159cdf0e10cSrcweir         {
160cdf0e10cSrcweir             aScaleData.AxisType = chart2::AxisType::SERIES;
161cdf0e10cSrcweir         }
162cdf0e10cSrcweir         xAxis->setScaleData( aScaleData );
163cdf0e10cSrcweir     }
164cdf0e10cSrcweir 
165cdf0e10cSrcweir     m_aOrigin.realloc( m_nDimensionCount );
166cdf0e10cSrcweir     for( sal_Int32 i = 0; i < m_nDimensionCount; ++i )
167cdf0e10cSrcweir         m_aOrigin[ i ] = uno::makeAny( double( 0.0 ) );
168cdf0e10cSrcweir 
169cdf0e10cSrcweir     setFastPropertyValue_NoBroadcast( PROP_COORDINATESYSTEM_SWAPXANDYAXIS, uno::makeAny( sal_Bool( bSwapXAndYAxis )));
170cdf0e10cSrcweir }
171cdf0e10cSrcweir 
172cdf0e10cSrcweir // explicit
BaseCoordinateSystem(const BaseCoordinateSystem & rSource)173cdf0e10cSrcweir BaseCoordinateSystem::BaseCoordinateSystem(
174cdf0e10cSrcweir     const BaseCoordinateSystem & rSource ) :
175cdf0e10cSrcweir         impl::BaseCoordinateSystem_Base(),
176cdf0e10cSrcweir         MutexContainer(),
177cdf0e10cSrcweir         ::property::OPropertySet( rSource, m_aMutex ),
178cdf0e10cSrcweir     m_xContext( rSource.m_xContext ),
179cdf0e10cSrcweir     m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
180cdf0e10cSrcweir     m_nDimensionCount( rSource.m_nDimensionCount ),
181cdf0e10cSrcweir     m_aOrigin( rSource.m_aOrigin )
182cdf0e10cSrcweir {
183cdf0e10cSrcweir     m_aAllAxis.resize(rSource.m_aAllAxis.size());
184cdf0e10cSrcweir     tAxisVecVecType::size_type nN=0;
185cdf0e10cSrcweir     for( nN=0; nN<m_aAllAxis.size(); nN++ )
186cdf0e10cSrcweir         CloneHelper::CloneRefVector< Reference< chart2::XAxis > >( rSource.m_aAllAxis[nN], m_aAllAxis[nN] );
187cdf0e10cSrcweir     CloneHelper::CloneRefVector< Reference< chart2::XChartType > >( rSource.m_aChartTypes, m_aChartTypes );
188cdf0e10cSrcweir 
189cdf0e10cSrcweir     for( nN=0; nN<m_aAllAxis.size(); nN++ )
190cdf0e10cSrcweir         ModifyListenerHelper::addListenerToAllElements( m_aAllAxis[nN], m_xModifyEventForwarder );
191cdf0e10cSrcweir     ModifyListenerHelper::addListenerToAllElements( m_aChartTypes, m_xModifyEventForwarder );
192cdf0e10cSrcweir }
193cdf0e10cSrcweir 
~BaseCoordinateSystem()194cdf0e10cSrcweir BaseCoordinateSystem::~BaseCoordinateSystem()
195cdf0e10cSrcweir {
196cdf0e10cSrcweir     try
197cdf0e10cSrcweir     {
198cdf0e10cSrcweir         for( tAxisVecVecType::size_type nN=0; nN<m_aAllAxis.size(); nN++ )
199cdf0e10cSrcweir             ModifyListenerHelper::removeListenerFromAllElements( m_aAllAxis[nN], m_xModifyEventForwarder );
200cdf0e10cSrcweir         ModifyListenerHelper::removeListenerFromAllElements( m_aChartTypes, m_xModifyEventForwarder );
201cdf0e10cSrcweir     }
202cdf0e10cSrcweir     catch( const uno::Exception & ex )
203cdf0e10cSrcweir     {
204cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
205cdf0e10cSrcweir     }
206cdf0e10cSrcweir }
207cdf0e10cSrcweir 
208cdf0e10cSrcweir // ____ XCoordinateSystem ____
getDimension()209cdf0e10cSrcweir sal_Int32 SAL_CALL BaseCoordinateSystem::getDimension()
210cdf0e10cSrcweir     throw (uno::RuntimeException)
211cdf0e10cSrcweir {
212cdf0e10cSrcweir     return m_nDimensionCount;
213cdf0e10cSrcweir }
214cdf0e10cSrcweir 
setAxisByDimension(sal_Int32 nDimensionIndex,const Reference<chart2::XAxis> & xAxis,sal_Int32 nIndex)215cdf0e10cSrcweir void SAL_CALL BaseCoordinateSystem::setAxisByDimension(
216cdf0e10cSrcweir     sal_Int32 nDimensionIndex,
217cdf0e10cSrcweir     const Reference< chart2::XAxis >& xAxis,
218cdf0e10cSrcweir     sal_Int32 nIndex )
219cdf0e10cSrcweir     throw (lang::IndexOutOfBoundsException,
220cdf0e10cSrcweir            uno::RuntimeException)
221cdf0e10cSrcweir {
222cdf0e10cSrcweir     if( nDimensionIndex < 0 || nDimensionIndex >= getDimension() )
223cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
224cdf0e10cSrcweir 
225cdf0e10cSrcweir     if( nIndex < 0 )
226cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
227cdf0e10cSrcweir 
228cdf0e10cSrcweir     if( m_aAllAxis[ nDimensionIndex ].size() < static_cast< tAxisVecVecType::size_type >( nIndex+1 ))
229cdf0e10cSrcweir     {
230cdf0e10cSrcweir         m_aAllAxis[ nDimensionIndex ].resize( nIndex+1 );
231cdf0e10cSrcweir         m_aAllAxis[ nDimensionIndex ][nIndex] = 0;
232cdf0e10cSrcweir     }
233cdf0e10cSrcweir 
234cdf0e10cSrcweir     Reference< chart2::XAxis > xOldAxis( m_aAllAxis[ nDimensionIndex ][nIndex] );
235cdf0e10cSrcweir     if( xOldAxis.is())
236cdf0e10cSrcweir         ModifyListenerHelper::removeListener( xOldAxis, m_xModifyEventForwarder );
237cdf0e10cSrcweir     m_aAllAxis[ nDimensionIndex ][nIndex] = xAxis;
238cdf0e10cSrcweir     if( xAxis.is())
239cdf0e10cSrcweir         ModifyListenerHelper::addListener( xAxis, m_xModifyEventForwarder );
240cdf0e10cSrcweir     fireModifyEvent();
241cdf0e10cSrcweir }
242cdf0e10cSrcweir 
getAxisByDimension(sal_Int32 nDimensionIndex,sal_Int32 nAxisIndex)243cdf0e10cSrcweir Reference< chart2::XAxis > SAL_CALL BaseCoordinateSystem::getAxisByDimension(
244cdf0e10cSrcweir             sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
245cdf0e10cSrcweir     throw (lang::IndexOutOfBoundsException,
246cdf0e10cSrcweir            uno::RuntimeException)
247cdf0e10cSrcweir {
248cdf0e10cSrcweir     if( nDimensionIndex < 0 || nDimensionIndex >= getDimension() )
249cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
250cdf0e10cSrcweir 
251cdf0e10cSrcweir     OSL_ASSERT( m_aAllAxis.size() == static_cast< size_t >( getDimension()));
252cdf0e10cSrcweir 
253cdf0e10cSrcweir     if( nAxisIndex < 0 || nAxisIndex > this->getMaximumAxisIndexByDimension(nDimensionIndex) )
254cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
255cdf0e10cSrcweir 
256cdf0e10cSrcweir     return m_aAllAxis[ nDimensionIndex ][nAxisIndex];
257cdf0e10cSrcweir }
258cdf0e10cSrcweir 
getMaximumAxisIndexByDimension(sal_Int32 nDimensionIndex)259cdf0e10cSrcweir sal_Int32 SAL_CALL BaseCoordinateSystem::getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex )
260cdf0e10cSrcweir         throw (lang::IndexOutOfBoundsException,
261cdf0e10cSrcweir            uno::RuntimeException)
262cdf0e10cSrcweir {
263cdf0e10cSrcweir     if( nDimensionIndex < 0 || nDimensionIndex >= getDimension() )
264cdf0e10cSrcweir         throw lang::IndexOutOfBoundsException();
265cdf0e10cSrcweir 
266cdf0e10cSrcweir     OSL_ASSERT( m_aAllAxis.size() == static_cast< size_t >( getDimension()));
267cdf0e10cSrcweir 
268cdf0e10cSrcweir     sal_Int32 nRet = m_aAllAxis[ nDimensionIndex ].size();
269cdf0e10cSrcweir     if(nRet)
270cdf0e10cSrcweir         nRet-=1;
271cdf0e10cSrcweir 
272cdf0e10cSrcweir     return nRet;
273cdf0e10cSrcweir }
274cdf0e10cSrcweir 
275cdf0e10cSrcweir // ____ XChartTypeContainer ____
addChartType(const Reference<chart2::XChartType> & aChartType)276cdf0e10cSrcweir void SAL_CALL BaseCoordinateSystem::addChartType( const Reference< chart2::XChartType >& aChartType )
277cdf0e10cSrcweir     throw (lang::IllegalArgumentException,
278cdf0e10cSrcweir            uno::RuntimeException)
279cdf0e10cSrcweir {
280cdf0e10cSrcweir     if( ::std::find( m_aChartTypes.begin(), m_aChartTypes.end(), aChartType )
281cdf0e10cSrcweir         != m_aChartTypes.end())
282cdf0e10cSrcweir         throw lang::IllegalArgumentException();
283cdf0e10cSrcweir 
284cdf0e10cSrcweir     m_aChartTypes.push_back( aChartType );
285cdf0e10cSrcweir     ModifyListenerHelper::addListener( aChartType, m_xModifyEventForwarder );
286cdf0e10cSrcweir     fireModifyEvent();
287cdf0e10cSrcweir }
288cdf0e10cSrcweir 
removeChartType(const Reference<chart2::XChartType> & aChartType)289cdf0e10cSrcweir void SAL_CALL BaseCoordinateSystem::removeChartType( const Reference< chart2::XChartType >& aChartType )
290cdf0e10cSrcweir     throw (container::NoSuchElementException,
291cdf0e10cSrcweir            uno::RuntimeException)
292cdf0e10cSrcweir {
293cdf0e10cSrcweir     ::std::vector< uno::Reference< chart2::XChartType > >::iterator
294cdf0e10cSrcweir           aIt( ::std::find( m_aChartTypes.begin(), m_aChartTypes.end(), aChartType ));
295cdf0e10cSrcweir     if( aIt == m_aChartTypes.end())
296cdf0e10cSrcweir         throw container::NoSuchElementException(
297cdf0e10cSrcweir             C2U( "The given chart type is no element of the container" ),
298cdf0e10cSrcweir             static_cast< uno::XWeak * >( this ));
299cdf0e10cSrcweir 
300cdf0e10cSrcweir     m_aChartTypes.erase( aIt );
301cdf0e10cSrcweir     ModifyListenerHelper::removeListener( aChartType, m_xModifyEventForwarder );
302cdf0e10cSrcweir     fireModifyEvent();
303cdf0e10cSrcweir }
304cdf0e10cSrcweir 
getChartTypes()305cdf0e10cSrcweir Sequence< Reference< chart2::XChartType > > SAL_CALL BaseCoordinateSystem::getChartTypes()
306cdf0e10cSrcweir     throw (uno::RuntimeException)
307cdf0e10cSrcweir {
308cdf0e10cSrcweir     return ContainerHelper::ContainerToSequence( m_aChartTypes );
309cdf0e10cSrcweir }
310cdf0e10cSrcweir 
setChartTypes(const Sequence<Reference<chart2::XChartType>> & aChartTypes)311cdf0e10cSrcweir void SAL_CALL BaseCoordinateSystem::setChartTypes( const Sequence< Reference< chart2::XChartType > >& aChartTypes )
312cdf0e10cSrcweir     throw (lang::IllegalArgumentException,
313cdf0e10cSrcweir            uno::RuntimeException)
314cdf0e10cSrcweir {
315cdf0e10cSrcweir     ModifyListenerHelper::removeListenerFromAllElements( m_aChartTypes, m_xModifyEventForwarder );
316cdf0e10cSrcweir     m_aChartTypes = ContainerHelper::SequenceToVector( aChartTypes );
317cdf0e10cSrcweir     ModifyListenerHelper::addListenerToAllElements( m_aChartTypes, m_xModifyEventForwarder );
318cdf0e10cSrcweir     fireModifyEvent();
319cdf0e10cSrcweir }
320cdf0e10cSrcweir 
321cdf0e10cSrcweir // ____ XModifyBroadcaster ____
addModifyListener(const Reference<util::XModifyListener> & aListener)322cdf0e10cSrcweir void SAL_CALL BaseCoordinateSystem::addModifyListener( const Reference< util::XModifyListener >& aListener )
323cdf0e10cSrcweir     throw (uno::RuntimeException)
324cdf0e10cSrcweir {
325cdf0e10cSrcweir     try
326cdf0e10cSrcweir     {
327cdf0e10cSrcweir         Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
328cdf0e10cSrcweir         xBroadcaster->addModifyListener( aListener );
329cdf0e10cSrcweir     }
330cdf0e10cSrcweir     catch( const uno::Exception & ex )
331cdf0e10cSrcweir     {
332cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
333cdf0e10cSrcweir     }
334cdf0e10cSrcweir }
335cdf0e10cSrcweir 
removeModifyListener(const Reference<util::XModifyListener> & aListener)336cdf0e10cSrcweir void SAL_CALL BaseCoordinateSystem::removeModifyListener( const Reference< util::XModifyListener >& aListener )
337cdf0e10cSrcweir     throw (uno::RuntimeException)
338cdf0e10cSrcweir {
339cdf0e10cSrcweir     try
340cdf0e10cSrcweir     {
341cdf0e10cSrcweir         Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
342cdf0e10cSrcweir         xBroadcaster->removeModifyListener( aListener );
343cdf0e10cSrcweir     }
344cdf0e10cSrcweir     catch( const uno::Exception & ex )
345cdf0e10cSrcweir     {
346cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
347cdf0e10cSrcweir     }
348cdf0e10cSrcweir }
349cdf0e10cSrcweir 
350cdf0e10cSrcweir // ____ XModifyListener ____
modified(const lang::EventObject & aEvent)351cdf0e10cSrcweir void SAL_CALL BaseCoordinateSystem::modified( const lang::EventObject& aEvent )
352cdf0e10cSrcweir     throw (uno::RuntimeException)
353cdf0e10cSrcweir {
354cdf0e10cSrcweir     m_xModifyEventForwarder->modified( aEvent );
355cdf0e10cSrcweir }
356cdf0e10cSrcweir 
357cdf0e10cSrcweir // ____ XEventListener (base of XModifyListener) ____
disposing(const lang::EventObject &)358cdf0e10cSrcweir void SAL_CALL BaseCoordinateSystem::disposing( const lang::EventObject& /* Source */ )
359cdf0e10cSrcweir     throw (uno::RuntimeException)
360cdf0e10cSrcweir {
361cdf0e10cSrcweir     // nothing
362cdf0e10cSrcweir }
363cdf0e10cSrcweir 
364cdf0e10cSrcweir // ____ OPropertySet ____
firePropertyChangeEvent()365cdf0e10cSrcweir void BaseCoordinateSystem::firePropertyChangeEvent()
366cdf0e10cSrcweir {
367cdf0e10cSrcweir     fireModifyEvent();
368cdf0e10cSrcweir }
369cdf0e10cSrcweir 
fireModifyEvent()370cdf0e10cSrcweir void BaseCoordinateSystem::fireModifyEvent()
371cdf0e10cSrcweir {
372cdf0e10cSrcweir     m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
373cdf0e10cSrcweir }
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 
376cdf0e10cSrcweir // ____ OPropertySet ____
GetDefaultValue(sal_Int32 nHandle) const377cdf0e10cSrcweir uno::Any BaseCoordinateSystem::GetDefaultValue( sal_Int32 nHandle ) const
378cdf0e10cSrcweir     throw(beans::UnknownPropertyException)
379cdf0e10cSrcweir {
380cdf0e10cSrcweir     const tPropertyValueMap& rStaticDefaults = *StaticCooSysDefaults::get();
381cdf0e10cSrcweir     tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
382cdf0e10cSrcweir     if( aFound == rStaticDefaults.end() )
383cdf0e10cSrcweir         return uno::Any();
384cdf0e10cSrcweir     return (*aFound).second;
385cdf0e10cSrcweir }
386cdf0e10cSrcweir 
387cdf0e10cSrcweir // ____ OPropertySet ____
getInfoHelper()388cdf0e10cSrcweir ::cppu::IPropertyArrayHelper & SAL_CALL BaseCoordinateSystem::getInfoHelper()
389cdf0e10cSrcweir {
390cdf0e10cSrcweir     return *StaticCooSysInfoHelper::get();
391cdf0e10cSrcweir }
392cdf0e10cSrcweir 
393cdf0e10cSrcweir 
394cdf0e10cSrcweir // ____ XPropertySet ____
getPropertySetInfo()395cdf0e10cSrcweir Reference< beans::XPropertySetInfo > SAL_CALL BaseCoordinateSystem::getPropertySetInfo()
396cdf0e10cSrcweir     throw (uno::RuntimeException)
397cdf0e10cSrcweir {
398cdf0e10cSrcweir     return *StaticCooSysInfo::get();
399cdf0e10cSrcweir }
400cdf0e10cSrcweir 
401cdf0e10cSrcweir using impl::BaseCoordinateSystem_Base;
402cdf0e10cSrcweir 
403cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE2( BaseCoordinateSystem, BaseCoordinateSystem_Base, ::property::OPropertySet )
404cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER2( BaseCoordinateSystem, BaseCoordinateSystem_Base, ::property::OPropertySet )
405cdf0e10cSrcweir 
406cdf0e10cSrcweir } //  namespace chart
407