summaryrefslogtreecommitdiff
path: root/chart2/source/model
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/model')
-rw-r--r--chart2/source/model/inc/DataSeries.hxx4
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/Axis.cxx142
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/BaseCoordinateSystem.cxx99
-rwxr-xr-xchart2/source/model/main/ChartModel.cxx13
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/ChartModel.hxx19
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/DataPoint.cxx73
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/DataPoint.hxx7
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/DataSeries.cxx115
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/Diagram.cxx114
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/FormattedString.cxx100
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/GridProperties.cxx105
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/Legend.cxx123
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/PageBackground.cxx112
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/StockBar.cxx110
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/Title.cxx144
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/Wall.cxx112
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/AreaChartTypeTemplate.cxx101
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/BarChartTypeTemplate.cxx103
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/BubbleChartType.cxx98
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/BubbleChartTypeTemplate.cxx99
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/CandleStickChartType.cxx109
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/ChartType.cxx57
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/ChartTypeTemplate.cxx1
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/ColumnChartType.cxx108
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/ColumnLineChartTypeTemplate.cxx101
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/DataInterpreter.cxx4
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/LineChartType.cxx109
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/LineChartTypeTemplate.cxx109
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/NetChartType.cxx54
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/PieChartType.cxx101
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/PieChartTypeTemplate.cxx108
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/ScatterChartType.cxx109
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/ScatterChartTypeTemplate.cxx109
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/StockChartTypeTemplate.cxx106
-rwxr-xr-x[-rw-r--r--]chart2/source/model/template/_serviceregistration_charttypes.cxx1
35 files changed, 1479 insertions, 1500 deletions
diff --git a/chart2/source/model/inc/DataSeries.hxx b/chart2/source/model/inc/DataSeries.hxx
index e05bac782b86..c557e537da70 100644
--- a/chart2/source/model/inc/DataSeries.hxx
+++ b/chart2/source/model/inc/DataSeries.hxx
@@ -198,10 +198,6 @@ protected:
void fireModifyEvent();
- /** const variant of getInfoHelper()
- */
- ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelperConst() const;
-
private:
::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >
diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx
index fd1d78ebe071..165ebe0f0717 100644..100755
--- a/chart2/source/model/main/Axis.cxx
+++ b/chart2/source/model/main/Axis.cxx
@@ -194,63 +194,86 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::MAYBEDEFAULT ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
-{
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_SHOW, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_CROSSOVER_POSITION, ::com::sun::star::chart::ChartAxisPosition_ZERO );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_DISPLAY_LABELS, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LABEL_POSITION, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS );
- ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_AXIS_TEXT_ROTATION, 0.0 );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_BREAK, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_OVERLAP, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_STACKED, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_ARRANGE_ORDER, ::com::sun::star::chart::ChartAxisArrangeOrderType_AUTO );
-
- float fDefaultCharHeight = 10.0;
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
-
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AXIS_MAJOR_TICKMARKS, 2 /* CHAXIS_MARK_OUTER */ );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AXIS_MINOR_TICKMARKS, 0 /* CHAXIS_MARK_NONE */ );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_MARK_POSITION, ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
-}
+struct StaticAxisDefaults_Initializer
+{
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::CharacterProperties::AddDefaultsToMap( rOutMap );
+ ::chart::LineProperties::AddDefaultsToMap( rOutMap );
+
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_SHOW, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_CROSSOVER_POSITION, ::com::sun::star::chart::ChartAxisPosition_ZERO );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_DISPLAY_LABELS, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_LABEL_POSITION, ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS );
+ ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_AXIS_TEXT_ROTATION, 0.0 );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_BREAK, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_OVERLAP, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_STACKED, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_ARRANGE_ORDER, ::com::sun::star::chart::ChartAxisArrangeOrderType_AUTO );
+
+ float fDefaultCharHeight = 10.0;
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
+
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AXIS_MAJOR_TICKMARKS, 2 /* CHAXIS_MARK_OUTER */ );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AXIS_MINOR_TICKMARKS, 0 /* CHAXIS_MARK_NONE */ );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_MARK_POSITION, ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
+ }
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticAxisDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticAxisDefaults_Initializer >
{
- static Sequence< Property > aPropSeq;
+};
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+struct StaticAxisInfoHelper_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 );
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
::chart::LineProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::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 StaticAxisInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticAxisInfoHelper_Initializer >
+{
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticAxisInfo_Initializer
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticAxisInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
- return aArrayHelper;
-}
+struct StaticAxisInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticAxisInfo_Initializer >
+{
+};
typedef uno::Reference< beans::XPropertySet > lcl_tSubGridType;
typedef uno::Sequence< lcl_tSubGridType > lcl_tSubGridSeq;
@@ -577,52 +600,23 @@ void Axis::fireModifyEvent()
uno::Any Axis::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
- static tPropertyValueMap aStaticDefaults;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aStaticDefaults.size() )
- {
- CharacterProperties::AddDefaultsToMap( aStaticDefaults );
- LineProperties::AddDefaultsToMap( aStaticDefaults );
-
- // initialize defaults
- lcl_AddDefaultsToMap( aStaticDefaults );
- }
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
+ const tPropertyValueMap& rStaticDefaults = *StaticAxisDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL Axis::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticAxisInfoHelper::get();
}
-
// ____ XPropertySet ____
-Reference< beans::XPropertySetInfo > SAL_CALL
- Axis::getPropertySetInfo()
+Reference< beans::XPropertySetInfo > SAL_CALL Axis::getPropertySetInfo()
throw (uno::RuntimeException)
{
- static Reference< beans::XPropertySetInfo > xInfo;
-
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !xInfo.is())
- {
- xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
- getInfoHelper());
- }
-
- return xInfo;
- // \--
+ return *StaticAxisInfo::get();
}
// ================================================================================
diff --git a/chart2/source/model/main/BaseCoordinateSystem.cxx b/chart2/source/model/main/BaseCoordinateSystem.cxx
index 4fa58cff5039..80fa0b51575f 100644..100755
--- a/chart2/source/model/main/BaseCoordinateSystem.cxx
+++ b/chart2/source/model/main/BaseCoordinateSystem.cxx
@@ -69,35 +69,64 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticCooSysDefaults_Initializer
{
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_COORDINATESYSTEM_SWAPXANDYAXIS, 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_COORDINATESYSTEM_SWAPXANDYAXIS, false );
+ }
+};
+
+struct StaticCooSysDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticCooSysDefaults_Initializer >
+{
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticCooSysInfoHelper_Initializer
{
- static Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+private:
+ Sequence< Property > lcl_GetPropertySequence()
{
- // get properties
::std::vector< ::com::sun::star::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::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 StaticCooSysInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticCooSysInfoHelper_Initializer >
+{
+};
+
+struct StaticCooSysInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticCooSysInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticCooSysInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticCooSysInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -352,53 +381,25 @@ void BaseCoordinateSystem::fireModifyEvent()
uno::Any BaseCoordinateSystem::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 = *StaticCooSysDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL BaseCoordinateSystem::getInfoHelper()
{
- static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
-
- return aArrayHelper;
+ return *StaticCooSysInfoHelper::get();
}
// ____ XPropertySet ____
-Reference< beans::XPropertySetInfo > SAL_CALL
- BaseCoordinateSystem::getPropertySetInfo()
+Reference< beans::XPropertySetInfo > SAL_CALL BaseCoordinateSystem::getPropertySetInfo()
throw (uno::RuntimeException)
{
- static Reference< beans::XPropertySetInfo > xInfo;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !xInfo.is())
- {
- xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
- getInfoHelper());
- }
-
- return xInfo;
- // \--
+ return *StaticCooSysInfo::get();
}
using impl::BaseCoordinateSystem_Base;
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 5a30d97118c5..95bc1315ad51 100755
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -182,6 +182,16 @@ ChartModel::~ChartModel()
m_xOldModelAgg->setDelegator( 0 );
}
+void SAL_CALL ChartModel::initialize( const Sequence< Any >& /*rArguments*/ )
+ throw (uno::Exception, uno::RuntimeException)
+{
+ //#i113722# avoid duplicate creation
+
+ //maybe additional todo?:
+ //support argument "EmbeddedObject"?
+ //support argument "EmbeddedScriptSupport"?
+ //support argument "DocumentRecoverySupport"?
+}
//-----------------------------------------------------------------
// private methods
@@ -1301,7 +1311,8 @@ Reference< util::XNumberFormatsSupplier > ChartModel::impl_getNumberFormatsSuppl
if( !m_xOwnNumberFormatsSupplier.is() )
{
Reference< lang::XMultiServiceFactory > xFactory( m_xContext->getServiceManager(), uno::UNO_QUERY );
- m_xOwnNumberFormatsSupplier = new SvNumberFormatsSupplierObj( new SvNumberFormatter( xFactory, LANGUAGE_SYSTEM ) );
+ m_apSvNumberFormatter.reset( new SvNumberFormatter( xFactory, LANGUAGE_SYSTEM ) );
+ m_xOwnNumberFormatsSupplier = new SvNumberFormatsSupplierObj( m_apSvNumberFormatter.get() );
//pOwnNumberFormatter->ChangeStandardPrec( 15 ); todo?
}
m_xNumberFormatsSupplier = m_xOwnNumberFormatsSupplier;
diff --git a/chart2/source/model/main/ChartModel.hxx b/chart2/source/model/main/ChartModel.hxx
index 23da02f3f83a..190d4f597c94 100644..100755
--- a/chart2/source/model/main/ChartModel.hxx
+++ b/chart2/source/model/main/ChartModel.hxx
@@ -38,6 +38,7 @@
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/util/XCloneable.hpp>
#include <com/sun/star/embed/XVisualObject.hpp>
@@ -62,9 +63,9 @@
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/datatransfer/XTransferable.hpp>
-#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_20)
-#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_20
-#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 20
+#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_21)
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_21
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 21
#include "comphelper/implbase_var.hxx"
#endif
#include <osl/mutex.hxx>
@@ -74,6 +75,8 @@
// for auto_ptr
#include <memory>
+class SvNumberFormatter;
+
//=============================================================================
/** this is an example implementation for the service ::com::sun::star::document::OfficeDocument
*/
@@ -85,7 +88,7 @@ namespace impl
{
// Note: needed for queryInterface (if it calls the base-class implementation)
-typedef ::comphelper::WeakImplHelper20<
+typedef ::comphelper::WeakImplHelper21<
// ::com::sun::star::frame::XModel //comprehends XComponent (required interface), base of XChartDocument
::com::sun::star::util::XCloseable //comprehends XCloseBroadcaster
,::com::sun::star::frame::XStorable2 //(extension of XStorable)
@@ -95,6 +98,7 @@ typedef ::comphelper::WeakImplHelper20<
// ,::com::sun::star::uno::XInterface // implemented by WeakImplHelper(optional interface)
// ,::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
,::com::sun::star::lang::XServiceInfo
+ ,::com::sun::star::lang::XInitialization
,::com::sun::star::chart2::XChartDocument // derived from XModel
,::com::sun::star::chart2::data::XDataReceiver // public API
,::com::sun::star::chart2::XTitled
@@ -157,6 +161,7 @@ private:
m_xOwnNumberFormatsSupplier;
::com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatsSupplier >
m_xNumberFormatsSupplier;
+ std::auto_ptr< SvNumberFormatter > m_apSvNumberFormatter; // #i113784# avoid memory leak
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartTypeManager >
m_xChartTypeManager;
@@ -246,6 +251,12 @@ public:
APPHELPER_SERVICE_FACTORY_HELPER(ChartModel)
//-----------------------------------------------------------------
+ // ::com::sun::star::lang::XInitialization
+ //-----------------------------------------------------------------
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ //-----------------------------------------------------------------
// ::com::sun::star::frame::XModel (required interface)
//-----------------------------------------------------------------
diff --git a/chart2/source/model/main/DataPoint.cxx b/chart2/source/model/main/DataPoint.cxx
index 1f3d92e4d94b..e658000cc9dd 100644..100755
--- a/chart2/source/model/main/DataPoint.cxx
+++ b/chart2/source/model/main/DataPoint.cxx
@@ -53,30 +53,48 @@ using ::rtl::OUString;
namespace
{
-const Sequence< Property > & lcl_GetPropertySequence()
+
+struct StaticDataPointInfoHelper_Initializer
{
- static Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+private:
+ Sequence< Property > lcl_GetPropertySequence()
{
- // get properties
::std::vector< ::com::sun::star::beans::Property > aProperties;
::chart::DataPointProperties::AddPropertiesToVector( aProperties );
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::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 );
}
+};
+
+struct StaticDataPointInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticDataPointInfoHelper_Initializer >
+{
+};
+
+struct StaticDataPointInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticDataPointInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticDataPointInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticDataPointInfo_Initializer >
+{
+};
- return aPropSeq;
-}
} // anonymous namespace
// ____________________________________________________________
@@ -157,7 +175,7 @@ uno::Reference< util::XCloneable > SAL_CALL DataPoint::createClone()
Reference< uno::XInterface > SAL_CALL DataPoint::getParent()
throw (uno::RuntimeException)
{
- return Reference< uno::XInterface >( m_xParentProperties, uno::UNO_QUERY );
+ return Reference< uno::XInterface >( m_xParentProperties.get(), uno::UNO_QUERY );
}
void SAL_CALL DataPoint::setParent(
@@ -165,7 +183,7 @@ void SAL_CALL DataPoint::setParent(
throw (lang::NoSupportException,
uno::RuntimeException)
{
- m_xParentProperties.set( Parent, uno::UNO_QUERY );
+ m_xParentProperties = Reference< beans::XPropertySet >( Parent, uno::UNO_QUERY );
}
// ____ OPropertySet ____
@@ -173,7 +191,7 @@ uno::Any DataPoint::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
// the value set at the data series is the default
- uno::Reference< beans::XFastPropertySet > xFast( m_xParentProperties, uno::UNO_QUERY );
+ uno::Reference< beans::XFastPropertySet > xFast( m_xParentProperties.get(), uno::UNO_QUERY );
if( !xFast.is())
{
OSL_ENSURE( m_bNoParentPropAllowed, "data point needs a parent property set to provide values correctly" );
@@ -214,35 +232,14 @@ void SAL_CALL DataPoint::setFastPropertyValue_NoBroadcast(
::cppu::IPropertyArrayHelper & SAL_CALL DataPoint::getInfoHelper()
{
- return getInfoHelperConst();
-}
-
-::cppu::IPropertyArrayHelper & SAL_CALL DataPoint::getInfoHelperConst() const
-{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
-
- return aArrayHelper;
+ return *StaticDataPointInfoHelper::get();
}
// ____ XPropertySet ____
-Reference< beans::XPropertySetInfo > SAL_CALL
- DataPoint::getPropertySetInfo()
+Reference< beans::XPropertySetInfo > SAL_CALL DataPoint::getPropertySetInfo()
throw (uno::RuntimeException)
{
- static Reference< beans::XPropertySetInfo > xInfo;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !xInfo.is())
- {
- xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
- getInfoHelper());
- }
-
- return xInfo;
- // \--
+ return *StaticDataPointInfo::get();
}
// ____ XModifyBroadcaster ____
diff --git a/chart2/source/model/main/DataPoint.hxx b/chart2/source/model/main/DataPoint.hxx
index 1498b8345963..974899f42e24 100644..100755
--- a/chart2/source/model/main/DataPoint.hxx
+++ b/chart2/source/model/main/DataPoint.hxx
@@ -29,6 +29,7 @@
#include <osl/mutex.hxx>
#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/weakref.hxx>
#include <comphelper/uno3.hxx>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/util/XCloneable.hpp>
@@ -101,10 +102,6 @@ protected:
throw (::com::sun::star::lang::NoSupportException,
::com::sun::star::uno::RuntimeException);
- /** const variant of getInfoHelper()
- */
- ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelperConst() const;
-
// ____ XModifyBroadcaster ____
virtual void SAL_CALL addModifyListener(
const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
@@ -130,7 +127,7 @@ protected:
void fireModifyEvent();
private:
- ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::WeakReference<
::com::sun::star::beans::XPropertySet > m_xParentProperties;
::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder;
diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
index 89197aa5ba3f..55ab9c9e5a59 100644..100755
--- a/chart2/source/model/main/DataSeries.cxx
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -55,30 +55,73 @@ using ::osl::MutexGuard;
namespace
{
-const uno::Sequence< Property > & lcl_GetPropertySequence()
+
+struct StaticDataSeriesDefaults_Initializer
+{
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::DataSeriesProperties::AddDefaultsToMap( rOutMap );
+ ::chart::CharacterProperties::AddDefaultsToMap( rOutMap );
+
+ float fDefaultCharHeight = 10.0;
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
+ }
+};
+
+struct StaticDataSeriesDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticDataSeriesDefaults_Initializer >
{
- static uno::Sequence< Property > aPropSeq;
+};
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+struct StaticDataSeriesInfoHelper_Initializer
+{
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
+
+private:
+ uno::Sequence< Property > lcl_GetPropertySequence()
{
- // get properties
::std::vector< ::com::sun::star::beans::Property > aProperties;
::chart::DataSeriesProperties::AddPropertiesToVector( aProperties );
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::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 StaticDataSeriesInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticDataSeriesInfoHelper_Initializer >
+{
+};
+
+struct StaticDataSeriesInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticDataSeriesInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticDataSeriesInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticDataSeriesInfo_Initializer >
+{
+};
void lcl_SetParent(
const uno::Reference< uno::XInterface > & xChildInterface,
@@ -245,60 +288,24 @@ Sequence< OUString > DataSeries::getSupportedServiceNames_Static()
uno::Any DataSeries::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
- static tPropertyValueMap aStaticDefaults;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aStaticDefaults.size() )
- {
- // initialize defaults
- DataSeriesProperties::AddDefaultsToMap( aStaticDefaults );
- CharacterProperties::AddDefaultsToMap( aStaticDefaults );
-
- float fDefaultCharHeight = 10.0;
- ::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
- }
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
- throw beans::UnknownPropertyException();
-
+ const tPropertyValueMap& rStaticDefaults = *StaticDataSeriesDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
+ return uno::Any();
return (*aFound).second;
- // \--
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL DataSeries::getInfoHelper()
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
-
- return aArrayHelper;
+ return *StaticDataSeriesInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- DataSeries::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL DataSeries::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 *StaticDataSeriesInfo::get();
}
void SAL_CALL DataSeries::getFastPropertyValue
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index ff8a0c4030bc..aac706ab0c91 100644..100755
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -41,6 +41,7 @@
#include "DisposeHelper.hxx"
#include "BaseGFXHelper.hxx"
#include <basegfx/numeric/ftools.hxx>
+#include <rtl/instance.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>
@@ -176,42 +177,71 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticDiagramDefaults_Initializer
{
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_SORT_BY_X_VALUES, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_CONNECT_BARS, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_GROUP_BARS_PER_AXIS, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_RIGHT_ANGLED_AXES, false );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
-}
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_POSSIZE_EXCLUDE_LABELS, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_SORT_BY_X_VALUES, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_CONNECT_BARS, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_GROUP_BARS_PER_AXIS, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_RIGHT_ANGLED_AXES, false );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
+ }
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticDiagramDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticDiagramDefaults_Initializer >
{
- static Sequence< Property > aPropSeq;
+};
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+struct StaticDiagramInfoHelper_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 );
::chart::SceneProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::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 StaticDiagramInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticDiagramInfoHelper_Initializer >
+{
+};
+
+struct StaticDiagramInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticDiagramInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticDiagramInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticDiagramInfo_Initializer >
+{
+};
/// clones a UNO-sequence of UNO-References
typedef Reference< chart2::XCoordinateSystem > lcl_tCooSysRef;
@@ -591,54 +621,24 @@ Sequence< OUString > Diagram::getSupportedServiceNames_Static()
uno::Any Diagram::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 );
- ::chart::SceneProperties::AddDefaultsToMap( aStaticDefaults );
- }
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
+ const tPropertyValueMap& rStaticDefaults = *StaticDiagramDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL Diagram::getInfoHelper()
{
- static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
-
- return aArrayHelper;
+ return *StaticDiagramInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- Diagram::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL Diagram::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 *StaticDiagramInfo::get();
}
// ____ XFastPropertySet ____
diff --git a/chart2/source/model/main/FormattedString.cxx b/chart2/source/model/main/FormattedString.cxx
index 9d38fafd3cf7..2d1f937d3e57 100644..100755
--- a/chart2/source/model/main/FormattedString.cxx
+++ b/chart2/source/model/main/FormattedString.cxx
@@ -47,37 +47,64 @@ using ::osl::MutexGuard;
namespace
{
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticFormattedStringDefaults_Initializer
{
- static Sequence< Property > aPropSeq;
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::CharacterProperties::AddDefaultsToMap( rOutMap );
+ }
+};
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+struct StaticFormattedStringDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticFormattedStringDefaults_Initializer >
+{
+};
+
+struct StaticFormattedStringInfoHelper_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;
::chart::CharacterProperties::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;
-}
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticFormattedStringInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticFormattedStringInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+};
- return aArrayHelper;
-}
+struct StaticFormattedStringInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticFormattedStringInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticFormattedStringInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticFormattedStringInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -201,50 +228,25 @@ Sequence< OUString > FormattedString::getSupportedServiceNames_Static()
uno::Any FormattedString::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
- static tPropertyValueMap aStaticDefaults;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aStaticDefaults.size() )
- {
- // initialize defaults
- CharacterProperties::AddDefaultsToMap( aStaticDefaults );
- }
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
- throw beans::UnknownPropertyException();
-
+ const tPropertyValueMap& rStaticDefaults = *StaticFormattedStringDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
+ return uno::Any();
return (*aFound).second;
- // \--
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL FormattedString::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticFormattedStringInfoHelper::get();
}
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- FormattedString::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL FormattedString::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 *StaticFormattedStringInfo::get();
}
// ================================================================================
diff --git a/chart2/source/model/main/GridProperties.cxx b/chart2/source/model/main/GridProperties.cxx
index a8d5be5d1453..4739b96bb4b7 100644..100755
--- a/chart2/source/model/main/GridProperties.cxx
+++ b/chart2/source/model/main/GridProperties.cxx
@@ -71,50 +71,73 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
-void lcl_addDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+struct StaticGridDefaults_Initializer
{
- ::chart::LineProperties::AddDefaultsToMap( rOutMap );
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::LineProperties::AddDefaultsToMap( rOutMap );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_GRID_SHOW, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_GRID_SHOW, false );
- // override other defaults
- ::chart::PropertyHelper::setPropertyValue< sal_Int32 >(
- rOutMap, ::chart::LineProperties::PROP_LINE_COLOR, 0xb3b3b3 ); // gray30
-}
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue< sal_Int32 >(
+ rOutMap, ::chart::LineProperties::PROP_LINE_COLOR, 0xb3b3b3 ); // gray30
+ }
+};
+
+struct StaticGridDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticGridDefaults_Initializer >
+{
+};
-const Sequence< Property > & lcl_getPropertySequence()
+struct StaticGridInfoHelper_Initializer
{
- static Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+private:
+ Sequence< Property > lcl_GetPropertySequence()
{
- // get properties
::std::vector< Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::LineProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::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;
-}
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+};
+
+struct StaticGridInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticGridInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_getPropertySequence(),
- /* bSorted = */ sal_True );
+};
- return aArrayHelper;
-}
+struct StaticGridInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticGridInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticGridInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticGridInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -149,45 +172,23 @@ GridProperties::~GridProperties()
uno::Any GridProperties::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
- static tPropertyValueMap aStaticDefaults;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aStaticDefaults.size() )
- lcl_addDefaultsToMap( aStaticDefaults );
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
+ const tPropertyValueMap& rStaticDefaults = *StaticGridDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL GridProperties::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticGridInfoHelper::get();
}
// ____ XPropertySet ____
-Reference< beans::XPropertySetInfo > SAL_CALL
- GridProperties::getPropertySetInfo()
+Reference< beans::XPropertySetInfo > SAL_CALL GridProperties::getPropertySetInfo()
throw (uno::RuntimeException)
{
- static Reference< beans::XPropertySetInfo > xInfo;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !xInfo.is())
- {
- xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
- lcl_getInfoHelper());
- }
-
- return xInfo;
- // \--
+ return *StaticGridInfo::get();
}
// ____ XCloneable ____
diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx
index c1143ecdf77a..e9f5f5324365 100644..100755
--- a/chart2/source/model/main/Legend.cxx
+++ b/chart2/source/model/main/Legend.cxx
@@ -107,28 +107,47 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticLegendDefaults_Initializer
{
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_ANCHOR_POSITION, chart2::LegendPosition_LINE_END );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_PREFERRED_EXPANSION, chart2::LegendExpansion_HIGH );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_SHOW, true );
-
- float fDefaultCharHeight = 10.0;
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
-}
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::LineProperties::AddDefaultsToMap( rOutMap );
+ ::chart::FillProperties::AddDefaultsToMap( rOutMap );
+ ::chart::CharacterProperties::AddDefaultsToMap( rOutMap );
+
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_ANCHOR_POSITION, chart2::LegendPosition_LINE_END );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_PREFERRED_EXPANSION, chart2::LegendExpansion_HIGH );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_SHOW, true );
+
+ float fDefaultCharHeight = 10.0;
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
+ }
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticLegendDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticLegendDefaults_Initializer >
{
- static Sequence< Property > aPropSeq;
+};
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+struct StaticLegendInfoHelper_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 );
::chart::LineProperties::AddPropertiesToVector( aProperties );
@@ -136,25 +155,30 @@ const Sequence< Property > & lcl_GetPropertySequence()
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::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 StaticLegendInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticLegendInfoHelper_Initializer >
+{
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticLegendInfo_Initializer
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticLegendInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
- return aArrayHelper;
-}
+struct StaticLegendInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticLegendInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -309,52 +333,23 @@ Sequence< OUString > Legend::getSupportedServiceNames_Static()
Any Legend::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
- static tPropertyValueMap aStaticDefaults;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aStaticDefaults.size() )
- {
- LineProperties::AddDefaultsToMap( aStaticDefaults );
- FillProperties::AddDefaultsToMap( aStaticDefaults );
- CharacterProperties::AddDefaultsToMap( aStaticDefaults );
- // call last to overwrite some character property defaults
- lcl_AddDefaultsToMap( aStaticDefaults );
- }
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
- return Any();
-
+ const tPropertyValueMap& rStaticDefaults = *StaticLegendDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
+ return uno::Any();
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL Legend::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticLegendInfoHelper::get();
}
-
// ____ XPropertySet ____
-Reference< beans::XPropertySetInfo > SAL_CALL
- Legend::getPropertySetInfo()
+Reference< beans::XPropertySetInfo > SAL_CALL Legend::getPropertySetInfo()
throw (uno::RuntimeException)
{
- static Reference< beans::XPropertySetInfo > xInfo;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !xInfo.is())
- {
- xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
- getInfoHelper());
- }
-
- return xInfo;
- // \--
+ return *StaticLegendInfo::get();
}
// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
diff --git a/chart2/source/model/main/PageBackground.cxx b/chart2/source/model/main/PageBackground.cxx
index 0dbe1d82fcf3..5f237b21ae7a 100644..100755
--- a/chart2/source/model/main/PageBackground.cxx
+++ b/chart2/source/model/main/PageBackground.cxx
@@ -53,47 +53,71 @@ namespace
static const ::rtl::OUString lcl_aServiceName(
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.PageBackground" ));
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticPageBackgroundDefaults_Initializer
{
- // override other defaults
- ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE );
-}
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::LineProperties::AddDefaultsToMap( rOutMap );
+ ::chart::FillProperties::AddDefaultsToMap( rOutMap );
+
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff );
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE );
+ }
+};
+
+struct StaticPageBackgroundDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticPageBackgroundDefaults_Initializer >
+{
+};
-const uno::Sequence< Property > & lcl_GetPropertySequence()
+struct StaticPageBackgroundInfoHelper_Initializer
{
- static uno::Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+private:
+ uno::Sequence< Property > lcl_GetPropertySequence()
{
- // get properties
::std::vector< ::com::sun::star::beans::Property > aProperties;
::chart::LineProperties::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::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;
-}
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticPageBackgroundInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticPageBackgroundInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+};
- return aArrayHelper;
-}
+struct StaticPageBackgroundInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticPageBackgroundInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticPageBackgroundInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticPageBackgroundInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -132,55 +156,25 @@ uno::Reference< util::XCloneable > SAL_CALL PageBackground::createClone()
uno::Any PageBackground::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
- static tPropertyValueMap aStaticDefaults;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aStaticDefaults.size() )
- {
- // initialize defaults
- LineProperties::AddDefaultsToMap( aStaticDefaults );
- FillProperties::AddDefaultsToMap( aStaticDefaults );
- // overrides defaults of FillProperties
- lcl_AddDefaultsToMap( aStaticDefaults );
- }
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
+ const tPropertyValueMap& rStaticDefaults = *StaticPageBackgroundDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL PageBackground::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticPageBackgroundInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- PageBackground::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL PageBackground::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 *StaticPageBackgroundInfo::get();
}
-
// ____ XModifyBroadcaster ____
void SAL_CALL PageBackground::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
throw (uno::RuntimeException)
diff --git a/chart2/source/model/main/StockBar.cxx b/chart2/source/model/main/StockBar.cxx
index 9a3c7f8ab623..e812ba3c39dd 100644..100755
--- a/chart2/source/model/main/StockBar.cxx
+++ b/chart2/source/model/main/StockBar.cxx
@@ -57,46 +57,70 @@ namespace
static const ::rtl::OUString lcl_aServiceName(
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.StockBar" ));
-const uno::Sequence< Property > & lcl_GetPropertySequence()
+struct StaticStockBarInfoHelper_Initializer
{
- static uno::Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+private:
+ uno::Sequence< Property > lcl_GetPropertySequence()
{
- // get properties
::std::vector< ::com::sun::star::beans::Property > aProperties;
::chart::LineProperties::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::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;
-}
+};
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticStockBarInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticStockBarInfoHelper_Initializer >
{
- // override other defaults
- ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff ); // white
-}
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticStockBarInfo_Initializer
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticStockBarInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
- return aArrayHelper;
-}
+struct StaticStockBarInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticStockBarInfo_Initializer >
+{
+};
+
+struct StaticStockBarDefaults_Initializer
+{
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::LineProperties::AddDefaultsToMap( rOutMap );
+ ::chart::FillProperties::AddDefaultsToMap( rOutMap );
+
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff ); // white
+ }
+};
+
+struct StaticStockBarDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticStockBarDefaults_Initializer >
+{
+};
} // anonymous namespace
@@ -144,55 +168,25 @@ uno::Reference< util::XCloneable > SAL_CALL StockBar::createClone()
uno::Any StockBar::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
- static tPropertyValueMap aStaticDefaults;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aStaticDefaults.size() )
- {
- // initialize defaults
- LineProperties::AddDefaultsToMap( aStaticDefaults );
- FillProperties::AddDefaultsToMap( aStaticDefaults );
-
- // overrides a line property
- lcl_AddDefaultsToMap( aStaticDefaults );
- }
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
+ const tPropertyValueMap& rStaticDefaults = *StaticStockBarDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL StockBar::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticStockBarInfoHelper::get();
}
// ____ XPropertySet ____
-Reference< beans::XPropertySetInfo > SAL_CALL
- StockBar::getPropertySetInfo()
+Reference< beans::XPropertySetInfo > SAL_CALL StockBar::getPropertySetInfo()
throw (uno::RuntimeException)
{
- static Reference< beans::XPropertySetInfo > xInfo;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !xInfo.is())
- {
- xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
- lcl_getInfoHelper());
- }
-
- return xInfo;
- // \--
+ return *StaticStockBarInfo::get();
}
-
// ____ XModifyBroadcaster ____
void SAL_CALL StockBar::addModifyListener( const uno::Reference< util::XModifyListener >& aListener )
throw (uno::RuntimeException)
diff --git a/chart2/source/model/main/Title.cxx b/chart2/source/model/main/Title.cxx
index d7c5691d160d..7483c02ffa93 100644..100755
--- a/chart2/source/model/main/Title.cxx
+++ b/chart2/source/model/main/Title.cxx
@@ -156,62 +156,87 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticTitleDefaults_Initializer
{
- // ParagraphProperties
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_TITLE_PARA_ADJUST,
- ::com::sun::star::style::ParagraphAdjust_CENTER );
- // PROP_TITLE_PARA_LAST_LINE_ADJUST
-
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_TITLE_PARA_LEFT_MARGIN, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_TITLE_PARA_RIGHT_MARGIN, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_TITLE_PARA_TOP_MARGIN, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_TITLE_PARA_BOTTOM_MARGIN, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_TITLE_PARA_IS_HYPHENATION, true );
-
- // own properties
- ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_TITLE_TEXT_ROTATION, 0.0 );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_TITLE_TEXT_STACKED, false );
-
- // override other defaults
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE );
-}
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::LineProperties::AddDefaultsToMap( rOutMap );
+ ::chart::FillProperties::AddDefaultsToMap( rOutMap );
+
+ // ParagraphProperties
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_TITLE_PARA_ADJUST,
+ ::com::sun::star::style::ParagraphAdjust_CENTER );
+ // PROP_TITLE_PARA_LAST_LINE_ADJUST
+
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_TITLE_PARA_LEFT_MARGIN, 0 );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_TITLE_PARA_RIGHT_MARGIN, 0 );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_TITLE_PARA_TOP_MARGIN, 0 );
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_TITLE_PARA_BOTTOM_MARGIN, 0 );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_TITLE_PARA_IS_HYPHENATION, true );
+
+ // own properties
+ ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_TITLE_TEXT_ROTATION, 0.0 );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_TITLE_TEXT_STACKED, false );
+
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE );
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE );
+ }
+};
-const uno::Sequence< Property > & lcl_GetPropertySequence()
+struct StaticTitleDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticTitleDefaults_Initializer >
{
- static uno::Sequence< Property > aPropSeq;
+};
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+struct StaticTitleInfoHelper_Initializer
+{
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
+
+private:
+ uno::Sequence< Property > lcl_GetPropertySequence()
{
- // get properties
::std::vector< ::com::sun::star::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::LineProperties::AddPropertiesToVector( aProperties );
::chart::FillProperties::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;
-}
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+};
+
+struct StaticTitleInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticTitleInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+};
- return aArrayHelper;
-}
+struct StaticTitleInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticTitleInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticTitleInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticTitleInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -283,54 +308,23 @@ void SAL_CALL Title::setText( const uno::Sequence< uno::Reference< chart2::XForm
uno::Any Title::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
- static tPropertyValueMap aStaticDefaults;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aStaticDefaults.size() )
- {
- LineProperties::AddDefaultsToMap( aStaticDefaults );
- FillProperties::AddDefaultsToMap( aStaticDefaults );
-
- // initialize defaults
- // Note: this should be last to override defaults of the previously
- // added defaults
- lcl_AddDefaultsToMap( aStaticDefaults );
- }
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
+ const tPropertyValueMap& rStaticDefaults = *StaticTitleDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL Title::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticTitleInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- Title::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL Title::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 *StaticTitleInfo::get();
}
// ____ XModifyBroadcaster ____
diff --git a/chart2/source/model/main/Wall.cxx b/chart2/source/model/main/Wall.cxx
index 2ad00a4c90ae..404a5e6ff97f 100644..100755
--- a/chart2/source/model/main/Wall.cxx
+++ b/chart2/source/model/main/Wall.cxx
@@ -59,46 +59,70 @@ namespace
static const ::rtl::OUString lcl_aServiceName(
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.Wall" ));
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticWallDefaults_Initializer
{
- // override other defaults
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE );
-}
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::LineProperties::AddDefaultsToMap( rOutMap );
+ ::chart::FillProperties::AddDefaultsToMap( rOutMap );
+
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE );
+ }
+};
+
+struct StaticWallDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticWallDefaults_Initializer >
+{
+};
-const uno::Sequence< Property > & lcl_GetPropertySequence()
+struct StaticWallInfoHelper_Initializer
{
- static uno::Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+private:
+ uno::Sequence< Property > lcl_GetPropertySequence()
{
- // get properties
::std::vector< ::com::sun::star::beans::Property > aProperties;
::chart::LineProperties::AddPropertiesToVector( aProperties );
::chart::FillProperties::AddPropertiesToVector( aProperties );
::chart::UserDefinedProperties::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;
-}
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticWallInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticWallInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+};
- return aArrayHelper;
-}
+struct StaticWallInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticWallInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticWallInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticWallInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -135,55 +159,23 @@ uno::Reference< util::XCloneable > SAL_CALL Wall::createClone()
uno::Any Wall::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
- static tPropertyValueMap aStaticDefaults;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aStaticDefaults.size() )
- {
- // initialize defaults
- LineProperties::AddDefaultsToMap( aStaticDefaults );
- FillProperties::AddDefaultsToMap( aStaticDefaults );
-
- // initialize defaults
- // Note: this should be last to override defaults of the previously
- // added defaults
- lcl_AddDefaultsToMap( aStaticDefaults );
- }
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
+ const tPropertyValueMap& rStaticDefaults = *StaticWallDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL Wall::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticWallInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- Wall::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL Wall::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 *StaticWallInfo::get();
}
// ____ XModifyBroadcaster ____
diff --git a/chart2/source/model/template/AreaChartTypeTemplate.cxx b/chart2/source/model/template/AreaChartTypeTemplate.cxx
index 5fe21cfb25e0..ea8b7a89c778 100644..100755
--- a/chart2/source/model/template/AreaChartTypeTemplate.cxx
+++ b/chart2/source/model/template/AreaChartTypeTemplate.cxx
@@ -70,43 +70,64 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticAreaChartTypeTemplateDefaults_Initializer
{
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AREA_TEMPLATE_DIMENSION, 2 );
-}
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_AREA_TEMPLATE_DIMENSION, 2 );
+ }
+};
+
+struct StaticAreaChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticAreaChartTypeTemplateDefaults_Initializer >
+{
+};
-const uno::Sequence< Property > & lcl_GetPropertySequence()
+struct StaticAreaChartTypeTemplateInfoHelper_Initializer
{
- static uno::Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+private:
+ uno::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;
-}
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticAreaChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticAreaChartTypeTemplateInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+};
- return aArrayHelper;
-}
+struct StaticAreaChartTypeTemplateInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticAreaChartTypeTemplateInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticAreaChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticAreaChartTypeTemplateInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -133,49 +154,23 @@ AreaChartTypeTemplate::~AreaChartTypeTemplate()
uno::Any AreaChartTypeTemplate::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 = *StaticAreaChartTypeTemplateDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL AreaChartTypeTemplate::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticAreaChartTypeTemplateInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- AreaChartTypeTemplate::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL AreaChartTypeTemplate::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 *StaticAreaChartTypeTemplateInfo::get();
}
sal_Int32 AreaChartTypeTemplate::getDimension() const
diff --git a/chart2/source/model/template/BarChartTypeTemplate.cxx b/chart2/source/model/template/BarChartTypeTemplate.cxx
index 01dc4c253d2b..77cd240c3fd0 100644..100755
--- a/chart2/source/model/template/BarChartTypeTemplate.cxx
+++ b/chart2/source/model/template/BarChartTypeTemplate.cxx
@@ -77,44 +77,65 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticBarChartTypeTemplateDefaults_Initializer
{
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_BAR_TEMPLATE_DIMENSION, 2 );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BAR_TEMPLATE_GEOMETRY3D, ::chart2::DataPointGeometry3D::CUBOID );
-}
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_BAR_TEMPLATE_DIMENSION, 2 );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BAR_TEMPLATE_GEOMETRY3D, ::chart2::DataPointGeometry3D::CUBOID );
+ }
+};
+
+struct StaticBarChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticBarChartTypeTemplateDefaults_Initializer >
+{
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticBarChartTypeTemplateInfoHelper_Initializer
{
- static Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+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;
-}
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticBarChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticBarChartTypeTemplateInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+};
- return aArrayHelper;
-}
+struct StaticBarChartTypeTemplateInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticBarChartTypeTemplateInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticBarChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticBarChartTypeTemplateInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -226,49 +247,23 @@ Reference< chart2::XChartType > SAL_CALL BarChartTypeTemplate::getChartTypeForNe
uno::Any BarChartTypeTemplate::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 = *StaticBarChartTypeTemplateDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL BarChartTypeTemplate::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticBarChartTypeTemplateInfoHelper::get();
}
-
// ____ XPropertySet ____
-Reference< beans::XPropertySetInfo > SAL_CALL
- BarChartTypeTemplate::getPropertySetInfo()
+Reference< beans::XPropertySetInfo > SAL_CALL BarChartTypeTemplate::getPropertySetInfo()
throw (uno::RuntimeException)
{
- static Reference< beans::XPropertySetInfo > xInfo;
-
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !xInfo.is())
- {
- xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
- getInfoHelper());
- }
-
- return xInfo;
- // \--
+ return *StaticBarChartTypeTemplateInfo::get();
}
void SAL_CALL BarChartTypeTemplate::applyStyle(
diff --git a/chart2/source/model/template/BubbleChartType.cxx b/chart2/source/model/template/BubbleChartType.cxx
index 9922ed4df5fb..f82936241232 100644..100755
--- a/chart2/source/model/template/BubbleChartType.cxx
+++ b/chart2/source/model/template/BubbleChartType.cxx
@@ -56,33 +56,62 @@ void lcl_AddPropertiesToVector(
{
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & /*rOutMap*/ )
+struct StaticBubbleChartTypeDefaults_Initializer
{
-}
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & /*rOutMap*/ )
+ {
+ }
+};
+
+struct StaticBubbleChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticBubbleChartTypeDefaults_Initializer >
+{
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticBubbleChartTypeInfoHelper_Initializer
{
- static Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+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 StaticBubbleChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticBubbleChartTypeInfoHelper_Initializer >
+{
+};
+
+struct StaticBubbleChartTypeInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticBubbleChartTypeInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticBubbleChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticBubbleChartTypeInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -177,53 +206,24 @@ OUString SAL_CALL BubbleChartType::getRoleOfSequenceForSeriesLabel()
uno::Any BubbleChartType::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 = *StaticBubbleChartTypeDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartType::getInfoHelper()
{
- static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
-
- return aArrayHelper;
+ return *StaticBubbleChartTypeInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- BubbleChartType::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL BubbleChartType::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 *StaticBubbleChartTypeInfo::get();
}
uno::Sequence< ::rtl::OUString > BubbleChartType::getSupportedServiceNames_Static()
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.cxx b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
index 59b552cc8995..e0e37e2c825a 100644..100755
--- a/chart2/source/model/template/BubbleChartTypeTemplate.cxx
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
@@ -65,42 +65,63 @@ void lcl_AddPropertiesToVector(
{
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & /*rOutMap*/ )
+struct StaticBubbleChartTypeTemplateDefaults_Initializer
{
-}
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & /*rOutMap*/ )
+ {
+ }
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticBubbleChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticBubbleChartTypeTemplateDefaults_Initializer >
{
- static Sequence< Property > aPropSeq;
+};
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+struct StaticBubbleChartTypeTemplateInfoHelper_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;
-}
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticBubbleChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticBubbleChartTypeTemplateInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+};
- return aArrayHelper;
-}
+struct StaticBubbleChartTypeTemplateInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticBubbleChartTypeTemplateInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticBubbleChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticBubbleChartTypeTemplateInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -123,49 +144,23 @@ BubbleChartTypeTemplate::~BubbleChartTypeTemplate()
uno::Any BubbleChartTypeTemplate::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 = *StaticBubbleChartTypeTemplateDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL BubbleChartTypeTemplate::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticBubbleChartTypeTemplateInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- BubbleChartTypeTemplate::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL BubbleChartTypeTemplate::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 *StaticBubbleChartTypeTemplateInfo::get();
}
sal_Int32 BubbleChartTypeTemplate::getDimension() const
diff --git a/chart2/source/model/template/CandleStickChartType.cxx b/chart2/source/model/template/CandleStickChartType.cxx
index 22c8e058ea53..499ee238650e 100644..100755
--- a/chart2/source/model/template/CandleStickChartType.cxx
+++ b/chart2/source/model/template/CandleStickChartType.cxx
@@ -95,39 +95,67 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap,
- ::osl::Mutex & rMutex )
+struct StaticCandleStickChartTypeDefaults_Initializer
{
- ::osl::MutexGuard aGuard( rMutex );
- // must match default in CTOR!
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CANDLESTICKCHARTTYPE_JAPANESE, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CANDLESTICKCHARTTYPE_SHOW_FIRST, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CANDLESTICKCHARTTYPE_SHOW_HIGH_LOW, true );
-}
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ // must match default in CTOR!
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CANDLESTICKCHARTTYPE_JAPANESE, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CANDLESTICKCHARTTYPE_SHOW_FIRST, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_CANDLESTICKCHARTTYPE_SHOW_HIGH_LOW, true );
+ }
+};
+
+struct StaticCandleStickChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticCandleStickChartTypeDefaults_Initializer >
+{
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticCandleStickChartTypeInfoHelper_Initializer
{
- static Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+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 StaticCandleStickChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticCandleStickChartTypeInfoHelper_Initializer >
+{
+};
+
+struct StaticCandleStickChartTypeInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticCandleStickChartTypeInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticCandleStickChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticCandleStickChartTypeInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -261,53 +289,24 @@ OUString SAL_CALL CandleStickChartType::getRoleOfSequenceForSeriesLabel()
uno::Any CandleStickChartType::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, GetMutex() );
- }
-
- tPropertyValueMap::const_iterator aFound(
- aStaticDefaults.find( nHandle ));
-
- if( aFound == aStaticDefaults.end())
+ const tPropertyValueMap& rStaticDefaults = *StaticCandleStickChartTypeDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL CandleStickChartType::getInfoHelper()
{
- static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
-
- return aArrayHelper;
+ return *StaticCandleStickChartTypeInfoHelper::get();
}
-
// ____ XPropertySet ____
-Reference< beans::XPropertySetInfo > SAL_CALL
- CandleStickChartType::getPropertySetInfo()
+Reference< beans::XPropertySetInfo > SAL_CALL CandleStickChartType::getPropertySetInfo()
throw (uno::RuntimeException)
{
- static Reference< beans::XPropertySetInfo > xInfo;
-
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !xInfo.is())
- {
- xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
- getInfoHelper());
- }
-
- return xInfo;
- // \--
+ return *StaticCandleStickChartTypeInfo::get();
}
void SAL_CALL CandleStickChartType::setFastPropertyValue_NoBroadcast(
diff --git a/chart2/source/model/template/ChartType.cxx b/chart2/source/model/template/ChartType.cxx
index 22a744769fc6..146c06934a46 100644..100755
--- a/chart2/source/model/template/ChartType.cxx
+++ b/chart2/source/model/template/ChartType.cxx
@@ -230,34 +230,51 @@ uno::Any ChartType::GetDefaultValue( sal_Int32 /* nHandle */ ) const
return uno::Any();
}
-// ____ OPropertySet ____
-::cppu::IPropertyArrayHelper & SAL_CALL ChartType::getInfoHelper()
+namespace
{
- // using assignment for broken gcc 3.3
- static ::cppu::OPropertyArrayHelper aArrayHelper = ::cppu::OPropertyArrayHelper(
- Sequence< beans::Property >(), /* bSorted */ sal_True );
-
- return aArrayHelper;
-}
+struct StaticChartTypeInfoHelper_Initializer
+{
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ // using assignment for broken gcc 3.3
+ static ::cppu::OPropertyArrayHelper aPropHelper = ::cppu::OPropertyArrayHelper(
+ Sequence< beans::Property >() );
+ return &aPropHelper;
+ }
+};
-// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- ChartType::getPropertySetInfo()
- throw (uno::RuntimeException)
+struct StaticChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticChartTypeInfoHelper_Initializer >
{
- static uno::Reference< beans::XPropertySetInfo > xInfo;
+};
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !xInfo.is())
+struct StaticChartTypeInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
{
- xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
- getInfoHelper());
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticChartTypeInfoHelper::get() ) );
+ return &xPropertySetInfo;
}
+};
+
+struct StaticChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticChartTypeInfo_Initializer >
+{
+};
+
+}
- return xInfo;
- // \--
+// ____ OPropertySet ____
+::cppu::IPropertyArrayHelper & SAL_CALL ChartType::getInfoHelper()
+{
+ return *StaticChartTypeInfoHelper::get();
+}
+
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL ChartType::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ return *StaticChartTypeInfo::get();
}
// ____ XModifyBroadcaster ____
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx
index e3943e9eb45f..c922de69a2c7 100644..100755
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -882,7 +882,6 @@ void ChartTypeTemplate::createChartTypes(
}
}
-//static
void ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem(
const Sequence< Reference< XChartType > > & rOldChartTypesSeq,
const Reference< XChartType > & xNewChartType )
diff --git a/chart2/source/model/template/ColumnChartType.cxx b/chart2/source/model/template/ColumnChartType.cxx
index aa11d77e8995..90dcf7c80ee2 100644..100755
--- a/chart2/source/model/template/ColumnChartType.cxx
+++ b/chart2/source/model/template/ColumnChartType.cxx
@@ -67,40 +67,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,51 +168,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();
}
//
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
index 663cad4c2fe4..35a29f78e6ee 100644..100755
--- a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
@@ -76,43 +76,64 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticColumnLineChartTypeTemplateDefaults_Initializer
{
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_COL_LINE_NUMBER_OF_LINES, 1 );
-}
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
+ {
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_COL_LINE_NUMBER_OF_LINES, 1 );
+ }
+};
+
+struct StaticColumnLineChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticColumnLineChartTypeTemplateDefaults_Initializer >
+{
+};
-const uno::Sequence< Property > & lcl_GetPropertySequence()
+struct StaticColumnLineChartTypeTemplateInfoHelper_Initializer
{
- static uno::Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+private:
+ uno::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;
-}
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticColumnLineChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticColumnLineChartTypeTemplateInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+};
- return aArrayHelper;
-}
+struct StaticColumnLineChartTypeTemplateInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticColumnLineChartTypeTemplateInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticColumnLineChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticColumnLineChartTypeTemplateInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -139,49 +160,23 @@ ColumnLineChartTypeTemplate::~ColumnLineChartTypeTemplate()
uno::Any ColumnLineChartTypeTemplate::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 = *StaticColumnLineChartTypeTemplateDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL ColumnLineChartTypeTemplate::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticColumnLineChartTypeTemplateInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- ColumnLineChartTypeTemplate::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL ColumnLineChartTypeTemplate::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 *StaticColumnLineChartTypeTemplateInfo::get();
}
void ColumnLineChartTypeTemplate::createChartTypes(
diff --git a/chart2/source/model/template/DataInterpreter.cxx b/chart2/source/model/template/DataInterpreter.cxx
index b619553ee959..b5aa13775e8e 100644..100755
--- a/chart2/source/model/template/DataInterpreter.cxx
+++ b/chart2/source/model/template/DataInterpreter.cxx
@@ -329,7 +329,6 @@ Reference< data::XDataSource > SAL_CALL DataInterpreter::mergeInterpretedData(
// convenience methods
-// static
OUString DataInterpreter::GetRole( const Reference< data::XDataSequence > & xSeq )
{
OUString aResult;
@@ -348,7 +347,6 @@ OUString DataInterpreter::GetRole( const Reference< data::XDataSequence > & xSeq
return aResult;
}
-// static
void DataInterpreter::SetRole( const Reference< data::XDataSequence > & xSeq, const OUString & rRole )
{
if( ! xSeq.is())
@@ -364,7 +362,6 @@ void DataInterpreter::SetRole( const Reference< data::XDataSequence > & xSeq, co
}
}
-// static
uno::Any DataInterpreter::GetProperty(
const Sequence< beans::PropertyValue > & aArguments,
const OUString & rName )
@@ -377,7 +374,6 @@ uno::Any DataInterpreter::GetProperty(
return uno::Any();
}
-// static
bool DataInterpreter::HasCategories(
const Sequence< beans::PropertyValue > & rArguments,
const Sequence< Reference< data::XLabeledDataSequence > > & rData )
diff --git a/chart2/source/model/template/LineChartType.cxx b/chart2/source/model/template/LineChartType.cxx
index f96d7ed1297d..e249f7508908 100644..100755
--- a/chart2/source/model/template/LineChartType.cxx
+++ b/chart2/source/model/template/LineChartType.cxx
@@ -78,39 +78,69 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticLineChartTypeDefaults_Initializer
{
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINECHARTTYPE_CURVE_STYLE, ::chart2::CurveStyle_LINES );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINECHARTTYPE_CURVE_RESOLUTION, 20 );
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ 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 );
-}
+ // 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 );
+ }
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticLineChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticLineChartTypeDefaults_Initializer >
{
- static Sequence< Property > aPropSeq;
+};
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+struct StaticLineChartTypeInfoHelper_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 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;
+ }
+};
+
+struct StaticLineChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticLineChartTypeInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -150,52 +180,23 @@ uno::Reference< util::XCloneable > SAL_CALL LineChartType::createClone()
uno::Any LineChartType::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 = *StaticLineChartTypeDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL LineChartType::getInfoHelper()
{
- static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
-
- return aArrayHelper;
+ return *StaticLineChartTypeInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- LineChartType::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL LineChartType::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 *StaticLineChartTypeInfo::get();
}
uno::Sequence< ::rtl::OUString > LineChartType::getSupportedServiceNames_Static()
diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx
index 8d582178a128..cc9bbc804288 100644..100755
--- a/chart2/source/model/template/LineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/LineChartTypeTemplate.cxx
@@ -88,48 +88,69 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticLineChartTypeTemplateDefaults_Initializer
{
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, chart2::CurveStyle_LINES );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, 20 );
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ 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 );
-}
+ // 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 >
+{
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticLineChartTypeTemplateInfoHelper_Initializer
{
- static Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+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;
-}
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticLineChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticLineChartTypeTemplateInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+};
- return aArrayHelper;
-}
+struct StaticLineChartTypeTemplateInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticLineChartTypeTemplateInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticLineChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticLineChartTypeTemplateInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -161,49 +182,23 @@ LineChartTypeTemplate::~LineChartTypeTemplate()
uno::Any LineChartTypeTemplate::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 = *StaticLineChartTypeTemplateDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL LineChartTypeTemplate::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticLineChartTypeTemplateInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- LineChartTypeTemplate::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL LineChartTypeTemplate::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 *StaticLineChartTypeTemplateInfo::get();
}
sal_Int32 LineChartTypeTemplate::getDimension() const
diff --git a/chart2/source/model/template/NetChartType.cxx b/chart2/source/model/template/NetChartType.cxx
index ddf001b2a6e4..bba666bb006c 100644..100755
--- a/chart2/source/model/template/NetChartType.cxx
+++ b/chart2/source/model/template/NetChartType.cxx
@@ -108,31 +108,51 @@ uno::Any NetChartType_Base::GetDefaultValue( sal_Int32 /*nHandle*/ ) const
return uno::Any();
}
+namespace
+{
+
+struct StaticNetChartTypeInfoHelper_Initializer
+{
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ // using assignment for broken gcc 3.3
+ static ::cppu::OPropertyArrayHelper aPropHelper = ::cppu::OPropertyArrayHelper(
+ 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;
+ }
+};
+
+struct StaticNetChartTypeInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticNetChartTypeInfo_Initializer >
+{
+};
+
+}
+
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL NetChartType_Base::getInfoHelper()
{
- uno::Sequence< beans::Property > aProps;
- static ::cppu::OPropertyArrayHelper aArrayHelper(aProps);
- return aArrayHelper;
+ return *StaticNetChartTypeInfoHelper::get();
}
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- NetChartType_Base::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL NetChartType_Base::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 *StaticNetChartTypeInfo::get();
}
//-----------------------------------------------------------------------------
diff --git a/chart2/source/model/template/PieChartType.cxx b/chart2/source/model/template/PieChartType.cxx
index 9c199bb23d70..2c9bd4792cbf 100644..100755
--- a/chart2/source/model/template/PieChartType.cxx
+++ b/chart2/source/model/template/PieChartType.cxx
@@ -67,34 +67,64 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticPieChartTypeDefaults_Initializer
{
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_PIECHARTTYPE_USE_RINGS, 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_PIECHARTTYPE_USE_RINGS, false );
+ }
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticPieChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticPieChartTypeDefaults_Initializer >
{
- static Sequence< Property > aPropSeq;
+};
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+struct StaticPieChartTypeInfoHelper_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 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 >
+{
+};
} // anonymous namespace
@@ -174,53 +204,24 @@ Reference< chart2::XCoordinateSystem > SAL_CALL
uno::Any PieChartType::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 = *StaticPieChartTypeDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL PieChartType::getInfoHelper()
{
- static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
-
- return aArrayHelper;
+ return *StaticPieChartTypeInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- PieChartType::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL PieChartType::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 *StaticPieChartTypeInfo::get();
}
uno::Sequence< ::rtl::OUString > PieChartType::getSupportedServiceNames_Static()
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
index c16682846d53..439e4946378d 100644..100755
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -100,46 +100,67 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticPieChartTypeTemplateDefaults_Initializer
{
- ::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 );
-}
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ 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 );
+ }
+};
+
+struct StaticPieChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticPieChartTypeTemplateDefaults_Initializer >
+{
+};
-const uno::Sequence< Property > & lcl_GetPropertySequence()
+struct StaticPieChartTypeTemplateInfoHelper_Initializer
{
- static uno::Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+private:
+ uno::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;
-}
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticPieChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticPieChartTypeTemplateInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+};
- return aArrayHelper;
-}
+struct StaticPieChartTypeTemplateInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticPieChartTypeTemplateInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticPieChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticPieChartTypeTemplateInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -168,52 +189,25 @@ PieChartTypeTemplate::~PieChartTypeTemplate()
uno::Any PieChartTypeTemplate::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 = *StaticPieChartTypeTemplateDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL PieChartTypeTemplate::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticPieChartTypeTemplateInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- PieChartTypeTemplate::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL PieChartTypeTemplate::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 *StaticPieChartTypeTemplateInfo::get();
}
-
// ____ ChartTypeTemplate ____
sal_Int32 PieChartTypeTemplate::getDimension() const
{
diff --git a/chart2/source/model/template/ScatterChartType.cxx b/chart2/source/model/template/ScatterChartType.cxx
index 8c4ab0d18415..7952e69497b5 100644..100755
--- a/chart2/source/model/template/ScatterChartType.cxx
+++ b/chart2/source/model/template/ScatterChartType.cxx
@@ -82,39 +82,69 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticScatterChartTypeDefaults_Initializer
{
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCATTERCHARTTYPE_CURVE_STYLE, chart2::CurveStyle_LINES );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION, 20 );
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ 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 );
-}
+ // 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 );
+ }
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticScatterChartTypeDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticScatterChartTypeDefaults_Initializer >
{
- static Sequence< Property > aPropSeq;
+};
- // /--
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+struct StaticScatterChartTypeInfoHelper_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 StaticScatterChartTypeInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticScatterChartTypeInfoHelper_Initializer >
+{
+};
+
+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 >
+{
+};
} // anonymous namespace
@@ -231,53 +261,24 @@ uno::Sequence< ::rtl::OUString > SAL_CALL ScatterChartType::getSupportedOptional
uno::Any ScatterChartType::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 = *StaticScatterChartTypeDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
// ____ OPropertySet ____
::cppu::IPropertyArrayHelper & SAL_CALL ScatterChartType::getInfoHelper()
{
- static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
-
- return aArrayHelper;
+ return *StaticScatterChartTypeInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- ScatterChartType::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL ScatterChartType::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 *StaticScatterChartTypeInfo::get();
}
uno::Sequence< ::rtl::OUString > ScatterChartType::getSupportedServiceNames_Static()
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
index a83d9a8a4ea3..eaec10fe7c21 100644..100755
--- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
@@ -90,48 +90,69 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
-void lcl_AddDefaultsToMap(
- ::chart::tPropertyValueMap & rOutMap )
+struct StaticScatterChartTypeTemplateDefaults_Initializer
{
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, chart2::CurveStyle_LINES );
- ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, 20 );
+ ::chart::tPropertyValueMap* operator()()
+ {
+ static ::chart::tPropertyValueMap aStaticDefaults;
+ lcl_AddDefaultsToMap( aStaticDefaults );
+ return &aStaticDefaults;
+ }
+private:
+ 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 );
-}
+ // 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 >
+{
+};
-const Sequence< Property > & lcl_GetPropertySequence()
+struct StaticScatterChartTypeTemplateInfoHelper_Initializer
{
- static Sequence< Property > aPropSeq;
+ ::cppu::OPropertyArrayHelper* operator()()
+ {
+ static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
+ return &aPropHelper;
+ }
- // /--
- MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( 0 == aPropSeq.getLength() )
+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;
-}
+};
-::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
+struct StaticScatterChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticScatterChartTypeTemplateInfoHelper_Initializer >
{
- static ::cppu::OPropertyArrayHelper aArrayHelper(
- lcl_GetPropertySequence(),
- /* bSorted = */ sal_True );
+};
- return aArrayHelper;
-}
+struct StaticScatterChartTypeTemplateInfo_Initializer
+{
+ uno::Reference< beans::XPropertySetInfo >* operator()()
+ {
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticScatterChartTypeTemplateInfoHelper::get() ) );
+ return &xPropertySetInfo;
+ }
+};
+
+struct StaticScatterChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticScatterChartTypeTemplateInfo_Initializer >
+{
+};
} // anonymous namespace
@@ -162,49 +183,23 @@ ScatterChartTypeTemplate::~ScatterChartTypeTemplate()
uno::Any ScatterChartTypeTemplate::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 = *StaticScatterChartTypeTemplateDefaults::get();
+ tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
+ if( aFound == rStaticDefaults.end() )
return uno::Any();
-
return (*aFound).second;
- // \--
}
::cppu::IPropertyArrayHelper & SAL_CALL ScatterChartTypeTemplate::getInfoHelper()
{
- return lcl_getInfoHelper();
+ return *StaticScatterChartTypeTemplateInfoHelper::get();
}
-
// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL
- ScatterChartTypeTemplate::getPropertySetInfo()
+uno::Reference< beans::XPropertySetInfo > SAL_CALL ScatterChartTypeTemplate::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 *StaticScatterChartTypeTemplateInfo::get();
}
sal_Int32 ScatterChartTypeTemplate::getDimension() const
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx
index 00ace6c330ad..b265561eca90 100644..100755
--- a/chart2/source/model/template/StockChartTypeTemplate.cxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.cxx
@@ -104,46 +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,49 +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 )
diff --git a/chart2/source/model/template/_serviceregistration_charttypes.cxx b/chart2/source/model/template/_serviceregistration_charttypes.cxx
index c0ffb8f4825f..9a62a97582e0 100644..100755
--- a/chart2/source/model/template/_serviceregistration_charttypes.cxx
+++ b/chart2/source/model/template/_serviceregistration_charttypes.cxx
@@ -130,7 +130,6 @@ static struct ::cppu::ImplementationEntry g_entries_chart2_charttypes[] =
} // anonymous namespace
-// static
struct ::cppu::ImplementationEntry *
ChartTypeEntriesForServiceRegistration::getImplementationEntries()
{