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/StockChartTypeTemplate.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/StockChartTypeTemplate.cxx')
-rwxr-xr-x[-rw-r--r--] | chart2/source/model/template/StockChartTypeTemplate.cxx | 102 |
1 files changed, 50 insertions, 52 deletions
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx index d47bb48f2763..9c93feda749f 100644..100755 --- a/chart2/source/model/template/StockChartTypeTemplate.cxx +++ b/chart2/source/model/template/StockChartTypeTemplate.cxx @@ -40,7 +40,6 @@ #include "ContainerHelper.hxx" #include "AxisIndexDefines.hxx" #include <com/sun/star/chart2/AxisType.hpp> -#include <com/sun/star/chart2/SymbolStyle.hpp> #include <com/sun/star/chart2/data/XDataSource.hpp> #include <com/sun/star/chart2/XChartTypeContainer.hpp> #include <com/sun/star/chart2/XDataSeriesContainer.hpp> @@ -105,45 +104,66 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); } -void lcl_AddDefaultsToMap( - ::chart::tPropertyValueMap & rOutMap ) +struct StaticStockChartTypeTemplateDefaults_Initializer { - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME, false ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_OPEN, false ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH, true ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE, false ); -} + ::chart::tPropertyValueMap* operator()() + { + static ::chart::tPropertyValueMap aStaticDefaults; + lcl_AddDefaultsToMap( aStaticDefaults ); + return &aStaticDefaults; + } +private: + void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) + { + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME, false ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_OPEN, false ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH, true ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE, false ); + } +}; -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticStockChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticStockChartTypeTemplateDefaults_Initializer > { - static Sequence< Property > aPropSeq; +}; - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +struct StaticStockChartTypeTemplateInfoHelper_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 StaticStockChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticStockChartTypeTemplateInfoHelper_Initializer > +{ +}; -::cppu::IPropertyArrayHelper & lcl_getInfoHelper() +struct StaticStockChartTypeTemplateInfo_Initializer { - static ::cppu::OPropertyArrayHelper aArrayHelper( - lcl_GetPropertySequence(), - /* bSorted = */ sal_True ); + uno::Reference< beans::XPropertySetInfo >* operator()() + { + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticStockChartTypeTemplateInfoHelper::get() ) ); + return &xPropertySetInfo; + } +}; - return aArrayHelper; -} +struct StaticStockChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticStockChartTypeTemplateInfo_Initializer > +{ +}; } // anonymous namespace // ---------------------------------------- @@ -180,45 +200,23 @@ StockChartTypeTemplate::~StockChartTypeTemplate() uno::Any StockChartTypeTemplate::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 = *StaticStockChartTypeTemplateDefaults::get(); + tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); + if( aFound == rStaticDefaults.end() ) return uno::Any(); - return (*aFound).second; } ::cppu::IPropertyArrayHelper & SAL_CALL StockChartTypeTemplate::getInfoHelper() { - return lcl_getInfoHelper(); + return *StaticStockChartTypeTemplateInfoHelper::get(); } - // ____ XPropertySet ____ -uno::Reference< beans::XPropertySetInfo > SAL_CALL - StockChartTypeTemplate::getPropertySetInfo() +uno::Reference< beans::XPropertySetInfo > SAL_CALL StockChartTypeTemplate::getPropertySetInfo() throw (uno::RuntimeException) { - static uno::Reference< beans::XPropertySetInfo > xInfo; - - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !xInfo.is()) - { - xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( - getInfoHelper()); - } - - return xInfo; + return *StaticStockChartTypeTemplateInfo::get(); } sal_Int32 StockChartTypeTemplate::getAxisCountByDimension( sal_Int32 nDimension ) |