merged tag ooo/OOO330_m14
[LibreOffice.git] / chart2 / source / model / main / Axis.cxx
blobfd1d78ebe0712a6dc79917036db257b32dc3e2ea
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
30 #include "Axis.hxx"
31 #include "GridProperties.hxx"
32 #include "macros.hxx"
33 #include "CharacterProperties.hxx"
34 #include "LineProperties.hxx"
35 #include "UserDefinedProperties.hxx"
36 #include "PropertyHelper.hxx"
37 #include "ContainerHelper.hxx"
38 #include "CloneHelper.hxx"
39 #include "AxisHelper.hxx"
40 #include "EventListenerHelper.hxx"
41 #include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
42 #include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
43 #include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
44 #include <com/sun/star/chart/ChartAxisPosition.hpp>
45 #include <com/sun/star/chart2/AxisType.hpp>
46 #include <com/sun/star/beans/PropertyAttribute.hpp>
47 #include <com/sun/star/lang/Locale.hpp>
48 #include <com/sun/star/drawing/LineStyle.hpp>
49 #include <com/sun/star/drawing/LineDash.hpp>
50 #include <com/sun/star/drawing/LineJoint.hpp>
51 #include <com/sun/star/awt/Size.hpp>
52 #include <rtl/uuid.h>
53 #include <cppuhelper/queryinterface.hxx>
55 #include <vector>
56 #include <algorithm>
58 using namespace ::com::sun::star;
59 using namespace ::com::sun::star::beans::PropertyAttribute;
61 using ::rtl::OUString;
62 using ::com::sun::star::uno::Sequence;
63 using ::com::sun::star::uno::Reference;
64 using ::com::sun::star::uno::Any;
65 using ::com::sun::star::beans::Property;
66 using ::osl::MutexGuard;
68 namespace
71 static const OUString lcl_aServiceName(
72 RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.Axis" ));
74 enum
76 PROP_AXIS_SHOW,
77 PROP_AXIS_CROSSOVER_POSITION,
78 PROP_AXIS_CROSSOVER_VALUE,
79 PROP_AXIS_DISPLAY_LABELS,
80 PROP_AXIS_NUMBER_FORMAT,
81 PROP_AXIS_LABEL_POSITION,
82 PROP_AXIS_TEXT_ROTATION,
83 PROP_AXIS_TEXT_BREAK,
84 PROP_AXIS_TEXT_OVERLAP,
85 PROP_AXIS_TEXT_STACKED,
86 PROP_AXIS_TEXT_ARRANGE_ORDER,
87 PROP_AXIS_REFERENCE_DIAGRAM_SIZE,
89 PROP_AXIS_MAJOR_TICKMARKS,
90 PROP_AXIS_MINOR_TICKMARKS,
91 PROP_AXIS_MARK_POSITION
94 void lcl_AddPropertiesToVector(
95 ::std::vector< Property > & rOutProperties )
97 rOutProperties.push_back(
98 Property( C2U( "Show" ),
99 PROP_AXIS_SHOW,
100 ::getBooleanCppuType(),
101 beans::PropertyAttribute::BOUND
102 | beans::PropertyAttribute::MAYBEDEFAULT ));
104 rOutProperties.push_back(
105 Property( C2U( "CrossoverPosition" ),
106 PROP_AXIS_CROSSOVER_POSITION,
107 ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisPosition * >(0)),
108 beans::PropertyAttribute::MAYBEDEFAULT ));
110 rOutProperties.push_back(
111 Property( C2U( "CrossoverValue" ),
112 PROP_AXIS_CROSSOVER_VALUE,
113 ::getCppuType( reinterpret_cast< const double * >(0)),
114 beans::PropertyAttribute::MAYBEVOID ));
116 rOutProperties.push_back(
117 Property( C2U( "DisplayLabels" ),
118 PROP_AXIS_DISPLAY_LABELS,
119 ::getBooleanCppuType(),
120 beans::PropertyAttribute::BOUND
121 | beans::PropertyAttribute::MAYBEDEFAULT ));
123 rOutProperties.push_back(
124 Property( C2U( "NumberFormat" ),
125 PROP_AXIS_NUMBER_FORMAT,
126 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
127 beans::PropertyAttribute::BOUND
128 | beans::PropertyAttribute::MAYBEVOID ));
130 rOutProperties.push_back(
131 Property( C2U( "LabelPosition" ),
132 PROP_AXIS_LABEL_POSITION,
133 ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisLabelPosition * >(0)),
134 beans::PropertyAttribute::MAYBEDEFAULT ));
136 rOutProperties.push_back(
137 Property( C2U( "TextRotation" ),
138 PROP_AXIS_TEXT_ROTATION,
139 ::getCppuType( reinterpret_cast< const double * >(0)),
140 beans::PropertyAttribute::BOUND
141 | beans::PropertyAttribute::MAYBEDEFAULT ));
143 rOutProperties.push_back(
144 Property( C2U( "TextBreak" ),
145 PROP_AXIS_TEXT_BREAK,
146 ::getBooleanCppuType(),
147 beans::PropertyAttribute::BOUND
148 | beans::PropertyAttribute::MAYBEDEFAULT ));
150 rOutProperties.push_back(
151 Property( C2U( "TextOverlap" ),
152 PROP_AXIS_TEXT_OVERLAP,
153 ::getBooleanCppuType(),
154 beans::PropertyAttribute::BOUND
155 | beans::PropertyAttribute::MAYBEDEFAULT ));
157 rOutProperties.push_back(
158 Property( C2U( "StackCharacters" ),
159 PROP_AXIS_TEXT_STACKED,
160 ::getBooleanCppuType(),
161 beans::PropertyAttribute::BOUND
162 | beans::PropertyAttribute::MAYBEDEFAULT ));
164 rOutProperties.push_back(
165 Property( C2U( "ArrangeOrder" ),
166 PROP_AXIS_TEXT_ARRANGE_ORDER,
167 ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisArrangeOrderType * >(0)),
168 beans::PropertyAttribute::BOUND
169 | beans::PropertyAttribute::MAYBEDEFAULT ));
171 rOutProperties.push_back(
172 Property( C2U( "ReferencePageSize" ),
173 PROP_AXIS_REFERENCE_DIAGRAM_SIZE,
174 ::getCppuType( reinterpret_cast< const awt::Size * >(0)),
175 beans::PropertyAttribute::BOUND
176 | beans::PropertyAttribute::MAYBEVOID ));
178 rOutProperties.push_back(
179 Property( C2U( "MajorTickmarks" ),
180 PROP_AXIS_MAJOR_TICKMARKS,
181 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
182 beans::PropertyAttribute::BOUND
183 | beans::PropertyAttribute::MAYBEDEFAULT ));
184 rOutProperties.push_back(
185 Property( C2U( "MinorTickmarks" ),
186 PROP_AXIS_MINOR_TICKMARKS,
187 ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
188 beans::PropertyAttribute::BOUND
189 | beans::PropertyAttribute::MAYBEDEFAULT ));
190 rOutProperties.push_back(
191 Property( C2U( "MarkPosition" ),
192 PROP_AXIS_MARK_POSITION,
193 ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisMarkPosition * >(0)),
194 beans::PropertyAttribute::MAYBEDEFAULT ));
197 void lcl_AddDefaultsToMap(
198 ::chart::tPropertyValueMap & rOutMap )
200 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_SHOW, true );
201 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_CROSSOVER_POSITION, ::com::sun::star::chart::ChartAxisPosition_ZERO );
202 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_DISPLAY_LABELS, true );
203 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LABEL_POSITION, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS );
204 ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_AXIS_TEXT_ROTATION, 0.0 );
205 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_BREAK, false );
206 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_OVERLAP, false );
207 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_STACKED, false );
208 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_ARRANGE_ORDER, ::com::sun::star::chart::ChartAxisArrangeOrderType_AUTO );
210 float fDefaultCharHeight = 10.0;
211 ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
212 ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
213 ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
215 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AXIS_MAJOR_TICKMARKS, 2 /* CHAXIS_MARK_OUTER */ );
216 ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AXIS_MINOR_TICKMARKS, 0 /* CHAXIS_MARK_NONE */ );
217 ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_MARK_POSITION, ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
220 const Sequence< Property > & lcl_GetPropertySequence()
222 static Sequence< Property > aPropSeq;
224 // /--
225 MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
226 if( 0 == aPropSeq.getLength() )
228 // get properties
229 ::std::vector< ::com::sun::star::beans::Property > aProperties;
230 lcl_AddPropertiesToVector( aProperties );
231 ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
232 ::chart::LineProperties::AddPropertiesToVector( aProperties );
233 ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
235 // and sort them for access via bsearch
236 ::std::sort( aProperties.begin(), aProperties.end(),
237 ::chart::PropertyNameLess() );
239 // transfer result to static Sequence
240 aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
243 return aPropSeq;
246 ::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
248 static ::cppu::OPropertyArrayHelper aArrayHelper(
249 lcl_GetPropertySequence(),
250 /* bSorted = */ sal_True );
252 return aArrayHelper;
255 typedef uno::Reference< beans::XPropertySet > lcl_tSubGridType;
256 typedef uno::Sequence< lcl_tSubGridType > lcl_tSubGridSeq;
258 void lcl_CloneSubGrids(
259 const lcl_tSubGridSeq & rSource, lcl_tSubGridSeq & rDestination )
261 const lcl_tSubGridType * pBegin = rSource.getConstArray();
262 const lcl_tSubGridType * pEnd = pBegin + rSource.getLength();
264 rDestination.realloc( rSource.getLength());
265 lcl_tSubGridType * pDestBegin = rDestination.getArray();
266 lcl_tSubGridType * pDestEnd = pDestBegin + rDestination.getLength();
267 lcl_tSubGridType * pDestIt = pDestBegin;
269 for( const lcl_tSubGridType * pIt = pBegin; pIt != pEnd; ++pIt )
271 Reference< beans::XPropertySet > xSubGrid( *pIt );
272 if( xSubGrid.is())
274 Reference< util::XCloneable > xCloneable( xSubGrid, uno::UNO_QUERY );
275 if( xCloneable.is())
276 xSubGrid.set( xCloneable->createClone(), uno::UNO_QUERY );
279 (*pDestIt) = xSubGrid;
280 OSL_ASSERT( pDestIt != pDestEnd );
281 ++pDestIt;
283 OSL_ASSERT( pDestIt == pDestEnd );
284 (void)(pDestEnd); // avoid warning
287 } // anonymous namespace
289 // ================================================================================
291 namespace chart
294 Axis::Axis( Reference< uno::XComponentContext > const & /* xContext */ ) :
295 ::property::OPropertySet( m_aMutex ),
296 m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
297 m_aScaleData( AxisHelper::createDefaultScale() ),
298 m_xGrid( new GridProperties() ),
299 m_aSubGridProperties(),
300 m_xTitle()
302 osl_incrementInterlockedCount(&m_refCount);
303 setFastPropertyValue_NoBroadcast(
304 ::chart::LineProperties::PROP_LINE_COLOR, uno::makeAny( static_cast< sal_Int32 >( 0xb3b3b3 ) ) ); // gray30
306 if( m_xGrid.is())
307 ModifyListenerHelper::addListener( m_xGrid, m_xModifyEventForwarder );
308 if( m_aScaleData.Categories.is())
309 ModifyListenerHelper::addListener( m_aScaleData.Categories, m_xModifyEventForwarder );
311 AllocateSubGrids();
312 osl_decrementInterlockedCount(&m_refCount);
315 Axis::Axis( const Axis & rOther ) :
316 MutexContainer(),
317 impl::Axis_Base(),
318 ::property::OPropertySet( rOther, m_aMutex ),
319 m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder()),
320 m_aScaleData( rOther.m_aScaleData )
322 m_xGrid.set( CloneHelper::CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xGrid ));
323 if( m_xGrid.is())
324 ModifyListenerHelper::addListener( m_xGrid, m_xModifyEventForwarder );
326 if( m_aScaleData.Categories.is())
327 ModifyListenerHelper::addListener( m_aScaleData.Categories, m_xModifyEventForwarder );
329 if( rOther.m_aSubGridProperties.getLength() != 0 )
330 lcl_CloneSubGrids( rOther.m_aSubGridProperties, m_aSubGridProperties );
331 ModifyListenerHelper::addListenerToAllSequenceElements( m_aSubGridProperties, m_xModifyEventForwarder );
333 m_xTitle.set( CloneHelper::CreateRefClone< Reference< chart2::XTitle > >()( rOther.m_xTitle ));
334 if( m_xTitle.is())
335 ModifyListenerHelper::addListener( m_xTitle, m_xModifyEventForwarder );
338 // late initialization to call after copy-constructing
339 void Axis::Init( const Axis & /* rOther */ )
341 if( m_aScaleData.Categories.is())
342 EventListenerHelper::addListener( m_aScaleData.Categories, this );
345 Axis::~Axis()
349 ModifyListenerHelper::removeListener( m_xGrid, m_xModifyEventForwarder );
350 ModifyListenerHelper::removeListenerFromAllSequenceElements( m_aSubGridProperties, m_xModifyEventForwarder );
351 ModifyListenerHelper::removeListener( m_xTitle, m_xModifyEventForwarder );
352 if( m_aScaleData.Categories.is())
354 ModifyListenerHelper::removeListener( m_aScaleData.Categories, m_xModifyEventForwarder );
355 m_aScaleData.Categories.set(0);
358 catch( const uno::Exception & ex )
360 ASSERT_EXCEPTION( ex );
363 m_aSubGridProperties.realloc(0);
364 m_xGrid = 0;
365 m_xTitle = 0;
368 void Axis::AllocateSubGrids()
370 Reference< util::XModifyListener > xModifyEventForwarder;
371 Reference< lang::XEventListener > xEventListener;
372 std::vector< Reference< beans::XPropertySet > > aOldBroadcasters;
373 std::vector< Reference< beans::XPropertySet > > aNewBroadcasters;
375 MutexGuard aGuard( m_aMutex );
376 xModifyEventForwarder = m_xModifyEventForwarder;
377 xEventListener = this;
379 sal_Int32 nNewSubIncCount = m_aScaleData.IncrementData.SubIncrements.getLength();
380 sal_Int32 nOldSubIncCount = m_aSubGridProperties.getLength();
382 if( nOldSubIncCount > nNewSubIncCount )
384 // remove superfluous entries
385 for( sal_Int32 i = nNewSubIncCount; i < nOldSubIncCount; ++i )
386 aOldBroadcasters.push_back( m_aSubGridProperties[ i ] );
387 m_aSubGridProperties.realloc( nNewSubIncCount );
389 else if( nOldSubIncCount < nNewSubIncCount )
391 m_aSubGridProperties.realloc( nNewSubIncCount );
393 // allocate new entries
394 for( sal_Int32 i = nOldSubIncCount; i < nNewSubIncCount; ++i )
396 m_aSubGridProperties[ i ] = new GridProperties();
397 LineProperties::SetLineInvisible( m_aSubGridProperties[ i ] );
398 aNewBroadcasters.push_back( m_aSubGridProperties[ i ] );
402 //don't keep the mutex locked while calling out
403 std::vector< Reference< beans::XPropertySet > >::iterator aBroadcaster = aOldBroadcasters.begin();
404 for( ;aBroadcaster != aOldBroadcasters.end(); ++aBroadcaster )
405 ModifyListenerHelper::removeListener( *aBroadcaster, xModifyEventForwarder );
406 for( aBroadcaster = aNewBroadcasters.begin(); aBroadcaster != aNewBroadcasters.end(); ++aBroadcaster )
407 ModifyListenerHelper::addListener( *aBroadcaster, xModifyEventForwarder );
410 // --------------------------------------------------------------------------------
412 // ____ XAxis ____
413 void SAL_CALL Axis::setScaleData( const chart2::ScaleData& rScaleData )
414 throw (uno::RuntimeException)
416 Reference< util::XModifyListener > xModifyEventForwarder;
417 Reference< lang::XEventListener > xEventListener;
418 Reference< chart2::data::XLabeledDataSequence > xOldCategories;
419 Reference< chart2::data::XLabeledDataSequence > xNewCategories = rScaleData.Categories;
421 MutexGuard aGuard( m_aMutex );
422 xModifyEventForwarder = m_xModifyEventForwarder;
423 xEventListener = this;
424 xOldCategories = m_aScaleData.Categories;
425 m_aScaleData = rScaleData;
427 AllocateSubGrids();
429 //don't keep the mutex locked while calling out
430 if( xOldCategories.is() && xOldCategories != xNewCategories )
432 ModifyListenerHelper::removeListener( xOldCategories, xModifyEventForwarder );
433 EventListenerHelper::removeListener( xOldCategories, xEventListener );
435 if( xNewCategories.is() && xOldCategories != xNewCategories )
437 ModifyListenerHelper::addListener( xNewCategories, m_xModifyEventForwarder );
438 EventListenerHelper::addListener( xNewCategories, xEventListener );
440 fireModifyEvent();
443 chart2::ScaleData SAL_CALL Axis::getScaleData()
444 throw (uno::RuntimeException)
446 // /--
447 MutexGuard aGuard( m_aMutex );
448 return m_aScaleData;
449 // \--
452 Reference< beans::XPropertySet > SAL_CALL Axis::getGridProperties()
453 throw (uno::RuntimeException)
455 // /--
456 MutexGuard aGuard( m_aMutex );
457 return m_xGrid;
458 // \--
460 Sequence< Reference< beans::XPropertySet > > SAL_CALL Axis::getSubGridProperties()
461 throw (uno::RuntimeException)
463 // /--
464 MutexGuard aGuard( m_aMutex );
465 return m_aSubGridProperties;
466 // \--
469 Sequence< Reference< beans::XPropertySet > > SAL_CALL Axis::getSubTickProperties()
470 throw (uno::RuntimeException)
472 OSL_ENSURE( false, "Not implemented yet" );
473 return Sequence< Reference< beans::XPropertySet > >();
477 // ____ XTitled ____
478 Reference< chart2::XTitle > SAL_CALL Axis::getTitleObject()
479 throw (uno::RuntimeException)
481 // /--
482 MutexGuard aGuard( GetMutex() );
483 return m_xTitle;
484 // \--
487 void SAL_CALL Axis::setTitleObject( const Reference< chart2::XTitle >& xNewTitle )
488 throw (uno::RuntimeException)
490 Reference< util::XModifyListener > xModifyEventForwarder;
491 Reference< chart2::XTitle > xOldTitle;
493 MutexGuard aGuard( GetMutex() );
494 xOldTitle = m_xTitle;
495 xModifyEventForwarder = m_xModifyEventForwarder;
496 m_xTitle = xNewTitle;
499 //don't keep the mutex locked while calling out
500 if( xOldTitle.is() && xOldTitle != xNewTitle )
501 ModifyListenerHelper::removeListener( xOldTitle, xModifyEventForwarder );
502 if( xNewTitle.is() && xOldTitle != xNewTitle )
503 ModifyListenerHelper::addListener( xNewTitle, xModifyEventForwarder );
504 fireModifyEvent();
507 // ____ XCloneable ____
508 Reference< util::XCloneable > SAL_CALL Axis::createClone()
509 throw (uno::RuntimeException)
511 Axis * pNewAxis( new Axis( *this ));
512 // hold a reference to the clone
513 Reference< util::XCloneable > xResult( pNewAxis );
514 // do initialization that uses uno references to the clone
515 pNewAxis->Init( *this );
516 return xResult;
519 // ____ XModifyBroadcaster ____
520 void SAL_CALL Axis::addModifyListener( const Reference< util::XModifyListener >& aListener )
521 throw (uno::RuntimeException)
525 Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
526 xBroadcaster->addModifyListener( aListener );
528 catch( const uno::Exception & ex )
530 ASSERT_EXCEPTION( ex );
534 void SAL_CALL Axis::removeModifyListener( const Reference< util::XModifyListener >& aListener )
535 throw (uno::RuntimeException)
539 Reference< util::XModifyBroadcaster > xBroadcaster( m_xModifyEventForwarder, uno::UNO_QUERY_THROW );
540 xBroadcaster->removeModifyListener( aListener );
542 catch( const uno::Exception & ex )
544 ASSERT_EXCEPTION( ex );
548 // ____ XModifyListener ____
549 void SAL_CALL Axis::modified( const lang::EventObject& aEvent )
550 throw (uno::RuntimeException)
552 m_xModifyEventForwarder->modified( aEvent );
555 // ____ XEventListener (base of XModifyListener) ____
556 void SAL_CALL Axis::disposing( const lang::EventObject& Source )
557 throw (uno::RuntimeException)
559 if( Source.Source == m_aScaleData.Categories )
560 m_aScaleData.Categories = 0;
563 // ____ OPropertySet ____
564 void Axis::firePropertyChangeEvent()
566 fireModifyEvent();
569 void Axis::fireModifyEvent()
571 m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
574 // ================================================================================
576 // ____ OPropertySet ____
577 uno::Any Axis::GetDefaultValue( sal_Int32 nHandle ) const
578 throw(beans::UnknownPropertyException)
580 static tPropertyValueMap aStaticDefaults;
582 // /--
583 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
584 if( 0 == aStaticDefaults.size() )
586 CharacterProperties::AddDefaultsToMap( aStaticDefaults );
587 LineProperties::AddDefaultsToMap( aStaticDefaults );
589 // initialize defaults
590 lcl_AddDefaultsToMap( aStaticDefaults );
593 tPropertyValueMap::const_iterator aFound(
594 aStaticDefaults.find( nHandle ));
596 if( aFound == aStaticDefaults.end())
597 return uno::Any();
599 return (*aFound).second;
600 // \--
603 ::cppu::IPropertyArrayHelper & SAL_CALL Axis::getInfoHelper()
605 return lcl_getInfoHelper();
609 // ____ XPropertySet ____
610 Reference< beans::XPropertySetInfo > SAL_CALL
611 Axis::getPropertySetInfo()
612 throw (uno::RuntimeException)
614 static Reference< beans::XPropertySetInfo > xInfo;
616 // /--
617 MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
618 if( !xInfo.is())
620 xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
621 getInfoHelper());
624 return xInfo;
625 // \--
628 // ================================================================================
630 Sequence< OUString > Axis::getSupportedServiceNames_Static()
632 Sequence< OUString > aServices( 2 );
633 aServices[ 0 ] = C2U( "com.sun.star.chart2.Axis" );
634 aServices[ 1 ] = C2U( "com.sun.star.beans.PropertySet" );
635 return aServices;
638 using impl::Axis_Base;
640 IMPLEMENT_FORWARD_XINTERFACE2( Axis, Axis_Base, ::property::OPropertySet )
641 IMPLEMENT_FORWARD_XTYPEPROVIDER2( Axis, Axis_Base, ::property::OPropertySet )
643 // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
644 APPHELPER_XSERVICEINFO_IMPL( Axis, lcl_aServiceName );
646 } // namespace chart