diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-02-12 11:50:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-02-13 17:21:40 +0100 |
commit | 9985cc1088218c616f9cb8854cd58eb1f4fa895c (patch) | |
tree | 8c787a8074061c3572cf440a5cacb5cf9c290bd8 | |
parent | 0e3092fd6c8dc8908bd7820a4eb858771ca7eb00 (diff) |
rtl::Static -> local static
Change-Id: I43059938f1fc814b2b8306258210a67d7a1fac84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129858
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | chart2/source/model/template/ColumnLineChartTypeTemplate.cxx | 91 | ||||
-rw-r--r-- | chart2/source/model/template/LineChartType.cxx | 115 | ||||
-rw-r--r-- | chart2/source/model/template/LineChartTypeTemplate.cxx | 115 | ||||
-rw-r--r-- | chart2/source/model/template/NetChartType.cxx | 36 | ||||
-rw-r--r-- | chart2/source/model/template/PieChartType.cxx | 105 | ||||
-rw-r--r-- | chart2/source/model/template/PieChartTypeTemplate.cxx | 113 | ||||
-rw-r--r-- | chart2/source/model/template/ScatterChartType.cxx | 115 | ||||
-rw-r--r-- | chart2/source/model/template/ScatterChartTypeTemplate.cxx | 127 |
8 files changed, 296 insertions, 521 deletions
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx index 1f3bd9c9a538..90646552e50e 100644 --- a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx +++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx @@ -56,69 +56,44 @@ enum PROP_COL_LINE_NUMBER_OF_LINES }; -void lcl_AddPropertiesToVector( - std::vector< Property > & rOutProperties ) +::chart::tPropertyValueMap& StaticColumnLineChartTypeTemplateDefaults() { - rOutProperties.emplace_back( "NumberOfLines", - PROP_COL_LINE_NUMBER_OF_LINES, - cppu::UnoType<sal_Int32>::get(), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); + static ::chart::tPropertyValueMap aStaticDefaults = + []() + { + ::chart::tPropertyValueMap aOutMap; + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_COL_LINE_NUMBER_OF_LINES, 1 ); + return aOutMap; + }(); + return aStaticDefaults; } -struct StaticColumnLineChartTypeTemplateDefaults_Initializer -{ - ::chart::tPropertyValueMap* operator()() - { - static ::chart::tPropertyValueMap aStaticDefaults; - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aStaticDefaults, PROP_COL_LINE_NUMBER_OF_LINES, 1 ); - return &aStaticDefaults; - } -}; - -struct StaticColumnLineChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticColumnLineChartTypeTemplateDefaults_Initializer > +::cppu::OPropertyArrayHelper& StaticColumnLineChartTypeTemplateInfoHelper() { -}; - -struct StaticColumnLineChartTypeTemplateInfoHelper_Initializer -{ - ::cppu::OPropertyArrayHelper* operator()() - { - static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); - return &aPropHelper; - } - -private: - static uno::Sequence< Property > lcl_GetPropertySequence() - { - std::vector< css::beans::Property > aProperties; - lcl_AddPropertiesToVector( aProperties ); - - std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); - - return comphelper::containerToSequence( aProperties ); - } + static ::cppu::OPropertyArrayHelper aPropHelper( + []() + { + std::vector< css::beans::Property > aProperties { + { "NumberOfLines", + PROP_COL_LINE_NUMBER_OF_LINES, + cppu::UnoType<sal_Int32>::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT } }; -}; + std::sort( aProperties.begin(), aProperties.end(), + ::chart::PropertyNameLess() ); -struct StaticColumnLineChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticColumnLineChartTypeTemplateInfoHelper_Initializer > -{ -}; - -struct StaticColumnLineChartTypeTemplateInfo_Initializer -{ - uno::Reference< beans::XPropertySetInfo >* operator()() - { - static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( - ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticColumnLineChartTypeTemplateInfoHelper::get() ) ); - return &xPropertySetInfo; - } -}; + return comphelper::containerToSequence( aProperties ); + }()); + return aPropHelper; +} -struct StaticColumnLineChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticColumnLineChartTypeTemplateInfo_Initializer > +uno::Reference< beans::XPropertySetInfo >& StaticColumnLineChartTypeTemplateInfo() { -}; + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(StaticColumnLineChartTypeTemplateInfoHelper() ) ); + return xPropertySetInfo; +} } // anonymous namespace @@ -144,7 +119,7 @@ ColumnLineChartTypeTemplate::~ColumnLineChartTypeTemplate() // ____ OPropertySet ____ void ColumnLineChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const { - const tPropertyValueMap& rStaticDefaults = *StaticColumnLineChartTypeTemplateDefaults::get(); + const tPropertyValueMap& rStaticDefaults = StaticColumnLineChartTypeTemplateDefaults(); tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); if( aFound == rStaticDefaults.end() ) rAny.clear(); @@ -154,13 +129,13 @@ void ColumnLineChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& ::cppu::IPropertyArrayHelper & SAL_CALL ColumnLineChartTypeTemplate::getInfoHelper() { - return *StaticColumnLineChartTypeTemplateInfoHelper::get(); + return StaticColumnLineChartTypeTemplateInfoHelper(); } // ____ XPropertySet ____ uno::Reference< beans::XPropertySetInfo > SAL_CALL ColumnLineChartTypeTemplate::getPropertySetInfo() { - return *StaticColumnLineChartTypeTemplateInfo::get(); + return StaticColumnLineChartTypeTemplateInfo(); } void ColumnLineChartTypeTemplate::createChartTypes( diff --git a/chart2/source/model/template/LineChartType.cxx b/chart2/source/model/template/LineChartType.cxx index 8edccdfb858e..e9d7cf808e53 100644 --- a/chart2/source/model/template/LineChartType.cxx +++ b/chart2/source/model/template/LineChartType.cxx @@ -43,90 +43,59 @@ enum PROP_LINECHARTTYPE_SPLINE_ORDER }; -void lcl_AddPropertiesToVector( - std::vector< Property > & rOutProperties ) +::chart::tPropertyValueMap& StaticLineChartTypeDefaults() +{ + static ::chart::tPropertyValueMap aStaticDefaults = + []() + { + ::chart::tPropertyValueMap aOutMap; + ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_LINECHARTTYPE_CURVE_STYLE, ::chart2::CurveStyle_LINES ); + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_LINECHARTTYPE_CURVE_RESOLUTION, 20 ); + + // todo: check whether order 3 means polygons of order 3 or 2. (see + // http://www.people.nnov.ru/fractal/Splines/Basis.htm ) + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_LINECHARTTYPE_SPLINE_ORDER, 3 ); + return aOutMap; + }(); + return aStaticDefaults; +} + +::cppu::OPropertyArrayHelper& StaticLineChartTypeInfoHelper() { - rOutProperties.emplace_back( CHART_UNONAME_CURVE_STYLE, + static ::cppu::OPropertyArrayHelper aPropHelper( + []() + { + std::vector< css::beans::Property > aProperties { + { CHART_UNONAME_CURVE_STYLE, PROP_LINECHARTTYPE_CURVE_STYLE, cppu::UnoType<chart2::CurveStyle>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - - rOutProperties.emplace_back( CHART_UNONAME_CURVE_RESOLUTION, + | beans::PropertyAttribute::MAYBEDEFAULT }, + { CHART_UNONAME_CURVE_RESOLUTION, PROP_LINECHARTTYPE_CURVE_RESOLUTION, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( CHART_UNONAME_SPLINE_ORDER, + | beans::PropertyAttribute::MAYBEDEFAULT }, + { CHART_UNONAME_SPLINE_ORDER, PROP_LINECHARTTYPE_SPLINE_ORDER, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); -} - -struct StaticLineChartTypeDefaults_Initializer -{ - ::chart::tPropertyValueMap* operator()() - { - static ::chart::tPropertyValueMap aStaticDefaults; - lcl_AddDefaultsToMap( aStaticDefaults ); - return &aStaticDefaults; - } -private: - static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) - { - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINECHARTTYPE_CURVE_STYLE, ::chart2::CurveStyle_LINES ); - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINECHARTTYPE_CURVE_RESOLUTION, 20 ); - - // todo: check whether order 3 means polygons of order 3 or 2. (see - // http://www.people.nnov.ru/fractal/Splines/Basis.htm ) - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINECHARTTYPE_SPLINE_ORDER, 3 ); - } -}; - -struct StaticLineChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticLineChartTypeDefaults_Initializer > -{ -}; - -struct StaticLineChartTypeInfoHelper_Initializer -{ - ::cppu::OPropertyArrayHelper* operator()() - { - static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); - return &aPropHelper; - } - -private: - static Sequence< Property > lcl_GetPropertySequence() - { - std::vector< css::beans::Property > aProperties; - lcl_AddPropertiesToVector( aProperties ); + | beans::PropertyAttribute::MAYBEDEFAULT } }; - std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); + std::sort( aProperties.begin(), aProperties.end(), + ::chart::PropertyNameLess() ); - return comphelper::containerToSequence( aProperties ); - } - -}; - -struct StaticLineChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticLineChartTypeInfoHelper_Initializer > -{ -}; - -struct StaticLineChartTypeInfo_Initializer -{ - uno::Reference< beans::XPropertySetInfo >* operator()() - { - static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( - ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticLineChartTypeInfoHelper::get() ) ); - return &xPropertySetInfo; - } -}; + return comphelper::containerToSequence( aProperties ); + }()); + return aPropHelper; +} -struct StaticLineChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticLineChartTypeInfo_Initializer > +uno::Reference< beans::XPropertySetInfo >& StaticLineChartTypeInfo() { -}; + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(StaticLineChartTypeInfoHelper() ) ); + return xPropertySetInfo; +} } // anonymous namespace @@ -165,7 +134,7 @@ OUString SAL_CALL LineChartType::getChartType() // ____ OPropertySet ____ void LineChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const { - const tPropertyValueMap& rStaticDefaults = *StaticLineChartTypeDefaults::get(); + const tPropertyValueMap& rStaticDefaults = StaticLineChartTypeDefaults(); tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); if( aFound == rStaticDefaults.end() ) rAny.clear(); @@ -175,13 +144,13 @@ void LineChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const ::cppu::IPropertyArrayHelper & SAL_CALL LineChartType::getInfoHelper() { - return *StaticLineChartTypeInfoHelper::get(); + return StaticLineChartTypeInfoHelper(); } // ____ XPropertySet ____ uno::Reference< beans::XPropertySetInfo > SAL_CALL LineChartType::getPropertySetInfo() { - return *StaticLineChartTypeInfo::get(); + return StaticLineChartTypeInfo(); } OUString SAL_CALL LineChartType::getImplementationName() diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx index 8c80699a4d21..478692f15c12 100644 --- a/chart2/source/model/template/LineChartTypeTemplate.cxx +++ b/chart2/source/model/template/LineChartTypeTemplate.cxx @@ -58,89 +58,58 @@ enum }; -void lcl_AddPropertiesToVector( - std::vector< Property > & rOutProperties ) +::chart::tPropertyValueMap& StaticLineChartTypeTemplateDefaults() { - rOutProperties.emplace_back( CHART_UNONAME_CURVE_STYLE, + static ::chart::tPropertyValueMap aStaticDefaults = + []() + { + ::chart::tPropertyValueMap aOutMap; + ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, chart2::CurveStyle_LINES ); + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, 20 ); + + // todo: check whether order 3 means polygons of order 3 or 2. (see + // http://www.people.nnov.ru/fractal/Splines/Basis.htm ) + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER, 3 ); + return aOutMap; + }(); + return aStaticDefaults; +} + +::cppu::OPropertyArrayHelper& StaticLineChartTypeTemplateInfoHelper() +{ + static ::cppu::OPropertyArrayHelper aPropHelper( + []() + { + std::vector< css::beans::Property > aProperties { + { CHART_UNONAME_CURVE_STYLE, PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, cppu::UnoType<chart2::CurveStyle>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( CHART_UNONAME_CURVE_RESOLUTION, + | beans::PropertyAttribute::MAYBEDEFAULT }, + { CHART_UNONAME_CURVE_RESOLUTION, PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( CHART_UNONAME_SPLINE_ORDER, + | beans::PropertyAttribute::MAYBEDEFAULT }, + { CHART_UNONAME_SPLINE_ORDER, PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); -} - -struct StaticLineChartTypeTemplateDefaults_Initializer -{ - ::chart::tPropertyValueMap* operator()() - { - static ::chart::tPropertyValueMap aStaticDefaults; - lcl_AddDefaultsToMap( aStaticDefaults ); - return &aStaticDefaults; - } -private: - static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) - { - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, chart2::CurveStyle_LINES ); - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, 20 ); - - // todo: check whether order 3 means polygons of order 3 or 2. (see - // http://www.people.nnov.ru/fractal/Splines/Basis.htm ) - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER, 3 ); - } -}; - -struct StaticLineChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticLineChartTypeTemplateDefaults_Initializer > -{ -}; - -struct StaticLineChartTypeTemplateInfoHelper_Initializer -{ - ::cppu::OPropertyArrayHelper* operator()() - { - static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); - return &aPropHelper; - } - -private: - static Sequence< Property > lcl_GetPropertySequence() - { - std::vector< css::beans::Property > aProperties; - lcl_AddPropertiesToVector( aProperties ); - - std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); + | beans::PropertyAttribute::MAYBEDEFAULT } }; + std::sort( aProperties.begin(), aProperties.end(), + ::chart::PropertyNameLess() ); - return comphelper::containerToSequence( aProperties ); - } - -}; - -struct StaticLineChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticLineChartTypeTemplateInfoHelper_Initializer > -{ -}; - -struct StaticLineChartTypeTemplateInfo_Initializer -{ - uno::Reference< beans::XPropertySetInfo >* operator()() - { - static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( - ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticLineChartTypeTemplateInfoHelper::get() ) ); - return &xPropertySetInfo; - } -}; + return comphelper::containerToSequence( aProperties ); + }()); + return aPropHelper; +} -struct StaticLineChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticLineChartTypeTemplateInfo_Initializer > +uno::Reference< beans::XPropertySetInfo >& StaticLineChartTypeTemplateInfo() { -}; + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(StaticLineChartTypeTemplateInfoHelper() ) ); + return xPropertySetInfo; +} } // anonymous namespace @@ -172,7 +141,7 @@ LineChartTypeTemplate::~LineChartTypeTemplate() // ____ OPropertySet ____ void LineChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const { - const tPropertyValueMap& rStaticDefaults = *StaticLineChartTypeTemplateDefaults::get(); + const tPropertyValueMap& rStaticDefaults = StaticLineChartTypeTemplateDefaults(); tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); if( aFound == rStaticDefaults.end() ) rAny.clear(); @@ -182,13 +151,13 @@ void LineChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) ::cppu::IPropertyArrayHelper & SAL_CALL LineChartTypeTemplate::getInfoHelper() { - return *StaticLineChartTypeTemplateInfoHelper::get(); + return StaticLineChartTypeTemplateInfoHelper(); } // ____ XPropertySet ____ uno::Reference< beans::XPropertySetInfo > SAL_CALL LineChartTypeTemplate::getPropertySetInfo() { - return *StaticLineChartTypeTemplateInfo::get(); + return StaticLineChartTypeTemplateInfo(); } sal_Int32 LineChartTypeTemplate::getDimension() const diff --git a/chart2/source/model/template/NetChartType.cxx b/chart2/source/model/template/NetChartType.cxx index 8441215818d8..b3e809f901fe 100644 --- a/chart2/source/model/template/NetChartType.cxx +++ b/chart2/source/model/template/NetChartType.cxx @@ -90,45 +90,31 @@ void NetChartType_Base::GetDefaultValue( sal_Int32 /*nHandle*/, uno::Any& rAny ) namespace { -struct StaticNetChartTypeInfoHelper_Initializer +::cppu::OPropertyArrayHelper& StaticNetChartTypeInfoHelper() { - ::cppu::OPropertyArrayHelper* operator()() - { - static ::cppu::OPropertyArrayHelper aPropHelper(Sequence< beans::Property >{}); - return &aPropHelper; - } -}; - -struct StaticNetChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticNetChartTypeInfoHelper_Initializer > -{ -}; - -struct StaticNetChartTypeInfo_Initializer -{ - uno::Reference< beans::XPropertySetInfo >* operator()() - { - static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( - ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticNetChartTypeInfoHelper::get() ) ); - return &xPropertySetInfo; - } -}; + static ::cppu::OPropertyArrayHelper aPropHelper(Sequence< beans::Property >{}); + return aPropHelper; +} -struct StaticNetChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticNetChartTypeInfo_Initializer > +uno::Reference< beans::XPropertySetInfo >& StaticNetChartTypeInfo() { -}; + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(StaticNetChartTypeInfoHelper() ) ); + return xPropertySetInfo; +} } // ____ OPropertySet ____ ::cppu::IPropertyArrayHelper & SAL_CALL NetChartType_Base::getInfoHelper() { - return *StaticNetChartTypeInfoHelper::get(); + return StaticNetChartTypeInfoHelper(); } // ____ XPropertySet ____ uno::Reference< beans::XPropertySetInfo > SAL_CALL NetChartType_Base::getPropertySetInfo() { - return *StaticNetChartTypeInfo::get(); + return StaticNetChartTypeInfo(); } NetChartType::NetChartType() diff --git a/chart2/source/model/template/PieChartType.cxx b/chart2/source/model/template/PieChartType.cxx index 4727a47acc26..b0f95e426f02 100644 --- a/chart2/source/model/template/PieChartType.cxx +++ b/chart2/source/model/template/PieChartType.cxx @@ -43,79 +43,50 @@ enum PROP_PIECHARTTYPE_3DRELATIVEHEIGHT }; -void lcl_AddPropertiesToVector( - std::vector< Property > & rOutProperties ) + +::chart::tPropertyValueMap& StaticPieChartTypeDefaults() +{ + static ::chart::tPropertyValueMap aStaticDefaults = + []() + { + ::chart::tPropertyValueMap aOutMap; + ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_PIECHARTTYPE_USE_RINGS, false ); + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, 100 ); + return aOutMap; + }(); + return aStaticDefaults; +} + +::cppu::OPropertyArrayHelper& StaticPieChartTypeInfoHelper() { - rOutProperties.emplace_back( "UseRings", + static ::cppu::OPropertyArrayHelper aPropHelper( + []() + { + std::vector< css::beans::Property > aProperties { + { "UseRings", PROP_PIECHARTTYPE_USE_RINGS, cppu::UnoType<bool>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( "3DRelativeHeight", + | beans::PropertyAttribute::MAYBEDEFAULT }, + { "3DRelativeHeight", PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, cppu::UnoType<sal_Int32>::get(), - beans::PropertyAttribute::MAYBEVOID ); + beans::PropertyAttribute::MAYBEVOID } + }; + std::sort( aProperties.begin(), aProperties.end(), + ::chart::PropertyNameLess() ); + + return comphelper::containerToSequence( aProperties ); + }()); + return aPropHelper; } -struct StaticPieChartTypeDefaults_Initializer +uno::Reference< beans::XPropertySetInfo >& StaticPieChartTypeInfo() { - ::chart::tPropertyValueMap* operator()() - { - static ::chart::tPropertyValueMap aStaticDefaults; - lcl_AddDefaultsToMap( aStaticDefaults ); - return &aStaticDefaults; - } -private: - static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) - { - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PIECHARTTYPE_USE_RINGS, false ); - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, 100 ); - } -}; - -struct StaticPieChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticPieChartTypeDefaults_Initializer > -{ -}; - -struct StaticPieChartTypeInfoHelper_Initializer -{ - ::cppu::OPropertyArrayHelper* operator()() - { - static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); - return &aPropHelper; - } - -private: - static Sequence< Property > lcl_GetPropertySequence() - { - std::vector< css::beans::Property > aProperties; - lcl_AddPropertiesToVector( aProperties ); - - std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); - - return comphelper::containerToSequence( aProperties ); - } - -}; - -struct StaticPieChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticPieChartTypeInfoHelper_Initializer > -{ -}; - -struct StaticPieChartTypeInfo_Initializer -{ - uno::Reference< beans::XPropertySetInfo >* operator()() - { - static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( - ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticPieChartTypeInfoHelper::get() ) ); - return &xPropertySetInfo; - } -}; - -struct StaticPieChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticPieChartTypeInfo_Initializer > -{ -}; + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo( StaticPieChartTypeInfoHelper() ) ); + return xPropertySetInfo; +} } // anonymous namespace @@ -194,7 +165,7 @@ uno::Sequence< OUString > PieChartType::getSupportedPropertyRoles() // ____ OPropertySet ____ void PieChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const { - const tPropertyValueMap& rStaticDefaults = *StaticPieChartTypeDefaults::get(); + const tPropertyValueMap& rStaticDefaults = StaticPieChartTypeDefaults(); tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); if( aFound == rStaticDefaults.end() ) rAny.clear(); @@ -205,13 +176,13 @@ void PieChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const // ____ OPropertySet ____ ::cppu::IPropertyArrayHelper & SAL_CALL PieChartType::getInfoHelper() { - return *StaticPieChartTypeInfoHelper::get(); + return StaticPieChartTypeInfoHelper(); } // ____ XPropertySet ____ uno::Reference< beans::XPropertySetInfo > SAL_CALL PieChartType::getPropertySetInfo() { - return *StaticPieChartTypeInfo::get(); + return StaticPieChartTypeInfo(); } OUString SAL_CALL PieChartType::getImplementationName() diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx index da7ec3bef878..ce206fa2e2f8 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.cxx +++ b/chart2/source/model/template/PieChartTypeTemplate.cxx @@ -63,92 +63,61 @@ enum PROP_PIE_TEMPLATE_USE_RINGS }; -void lcl_AddPropertiesToVector( - std::vector< Property > & rOutProperties ) +::chart::tPropertyValueMap& StaticPieChartTypeTemplateDefaults() { - rOutProperties.emplace_back( "OffsetMode", + static ::chart::tPropertyValueMap aStaticDefaults = + []{ + ::chart::tPropertyValueMap aOutMap; + ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_PIE_TEMPLATE_OFFSET_MODE, chart2::PieChartOffsetMode_NONE ); + ::chart::PropertyHelper::setPropertyValueDefault< double >( aOutMap, PROP_PIE_TEMPLATE_DEFAULT_OFFSET, 0.5 ); + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_PIE_TEMPLATE_DIMENSION, 2 ); + ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_PIE_TEMPLATE_USE_RINGS, false ); + return aOutMap; + }(); + return aStaticDefaults; +} + +::cppu::OPropertyArrayHelper& StaticPieChartTypeTemplateInfoHelper() +{ + static ::cppu::OPropertyArrayHelper aPropHelper( + []() + { + std::vector< css::beans::Property > aProperties { + { "OffsetMode", PROP_PIE_TEMPLATE_OFFSET_MODE, cppu::UnoType<chart2::PieChartOffsetMode>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( "DefaultOffset", + | beans::PropertyAttribute::MAYBEDEFAULT }, + { "DefaultOffset", PROP_PIE_TEMPLATE_DEFAULT_OFFSET, cppu::UnoType<double>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( "Dimension", + | beans::PropertyAttribute::MAYBEDEFAULT }, + { "Dimension", PROP_PIE_TEMPLATE_DIMENSION, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( "UseRings", + | beans::PropertyAttribute::MAYBEDEFAULT }, + { "UseRings", PROP_PIE_TEMPLATE_USE_RINGS, cppu::UnoType<bool>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); -} - -struct StaticPieChartTypeTemplateDefaults_Initializer -{ - ::chart::tPropertyValueMap* operator()() - { - static ::chart::tPropertyValueMap aStaticDefaults; - lcl_AddDefaultsToMap( aStaticDefaults ); - return &aStaticDefaults; - } -private: - static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) - { - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PIE_TEMPLATE_OFFSET_MODE, chart2::PieChartOffsetMode_NONE ); - ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_PIE_TEMPLATE_DEFAULT_OFFSET, 0.5 ); - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_PIE_TEMPLATE_DIMENSION, 2 ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PIE_TEMPLATE_USE_RINGS, false ); - } -}; + | beans::PropertyAttribute::MAYBEDEFAULT } }; -struct StaticPieChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticPieChartTypeTemplateDefaults_Initializer > -{ -}; - -struct StaticPieChartTypeTemplateInfoHelper_Initializer -{ - ::cppu::OPropertyArrayHelper* operator()() - { - static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); - return &aPropHelper; - } + std::sort( aProperties.begin(), aProperties.end(), + ::chart::PropertyNameLess() ); -private: - static uno::Sequence< Property > lcl_GetPropertySequence() - { - std::vector< css::beans::Property > aProperties; - lcl_AddPropertiesToVector( aProperties ); - - std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); - - return comphelper::containerToSequence( aProperties ); - } - -}; - -struct StaticPieChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticPieChartTypeTemplateInfoHelper_Initializer > -{ -}; - -struct StaticPieChartTypeTemplateInfo_Initializer -{ - uno::Reference< beans::XPropertySetInfo >* operator()() - { - static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( - ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticPieChartTypeTemplateInfoHelper::get() ) ); - return &xPropertySetInfo; - } -}; + return comphelper::containerToSequence( aProperties ); + }() ); + return aPropHelper; +} -struct StaticPieChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticPieChartTypeTemplateInfo_Initializer > +uno::Reference< beans::XPropertySetInfo >& StaticPieChartTypeTemplateInfo() { -}; + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(StaticPieChartTypeTemplateInfoHelper() ) ); + return xPropertySetInfo; +} } // anonymous namespace @@ -176,7 +145,7 @@ PieChartTypeTemplate::~PieChartTypeTemplate() // ____ OPropertySet ____ void PieChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const { - const tPropertyValueMap& rStaticDefaults = *StaticPieChartTypeTemplateDefaults::get(); + const tPropertyValueMap& rStaticDefaults = StaticPieChartTypeTemplateDefaults(); tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); if( aFound == rStaticDefaults.end() ) rAny.clear(); @@ -186,13 +155,13 @@ void PieChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) ::cppu::IPropertyArrayHelper & SAL_CALL PieChartTypeTemplate::getInfoHelper() { - return *StaticPieChartTypeTemplateInfoHelper::get(); + return StaticPieChartTypeTemplateInfoHelper(); } // ____ XPropertySet ____ uno::Reference< beans::XPropertySetInfo > SAL_CALL PieChartTypeTemplate::getPropertySetInfo() { - return *StaticPieChartTypeTemplateInfo::get(); + return StaticPieChartTypeTemplateInfo(); } // ____ ChartTypeTemplate ____ diff --git a/chart2/source/model/template/ScatterChartType.cxx b/chart2/source/model/template/ScatterChartType.cxx index 1835abc10a1d..9929a8e19b2d 100644 --- a/chart2/source/model/template/ScatterChartType.cxx +++ b/chart2/source/model/template/ScatterChartType.cxx @@ -47,90 +47,57 @@ enum PROP_SCATTERCHARTTYPE_SPLINE_ORDER }; -void lcl_AddPropertiesToVector( - std::vector< Property > & rOutProperties ) +::chart::tPropertyValueMap& StaticScatterChartTypeDefaults() { - rOutProperties.emplace_back( CHART_UNONAME_CURVE_STYLE, + static ::chart::tPropertyValueMap aStaticDefaults = + []() + { + ::chart::tPropertyValueMap aOutMap; + ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_SCATTERCHARTTYPE_CURVE_STYLE, chart2::CurveStyle_LINES ); + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION, 20 ); + + // todo: check whether order 3 means polygons of order 3 or 2. (see + // http://www.people.nnov.ru/fractal/Splines/Basis.htm ) + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_SCATTERCHARTTYPE_SPLINE_ORDER, 3 ); + return aOutMap; + }(); + return aStaticDefaults; +} + +::cppu::OPropertyArrayHelper& StaticScatterChartTypeInfoHelper() +{ + static ::cppu::OPropertyArrayHelper aPropHelper( + []() + { + std::vector< css::beans::Property > aProperties { + { CHART_UNONAME_CURVE_STYLE, PROP_SCATTERCHARTTYPE_CURVE_STYLE, cppu::UnoType<chart2::CurveStyle>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - - rOutProperties.emplace_back( CHART_UNONAME_CURVE_RESOLUTION, + | beans::PropertyAttribute::MAYBEDEFAULT }, + { CHART_UNONAME_CURVE_RESOLUTION, PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( CHART_UNONAME_SPLINE_ORDER, + | beans::PropertyAttribute::MAYBEDEFAULT }, + { CHART_UNONAME_SPLINE_ORDER, PROP_SCATTERCHARTTYPE_SPLINE_ORDER, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); + | beans::PropertyAttribute::MAYBEDEFAULT } }; + std::sort( aProperties.begin(), aProperties.end(), + ::chart::PropertyNameLess() ); + return comphelper::containerToSequence( aProperties ); + }() ); + return aPropHelper; } -struct StaticScatterChartTypeDefaults_Initializer -{ - ::chart::tPropertyValueMap* operator()() - { - static ::chart::tPropertyValueMap aStaticDefaults; - lcl_AddDefaultsToMap( aStaticDefaults ); - return &aStaticDefaults; - } -private: - static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) - { - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCATTERCHARTTYPE_CURVE_STYLE, chart2::CurveStyle_LINES ); - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION, 20 ); - - // todo: check whether order 3 means polygons of order 3 or 2. (see - // http://www.people.nnov.ru/fractal/Splines/Basis.htm ) - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_SCATTERCHARTTYPE_SPLINE_ORDER, 3 ); - } -}; - -struct StaticScatterChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticScatterChartTypeDefaults_Initializer > -{ -}; - -struct StaticScatterChartTypeInfoHelper_Initializer -{ - ::cppu::OPropertyArrayHelper* operator()() - { - static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); - return &aPropHelper; - } - -private: - static Sequence< Property > lcl_GetPropertySequence() - { - std::vector< css::beans::Property > aProperties; - lcl_AddPropertiesToVector( aProperties ); - - std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); - - return comphelper::containerToSequence( aProperties ); - } - -}; - -struct StaticScatterChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticScatterChartTypeInfoHelper_Initializer > +const uno::Reference< beans::XPropertySetInfo >& StaticScatterChartTypeInfo() { -}; - -struct StaticScatterChartTypeInfo_Initializer -{ - uno::Reference< beans::XPropertySetInfo >* operator()() - { - static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( - ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticScatterChartTypeInfoHelper::get() ) ); - return &xPropertySetInfo; - } -}; - -struct StaticScatterChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticScatterChartTypeInfo_Initializer > -{ -}; + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(StaticScatterChartTypeInfoHelper() ) ); + return xPropertySetInfo; +} } // anonymous namespace @@ -204,7 +171,7 @@ uno::Sequence< OUString > SAL_CALL ScatterChartType::getSupportedMandatoryRoles( // ____ OPropertySet ____ void ScatterChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const { - const tPropertyValueMap& rStaticDefaults = *StaticScatterChartTypeDefaults::get(); + const tPropertyValueMap& rStaticDefaults = StaticScatterChartTypeDefaults(); tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); if( aFound == rStaticDefaults.end() ) rAny.clear(); @@ -215,13 +182,13 @@ void ScatterChartType::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) cons // ____ OPropertySet ____ ::cppu::IPropertyArrayHelper & SAL_CALL ScatterChartType::getInfoHelper() { - return *StaticScatterChartTypeInfoHelper::get(); + return StaticScatterChartTypeInfoHelper(); } // ____ XPropertySet ____ uno::Reference< beans::XPropertySetInfo > SAL_CALL ScatterChartType::getPropertySetInfo() { - return *StaticScatterChartTypeInfo::get(); + return StaticScatterChartTypeInfo(); } OUString SAL_CALL ScatterChartType::getImplementationName() diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx index 84315c79ddc9..bd02e69fb2e9 100644 --- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx +++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx @@ -58,89 +58,58 @@ enum }; -void lcl_AddPropertiesToVector( - std::vector< Property > & rOutProperties ) +const ::chart::tPropertyValueMap& StaticScatterChartTypeTemplateDefaults() { - rOutProperties.emplace_back( CHART_UNONAME_CURVE_STYLE, - PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, - cppu::UnoType<chart2::CurveStyle>::get(), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( CHART_UNONAME_CURVE_RESOLUTION, - PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, - cppu::UnoType<sal_Int32>::get(), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); - rOutProperties.emplace_back( CHART_UNONAME_SPLINE_ORDER, - PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER, - cppu::UnoType<sal_Int32>::get(), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT ); + static const ::chart::tPropertyValueMap aStaticDefaults = + []() + { + ::chart::tPropertyValueMap aOutMap; + ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, chart2::CurveStyle_LINES ); + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, 20 ); + + // todo: check whether order 3 means polygons of order 3 or 2. (see + // http://www.people.nnov.ru/fractal/Splines/Basis.htm ) + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER, 3 ); + return aOutMap; + }(); + return aStaticDefaults; } -struct StaticScatterChartTypeTemplateDefaults_Initializer -{ - ::chart::tPropertyValueMap* operator()() - { - static ::chart::tPropertyValueMap aStaticDefaults; - lcl_AddDefaultsToMap( aStaticDefaults ); - return &aStaticDefaults; - } -private: - static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) - { - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, chart2::CurveStyle_LINES ); - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, 20 ); - - // todo: check whether order 3 means polygons of order 3 or 2. (see - // http://www.people.nnov.ru/fractal/Splines/Basis.htm ) - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER, 3 ); - } -}; - -struct StaticScatterChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticScatterChartTypeTemplateDefaults_Initializer > -{ -}; - -struct StaticScatterChartTypeTemplateInfoHelper_Initializer -{ - ::cppu::OPropertyArrayHelper* operator()() - { - static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() ); - return &aPropHelper; - } - -private: - static Sequence< Property > lcl_GetPropertySequence() - { - std::vector< css::beans::Property > aProperties; - lcl_AddPropertiesToVector( aProperties ); - - std::sort( aProperties.begin(), aProperties.end(), - ::chart::PropertyNameLess() ); - - return comphelper::containerToSequence( aProperties ); - } - -}; - -struct StaticScatterChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticScatterChartTypeTemplateInfoHelper_Initializer > -{ -}; -struct StaticScatterChartTypeTemplateInfo_Initializer +::cppu::OPropertyArrayHelper& StaticScatterChartTypeTemplateInfoHelper() { - uno::Reference< beans::XPropertySetInfo >* operator()() - { - static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( - ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticScatterChartTypeTemplateInfoHelper::get() ) ); - return &xPropertySetInfo; - } -}; + static ::cppu::OPropertyArrayHelper aPropHelper( + []() + { + std::vector< css::beans::Property > aProperties { + { CHART_UNONAME_CURVE_STYLE, + PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, + cppu::UnoType<chart2::CurveStyle>::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT }, + { CHART_UNONAME_CURVE_RESOLUTION, + PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, + cppu::UnoType<sal_Int32>::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT }, + { CHART_UNONAME_SPLINE_ORDER, + PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER, + cppu::UnoType<sal_Int32>::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT } }; + std::sort( aProperties.begin(), aProperties.end(), + ::chart::PropertyNameLess() ); + return comphelper::containerToSequence( aProperties ); + }() ); + return aPropHelper; +} -struct StaticScatterChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticScatterChartTypeTemplateInfo_Initializer > +const uno::Reference< beans::XPropertySetInfo >& StaticScatterChartTypeTemplateInfo() { -}; + static const uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(StaticScatterChartTypeTemplateInfoHelper() ) ); + return xPropertySetInfo; +} } // anonymous namespace @@ -170,7 +139,7 @@ ScatterChartTypeTemplate::~ScatterChartTypeTemplate() // ____ OPropertySet ____ void ScatterChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAny ) const { - const tPropertyValueMap& rStaticDefaults = *StaticScatterChartTypeTemplateDefaults::get(); + const tPropertyValueMap& rStaticDefaults = StaticScatterChartTypeTemplateDefaults(); tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); if( aFound == rStaticDefaults.end() ) rAny.clear(); @@ -180,13 +149,13 @@ void ScatterChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle, uno::Any& rAn ::cppu::IPropertyArrayHelper & SAL_CALL ScatterChartTypeTemplate::getInfoHelper() { - return *StaticScatterChartTypeTemplateInfoHelper::get(); + return StaticScatterChartTypeTemplateInfoHelper(); } // ____ XPropertySet ____ uno::Reference< beans::XPropertySetInfo > SAL_CALL ScatterChartTypeTemplate::getPropertySetInfo() { - return *StaticScatterChartTypeTemplateInfo::get(); + return StaticScatterChartTypeTemplateInfo(); } sal_Int32 ScatterChartTypeTemplate::getDimension() const |