rtl::Static-> thread-safe-static in chart2

Change-Id: Ie629e4e2d4e3a56894bc964b8bb50dac5823cf4c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149337
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2023-03-23 06:11:52 +00:00
committed by Noel Grandin
parent edb2c2a9f1
commit 4e8f36fcd4
11 changed files with 188 additions and 385 deletions
@@ -36,38 +36,6 @@ using ::osl::MutexGuard;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
namespace
{
struct StaticAreaWrapperPropertyArray_Initializer
{
Sequence< Property >* operator()()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
return &aPropSeq;
}
private:
static Sequence< Property > lcl_GetPropertySequence()
{
std::vector< css::beans::Property > aProperties;
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}
};
struct StaticAreaWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticAreaWrapperPropertyArray_Initializer >
{
};
} // anonymous namespace
namespace chart::wrapper
{
@@ -142,7 +110,19 @@ Reference< beans::XPropertySet > AreaWrapper::getInnerPropertySet()
const Sequence< beans::Property >& AreaWrapper::getPropertySequence()
{
return *StaticAreaWrapperPropertyArray::get();
static Sequence< Property > aPropSeq = []()
{
std::vector< css::beans::Property > aProperties;
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}();
return aPropSeq;
}
std::vector< std::unique_ptr<WrappedProperty> > AreaWrapper::createWrappedProperties()
@@ -335,33 +335,23 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID );
}
struct StaticAxisWrapperPropertyArray_Initializer
const Sequence< Property >& StaticAxisWrapperPropertyArray()
{
Sequence< Property >* operator()()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
return &aPropSeq;
}
static Sequence< Property > aPropSeq = []()
{
std::vector< css::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
private:
static Sequence< Property > lcl_GetPropertySequence()
{
std::vector< css::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}
};
struct StaticAxisWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticAxisWrapperPropertyArray_Initializer >
{
return comphelper::containerToSequence( aProperties );
}();
return aPropSeq;
};
} // anonymous namespace
@@ -607,7 +597,7 @@ Reference< beans::XPropertySet > AxisWrapper::getInnerPropertySet()
const Sequence< beans::Property >& AxisWrapper::getPropertySequence()
{
return *StaticAxisWrapperPropertyArray::get();
return StaticAxisWrapperPropertyArray();
}
std::vector< std::unique_ptr<WrappedProperty> > AxisWrapper::createWrappedProperties()
@@ -221,30 +221,20 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::MAYBEDEFAULT );
}
struct StaticChartDocumentWrapperPropertyArray_Initializer
const Sequence< Property > & StaticChartDocumentWrapperPropertyArray()
{
Sequence< Property >* operator()()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
return &aPropSeq;
}
static Sequence< Property > aPropSeq = []()
{
std::vector< css::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
private:
static uno::Sequence< Property > lcl_GetPropertySequence()
{
std::vector< css::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}
};
struct StaticChartDocumentWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticChartDocumentWrapperPropertyArray_Initializer >
{
};
return comphelper::containerToSequence( aProperties );
}();
return aPropSeq;
}
} // anonymous namespace
@@ -1384,7 +1374,7 @@ Reference< beans::XPropertySet > ChartDocumentWrapper::getInnerPropertySet()
}
const Sequence< beans::Property >& ChartDocumentWrapper::getPropertySequence()
{
return *StaticChartDocumentWrapperPropertyArray::get();
return StaticChartDocumentWrapperPropertyArray();
}
std::vector< std::unique_ptr<WrappedProperty> > ChartDocumentWrapper::createWrappedProperties()
@@ -247,30 +247,16 @@ uno::Sequence< Property > lcl_GetPropertySequence( DataSeriesPointWrapper::eType
return comphelper::containerToSequence( aProperties );
}
struct StaticSeriesWrapperPropertyArray_Initializer
const Sequence< Property >& StaticSeriesWrapperPropertyArray()
{
Sequence< Property >* operator()()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_SERIES ) );
return &aPropSeq;
}
static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_SERIES ) );
return aPropSeq;
};
struct StaticSeriesWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticSeriesWrapperPropertyArray_Initializer >
{
};
struct StaticPointWrapperPropertyArray_Initializer
{
Sequence< Property >* operator()()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_POINT ) );
return &aPropSeq;
}
};
struct StaticPointWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticPointWrapperPropertyArray_Initializer >
const Sequence< Property >& StaticPointWrapperPropertyArray()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_POINT ) );
return aPropSeq;
};
//PROP_SERIES_ATTACHED_AXIS
@@ -720,9 +706,9 @@ Reference< beans::XPropertySet > DataSeriesPointWrapper::getInnerPropertySet()
const Sequence< beans::Property >& DataSeriesPointWrapper::getPropertySequence()
{
if( m_eType == DATA_SERIES )
return *StaticSeriesWrapperPropertyArray::get();
return StaticSeriesWrapperPropertyArray();
else
return *StaticPointWrapperPropertyArray::get();
return StaticPointWrapperPropertyArray();
}
std::vector< std::unique_ptr<WrappedProperty> > DataSeriesPointWrapper::createWrappedProperties()
@@ -386,39 +386,29 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID );
}
struct StaticDiagramWrapperPropertyArray_Initializer
const Sequence< Property >& StaticDiagramWrapperPropertyArray()
{
Sequence< Property >* operator()()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
return &aPropSeq;
}
static Sequence< Property > aPropSeq = []()
{
std::vector< css::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
::chart::SceneProperties::AddPropertiesToVector( aProperties );
WrappedStatisticProperties::addProperties( aProperties );
WrappedSymbolProperties::addProperties( aProperties );
WrappedDataCaptionProperties::addProperties( aProperties );
WrappedSplineProperties::addProperties( aProperties );
WrappedStockProperties::addProperties( aProperties );
WrappedAutomaticPositionProperties::addProperties( aProperties );
private:
static uno::Sequence< Property > lcl_GetPropertySequence()
{
std::vector< css::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
::chart::SceneProperties::AddPropertiesToVector( aProperties );
WrappedStatisticProperties::addProperties( aProperties );
WrappedSymbolProperties::addProperties( aProperties );
WrappedDataCaptionProperties::addProperties( aProperties );
WrappedSplineProperties::addProperties( aProperties );
WrappedStockProperties::addProperties( aProperties );
WrappedAutomaticPositionProperties::addProperties( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}
};
struct StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticDiagramWrapperPropertyArray_Initializer >
{
return comphelper::containerToSequence( aProperties );
}();
return aPropSeq;
};
bool lcl_isXYChart( const rtl::Reference< ::chart::Diagram >& xDiagram )
@@ -1842,7 +1832,7 @@ Reference< beans::XPropertySet > DiagramWrapper::getInnerPropertySet()
const Sequence< beans::Property >& DiagramWrapper::getPropertySequence()
{
return *StaticDiagramWrapperPropertyArray::get();
return StaticDiagramWrapperPropertyArray();
}
std::vector< std::unique_ptr<WrappedProperty> > DiagramWrapper::createWrappedProperties()
@@ -40,36 +40,6 @@ using ::com::sun::star::beans::Property;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
namespace
{
struct StaticGridWrapperPropertyArray_Initializer
{
Sequence< Property >* operator()()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
return &aPropSeq;
}
private:
static Sequence< Property > lcl_GetPropertySequence()
{
std::vector< css::beans::Property > aProperties;
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}
};
struct StaticGridWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticGridWrapperPropertyArray_Initializer >
{
};
} // anonymous namespace
namespace chart::wrapper
{
@@ -154,7 +124,18 @@ Reference< beans::XPropertySet > GridWrapper::getInnerPropertySet()
const Sequence< beans::Property >& GridWrapper::getPropertySequence()
{
return *StaticGridWrapperPropertyArray::get();
static Sequence< Property > aPropSeq = []()
{
std::vector< css::beans::Property > aProperties;
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}();
return aPropSeq;
}
std::vector< std::unique_ptr<WrappedProperty> > GridWrapper::createWrappedProperties()
@@ -225,35 +225,25 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::MAYBEDEFAULT );
}
struct StaticLegendWrapperPropertyArray_Initializer
const Sequence< Property >& StaticLegendWrapperPropertyArray()
{
Sequence< Property >* operator()()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
return &aPropSeq;
}
static Sequence< Property > aPropSeq = []()
{
std::vector< css::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
private:
static Sequence< Property > lcl_GetPropertySequence()
{
std::vector< css::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}
};
struct StaticLegendWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticLegendWrapperPropertyArray_Initializer >
{
return comphelper::containerToSequence( aProperties );
}();
return aPropSeq;
};
} // anonymous namespace
@@ -380,7 +370,7 @@ Reference< beans::XPropertySet > LegendWrapper::getInnerPropertySet()
const Sequence< beans::Property >& LegendWrapper::getPropertySequence()
{
return *StaticLegendWrapperPropertyArray::get();
return StaticLegendWrapperPropertyArray();
}
std::vector< std::unique_ptr<WrappedProperty> > LegendWrapper::createWrappedProperties()
@@ -43,72 +43,34 @@ using ::com::sun::star::uno::Any;
namespace
{
struct StaticMinMaxLineWrapperDefaults_Initializer
Sequence< Property >& StaticMinMaxLineWrapperPropertyArray()
{
::chart::tPropertyValueMap* operator()()
{
static ::chart::tPropertyValueMap aStaticDefaults;
::chart::LinePropertiesHelper::AddDefaultsToMap( aStaticDefaults );
return &aStaticDefaults;
}
static Sequence< Property > aPropSeq = []()
{
std::vector< css::beans::Property > aProperties;
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}();
return aPropSeq;
};
struct StaticMinMaxLineWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticMinMaxLineWrapperDefaults_Initializer >
::cppu::OPropertyArrayHelper& StaticMinMaxLineWrapperInfoHelper()
{
static ::cppu::OPropertyArrayHelper aPropHelper( StaticMinMaxLineWrapperPropertyArray() );
return aPropHelper;
};
struct StaticMinMaxLineWrapperPropertyArray_Initializer
{
Sequence< Property >* operator()()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
return &aPropSeq;
}
private:
static Sequence< Property > lcl_GetPropertySequence()
{
std::vector< css::beans::Property > aProperties;
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}
};
struct StaticMinMaxLineWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticMinMaxLineWrapperPropertyArray_Initializer >
{
};
struct StaticMinMaxLineWrapperInfoHelper_Initializer
{
::cppu::OPropertyArrayHelper* operator()()
{
static ::cppu::OPropertyArrayHelper aPropHelper( *StaticMinMaxLineWrapperPropertyArray::get() );
return &aPropHelper;
}
};
struct StaticMinMaxLineWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticMinMaxLineWrapperInfoHelper_Initializer >
{
};
struct StaticMinMaxLineWrapperInfo_Initializer
{
uno::Reference< beans::XPropertySetInfo >* operator()()
{
static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
::cppu::OPropertySetHelper::createPropertySetInfo(*StaticMinMaxLineWrapperInfoHelper::get() ) );
return &xPropertySetInfo;
}
};
struct StaticMinMaxLineWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticMinMaxLineWrapperInfo_Initializer >
uno::Reference< beans::XPropertySetInfo >& StaticMinMaxLineWrapperInfo()
{
static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
::cppu::OPropertySetHelper::createPropertySetInfo( StaticMinMaxLineWrapperInfoHelper() ) );
return xPropertySetInfo;
};
} // anonymous namespace
@@ -151,7 +113,7 @@ void SAL_CALL MinMaxLineWrapper::removeEventListener(
//XPropertySet
uno::Reference< beans::XPropertySetInfo > SAL_CALL MinMaxLineWrapper::getPropertySetInfo()
{
return *StaticMinMaxLineWrapperInfo::get();
return StaticMinMaxLineWrapperInfo();
}
void SAL_CALL MinMaxLineWrapper::setPropertyValue( const OUString& rPropertyName, const uno::Any& rValue )
@@ -321,9 +283,14 @@ void SAL_CALL MinMaxLineWrapper::setPropertyToDefault( const OUString& rProperty
uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const OUString& rPropertyName )
{
const tPropertyValueMap& rStaticDefaults = *StaticMinMaxLineWrapperDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( StaticMinMaxLineWrapperInfoHelper::get()->getHandleByName( rPropertyName ) ) );
if( aFound == rStaticDefaults.end() )
static const ::chart::tPropertyValueMap aStaticDefaults = []
{
::chart::tPropertyValueMap aTmp;
::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp );
return aTmp;
}();
tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( StaticMinMaxLineWrapperInfoHelper().getHandleByName( rPropertyName ) ) );
if( aFound == aStaticDefaults.end() )
return uno::Any();
return (*aFound).second;
}
@@ -332,7 +299,7 @@ uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const OUString& rProper
//getPropertyStates() already declared in XPropertyState
void SAL_CALL MinMaxLineWrapper::setAllPropertiesToDefault( )
{
const Sequence< beans::Property >& rPropSeq = *StaticMinMaxLineWrapperPropertyArray::get();
const Sequence< beans::Property >& rPropSeq = StaticMinMaxLineWrapperPropertyArray();
for(beans::Property const & prop : rPropSeq)
{
setPropertyToDefault( prop.Name );
@@ -153,36 +153,27 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT );
}
struct StaticTitleWrapperPropertyArray_Initializer
const Sequence< Property > & StaticTitleWrapperPropertyArray()
{
Sequence< Property >* operator()()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
return &aPropSeq;
}
static Sequence< Property > aPropSeq = []()
{
std::vector< beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
private:
static Sequence< Property > lcl_GetPropertySequence()
{
std::vector< beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}
return comphelper::containerToSequence( aProperties );
}();
return aPropSeq;
};
struct StaticTitleWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticTitleWrapperPropertyArray_Initializer >
{
};
} // anonymous namespace
@@ -470,7 +461,7 @@ Reference< beans::XPropertySet > TitleWrapper::getInnerPropertySet()
const Sequence< beans::Property >& TitleWrapper::getPropertySequence()
{
return *StaticTitleWrapperPropertyArray::get();
return StaticTitleWrapperPropertyArray();
}
std::vector< std::unique_ptr<WrappedProperty> > TitleWrapper::createWrappedProperties()
@@ -43,79 +43,28 @@ using ::com::sun::star::uno::Any;
namespace
{
struct StaticUpDownBarWrapperPropertyArray_Initializer
const Sequence< Property > & StaticUpDownBarWrapperPropertyArray()
{
Sequence< Property >* operator()()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
return &aPropSeq;
}
static Sequence< Property > aPropSeq = []()
{
std::vector< css::beans::Property > aProperties;
private:
static Sequence< Property > lcl_GetPropertySequence()
{
std::vector< css::beans::Property > aProperties;
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}
return comphelper::containerToSequence( aProperties );
}();
return aPropSeq;
};
struct StaticUpDownBarWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticUpDownBarWrapperPropertyArray_Initializer >
{
};
struct StaticUpDownBarWrapperInfoHelper_Initializer
{
::cppu::OPropertyArrayHelper* operator()()
{
static ::cppu::OPropertyArrayHelper aPropHelper( *StaticUpDownBarWrapperPropertyArray::get() );
return &aPropHelper;
}
};
struct StaticUpDownBarWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticUpDownBarWrapperInfoHelper_Initializer >
{
};
struct StaticUpDownBarWrapperInfo_Initializer
{
uno::Reference< beans::XPropertySetInfo >* operator()()
{
static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
::cppu::OPropertySetHelper::createPropertySetInfo(*StaticUpDownBarWrapperInfoHelper::get() ) );
return &xPropertySetInfo;
}
};
struct StaticUpDownBarWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticUpDownBarWrapperInfo_Initializer >
{
};
struct StaticUpDownBarWrapperDefaults_Initializer
{
::chart::tPropertyValueMap* operator()()
{
static ::chart::tPropertyValueMap aStaticDefaults;
lcl_AddDefaultsToMap( aStaticDefaults );
return &aStaticDefaults;
}
private:
static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
{
::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap );
::chart::FillProperties::AddDefaultsToMap( rOutMap );
}
};
struct StaticUpDownBarWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticUpDownBarWrapperDefaults_Initializer >
::cppu::OPropertyArrayHelper& StaticUpDownBarWrapperInfoHelper()
{
static ::cppu::OPropertyArrayHelper aPropHelper( StaticUpDownBarWrapperPropertyArray() );
return aPropHelper;
};
} // anonymous namespace
@@ -159,8 +108,11 @@ void SAL_CALL UpDownBarWrapper::removeEventListener(
//XPropertySet
uno::Reference< beans::XPropertySetInfo > SAL_CALL UpDownBarWrapper::getPropertySetInfo()
{
return *StaticUpDownBarWrapperInfo::get();
static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
::cppu::OPropertySetHelper::createPropertySetInfo(StaticUpDownBarWrapperInfoHelper() ) );
return xPropertySetInfo;
}
void SAL_CALL UpDownBarWrapper::setPropertyValue( const OUString& rPropertyName, const uno::Any& rValue )
{
Reference< beans::XPropertySet > xPropSet;
@@ -294,9 +246,15 @@ void SAL_CALL UpDownBarWrapper::setPropertyToDefault( const OUString& rPropertyN
uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const OUString& rPropertyName )
{
const tPropertyValueMap& rStaticDefaults = *StaticUpDownBarWrapperDefaults::get();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( StaticUpDownBarWrapperInfoHelper::get()->getHandleByName( rPropertyName ) ) );
if( aFound == rStaticDefaults.end() )
static const ::chart::tPropertyValueMap aStaticDefaults = []()
{
::chart::tPropertyValueMap aTmp;
::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp );
::chart::FillProperties::AddDefaultsToMap( aTmp );
return aTmp;
}();
tPropertyValueMap::const_iterator aFound( aStaticDefaults.find( StaticUpDownBarWrapperInfoHelper().getHandleByName( rPropertyName ) ) );
if( aFound == aStaticDefaults.end() )
return uno::Any();
return (*aFound).second;
}
@@ -305,7 +263,7 @@ uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const OUString& rPropert
//getPropertyStates() already declared in XPropertyState
void SAL_CALL UpDownBarWrapper::setAllPropertiesToDefault( )
{
const Sequence< beans::Property >& rPropSeq = *StaticUpDownBarWrapperPropertyArray::get();
const Sequence< beans::Property >& rPropSeq = StaticUpDownBarWrapperPropertyArray();
for(beans::Property const & prop : rPropSeq)
{
setPropertyToDefault( prop.Name );
@@ -38,38 +38,6 @@ using ::osl::MutexGuard;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
namespace
{
struct StaticWallFloorWrapperPropertyArray_Initializer
{
Sequence< Property >* operator()()
{
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
return &aPropSeq;
}
private:
static Sequence< Property > lcl_GetPropertySequence()
{
std::vector< css::beans::Property > aProperties;
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}
};
struct StaticWallFloorWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticWallFloorWrapperPropertyArray_Initializer >
{
};
} // anonymous namespace
namespace chart::wrapper
{
@@ -128,7 +96,19 @@ Reference< beans::XPropertySet > WallFloorWrapper::getInnerPropertySet()
const Sequence< beans::Property >& WallFloorWrapper::getPropertySequence()
{
return *StaticWallFloorWrapperPropertyArray::get();
static Sequence< Property > aPropSeq = []()
{
std::vector< css::beans::Property > aProperties;
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
}();
return aPropSeq;
}
std::vector< std::unique_ptr<WrappedProperty> > WallFloorWrapper::createWrappedProperties()