diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-03-18 15:33:40 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-03-18 15:33:40 +0100 |
commit | e6064484fae8aa2797f86c68e9a8d23d2e213367 (patch) | |
tree | db2f4d140efca43ab01dee4fc053fff0829d106b /chart2/source/model/template/ColumnChartType.cxx | |
parent | 9e0a09e89c38774dd1af902387a8b25de158b634 (diff) | |
parent | 378c75a798c8baa34cb26e7f07fe28cb5ee2a85f (diff) |
Merge remote-tracking branch 'origin/integration/dev300_m101'
Conflicts:
chart2/source/controller/main/UndoManager.cxx
chart2/source/tools/RegressionCurveHelper.cxx
sc/inc/address.hxx
sc/inc/attrib.hxx
sc/inc/bigrange.hxx
sc/inc/callform.hxx
sc/inc/cell.hxx
sc/inc/chartarr.hxx
sc/inc/chartlis.hxx
sc/inc/chgtrack.hxx
sc/inc/collect.hxx
sc/inc/compiler.hxx
sc/inc/detdata.hxx
sc/inc/document.hxx
sc/inc/fillinfo.hxx
sc/inc/olinetab.hxx
sc/inc/prnsave.hxx
sc/inc/queryparam.hxx
sc/inc/sc.hrc
sc/inc/scabstdlg.hxx
sc/inc/table.hxx
sc/inc/validat.hxx
sc/inc/zforauto.hxx
sc/source/core/data/documen2.cxx
sc/source/core/data/document.cxx
sc/source/core/data/table1.cxx
sc/source/core/tool/address.cxx
sc/source/core/tool/token.cxx
sc/source/filter/excel/frmbase.cxx
sc/source/filter/excel/impop.cxx
sc/source/filter/excel/xename.cxx
sc/source/filter/inc/formel.hxx
sc/source/filter/inc/xename.hxx
sc/source/filter/xml/xmlexprt.cxx
sc/source/filter/xml/xmlnexpi.cxx
sc/source/filter/xml/xmlnexpi.hxx
sc/source/ui/dbgui/filtdlg.cxx
sc/source/ui/inc/docfunc.hxx
sc/source/ui/inc/namedlg.hxx
sc/source/ui/namedlg/namedlg.cxx
sc/source/ui/src/namedlg.src
Diffstat (limited to 'chart2/source/model/template/ColumnChartType.cxx')
-rwxr-xr-x[-rw-r--r--] | chart2/source/model/template/ColumnChartType.cxx | 103 |
1 files changed, 55 insertions, 48 deletions
diff --git a/chart2/source/model/template/ColumnChartType.cxx b/chart2/source/model/template/ColumnChartType.cxx index c6080cb8e64b..41168ea97ce9 100644..100755 --- a/chart2/source/model/template/ColumnChartType.cxx +++ b/chart2/source/model/template/ColumnChartType.cxx @@ -68,39 +68,70 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); } -void lcl_AddDefaultsToMap( - ::chart::tPropertyValueMap & rOutMap ) +struct StaticColumnChartTypeDefaults_Initializer { - Sequence< sal_Int32 > aSeq(2); + ::chart::tPropertyValueMap* operator()() + { + static ::chart::tPropertyValueMap aStaticDefaults; + lcl_AddDefaultsToMap( aStaticDefaults ); + return &aStaticDefaults; + } +private: + void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) + { + Sequence< sal_Int32 > aSeq(2); - aSeq[0] = aSeq[1] = 0; - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_OVERLAP_SEQUENCE, aSeq ); + aSeq[0] = aSeq[1] = 0; + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_OVERLAP_SEQUENCE, aSeq ); - aSeq[0] = aSeq[1] = 100; - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE, aSeq ); -} + aSeq[0] = aSeq[1] = 100; + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE, aSeq ); + } +}; -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticColumnChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticColumnChartTypeDefaults_Initializer > { - static Sequence< Property > aPropSeq; +}; - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +struct StaticColumnChartTypeInfoHelper_Initializer +{ + ::cppu::OPropertyArrayHelper* operator()() + { + static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); + return &aPropHelper; + } + +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); - // and sort them for access via bsearch ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // transfer result to static Sequence - aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); } - return aPropSeq; -} +}; + +struct StaticColumnChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticColumnChartTypeInfoHelper_Initializer > +{ +}; + +struct StaticColumnChartTypeInfo_Initializer +{ + uno::Reference< beans::XPropertySetInfo >* operator()() + { + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticColumnChartTypeInfoHelper::get() ) ); + return &xPropertySetInfo; + } +}; + +struct StaticColumnChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticColumnChartTypeInfo_Initializer > +{ +}; } // anonymous namespace @@ -138,47 +169,23 @@ uno::Reference< util::XCloneable > SAL_CALL ColumnChartType::createClone() uno::Any ColumnChartType::GetDefaultValue( sal_Int32 nHandle ) const throw(beans::UnknownPropertyException) { - static tPropertyValueMap aStaticDefaults; - - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aStaticDefaults.size() ) - { - // initialize defaults - lcl_AddDefaultsToMap( aStaticDefaults ); - } - - tPropertyValueMap::const_iterator aFound( - aStaticDefaults.find( nHandle )); - - if( aFound == aStaticDefaults.end()) + const tPropertyValueMap& rStaticDefaults = *StaticColumnChartTypeDefaults::get(); + tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); + if( aFound == rStaticDefaults.end() ) return uno::Any(); - return (*aFound).second; } ::cppu::IPropertyArrayHelper & SAL_CALL ColumnChartType::getInfoHelper() { - static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(), - /* bSorted = */ sal_True ); - return aArrayHelper; + return *StaticColumnChartTypeInfoHelper::get(); } - // ____ XPropertySet ____ -uno::Reference< beans::XPropertySetInfo > SAL_CALL - ColumnChartType::getPropertySetInfo() +uno::Reference< beans::XPropertySetInfo > SAL_CALL ColumnChartType::getPropertySetInfo() throw (uno::RuntimeException) { - static uno::Reference< beans::XPropertySetInfo > xInfo; - - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !xInfo.is()) - { - xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( - getInfoHelper()); - } - - return xInfo; + return *StaticColumnChartTypeInfo::get(); } |