diff options
author | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-01-15 17:21:37 +0100 |
---|---|---|
committer | Ingrid Halama [iha] <Ingrid.Halama@oracle.com> | 2011-01-15 17:21:37 +0100 |
commit | 2ce9a356b9c14263008c3c182d5e69508d2c9107 (patch) | |
tree | f3e07ed0cf867aea00cfd1ac1bbce09ccfabe323 /chart2/source | |
parent | df4eb12515da36973ad00eb2ae2b18ca303646c7 (diff) | |
parent | a7417580c63270351601a7aef27c11247a831206 (diff) |
chart46: merge with DEV300_m97
Diffstat (limited to 'chart2/source')
127 files changed, 3075 insertions, 2401 deletions
diff --git a/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx index 2e1636b4406b..b4422c5442ec 100644..100755 --- a/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx @@ -57,31 +57,35 @@ namespace static const ::rtl::OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Area" )); -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticAreaWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - // /-- - 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::LineProperties::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); -// ::chart::NamedProperties::AddPropertiesToVector( aProperties ); + //::chart::NamedProperties::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 StaticAreaWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticAreaWrapperPropertyArray_Initializer > +{ +}; + - return aPropSeq; -} } // anonymous namespace // -------------------------------------------------------------------------------- @@ -175,7 +179,7 @@ Reference< beans::XPropertySet > AreaWrapper::getInnerPropertySet() const Sequence< beans::Property >& AreaWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticAreaWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > AreaWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx index 7bdc5459ca20..80b7cd20574b 100644..100755 --- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx @@ -352,33 +352,35 @@ void lcl_AddPropertiesToVector( beans::PropertyAttribute::MAYBEDEFAULT )); } -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticAxisWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - // /-- - 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::CharacterProperties::AddPropertiesToVector( aProperties ); ::chart::LineProperties::AddPropertiesToVector( aProperties ); -// ::chart::NamedLineProperties::AddPropertiesToVector( aProperties ); + //::chart::NamedLineProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::chart::wrapper::WrappedScaleTextProperties::addProperties( 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 StaticAxisWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticAxisWrapperPropertyArray_Initializer > +{ +}; } // anonymous namespace @@ -534,7 +536,6 @@ uno::Reference< util::XNumberFormats > SAL_CALL AxisWrapper::getNumberFormats() return uno::Reference< util::XNumberFormats >(); } -// static void AxisWrapper::getDimensionAndMainAxisBool( tAxisType eType, sal_Int32& rnDimensionIndex, sal_Bool& rbMainAxis ) { switch( eType ) @@ -642,7 +643,7 @@ Reference< beans::XPropertySet > AxisWrapper::getInnerPropertySet() const Sequence< beans::Property >& AxisWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticAxisWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > AxisWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index 8dd846474170..52b35873da1e 100644..100755 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -247,28 +247,30 @@ void lcl_AddPropertiesToVector( beans::PropertyAttribute::MAYBEDEFAULT ) ); } -const uno::Sequence< Property > & lcl_GetPropertySequence() +struct StaticChartDocumentWrapperPropertyArray_Initializer { - static uno::Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - // /-- - 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; -} +struct StaticChartDocumentWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticChartDocumentWrapperPropertyArray_Initializer > +{ +}; } // anonymous namespace @@ -1580,7 +1582,7 @@ Reference< beans::XPropertySet > ChartDocumentWrapper::getInnerPropertySet() } const Sequence< beans::Property >& ChartDocumentWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticChartDocumentWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > ChartDocumentWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index d69212512ebe..b79cab0930c6 100644..100755 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -173,44 +173,55 @@ void lcl_AddPropertiesToVector_SeriesOnly( | beans::PropertyAttribute::MAYBEDEFAULT )); } -const uno::Sequence< Property > & lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType ) +uno::Sequence< Property > lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType ) { - static uno::Sequence< Property > aSeriesPropSeq; - static uno::Sequence< Property > aPointPropSeq; + ::std::vector< ::com::sun::star::beans::Property > aProperties; - // /-- - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - uno::Sequence< Property >& rPropSeq = - (_eType == DataSeriesPointWrapper::DATA_SERIES) ? aSeriesPropSeq : aPointPropSeq; - if( 0 == rPropSeq.getLength() ) + lcl_AddPropertiesToVector_PointProperties( aProperties ); + if( _eType == DataSeriesPointWrapper::DATA_SERIES ) { - // get properties - ::std::vector< ::com::sun::star::beans::Property > aProperties; + lcl_AddPropertiesToVector_SeriesOnly( aProperties ); + WrappedStatisticProperties::addProperties( aProperties ); + } + WrappedSymbolProperties::addProperties( aProperties ); //for series and points + WrappedDataCaptionProperties::addProperties( aProperties ); //for series and points - lcl_AddPropertiesToVector_PointProperties( aProperties ); - if( _eType == DataSeriesPointWrapper::DATA_SERIES ) - { - lcl_AddPropertiesToVector_SeriesOnly( aProperties ); - WrappedStatisticProperties::addProperties( aProperties ); - } - WrappedSymbolProperties::addProperties( aProperties ); //for series and points - WrappedDataCaptionProperties::addProperties( aProperties ); //for series and points + ::chart::FillProperties::AddPropertiesToVector( aProperties ); + ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); + ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); + ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties ); - ::chart::FillProperties::AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); - ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); - ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); - ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties ); + ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); - // and sort them for access via bsearch - ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); + return ::chart::ContainerHelper::ContainerToSequence( aProperties ); +} - // transfer result to static Sequence - rPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties ); +struct StaticSeriesWrapperPropertyArray_Initializer +{ + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_SERIES ) ); + return &aPropSeq; } +}; - return rPropSeq; -} +struct StaticSeriesWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticSeriesWrapperPropertyArray_Initializer > +{ +}; + +struct StaticPointWrapperPropertyArray_Initializer +{ + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence( DataSeriesPointWrapper::DATA_POINT ) ); + return &aPropSeq; + } +}; + +struct StaticPointWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticPointWrapperPropertyArray_Initializer > +{ +}; //---------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------- @@ -706,7 +717,10 @@ Reference< beans::XPropertySet > DataSeriesPointWrapper::getInnerPropertySet() const Sequence< beans::Property >& DataSeriesPointWrapper::getPropertySequence() { - return lcl_GetPropertySequence( m_eType ); + if( m_eType == DATA_SERIES ) + return *StaticSeriesWrapperPropertyArray::get(); + else + return *StaticPointWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 16992ac02b51..e365edb7bd46 100644..100755 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -432,15 +432,17 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); } -const uno::Sequence< Property > & lcl_GetPropertySequence() +struct StaticDiagramWrapperPropertyArray_Initializer { - static uno::Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - // /-- - 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 ); ::chart::LineProperties::AddPropertiesToVector( aProperties ); @@ -454,16 +456,16 @@ const uno::Sequence< Property > & lcl_GetPropertySequence() WrappedStockProperties::addProperties( aProperties ); WrappedAutomaticPositionProperties::addProperties( 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 StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticDiagramWrapperPropertyArray_Initializer > +{ +}; bool lcl_isXYChart( const Reference< chart2::XDiagram > xDiagram ) { @@ -568,7 +570,6 @@ OUString lcl_getDiagramType( const OUString & rTemplateServiceName ) } typedef ::comphelper::MakeMap< ::rtl::OUString, ::rtl::OUString > tMakeStringStringMap; -//static const tMakeStringStringMap& lcl_getChartTypeNameMap() { static tMakeStringStringMap g_aChartTypeNameMap = @@ -2088,7 +2089,7 @@ Reference< beans::XPropertySet > DiagramWrapper::getInnerPropertySet() const Sequence< beans::Property >& DiagramWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticDiagramWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx index 9d50a76557f8..51c269d7dd40 100644..100755 --- a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx @@ -59,30 +59,31 @@ namespace static const OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Grid" )); -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticGridWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; - - // /-- - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< ::com::sun::star::beans::Property > aProperties; ::chart::LineProperties::AddPropertiesToVector( aProperties ); -// ::chart::NamedLineProperties::AddPropertiesToVector( aProperties ); + //::chart::NamedLineProperties::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 StaticGridWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticGridWrapperPropertyArray_Initializer > +{ +}; } // anonymous namespace @@ -104,7 +105,6 @@ GridWrapper::GridWrapper( GridWrapper::~GridWrapper() {} -// static void GridWrapper::getDimensionAndSubGridBool( tGridType eType, sal_Int32& rnDimensionIndex, bool& rbSubGrid ) { rnDimensionIndex = 1; @@ -179,7 +179,7 @@ Reference< beans::XPropertySet > GridWrapper::getInnerPropertySet() const Sequence< beans::Property >& GridWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticGridWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > GridWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx index 02ffcb942c99..5b71c7d3e768 100644..100755 --- a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx @@ -246,35 +246,38 @@ void lcl_AddPropertiesToVector( beans::PropertyAttribute::MAYBEDEFAULT )); } -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticLegendWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - // /-- - 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::CharacterProperties::AddPropertiesToVector( aProperties ); ::chart::LineProperties::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); -// ::chart::NamedProperties::AddPropertiesToVector( aProperties ); + //::chart::NamedProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties ); ::chart::wrapper::WrappedScaleTextProperties::addProperties( 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 StaticLegendWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticLegendWrapperPropertyArray_Initializer > +{ +}; - return aPropSeq; -} } // anonymous namespace // -------------------------------------------------------------------------------- @@ -418,7 +421,7 @@ Reference< beans::XPropertySet > LegendWrapper::getInnerPropertySet() const Sequence< beans::Property >& LegendWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticLegendWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > LegendWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx index fdfc7c094aaf..2885a79afe6d 100644..100755 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx @@ -56,31 +56,79 @@ namespace static const OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartLine" )); -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticMinMaxLineWrapperDefaults_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::LineProperties::AddDefaultsToMap( rOutMap ); + } +}; + +struct StaticMinMaxLineWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticMinMaxLineWrapperDefaults_Initializer > +{ +}; + +struct StaticMinMaxLineWrapperPropertyArray_Initializer +{ + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - // /-- - 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::LineProperties::AddPropertiesToVector( aProperties ); -// ::chart::NamedLineProperties::AddPropertiesToVector( aProperties ); + //::chart::NamedLineProperties::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 StaticMinMaxLineWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticMinMaxLineWrapperPropertyArray_Initializer > +{ +}; + +struct StaticMinMaxLineWrapperInfoHelper_Initializer +{ + ::cppu::OPropertyArrayHelper* operator()() + { + static ::cppu::OPropertyArrayHelper aPropHelper( *StaticMinMaxLineWrapperPropertyArray::get() ); + return &aPropHelper; + } +}; + +struct StaticMinMaxLineWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticMinMaxLineWrapperInfoHelper_Initializer > +{ +}; + +struct StaticMinMaxLineWrapperInfo_Initializer +{ + uno::Reference< beans::XPropertySetInfo >* operator()() + { + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticMinMaxLineWrapperInfoHelper::get() ) ); + return &xPropertySetInfo; + } +}; + +struct StaticMinMaxLineWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticMinMaxLineWrapperInfo_Initializer > +{ +}; } // anonymous namespace @@ -94,7 +142,6 @@ namespace wrapper MinMaxLineWrapper::MinMaxLineWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) : m_spChart2ModelContact( spChart2ModelContact ) , m_aEventListenerContainer( m_aMutex ) - , m_pPropertyArrayHelper() , m_aWrappedLineJointProperty( C2U("LineJoint"), uno::makeAny( drawing::LineJoint_NONE )) { } @@ -109,11 +156,6 @@ void SAL_CALL MinMaxLineWrapper::dispose() { Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) ); - - // /-- - MutexGuard aGuard( GetMutex()); - m_xInfo.clear(); - // \-- } void SAL_CALL MinMaxLineWrapper::addEventListener( @@ -132,34 +174,16 @@ void SAL_CALL MinMaxLineWrapper::removeEventListener( ::cppu::IPropertyArrayHelper& MinMaxLineWrapper::getInfoHelper() { - if(!m_pPropertyArrayHelper.get()) - { - // /-- - ::osl::MutexGuard aGuard( GetMutex() ); - if(!m_pPropertyArrayHelper.get()) - { - sal_Bool bSorted = sal_True; - m_pPropertyArrayHelper = ::boost::shared_ptr< ::cppu::OPropertyArrayHelper >( new ::cppu::OPropertyArrayHelper( lcl_GetPropertySequence(), bSorted ) ); - } - // \-- - } - return *m_pPropertyArrayHelper.get(); + return *StaticMinMaxLineWrapperInfoHelper::get(); } //XPropertySet uno::Reference< beans::XPropertySetInfo > SAL_CALL MinMaxLineWrapper::getPropertySetInfo() throw (uno::RuntimeException) { - if( !m_xInfo.is() ) - { - // /-- - ::osl::MutexGuard aGuard( GetMutex() ); - if( !m_xInfo.is() ) - m_xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ); - // \-- - } - return m_xInfo; + return *StaticMinMaxLineWrapperInfo::get(); } + void SAL_CALL MinMaxLineWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) { @@ -355,26 +379,14 @@ void SAL_CALL MinMaxLineWrapper::setPropertyToDefault( const ::rtl::OUString& rP { this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) ); } + uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { - static tPropertyValueMap aStaticDefaults; - - // /-- - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aStaticDefaults.size() ) - { - LineProperties::AddDefaultsToMap( aStaticDefaults ); - } - - sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName ); - - tPropertyValueMap::const_iterator aFound( - aStaticDefaults.find( nHandle )); - - if( aFound == aStaticDefaults.end()) + const tPropertyValueMap& rStaticDefaults = *StaticMinMaxLineWrapperDefaults::get(); + tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( getInfoHelper().getHandleByName( rPropertyName ) ) ); + if( aFound == rStaticDefaults.end() ) return uno::Any(); - return (*aFound).second; } @@ -383,7 +395,7 @@ uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const ::rtl::OUString& void SAL_CALL MinMaxLineWrapper::setAllPropertiesToDefault( ) throw (uno::RuntimeException) { - const Sequence< beans::Property >& rPropSeq = lcl_GetPropertySequence(); + const Sequence< beans::Property >& rPropSeq = *StaticMinMaxLineWrapperPropertyArray::get(); for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++) { ::rtl::OUString aPropertyName( rPropSeq[nN].Name ); diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx index 449a1f550860..31a67b600536 100644..100755 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx @@ -123,12 +123,6 @@ private: //member ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySetInfo > - m_xInfo;//outer PropertySetInfo - - ::boost::shared_ptr< ::cppu::OPropertyArrayHelper > m_pPropertyArrayHelper; - WrappedIgnoreProperty m_aWrappedLineJointProperty; }; diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx index 20785faa8b66..9a2183f089fe 100644..100755 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx @@ -182,35 +182,37 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); } -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticTitleWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - // /-- - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +private: + Sequence< Property > lcl_GetPropertySequence() { - // get properties ::std::vector< beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); ::chart::LineProperties::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); -// ::chart::NamedProperties::AddPropertiesToVector( aProperties ); + //::chart::NamedProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties ); ::chart::wrapper::WrappedScaleTextProperties::addProperties( 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 StaticTitleWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticTitleWrapperPropertyArray_Initializer > +{ +}; } // anonymous namespace @@ -526,7 +528,7 @@ Reference< beans::XPropertySet > TitleWrapper::getInnerPropertySet() const Sequence< beans::Property >& TitleWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticTitleWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > TitleWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx index 338131c4f973..16f576453869 100644..100755 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx @@ -57,32 +57,81 @@ namespace static const OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartArea" )); -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticUpDownBarWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - // /-- - 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::LineProperties::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); -// ::chart::NamedProperties::AddPropertiesToVector( aProperties ); + //::chart::NamedProperties::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 StaticUpDownBarWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticUpDownBarWrapperPropertyArray_Initializer > +{ +}; + +struct StaticUpDownBarWrapperInfoHelper_Initializer +{ + ::cppu::OPropertyArrayHelper* operator()() + { + static ::cppu::OPropertyArrayHelper aPropHelper( *StaticUpDownBarWrapperPropertyArray::get() ); + return &aPropHelper; + } +}; + +struct StaticUpDownBarWrapperInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticUpDownBarWrapperInfoHelper_Initializer > +{ +}; + +struct StaticUpDownBarWrapperInfo_Initializer +{ + uno::Reference< beans::XPropertySetInfo >* operator()() + { + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticUpDownBarWrapperInfoHelper::get() ) ); + return &xPropertySetInfo; + } +}; + +struct StaticUpDownBarWrapperInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticUpDownBarWrapperInfo_Initializer > +{ +}; + +struct StaticUpDownBarWrapperDefaults_Initializer +{ + ::chart::tPropertyValueMap* operator()() + { + static ::chart::tPropertyValueMap aStaticDefaults; + lcl_AddDefaultsToMap( aStaticDefaults ); + return &aStaticDefaults; + } +private: + void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) + { + ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::FillProperties::AddDefaultsToMap( rOutMap ); + } +}; + +struct StaticUpDownBarWrapperDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticUpDownBarWrapperDefaults_Initializer > +{ +}; } // anonymous namespace @@ -98,8 +147,6 @@ UpDownBarWrapper::UpDownBarWrapper( : m_spChart2ModelContact( spChart2ModelContact ) , m_aEventListenerContainer( m_aMutex ) , m_aPropertySetName( bUp ? C2U("WhiteDay") : C2U("BlackDay") ) - , m_xInfo(0) - , m_pPropertyArrayHelper() { } @@ -113,11 +160,6 @@ void SAL_CALL UpDownBarWrapper::dispose() { Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) ); - - // /-- - MutexGuard aGuard( GetMutex()); - m_xInfo.clear(); - // \-- } void SAL_CALL UpDownBarWrapper::addEventListener( @@ -136,33 +178,14 @@ void SAL_CALL UpDownBarWrapper::removeEventListener( ::cppu::IPropertyArrayHelper& UpDownBarWrapper::getInfoHelper() { - if(!m_pPropertyArrayHelper.get()) - { - // /-- - ::osl::MutexGuard aGuard( GetMutex() ); - if(!m_pPropertyArrayHelper.get()) - { - sal_Bool bSorted = sal_True; - m_pPropertyArrayHelper = ::boost::shared_ptr< ::cppu::OPropertyArrayHelper >( new ::cppu::OPropertyArrayHelper( lcl_GetPropertySequence(), bSorted ) ); - } - // \-- - } - return *m_pPropertyArrayHelper.get(); + return *StaticUpDownBarWrapperInfoHelper::get(); } //XPropertySet uno::Reference< beans::XPropertySetInfo > SAL_CALL UpDownBarWrapper::getPropertySetInfo() throw (uno::RuntimeException) { - if( !m_xInfo.is() ) - { - // /-- - ::osl::MutexGuard aGuard( GetMutex() ); - if( !m_xInfo.is() ) - m_xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ); - // \-- - } - return m_xInfo; + return *StaticUpDownBarWrapperInfo::get(); } void SAL_CALL UpDownBarWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue ) throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) @@ -320,27 +343,14 @@ void SAL_CALL UpDownBarWrapper::setPropertyToDefault( const ::rtl::OUString& rPr { this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) ); } + uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) { - static tPropertyValueMap aStaticDefaults; - - // /-- - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aStaticDefaults.size() ) - { - LineProperties::AddDefaultsToMap( aStaticDefaults ); - FillProperties::AddDefaultsToMap( aStaticDefaults ); - } - - sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName ); - - tPropertyValueMap::const_iterator aFound( - aStaticDefaults.find( nHandle )); - - if( aFound == aStaticDefaults.end()) + const tPropertyValueMap& rStaticDefaults = *StaticUpDownBarWrapperDefaults::get(); + tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( getInfoHelper().getHandleByName( rPropertyName ) ) ); + if( aFound == rStaticDefaults.end() ) return uno::Any(); - return (*aFound).second; } @@ -349,7 +359,7 @@ uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const ::rtl::OUString& r void SAL_CALL UpDownBarWrapper::setAllPropertiesToDefault( ) throw (uno::RuntimeException) { - const Sequence< beans::Property >& rPropSeq = lcl_GetPropertySequence(); + const Sequence< beans::Property >& rPropSeq = *StaticUpDownBarWrapperPropertyArray::get(); for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++) { ::rtl::OUString aPropertyName( rPropSeq[nN].Name ); diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx index 5b028a6acc66..f271bcbf2bb5 100644..100755 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx @@ -123,11 +123,6 @@ private: //member ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; rtl::OUString m_aPropertySetName; - ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySetInfo > - m_xInfo;//outer PropertySetInfo - ::boost::shared_ptr< ::cppu::OPropertyArrayHelper > m_pPropertyArrayHelper; - }; } // namespace wrapper diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx index a43bc610fc0c..be485f86aac4 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx @@ -59,31 +59,33 @@ namespace static const OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.WallOrFloor" )); -const Sequence< Property > & lcl_GetPropertySequence() +struct StaticWallFloorWrapperPropertyArray_Initializer { - static Sequence< Property > aPropSeq; + Sequence< Property >* operator()() + { + static Sequence< Property > aPropSeq( lcl_GetPropertySequence() ); + return &aPropSeq; + } - // /-- - 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::FillProperties::AddPropertiesToVector( aProperties ); ::chart::LineProperties::AddPropertiesToVector( aProperties ); -// ::chart::NamedProperties::AddPropertiesToVector( aProperties ); + //::chart::NamedProperties::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 StaticWallFloorWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticWallFloorWrapperPropertyArray_Initializer > +{ +}; } // anonymous namespace @@ -155,7 +157,7 @@ Reference< beans::XPropertySet > WallFloorWrapper::getInnerPropertySet() const Sequence< beans::Property >& WallFloorWrapper::getPropertySequence() { - return lcl_GetPropertySequence(); + return *StaticWallFloorWrapperPropertyArray::get(); } const std::vector< WrappedProperty* > WallFloorWrapper::createWrappedProperties() diff --git a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx index 15ae48bc22dd..925b9694ba5f 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx @@ -131,7 +131,6 @@ void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList ) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedAutomaticPositionProperties::addProperties( ::std::vector< Property > & rOutProperties ) { rOutProperties.push_back( @@ -145,7 +144,6 @@ void WrappedAutomaticPositionProperties::addProperties( ::std::vector< Property //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedAutomaticPositionProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList ) { lcl_addWrappedProperties( rList ); diff --git a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx index 0c4a98263a04..11e49850b694 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx @@ -69,7 +69,6 @@ private: //member sal_Int32 m_nDimensionIndex; }; -//static void WrappedAxisAndGridExistenceProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { @@ -239,7 +238,6 @@ private: //member TitleHelper::eTitleType m_eTitleType; }; -//static void WrappedAxisTitleExistenceProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { @@ -359,7 +357,6 @@ private: //member sal_Int32 m_nDimensionIndex; }; -//static void WrappedAxisLabelExistenceProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx index 5fca42c2b3ad..bd7c49052804 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx @@ -62,7 +62,6 @@ WrappedCharacterHeightProperty_Base::~WrappedCharacterHeightProperty_Base() { } -//static void WrappedCharacterHeightProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList , ReferenceSizePropertyProvider* pRefSizePropProvider ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx index bc91136590cb..902938f04a78 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx @@ -119,7 +119,6 @@ void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedDataCaptionProperties::addProperties( ::std::vector< Property > & rOutProperties ) { rOutProperties.push_back( @@ -133,7 +132,6 @@ void WrappedDataCaptionProperties::addProperties( ::std::vector< Property > & rO //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedDataCaptionProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { @@ -143,7 +141,6 @@ void WrappedDataCaptionProperties::addWrappedPropertiesForSeries( std::vector< W //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedDataCaptionProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx index 61abab9e7209..658a9af83ac5 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx @@ -116,7 +116,6 @@ WrappedScaleProperty::~WrappedScaleProperty() { } -//static void WrappedScaleProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx index 5e11a3012cf3..2249ac1c41c3 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx @@ -141,7 +141,6 @@ enum //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedScaleTextProperties::addProperties( ::std::vector< Property > & rOutProperties ) { rOutProperties.push_back( @@ -155,7 +154,6 @@ void WrappedScaleTextProperties::addProperties( ::std::vector< Property > & rOut //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedScaleTextProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx index 68d408ea7147..79c09b8b41b0 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx @@ -46,7 +46,6 @@ namespace chart namespace wrapper { -//static void WrappedSceneProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx index 16ddb1137d4a..6890e06a1641 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx @@ -197,7 +197,6 @@ enum //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedSplineProperties::addProperties( ::std::vector< Property > & rOutProperties ) { rOutProperties.push_back( @@ -226,12 +225,11 @@ void WrappedSplineProperties::addProperties( ::std::vector< Property > & rOutPro //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedSplineProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { rList.push_back( new WrappedSplineTypeProperty( spChart2ModelContact ) ); - rList.push_back( new WrappedSplineProperty<sal_Int32>( C2U("SplineOrder"), C2U("SplineOrder"), uno::makeAny(sal_Int32(2)), spChart2ModelContact ) ); + rList.push_back( new WrappedSplineProperty<sal_Int32>( C2U("SplineOrder"), C2U("SplineOrder"), uno::makeAny(sal_Int32(3)), spChart2ModelContact ) ); rList.push_back( new WrappedSplineProperty<sal_Int32>( C2U("SplineResolution"), C2U("CurveResolution"), uno::makeAny(sal_Int32(20)), spChart2ModelContact ) ); } diff --git a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx index 1c7b495bd566..145e3423ccd8 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx @@ -1032,7 +1032,6 @@ void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList }//anonymous namespace -//static void WrappedStatisticProperties::addProperties( ::std::vector< Property > & rOutProperties ) { rOutProperties.push_back( @@ -1128,7 +1127,6 @@ void WrappedStatisticProperties::addProperties( ::std::vector< Property > & rOut //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedStatisticProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { @@ -1138,7 +1136,6 @@ void WrappedStatisticProperties::addWrappedPropertiesForSeries( std::vector< Wra //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedStatisticProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx index 3ecb23ce84d2..37db09b977b6 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx @@ -291,7 +291,6 @@ enum //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedStockProperties::addProperties( ::std::vector< Property > & rOutProperties ) { rOutProperties.push_back( @@ -313,7 +312,6 @@ void WrappedStockProperties::addProperties( ::std::vector< Property > & rOutProp //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedStockProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx index 4ca8f7161f6e..068f65f415be 100644..100755 --- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx @@ -201,7 +201,6 @@ void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedSymbolProperties::addProperties( ::std::vector< Property > & rOutProperties ) { rOutProperties.push_back( @@ -236,7 +235,6 @@ void WrappedSymbolProperties::addProperties( ::std::vector< Property > & rOutPro //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedSymbolProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { @@ -246,7 +244,6 @@ void WrappedSymbolProperties::addWrappedPropertiesForSeries( std::vector< Wrappe //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void WrappedSymbolProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) { @@ -573,8 +570,19 @@ void WrappedSymbolAndLinesProperty::setValueToSeries( if(!xSeriesPropertySet.is()) return; - drawing::LineStyle eLineStyle( bDrawLines ? drawing::LineStyle_SOLID : drawing::LineStyle_NONE ); - xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( eLineStyle ) ); + drawing::LineStyle eOldLineStyle( drawing::LineStyle_SOLID ); + xSeriesPropertySet->getPropertyValue( C2U("LineStyle") ) >>= eOldLineStyle; + if( bDrawLines ) + { + //#i114298# don't overwrite dashed lines with solid lines here + if( eOldLineStyle == drawing::LineStyle_NONE ) + xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_SOLID ) ); + } + else + { + if( eOldLineStyle != drawing::LineStyle_NONE ) + xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_NONE ) ); + } } beans::PropertyState WrappedSymbolAndLinesProperty::getPropertyState( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index 550aee7132d9..c4c2ba8bdcd8 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -388,7 +388,6 @@ bool SeriesHeader::HasFocus() const return m_spSeriesName->HasFocus(); } -// static Image SeriesHeader::GetChartTypeImage( const Reference< chart2::XChartType > & xChartType, bool bSwapXAndYAxis, diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index 49e28e304975..6e145dc1dfbf 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -381,7 +381,6 @@ DialogModel::DialogModel( m_xContext( xContext ), m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY ) ) { - createBackup(); } DialogModel::~DialogModel() @@ -724,20 +723,16 @@ bool DialogModel::setData( return true; } -// static OUString DialogModel::ConvertRoleFromInternalToUI( const OUString & rRoleString ) { return lcl_ConvertRole( rRoleString, true ); } -// static OUString DialogModel::GetRoleDataLabel() { return OUString( String( ::chart::SchResId( STR_OBJECT_DATALABELS ))); } -// static - sal_Int32 DialogModel::GetRoleIndexForSorting( const ::rtl::OUString & rInternalRoleString ) { static lcl_tRoleIndexMap aRoleIndexMap; @@ -754,20 +749,6 @@ sal_Int32 DialogModel::GetRoleIndexForSorting( const ::rtl::OUString & rInternal // private methods -void DialogModel::createBackup() -{ - OSL_ENSURE( ! m_xBackupChartDocument.is(), "Cloning already cloned model" ); - try - { - Reference< util::XCloneable > xCloneable( m_xChartDocument, uno::UNO_QUERY_THROW ); - m_xBackupChartDocument.set( xCloneable->createClone(), uno::UNO_QUERY_THROW ); - } - catch( uno::Exception & ex ) - { - ASSERT_EXCEPTION( ex ); - } -} - void DialogModel::applyInterpretedData( const InterpretedData & rNewData, const ::std::vector< Reference< XDataSeries > > & rSeriesToReUse, diff --git a/chart2/source/controller/dialogs/DialogModel.hxx b/chart2/source/controller/dialogs/DialogModel.hxx index dcca6c716b8d..b7f882611e47 100644 --- a/chart2/source/controller/dialogs/DialogModel.hxx +++ b/chart2/source/controller/dialogs/DialogModel.hxx @@ -163,10 +163,6 @@ private: m_xChartDocument; ::com::sun::star::uno::Reference< - ::com::sun::star::chart2::XChartDocument > - m_xBackupChartDocument; - - ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartTypeTemplate > m_xTemplate; diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index 81ec9c6c2ca7..257ff045f116 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -332,7 +332,7 @@ rtl::OUString ObjectNameProvider::getName( ObjectType eObjectType, bool bPlural } return aRet; } -//static + rtl::OUString ObjectNameProvider::getAxisName( const rtl::OUString& rObjectCID , const uno::Reference< frame::XModel >& xChartModel ) { @@ -373,7 +373,6 @@ rtl::OUString ObjectNameProvider::getAxisName( const rtl::OUString& rObjectCID return aRet; } -//static OUString ObjectNameProvider::getTitleNameByType( TitleHelper::eTitleType eType ) { OUString aRet; @@ -412,7 +411,6 @@ OUString ObjectNameProvider::getTitleNameByType( TitleHelper::eTitleType eType ) return aRet; } -//static OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID , const Reference< frame::XModel >& xChartModel ) { @@ -432,7 +430,6 @@ OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID return aRet; } -//static rtl::OUString ObjectNameProvider::getGridName( const rtl::OUString& rObjectCID , const uno::Reference< frame::XModel >& xChartModel ) { @@ -709,7 +706,6 @@ rtl::OUString ObjectNameProvider::getHelpText( const rtl::OUString& rObjectCID, return aRet; } -// static rtl::OUString ObjectNameProvider::getSelectedObjectText( const rtl::OUString & rObjectCID, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument ) { rtl::OUString aRet; @@ -762,8 +758,6 @@ rtl::OUString ObjectNameProvider::getSelectedObjectText( const rtl::OUString & r return aRet; } - -// static rtl::OUString ObjectNameProvider::getNameForCID( const rtl::OUString& rObjectCID, const uno::Reference< chart2::XChartDocument >& xChartDocument ) @@ -820,7 +814,6 @@ rtl::OUString ObjectNameProvider::getNameForCID( return getName( eType ); } -//static rtl::OUString ObjectNameProvider::getName_ObjectForSeries( ObjectType eObjectType, const rtl::OUString& rSeriesCID, @@ -839,7 +832,6 @@ rtl::OUString ObjectNameProvider::getName_ObjectForSeries( return ObjectNameProvider::getName_ObjectForAllSeries( eObjectType ); } -//static rtl::OUString ObjectNameProvider::getName_ObjectForAllSeries( ObjectType eObjectType ) { OUString aRet = String(SchResId(STR_OBJECT_FOR_ALL_SERIES)); diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx index 9469293ae1c5..3e4cba6b23ad 100644 --- a/chart2/source/controller/dialogs/dlg_DataSource.cxx +++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx @@ -146,7 +146,6 @@ void DataSourceTabControl::EnableTabToggling() // ---------------------------------------- -// static USHORT DataSourceDialog::m_nLastPageId = 0; DataSourceDialog::DataSourceDialog( diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx index a362c883567d..9c0d8f1e1b10 100644 --- a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx @@ -95,7 +95,6 @@ void InsertErrorBarsDialog::SetAxisMinorStepWidthForErrorBarDecimals( double fMi m_apErrorBarResources->SetAxisMinorStepWidthForErrorBarDecimals( fMinorStepWidth ); } -//static double InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( const Reference< frame::XModel >& xChartModel, const Reference< uno::XInterface >& xChartView, diff --git a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx index bf0dedfbc6e8..d7491156358e 100644 --- a/chart2/source/controller/dialogs/dlg_NumberFormat.cxx +++ b/chart2/source/controller/dialogs/dlg_NumberFormat.cxx @@ -67,7 +67,6 @@ NumberFormatDialog::~NumberFormatDialog() { } -//static SfxItemSet NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( SfxItemPool& rItemPool ) { static const USHORT nWhichPairs[] = diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx index 26a726ac5156..3c868f6aeaff 100644 --- a/chart2/source/controller/dialogs/dlg_View3D.cxx +++ b/chart2/source/controller/dialogs/dlg_View3D.cxx @@ -57,7 +57,6 @@ using namespace ::com::sun::star::chart2; //------------------------------------------------------------------- //------------------------------------------------------------------- -// static USHORT View3DDialog::m_nLastPageId = 0; View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, XColorTable* pColorTable ) diff --git a/chart2/source/controller/dialogs/tp_DataLabel.src b/chart2/source/controller/dialogs/tp_DataLabel.src index 615e81c2c550..0f8f12c3e48b 100644 --- a/chart2/source/controller/dialogs/tp_DataLabel.src +++ b/chart2/source/controller/dialogs/tp_DataLabel.src @@ -28,10 +28,6 @@ #include "TabPages.hrc" #include "res_DataLabel.hrc" -#ifndef _GLOBLMN_HRC -#include <svx/globlmn.hrc> -#endif - TabPage TP_DATA_DESCR { Hide = TRUE ; diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx index 48c96a715c5f..9da7f7536d28 100644 --- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx +++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx @@ -424,7 +424,6 @@ void DrawViewWrapper::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) } } -//static SdrObject* DrawViewWrapper::getSdrObject( const uno::Reference< drawing::XShape >& xShape ) { diff --git a/chart2/source/controller/inc/ConfigurationAccess.hxx b/chart2/source/controller/inc/ConfigurationAccess.hxx index 0cc8180b3dd2..4b5196e7f902 100644 --- a/chart2/source/controller/inc/ConfigurationAccess.hxx +++ b/chart2/source/controller/inc/ConfigurationAccess.hxx @@ -29,7 +29,7 @@ #define _CHART2_CONFIGURATIONACCESS_HXX // header for enum FieldUnit -#include <vcl/fldunit.hxx> +#include <tools/fldunit.hxx> //............................................................................. namespace chart diff --git a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx index 5ee167260974..5754559ce8ae 100644 --- a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx @@ -239,7 +239,6 @@ bool ItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) // -------------------------------------------------------------------------------- -//static void ItemConverter::InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItemSet &rSourceSet ) { SfxWhichIter aIter (rSourceSet); diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index bf8afc65e78f..675bcf40e7a2 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -475,6 +475,7 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent if( rEvent.NewMode.equals(C2U("dirty")) ) { //the view has become dirty, we should repaint it if we have a window + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if( m_pChartWindow ) m_pChartWindow->ForceInvalidate(); } @@ -518,8 +519,11 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent impl_initializeAccessible(); - if( m_pChartWindow ) - m_pChartWindow->Invalidate(); + { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if( m_pChartWindow ) + m_pChartWindow->Invalidate(); + } } m_bConnectingToView = false; @@ -537,10 +541,10 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent //is called to attach the controller to a new model. //return true if attach was successfully, false otherwise (e.g. if you do not work with a model) - ::vos::OClearableGuard aGuard( Application::GetSolarMutex()); + ::vos::OClearableGuard aClearableGuard( Application::GetSolarMutex()); if( impl_isDisposedOrSuspended() ) //@todo? allow attaching a new model while suspended? return sal_False; //behave passive if already disposed or suspended - aGuard.clear(); + aClearableGuard.clear(); TheModelRef aNewModelRef( new TheModel( xModel), m_aModelMutex); @@ -612,8 +616,11 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent } //the frameloader is responsible to call xModel->connectController - if( m_pChartWindow ) - m_pChartWindow->Invalidate(); + { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if( m_pChartWindow ) + m_pChartWindow->Invalidate(); + } uno::Reference< chart2::XUndoSupplier > xUndoSupplier( getModel(), uno::UNO_QUERY ); if( xUndoSupplier.is()) @@ -1106,6 +1113,7 @@ bool lcl_isFormatObjectCommand( const rtl::OString& aCommand ) else if(aCommand.equals("Update")) //Update Chart { ChartViewHelper::setViewToDirtyState( getModel() ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if( m_pChartWindow ) m_pChartWindow->Invalidate(); } @@ -1491,6 +1499,7 @@ uno::Reference< XAccessible > ChartController::CreateAccessible() void ChartController::impl_invalidateAccessible() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if( m_pChartWindow ) { Reference< lang::XInitialization > xInit( m_pChartWindow->GetAccessible(false), uno::UNO_QUERY ); @@ -1503,6 +1512,7 @@ void ChartController::impl_invalidateAccessible() } void ChartController::impl_initializeAccessible() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if( m_pChartWindow ) this->impl_initializeAccessible( Reference< lang::XInitialization >( m_pChartWindow->GetAccessible(false), uno::UNO_QUERY ) ); } @@ -1517,11 +1527,14 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn aArguments[1]=uno::makeAny(xModel); aArguments[2]=uno::makeAny(m_xChartView); uno::Reference< XAccessible > xParent; - if( m_pChartWindow ) { - Window* pParentWin( m_pChartWindow->GetAccessibleParentWindow()); - if( pParentWin ) - xParent.set( pParentWin->GetAccessible()); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if( m_pChartWindow ) + { + Window* pParentWin( m_pChartWindow->GetAccessibleParentWindow()); + if( pParentWin ) + xParent.set( pParentWin->GetAccessible()); + } } aArguments[3]=uno::makeAny(xParent); aArguments[4]=uno::makeAny(m_xViewWindow); diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx index a6e82430d8f6..6091fd8ef3f8 100644 --- a/chart2/source/controller/main/ChartController_TextEdit.cxx +++ b/chart2/source/controller/main/ChartController_TextEdit.cxx @@ -76,6 +76,7 @@ void ChartController::StartTextEdit( const Point* pMousePixel ) { //the first marked object will be edited + ::vos::OGuard aGuard( Application::GetSolarMutex() ); SdrObject* pTextObj = m_pDrawViewWrapper->getTextEditObject(); if(!pTextObj) return; diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index 779e3c32f1e7..735cb9634671 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -297,6 +297,7 @@ void ChartController::executeDispatch_ScaleText() void ChartController::executeDispatch_Paste() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if( m_pChartWindow ) { Graphic aGraphic; @@ -581,7 +582,6 @@ void ChartController::executeDispatch_Cut() executeDispatch_Delete(); } -//static bool ChartController::isObjectDeleteable( const uno::Any& rSelection ) { ObjectIdentifier aSelOID( rSelection ); diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 56908ac4ef79..885e37126dc2 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -243,12 +243,12 @@ const short HITPIX=2; //hit-tolerance in pixel , sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw (uno::RuntimeException) { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); uno::Reference<awt::XWindow> xWindow = m_xViewWindow; - Window* pWindow = m_pChartWindow; - if(xWindow.is() && pWindow) + if(xWindow.is() && m_pChartWindow) { - Size aLogicSize = pWindow->PixelToLogic( Size( Width, Height ), MapMode( MAP_100TH_MM ) ); + Size aLogicSize = m_pChartWindow->PixelToLogic( Size( Width, Height ), MapMode( MAP_100TH_MM ) ); bool bIsEmbedded = true; //todo: for standalone chart: detect wether we are standalone @@ -263,8 +263,8 @@ const short HITPIX=2; //hit-tolerance in pixel MapMode aNewMapMode( MAP_100TH_MM, Point(0,0) , Fraction(nScaleXNumerator,nScaleXDenominator) , Fraction(nScaleYNumerator,nScaleYDenominator) ); - pWindow->SetMapMode(aNewMapMode); - pWindow->SetPosSizePixel( X, Y, Width, Height, Flags ); + m_pChartWindow->SetMapMode(aNewMapMode); + m_pChartWindow->SetPosSizePixel( X, Y, Width, Height, Flags ); //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100% uno::Reference< beans::XPropertySet > xProp( m_xChartView, uno::UNO_QUERY ); @@ -285,7 +285,7 @@ const short HITPIX=2; //hit-tolerance in pixel //a correct work area is at least necessary for correct values in the position and size dialog and for dragging area if(m_pDrawViewWrapper) { - Rectangle aRect(Point(0,0), pWindow->GetOutputSize()); + Rectangle aRect(Point(0,0), m_pChartWindow->GetOutputSize()); m_pDrawViewWrapper->SetWorkArea( aRect ); } } @@ -293,9 +293,9 @@ const short HITPIX=2; //hit-tolerance in pixel { //change visarea ChartModelHelper::setPageSize( awt::Size( aLogicSize.Width(), aLogicSize.Height() ), getModel() ); - pWindow->SetPosSizePixel( X, Y, Width, Height, Flags ); + m_pChartWindow->SetPosSizePixel( X, Y, Width, Height, Flags ); } - pWindow->Invalidate(); + m_pChartWindow->Invalidate(); } } @@ -533,12 +533,11 @@ void ChartController::execute_Paint( const Rectangle& rRect ) if( xUpdatable.is() ) xUpdatable->update(); - Window* pWindow = m_pChartWindow; { ::vos::OGuard aGuard( Application::GetSolarMutex()); DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; if(pDrawViewWrapper) - pDrawViewWrapper->CompleteRedraw(pWindow, Region(rRect) ); + pDrawViewWrapper->CompleteRedraw(m_pChartWindow, Region(rRect) ); } } catch( uno::Exception & ex ) @@ -562,6 +561,8 @@ bool isDoubleClick( const MouseEvent& rMEvt ) void ChartController::startDoubleClickWaiting() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + m_bWaitingForDoubleClick = true; ULONG nDblClkTime = 500; @@ -587,6 +588,7 @@ IMPL_LINK( ChartController, DoubleClickWaitingHdl, void*, EMPTYARG ) if( !m_bWaitingForMouseUp && m_aSelection.maybeSwitchSelectionAfterSingleClickWasEnsured() ) { this->impl_selectObjectAndNotiy(); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if( m_pChartWindow ) { Window::PointerState aPointerState( m_pChartWindow->GetPointerState() ); @@ -615,17 +617,16 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt ) m_aSelection.remindSelectionBeforeMouseDown(); - Window* pWindow = m_pChartWindow; DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; - if(!pWindow || !pDrawViewWrapper ) + if(!m_pChartWindow || !pDrawViewWrapper ) return; - Point aMPos = pWindow->PixelToLogic(rMEvt.GetPosPixel()); + Point aMPos = m_pChartWindow->PixelToLogic(rMEvt.GetPosPixel()); if ( MOUSE_LEFT == rMEvt.GetButtons() ) { - pWindow->GrabFocus(); - pWindow->CaptureMouse(); + m_pChartWindow->GrabFocus(); + m_pChartWindow->CaptureMouse(); } if( pDrawViewWrapper->IsTextEdit() ) @@ -710,7 +711,7 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt ) && !rMEvt.IsRight() ) { //start drag - USHORT nDrgLog = (USHORT)pWindow->PixelToLogic(Size(DRGPIX,0)).Width(); + USHORT nDrgLog = (USHORT)m_pChartWindow->PixelToLogic(Size(DRGPIX,0)).Width(); SdrDragMethod* pDragMethod = NULL; //change selection to 3D scene if rotate mode @@ -750,9 +751,8 @@ void ChartController::execute_MouseMove( const MouseEvent& rMEvt ) { ::vos::OGuard aGuard( Application::GetSolarMutex()); - Window* pWindow = m_pChartWindow; DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; - if(!pWindow || !pDrawViewWrapper) + if(!m_pChartWindow || !pDrawViewWrapper) return; if( m_pDrawViewWrapper->IsTextEdit() ) @@ -763,7 +763,7 @@ void ChartController::execute_MouseMove( const MouseEvent& rMEvt ) if(pDrawViewWrapper->IsAction()) { - pDrawViewWrapper->MovAction( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); + pDrawViewWrapper->MovAction( m_pChartWindow->PixelToLogic( rMEvt.GetPosPixel() ) ); } //?? pDrawViewWrapper->GetPageView()->DragPoly(); @@ -785,12 +785,11 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) { ::vos::OGuard aGuard( Application::GetSolarMutex()); - Window* pWindow = m_pChartWindow; DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; - if(!pWindow || !pDrawViewWrapper) + if(!m_pChartWindow || !pDrawViewWrapper) return; - Point aMPos = pWindow->PixelToLogic(rMEvt.GetPosPixel()); + Point aMPos = m_pChartWindow->PixelToLogic(rMEvt.GetPosPixel()); if(pDrawViewWrapper->IsTextEdit()) { @@ -920,7 +919,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) } //@todo ForcePointer(&rMEvt); - pWindow->ReleaseMouse(); + m_pChartWindow->ReleaseMouse(); if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() ) bNotifySelectionChange = true; @@ -969,7 +968,9 @@ void ChartController::execute_DoubleClick( const Point* pMousePixel ) void ChartController::execute_Resize() { - m_pChartWindow->Invalidate(); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if(m_pChartWindow) + m_pChartWindow->Invalidate(); } void ChartController::execute_Activate() { @@ -992,13 +993,11 @@ void ChartController::execute_LoseFocus() void ChartController::execute_Command( const CommandEvent& rCEvt ) { - Window* pWindow = m_pChartWindow; - bool bIsAction = false; { ::vos::OGuard aGuard( Application::GetSolarMutex()); DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; - if(!pWindow || !pDrawViewWrapper) + if(!m_pChartWindow || !pDrawViewWrapper) return; bIsAction = m_pDrawViewWrapper->IsAction(); } @@ -1006,7 +1005,11 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) // pop-up menu if(rCEvt.GetCommand() == COMMAND_CONTEXTMENU && !bIsAction) { - m_pChartWindow->ReleaseMouse(); + { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if(m_pChartWindow) + m_pChartWindow->ReleaseMouse(); + } if( m_aSelection.isSelectionDifferentFromBeforeMouseDown() ) impl_notifySelectionChangeListeners(); @@ -1020,7 +1023,9 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) Point aPos( rCEvt.GetMousePosPixel() ); if( !rCEvt.IsMouseEvent() ) { - aPos = m_pChartWindow->GetPointerState().maPos; + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if(m_pChartWindow) + aPos = m_pChartWindow->GetPointerState().maPos; } aContextMenuHelper.completeAndExecute( aPos, aContextMenu ); } @@ -1290,7 +1295,11 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame ); Point aPos( rCEvt.GetMousePosPixel() ); if( !rCEvt.IsMouseEvent() ) - aPos = m_pChartWindow->GetPointerState().maPos; + { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if(m_pChartWindow) + aPos = m_pChartWindow->GetPointerState().maPos; + } aContextMenuHelper.completeAndExecute( aPos, xPopupMenu ); } } @@ -1301,6 +1310,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) ( rCEvt.GetCommand() == COMMAND_INPUTCONTEXTCHANGE ) ) { //#i84417# enable editing with IME + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if( m_pDrawViewWrapper ) m_pDrawViewWrapper->Command( rCEvt, m_pChartWindow ); } @@ -1310,9 +1320,8 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) { bool bReturn=false; - Window* pWindow = m_pChartWindow; DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; - if(!pWindow || !pDrawViewWrapper) + if(!m_pChartWindow || !pDrawViewWrapper) return bReturn; // handle accelerators @@ -1335,14 +1344,17 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) if( bReturn ) return bReturn; - if( pDrawViewWrapper->IsTextEdit() ) { - if( pDrawViewWrapper->KeyInput(rKEvt,pWindow) ) + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if( pDrawViewWrapper->IsTextEdit() ) { - bReturn = true; - if( nCode == KEY_ESCAPE ) + if( pDrawViewWrapper->KeyInput(rKEvt,m_pChartWindow) ) { - this->EndTextEdit(); + bReturn = true; + if( nCode == KEY_ESCAPE ) + { + this->EndTextEdit(); + } } } } @@ -1434,12 +1446,16 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) // default 1 mm in each direction double fGrowAmountX = 200.0; double fGrowAmountY = 200.0; - if( bAlternate && pWindow ) + if( bAlternate && m_pChartWindow ) { // together with Alt-key: 1 px in each direction - Size aPixelSize = pWindow->PixelToLogic( Size( 2, 2 )); - fGrowAmountX = static_cast< double >( aPixelSize.Width()); - fGrowAmountY = static_cast< double >( aPixelSize.Height()); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if( m_pChartWindow ) + { + Size aPixelSize = m_pChartWindow->PixelToLogic( Size( 2, 2 )); + fGrowAmountX = static_cast< double >( aPixelSize.Width()); + fGrowAmountY = static_cast< double >( aPixelSize.Height()); + } } if( nCode == KEY_SUBTRACT ) { @@ -1461,12 +1477,16 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) // default 1 mm double fShiftAmountX = 100.0; double fShiftAmountY = 100.0; - if( bAlternate && pWindow ) + if( bAlternate && m_pChartWindow ) { // together with Alt-key: 1 px - Size aPixelSize = pWindow->PixelToLogic( Size( 1, 1 )); - fShiftAmountX = static_cast< double >( aPixelSize.Width()); - fShiftAmountY = static_cast< double >( aPixelSize.Height()); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if(m_pChartWindow) + { + Size aPixelSize = m_pChartWindow->PixelToLogic( Size( 1, 1 )); + fShiftAmountX = static_cast< double >( aPixelSize.Width()); + fShiftAmountY = static_cast< double >( aPixelSize.Height()); + } } switch( nCode ) { @@ -1557,6 +1577,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) bReturn = executeDispatch_Delete(); if( ! bReturn ) { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); InfoBox( m_pChartWindow, String(SchResId( STR_ACTION_NOTPOSSIBLE ))).Execute(); } } @@ -1729,11 +1750,14 @@ bool ChartController::requestQuickHelp( void ChartController::impl_selectObjectAndNotiy() { - DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; - if( pDrawViewWrapper ) { - pDrawViewWrapper->SetDragMode( m_eDragMode ); - m_aSelection.applySelection( m_pDrawViewWrapper ); + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper; + if( pDrawViewWrapper ) + { + pDrawViewWrapper->SetDragMode( m_eDragMode ); + m_aSelection.applySelection( m_pDrawViewWrapper ); + } } impl_notifySelectionChangeListeners(); } @@ -1862,10 +1886,9 @@ bool ChartController::impl_DragDataPoint( const ::rtl::OUString & rCID, double f void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) { ::vos::OGuard aGuard( Application::GetSolarMutex()); - Window* pWindow = m_pChartWindow; - if( m_pDrawViewWrapper && pWindow ) + if( m_pDrawViewWrapper && m_pChartWindow ) { - Point aMousePos( pWindow->PixelToLogic( rEvent.GetPosPixel())); + Point aMousePos( m_pChartWindow->PixelToLogic( rEvent.GetPosPixel())); sal_uInt16 nModifier = rEvent.GetModifier(); BOOL bLeftDown = rEvent.IsLeft(); @@ -1873,8 +1896,8 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) { if( m_pDrawViewWrapper->IsTextEditHit( aMousePos, HITPIX) ) { - pWindow->SetPointer( m_pDrawViewWrapper->GetPreferedPointer( - aMousePos, pWindow, nModifier, bLeftDown ) ); + m_pChartWindow->SetPointer( m_pDrawViewWrapper->GetPreferedPointer( + aMousePos, m_pChartWindow, nModifier, bLeftDown ) ); return; } } @@ -1891,7 +1914,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) { Pointer aPointer = m_pDrawViewWrapper->GetPreferedPointer( - aMousePos, pWindow, nModifier, bLeftDown ); + aMousePos, m_pChartWindow, nModifier, bLeftDown ); bool bForceArrowPointer = false; ObjectIdentifier aOID( m_aSelection.getSelectedOID() ); @@ -1924,9 +1947,9 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) } if( bForceArrowPointer ) - pWindow->SetPointer( Pointer( POINTER_ARROW )); + m_pChartWindow->SetPointer( Pointer( POINTER_ARROW )); else - pWindow->SetPointer( aPointer ); + m_pChartWindow->SetPointer( aPointer ); } else { @@ -1975,7 +1998,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) } break; } - pWindow->SetPointer( Pointer( ePointerStyle ) ); + m_pChartWindow->SetPointer( Pointer( ePointerStyle ) ); return; } @@ -1987,7 +2010,7 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) { if( aHitObjectCID.equals(m_aSelection.getSelectedCID()) ) { - pWindow->SetPointer( Pointer( POINTER_ARROW )); + m_pChartWindow->SetPointer( Pointer( POINTER_ARROW )); return; } } @@ -1995,14 +2018,14 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) if( !aHitObjectCID.getLength() ) { //additional shape was hit - pWindow->SetPointer( POINTER_MOVE ); + m_pChartWindow->SetPointer( POINTER_MOVE ); } else if( ObjectIdentifier::isDragableObject( aHitObjectCID ) ) { if( (m_eDragMode == SDRDRAG_ROTATE) && SelectionHelper::isRotateableObject( aHitObjectCID , getModel() ) ) - pWindow->SetPointer( Pointer( POINTER_ROTATE ) ); + m_pChartWindow->SetPointer( Pointer( POINTER_ROTATE ) ); else { ObjectType eHitObjectType = ObjectIdentifier::getObjectType( aHitObjectCID ); @@ -2011,15 +2034,15 @@ void ChartController::impl_SetMousePointer( const MouseEvent & rEvent ) if( !ObjectIdentifier::areSiblings(aHitObjectCID,m_aSelection.getSelectedCID()) && !ObjectIdentifier::areIdenticalObjects(aHitObjectCID,m_aSelection.getSelectedCID()) ) { - pWindow->SetPointer( Pointer( POINTER_ARROW )); + m_pChartWindow->SetPointer( Pointer( POINTER_ARROW )); return; } } - pWindow->SetPointer( POINTER_MOVE ); + m_pChartWindow->SetPointer( POINTER_MOVE ); } } else - pWindow->SetPointer( Pointer( POINTER_ARROW )); + m_pChartWindow->SetPointer( Pointer( POINTER_ARROW )); } } } diff --git a/chart2/source/controller/main/ImplUndoManager.cxx b/chart2/source/controller/main/ImplUndoManager.cxx index e45329465d45..c805d39d36a1 100644 --- a/chart2/source/controller/main/ImplUndoManager.cxx +++ b/chart2/source/controller/main/ImplUndoManager.cxx @@ -143,7 +143,6 @@ OUString UndoElement::getActionString() const return m_aActionString; } -// static Reference< frame::XModel > UndoElement::cloneModel( const Reference< frame::XModel > & xModel ) { Reference< frame::XModel > xResult; @@ -155,7 +154,6 @@ Reference< frame::XModel > UndoElement::cloneModel( const Reference< frame::XMod return xResult; } -// static void UndoElement::applyModelContentToModel( Reference< frame::XModel > & xInOutModelToChange, const Reference< frame::XModel > & xModelToCopyFrom, diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index fe73d15500f5..19577eb4900e 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -630,13 +630,11 @@ ObjectHierarchy::ObjectHierarchy( ObjectHierarchy::~ObjectHierarchy() {} -// static ObjectHierarchy::tOID ObjectHierarchy::getRootNodeOID() { return ObjectIdentifier( C2U( "ROOT" ) ); } -// static bool ObjectHierarchy::isRootNode( const ObjectHierarchy::tOID& rOID ) { return ( rOID == ObjectHierarchy::getRootNodeOID() ); diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx index 567a36473a5b..cd51adc7842e 100644 --- a/chart2/source/controller/main/SelectionHelper.cxx +++ b/chart2/source/controller/main/SelectionHelper.cxx @@ -335,7 +335,6 @@ bool Selection::isAdditionalShapeSelected() const //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static bool SelectionHelper::findNamedParent( SdrObject*& pInOutObject , rtl::OUString& rOutName , bool bGivenObjectMayBeResult ) @@ -369,7 +368,6 @@ bool SelectionHelper::findNamedParent( SdrObject*& pInOutObject return true; } -//static bool SelectionHelper::findNamedParent( SdrObject*& pInOutObject , ObjectIdentifier& rOutObject , bool bGivenObjectMayBeResult ) @@ -383,7 +381,6 @@ bool SelectionHelper::findNamedParent( SdrObject*& pInOutObject return false; } -//static bool SelectionHelper::isDragableObjectHitTwice( const Point& rMPos , const rtl::OUString& rNameOfSelectedObject , const DrawViewWrapper& rDrawViewWrapper ) @@ -399,7 +396,6 @@ bool SelectionHelper::isDragableObjectHitTwice( const Point& rMPos return true; } -// static ::rtl::OUString SelectionHelper::getHitObjectCID( const Point& rMPos, DrawViewWrapper& rDrawViewWrapper, @@ -465,7 +461,6 @@ bool SelectionHelper::isDragableObjectHitTwice( const Point& rMPos // \\- solar mutex } -//static bool SelectionHelper::isRotateableObject( const ::rtl::OUString& rCID , const uno::Reference< frame::XModel >& xChartModel ) { @@ -497,7 +492,6 @@ bool SelectionHelper::getFrameDragSingles() return bFrameDragSingles; } -//static SdrObject* SelectionHelper::getMarkHandlesObject( SdrObject* pObj ) { if(!pObj) @@ -553,7 +547,6 @@ SdrObject* SelectionHelper::getObjectToMark() return m_pMarkObj; } -//static E3dScene* SelectionHelper::getSceneToRotate( SdrObject* pObj ) { //search wether the object or one of its children is a 3D object diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx index b6adf9bf7477..b2eccae6c98d 100644 --- a/chart2/source/controller/main/ShapeController.cxx +++ b/chart2/source/controller/main/ShapeController.cxx @@ -262,6 +262,7 @@ IMPL_LINK( ShapeController, CheckNameHdl, AbstractSvxNameDialog*, pDialog ) void ShapeController::executeDispatch_FormatLine() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( m_pChartController ) { Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); @@ -276,7 +277,6 @@ void ShapeController::executeDispatch_FormatLine() { pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE ); } - ::vos::OGuard aGuard( Application::GetSolarMutex() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -302,6 +302,7 @@ void ShapeController::executeDispatch_FormatLine() void ShapeController::executeDispatch_FormatArea() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( m_pChartController ) { Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); @@ -315,7 +316,6 @@ void ShapeController::executeDispatch_FormatArea() { pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE ); } - ::vos::OGuard aGuard( Application::GetSolarMutex() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -351,6 +351,7 @@ void ShapeController::executeDispatch_FormatArea() void ShapeController::executeDispatch_TextAttributes() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( m_pChartController ) { Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); @@ -363,7 +364,6 @@ void ShapeController::executeDispatch_TextAttributes() { pDrawViewWrapper->MergeAttrFromMarked( aAttr, FALSE ); } - ::vos::OGuard aGuard( Application::GetSolarMutex() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -388,6 +388,7 @@ void ShapeController::executeDispatch_TextAttributes() void ShapeController::executeDispatch_TransformDialog() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( m_pChartController ) { Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); @@ -402,7 +403,6 @@ void ShapeController::executeDispatch_TransformDialog() pDrawViewWrapper->GetAttributes( aAttr ); // item set for position and size SfxItemSet aGeoAttr( pDrawViewWrapper->GetGeoAttrFromMarked() ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -427,7 +427,6 @@ void ShapeController::executeDispatch_TransformDialog() else { SfxItemSet aGeoAttr( pDrawViewWrapper->GetGeoAttrFromMarked() ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -446,6 +445,7 @@ void ShapeController::executeDispatch_TransformDialog() void ShapeController::executeDispatch_ObjectTitleDescription() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( m_pChartController ) { DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); @@ -456,7 +456,6 @@ void ShapeController::executeDispatch_ObjectTitleDescription() { String aTitle( pSelectedObj->GetTitle() ); String aDescription( pSelectedObj->GetDescription() ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -477,6 +476,7 @@ void ShapeController::executeDispatch_ObjectTitleDescription() void ShapeController::executeDispatch_RenameObject() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( m_pChartController ) { DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); @@ -486,7 +486,6 @@ void ShapeController::executeDispatch_RenameObject() if ( pSelectedObj ) { String aName( pSelectedObj->GetName() ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); if ( pFact ) { @@ -509,10 +508,10 @@ void ShapeController::executeDispatch_RenameObject() void ShapeController::executeDispatch_ChangeZOrder( sal_uInt16 nId ) { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); DrawViewWrapper* pDrawViewWrapper = ( m_pChartController ? m_pChartController->GetDrawViewWrapper() : NULL ); if ( pDrawViewWrapper ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); switch ( nId ) { case COMMAND_ID_BRING_TO_FRONT: @@ -558,6 +557,7 @@ void ShapeController::executeDispatch_ChangeZOrder( sal_uInt16 nId ) void ShapeController::executeDispatch_FontDialog() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( m_pChartController ) { Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); @@ -568,7 +568,6 @@ void ShapeController::executeDispatch_FontDialog() SfxItemSet aAttr( pDrawViewWrapper->GetModel()->GetItemPool() ); pDrawViewWrapper->GetAttributes( aAttr ); ViewElementListProvider aViewElementListProvider( pDrawModelWrapper ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); ::boost::scoped_ptr< ShapeFontDialog > pDlg( new ShapeFontDialog( pParent, &aAttr, &aViewElementListProvider ) ); if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) ) { @@ -581,6 +580,7 @@ void ShapeController::executeDispatch_FontDialog() void ShapeController::executeDispatch_ParagraphDialog() { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( m_pChartController ) { Window* pParent = dynamic_cast< Window* >( m_pChartController->m_pChartWindow ); @@ -606,7 +606,6 @@ void ShapeController::executeDispatch_ParagraphDialog() aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) ); aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) ); - ::vos::OGuard aGuard( Application::GetSolarMutex() ); ::boost::scoped_ptr< ShapeParagraphDialog > pDlg( new ShapeParagraphDialog( pParent, &aNewAttr ) ); if ( pDlg.get() && ( pDlg->Execute() == RET_OK ) ) { @@ -701,6 +700,7 @@ bool ShapeController::isBackwardPossible() { if ( m_pChartController && m_pChartController->m_aSelection.isAdditionalShapeSelected() ) { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); if ( pDrawViewWrapper ) { @@ -719,6 +719,7 @@ bool ShapeController::isForwardPossible() { if ( m_pChartController && m_pChartController->m_aSelection.isAdditionalShapeSelected() ) { + ::vos::OGuard aGuard( Application::GetSolarMutex() ); DrawViewWrapper* pDrawViewWrapper = m_pChartController->GetDrawViewWrapper(); if ( pDrawViewWrapper ) { diff --git a/chart2/source/controller/main/StatusBarCommandDispatch.cxx b/chart2/source/controller/main/StatusBarCommandDispatch.cxx index d80d37eff7da..68c56f2d988b 100644 --- a/chart2/source/controller/main/StatusBarCommandDispatch.cxx +++ b/chart2/source/controller/main/StatusBarCommandDispatch.cxx @@ -40,9 +40,6 @@ // #include <vcl/svapp.hxx> // #endif -// for ressource strings STR_UNDO and STR_REDO -#include <sfx2/sfx.hrc> - #include "ResId.hxx" using namespace ::com::sun::star; diff --git a/chart2/source/controller/main/UndoCommandDispatch.cxx b/chart2/source/controller/main/UndoCommandDispatch.cxx index eb3d00a2723a..128a4b4091d0 100644 --- a/chart2/source/controller/main/UndoCommandDispatch.cxx +++ b/chart2/source/controller/main/UndoCommandDispatch.cxx @@ -38,9 +38,8 @@ #include <vcl/svapp.hxx> // for ressource strings STR_UNDO and STR_REDO -#include <sfx2/sfx.hrc> - -#include "ResId.hxx" +#include <svtools/svtools.hrc> +#include <svtools/svtdata.hxx> using namespace ::com::sun::star; @@ -86,13 +85,13 @@ void UndoCommandDispatch::fireStatusEvent( if( m_xUndoManager->undoPossible()) { // using assignment for broken gcc 3.3 - OUString aUndo = OUString( String( SchResId( STR_UNDO ))); + OUString aUndo = OUString( String( SvtResId( STR_UNDO ))); aUndoState <<= ( aUndo + m_xUndoManager->getCurrentUndoString()); } if( m_xUndoManager->redoPossible()) { // using assignment for broken gcc 3.3 - OUString aRedo = OUString( String( SchResId( STR_REDO ))); + OUString aRedo = OUString( String( SvtResId( STR_REDO ))); aRedoState <<= ( aRedo + m_xUndoManager->getCurrentRedoString()); } diff --git a/chart2/source/controller/main/UndoManager.cxx b/chart2/source/controller/main/UndoManager.cxx index 21e27922b1c8..21b3bbc1f725 100644 --- a/chart2/source/controller/main/UndoManager.cxx +++ b/chart2/source/controller/main/UndoManager.cxx @@ -408,7 +408,6 @@ sal_Int64 UndoManager::getSomething( const Sequence< sal_Int8 >& rId ) return 0; } -// static const Sequence< sal_Int8 >& UndoManager::getUnoTunnelId() { static Sequence< sal_Int8 >* pSeq = 0; @@ -425,7 +424,6 @@ const Sequence< sal_Int8 >& UndoManager::getUnoTunnelId() return *pSeq; } -// static UndoManager* UndoManager::getImplementation( const Reference< uno::XInterface > xObj ) { UndoManager* pRet = NULL; diff --git a/chart2/source/controller/makefile.mk b/chart2/source/controller/makefile.mk index fbc888f38c3f..41d7df24acaa 100644 --- a/chart2/source/controller/makefile.mk +++ b/chart2/source/controller/makefile.mk @@ -109,11 +109,10 @@ DEF1NAME= $(SHL1TARGET) # --- Resources --------------------------------------------------------------- -# sfx.srs is needed for the strings for UNDO and REDO in the UndoCommandDispatch RESLIB1LIST=\ $(SRS)$/chcdialogs.srs \ $(SRS)$/chcmenus.srs \ - $(SOLARCOMMONRESDIR)$/sfx.srs + RESLIB1NAME= $(TARGET) RESLIB1IMAGES=$(PRJ)$/res diff --git a/chart2/source/inc/OPropertySet.hxx b/chart2/source/inc/OPropertySet.hxx index fa773a6dab00..93dce272bf6e 100644 --- a/chart2/source/inc/OPropertySet.hxx +++ b/chart2/source/inc/OPropertySet.hxx @@ -96,39 +96,6 @@ protected: */ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0; - // ____ XPropertySet ____ - /** sample implementation using the InfoHelper: - - <pre> - uno::Reference< beans::XPropertySetInfo > SAL_CALL - OPropertySet::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; - // \-- - } - </pre> - - <p>(The reason why this isn't implemented here is, that the static - object is only valid per concrete PropertySet. Otherwise all - PropertySets derived from this base calss would have the same - properties.)</p> - - @see ::cppu::OPropertySetHelper - */ -// virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL -// getPropertySetInfo() -// throw (::com::sun::star::uno::RuntimeException) = 0; /** Try to convert the value <code>rValue</code> to the type required by the property associated with <code>nHandle</code>. 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 046fe7034012..ed2f7027395e 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 @@ -1288,7 +1298,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 94334a836b3e..322e84e1bc11 100644..100755 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -42,6 +42,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> @@ -177,42 +178,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; @@ -608,54 +638,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 82aa3e12075e..d089a88bb30b 100644..100755 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -895,7 +895,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 b4a748e4e022..686b02536d31 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() { diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 75bde77c801f..3f1213e06155 100644..100755 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -66,19 +66,16 @@ using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -//static Reference< chart2::XScaling > AxisHelper::createLinearScaling() { return new LinearScaling( 1.0, 0.0 ); } -//static Reference< chart2::XScaling > AxisHelper::createLogarithmicScaling( double fBase ) { return new LogarithmicScaling( fBase ); } -//static ScaleData AxisHelper::createDefaultScale() { ScaleData aScaleData; @@ -91,7 +88,6 @@ ScaleData AxisHelper::createDefaultScale() return aScaleData; } -//static void AxisHelper::removeExplicitScaling( ScaleData& rScaleData ) { uno::Any aEmpty; @@ -102,7 +98,6 @@ void AxisHelper::removeExplicitScaling( ScaleData& rScaleData ) rScaleData.TimeIncrement = aDefaultScale.TimeIncrement; } -//static bool AxisHelper::isLogarithmic( const Reference< XScaling >& xScaling ) { bool bReturn = false; @@ -290,7 +285,6 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( return nNumberFormatKey; } -//static Reference< XAxis > AxisHelper::createAxis( sal_Int32 nDimensionIndex , sal_Int32 nAxisIndex // 0==main or 1==secondary axis @@ -359,7 +353,6 @@ Reference< XAxis > AxisHelper::createAxis( return xAxis; } -//static Reference< XAxis > AxisHelper::createAxis( sal_Int32 nDimensionIndex, bool bMainAxis , const Reference< chart2::XDiagram >& xDiagram , const Reference< uno::XComponentContext >& xContext @@ -378,7 +371,6 @@ Reference< XAxis > AxisHelper::createAxis( sal_Int32 nDimensionIndex, bool bMain nDimensionIndex, nAxisIndex, xCooSys, xContext, pRefSizeProvider ); } -//static void AxisHelper::showAxis( sal_Int32 nDimensionIndex, bool bMainAxis , const Reference< chart2::XDiagram >& xDiagram , const Reference< uno::XComponentContext >& xContext @@ -401,7 +393,6 @@ void AxisHelper::showAxis( sal_Int32 nDimensionIndex, bool bMainAxis AxisHelper::makeAxisVisible( xAxis ); } -//static void AxisHelper::showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid , const Reference< XDiagram >& xDiagram , const Reference< uno::XComponentContext >& /*xContext*/ ) @@ -431,7 +422,6 @@ void AxisHelper::showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bo } } -//static void AxisHelper::makeAxisVisible( const Reference< XAxis >& xAxis ) { Reference< beans::XPropertySet > xProps( xAxis, uno::UNO_QUERY ); @@ -443,7 +433,6 @@ void AxisHelper::makeAxisVisible( const Reference< XAxis >& xAxis ) } } -//static void AxisHelper::makeGridVisible( const Reference< beans::XPropertySet >& xGridProperties ) { if( xGridProperties.is() ) @@ -453,14 +442,12 @@ void AxisHelper::makeGridVisible( const Reference< beans::XPropertySet >& xGridP } } -//static void AxisHelper::hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis , const Reference< XDiagram >& xDiagram ) { AxisHelper::makeAxisInvisible( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) ); } -//static void AxisHelper::makeAxisInvisible( const Reference< XAxis >& xAxis ) { Reference< beans::XPropertySet > xProps( xAxis, uno::UNO_QUERY ); @@ -470,7 +457,6 @@ void AxisHelper::makeAxisInvisible( const Reference< XAxis >& xAxis ) } } -//static void AxisHelper::hideAxisIfNoDataIsAttached( const Reference< XAxis >& xAxis, const Reference< XDiagram >& xDiagram ) { //axis is hidden if no data is attached anymore but data is available @@ -514,7 +500,6 @@ void AxisHelper::hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bo } } -//static void AxisHelper::makeGridInvisible( const Reference< beans::XPropertySet >& xGridProperties ) { if( xGridProperties.is() ) @@ -548,7 +533,6 @@ sal_Bool AxisHelper::isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIn return bRet; } -//static Reference< XCoordinateSystem > AxisHelper::getCoordinateSystemByIndex( const Reference< XDiagram >& xDiagram, sal_Int32 nIndex ) { @@ -561,7 +545,6 @@ Reference< XCoordinateSystem > AxisHelper::getCoordinateSystemByIndex( return NULL; } -//static Reference< XAxis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, bool bMainAxis , const Reference< XDiagram >& xDiagram ) { @@ -577,7 +560,6 @@ Reference< XAxis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, bool bMainAxi return xRet; } -//static Reference< XAxis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex , const Reference< XCoordinateSystem >& xCooSys ) { @@ -593,7 +575,6 @@ Reference< XAxis > AxisHelper::getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAx return xRet; } -//static Reference< XAxis > AxisHelper::getCrossingMainAxis( const Reference< XAxis >& xAxis , const Reference< XCoordinateSystem >& xCooSys ) { @@ -615,7 +596,6 @@ Reference< XAxis > AxisHelper::getCrossingMainAxis( const Reference< XAxis >& xA return AxisHelper::getAxis( nDimensionIndex, 0, xCooSys ); } -//static Reference< XAxis > AxisHelper::getParallelAxis( const Reference< XAxis >& xAxis , const Reference< XDiagram >& xDiagram ) { @@ -642,7 +622,6 @@ sal_Bool AxisHelper::isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis return AxisHelper::isAxisVisible( AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram ) ); } -//static sal_Bool AxisHelper::isAxisVisible( const Reference< XAxis >& xAxis ) { sal_Bool bRet = false; @@ -668,7 +647,6 @@ sal_Bool AxisHelper::areAxisLabelsVisible( const Reference< beans::XPropertySet return bRet; } -//static sal_Bool AxisHelper::isGridVisible( const Reference< beans::XPropertySet >& xGridProperies ) { sal_Bool bRet = false; @@ -682,7 +660,6 @@ sal_Bool AxisHelper::isGridVisible( const Reference< beans::XPropertySet >& xGri return bRet; } -//static Reference< beans::XPropertySet > AxisHelper::getGridProperties( const Reference< XCoordinateSystem >& xCooSys , sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex, sal_Int32 nSubGridIndex ) @@ -705,7 +682,6 @@ Reference< beans::XPropertySet > AxisHelper::getGridProperties( return xRet; } -//static sal_Int32 AxisHelper::getDimensionIndexOfAxis( const Reference< XAxis >& xAxis , const Reference< XDiagram >& xDiagram ) @@ -717,7 +693,6 @@ sal_Int32 AxisHelper::getDimensionIndexOfAxis( return nDimensionIndex; } -//static bool AxisHelper::getIndicesForAxis( const Reference< XAxis >& xAxis , const Reference< XCoordinateSystem >& xCooSys @@ -750,7 +725,6 @@ bool AxisHelper::getIndicesForAxis( return false; } -//static bool AxisHelper::getIndicesForAxis( const Reference< XAxis >& xAxis, const Reference< XDiagram >& xDiagram , sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex ) { @@ -777,7 +751,6 @@ bool AxisHelper::getIndicesForAxis( const Reference< XAxis >& xAxis, const Refer return false; } -//static std::vector< Reference< XAxis > > AxisHelper::getAllAxesOfCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys , bool bOnlyVisible /* = false */ ) @@ -824,7 +797,6 @@ std::vector< Reference< XAxis > > AxisHelper::getAllAxesOfCoordinateSystem( return aAxisVector; } -//static Sequence< Reference< XAxis > > AxisHelper::getAllAxesOfDiagram( const Reference< XDiagram >& xDiagram , bool bOnlyVisible ) @@ -846,7 +818,6 @@ Sequence< Reference< XAxis > > AxisHelper::getAllAxesOfDiagram( return ContainerHelper::ContainerToSequence( aAxisVector ); } -//static Sequence< Reference< beans::XPropertySet > > AxisHelper::getAllGrids( const Reference< XDiagram >& xDiagram ) { Sequence< Reference< XAxis > > aAllAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); @@ -875,7 +846,6 @@ Sequence< Reference< beans::XPropertySet > > AxisHelper::getAllGrids( const Refe return ContainerHelper::ContainerToSequence( aGridVector ); } -//static void AxisHelper::getAxisOrGridPossibilities( Sequence< sal_Bool >& rPossibilityList , const Reference< XDiagram>& xDiagram, sal_Bool bAxis ) { @@ -895,7 +865,6 @@ void AxisHelper::getAxisOrGridPossibilities( Sequence< sal_Bool >& rPossibilityL rPossibilityList[nIndex] = rPossibilityList[nIndex-3]; } -//static bool AxisHelper::isSecondaryYAxisNeeded( const Reference< XCoordinateSystem >& xCooSys ) { Reference< chart2::XChartTypeContainer > xCTCnt( xCooSys, uno::UNO_QUERY ); @@ -924,7 +893,6 @@ bool AxisHelper::isSecondaryYAxisNeeded( const Reference< XCoordinateSystem >& x return false; } -//static bool AxisHelper::shouldAxisBeDisplayed( const Reference< XAxis >& xAxis , const Reference< XCoordinateSystem >& xCooSys ) { @@ -950,7 +918,6 @@ bool AxisHelper::shouldAxisBeDisplayed( const Reference< XAxis >& xAxis return bRet; } -//static void AxisHelper::getAxisOrGridExcistence( Sequence< sal_Bool >& rExistenceList , const Reference< XDiagram>& xDiagram, sal_Bool bAxis ) { @@ -976,7 +943,6 @@ void AxisHelper::getAxisOrGridExcistence( Sequence< sal_Bool >& rExistenceList } } -//static bool AxisHelper::changeVisibilityOfAxes( const Reference< XDiagram >& xDiagram , const Sequence< sal_Bool >& rOldExistenceList , const Sequence< sal_Bool >& rNewExistenceList @@ -1000,7 +966,6 @@ bool AxisHelper::changeVisibilityOfAxes( const Reference< XDiagram >& xDiagram return bChanged; } -//static bool AxisHelper::changeVisibilityOfGrids( const Reference< XDiagram >& xDiagram , const Sequence< sal_Bool >& rOldExistenceList , const Sequence< sal_Bool >& rNewExistenceList @@ -1021,7 +986,6 @@ bool AxisHelper::changeVisibilityOfGrids( const Reference< XDiagram >& xDiagram return bChanged; } -//static Reference< XCoordinateSystem > AxisHelper::getCoordinateSystemOfAxis( const Reference< XAxis >& xAxis , const Reference< XDiagram >& xDiagram ) diff --git a/chart2/source/tools/CharacterProperties.cxx b/chart2/source/tools/CharacterProperties.cxx index cca655780a79..c403ca046b9e 100644..100755 --- a/chart2/source/tools/CharacterProperties.cxx +++ b/chart2/source/tools/CharacterProperties.cxx @@ -561,7 +561,6 @@ bool CharacterProperties::IsCharacterPropertyHandle( sal_Int32 nHandle ) nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP ); } -// static awt::FontDescriptor CharacterProperties::createFontDescriptorFromPropertySet( const uno::Reference< beans::XMultiPropertySet > & xMultiPropSet ) { diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx index a49b2abeac98..e5e21eac8a7f 100644..100755 --- a/chart2/source/tools/ChartModelHelper.cxx +++ b/chart2/source/tools/ChartModelHelper.cxx @@ -54,21 +54,18 @@ namespace chart using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; -//static uno::Reference< chart2::data::XRangeHighlighter > ChartModelHelper::createRangeHighlighter( const uno::Reference< view::XSelectionSupplier > & xSelectionSupplier ) { return new RangeHighlighter( xSelectionSupplier ); } -//static uno::Reference< chart2::data::XDataProvider > ChartModelHelper::createInternalDataProvider( const uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc, bool bConnectToModel ) { return new InternalDataProvider( xChartDoc, bConnectToModel ); } -//static uno::Reference< XDiagram > ChartModelHelper::findDiagram( const uno::Reference< frame::XModel >& xModel ) { uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY ); @@ -77,7 +74,6 @@ uno::Reference< XDiagram > ChartModelHelper::findDiagram( const uno::Reference< return NULL; } -// static uno::Reference< XDiagram > ChartModelHelper::findDiagram( const uno::Reference< chart2::XChartDocument >& xChartDoc ) { try @@ -92,7 +88,6 @@ uno::Reference< XDiagram > ChartModelHelper::findDiagram( const uno::Reference< return NULL; } -//static uno::Reference< XCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( const uno::Reference< frame::XModel >& xModel ) { uno::Reference< XCoordinateSystem > XCooSys; @@ -106,7 +101,6 @@ uno::Reference< XCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( return XCooSys; } -// static ::std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries( const uno::Reference< XChartDocument > & xChartDoc ) { @@ -119,7 +113,6 @@ uno::Reference< XCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( return aResult; } -// static ::std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries( const uno::Reference< frame::XModel > & xModel ) { diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index cd0a62312387..83ab4a26315b 100644..100755 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -459,7 +459,6 @@ bool ChartTypeHelper::noBordersForSimpleScheme( const uno::Reference< chart2::XC return sal_False; } -//static sal_Int32 ChartTypeHelper::getDefaultDirectLightColor( bool bSimple, const uno::Reference< chart2::XChartType >& xChartType ) { sal_Int32 nRet = static_cast< sal_Int32 >( 0x808080 ); // grey @@ -480,7 +479,6 @@ sal_Int32 ChartTypeHelper::getDefaultDirectLightColor( bool bSimple, const uno:: return nRet; } -//static sal_Int32 ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple, const uno::Reference< chart2::XChartType >& xChartType ) { sal_Int32 nRet = static_cast< sal_Int32 >( 0x999999 ); // grey40 diff --git a/chart2/source/tools/ChartViewHelper.cxx b/chart2/source/tools/ChartViewHelper.cxx index 55fbd368426a..c6f712787559 100644..100755 --- a/chart2/source/tools/ChartViewHelper.cxx +++ b/chart2/source/tools/ChartViewHelper.cxx @@ -45,7 +45,6 @@ namespace chart using namespace ::com::sun::star; using ::com::sun::star::uno::Reference; -//static void ChartViewHelper::setViewToDirtyState( const uno::Reference< frame::XModel >& xChartModel ) { try diff --git a/chart2/source/tools/ColorPerPointHelper.cxx b/chart2/source/tools/ColorPerPointHelper.cxx index 762cb436a9a7..b0b1e3f03130 100644..100755 --- a/chart2/source/tools/ColorPerPointHelper.cxx +++ b/chart2/source/tools/ColorPerPointHelper.cxx @@ -42,7 +42,6 @@ namespace chart using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; -//static bool ColorPerPointHelper::hasPointOwnColor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xDataSeriesProperties @@ -72,7 +71,6 @@ bool ColorPerPointHelper::hasPointOwnColor( return false; } -// static bool ColorPerPointHelper::hasPointOwnProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties diff --git a/chart2/source/tools/CommonConverters.cxx b/chart2/source/tools/CommonConverters.cxx index e9d90248ce84..6b70ac4c1500 100644..100755 --- a/chart2/source/tools/CommonConverters.cxx +++ b/chart2/source/tools/CommonConverters.cxx @@ -474,7 +474,6 @@ uno::Sequence< rtl::OUString > DataSequenceToStringSequence( const uno::Reference< data::XDataSequence >& xDataSequence ) { uno::Sequence< rtl::OUString > aResult; - OSL_ASSERT( xDataSequence.is()); if(!xDataSequence.is()) return aResult; diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 772994bf2498..58460c0749a5 100644..100755 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -81,7 +81,6 @@ using ::com::sun::star::chart2::XAnyDescriptionAccess; namespace chart { -// static DiagramHelper::tTemplateWithServiceName DiagramHelper::getTemplateForDiagram( const Reference< XDiagram > & xDiagram, @@ -140,7 +139,6 @@ DiagramHelper::tTemplateWithServiceName return aResult; } -// static void DiagramHelper::setVertical( const Reference< XDiagram > & xDiagram, bool bVertical /* = true */ ) @@ -218,7 +216,6 @@ void DiagramHelper::setVertical( } } -//static bool DiagramHelper::getVertical( const uno::Reference< chart2::XDiagram > & xDiagram, bool& rbFound, bool& rbAmbiguous ) { @@ -256,7 +253,6 @@ bool DiagramHelper::getVertical( const uno::Reference< chart2::XDiagram > & xDia return bValue; } -//static void DiagramHelper::setStackMode( const Reference< XDiagram > & xDiagram, StackMode eStackMode, @@ -348,8 +344,6 @@ void DiagramHelper::setStackMode( } } -//static - StackMode DiagramHelper::getStackMode( const Reference< XDiagram > & xDiagram, bool& rbFound, bool& rbAmbiguous ) { rbFound=false; @@ -391,7 +385,6 @@ StackMode DiagramHelper::getStackMode( const Reference< XDiagram > & xDiagram, b return eGlobalStackMode; } -// static StackMode DiagramHelper::getStackModeFromChartType( const Reference< XChartType > & xChartType, bool& rbFound, bool& rbAmbiguous, @@ -475,7 +468,6 @@ StackMode DiagramHelper::getStackModeFromChartType( return eStackMode; } -// static sal_Int32 DiagramHelper::getDimension( const Reference< XDiagram > & xDiagram ) { // -1: not yet set @@ -508,7 +500,6 @@ sal_Int32 DiagramHelper::getDimension( const Reference< XDiagram > & xDiagram ) return nResult; } -// static void DiagramHelper::setDimension( const Reference< XDiagram > & xDiagram, sal_Int32 nNewDimensionCount ) @@ -569,7 +560,6 @@ void DiagramHelper::setDimension( } } -// static void DiagramHelper::replaceCoordinateSystem( const Reference< XDiagram > & xDiagram, const Reference< XCoordinateSystem > & xCooSysToReplace, @@ -605,7 +595,6 @@ void DiagramHelper::replaceCoordinateSystem( } } -//static bool DiagramHelper::isSeriesAttachedToMainAxis( const uno::Reference< chart2::XDataSeries >& xDataSeries ) { @@ -613,7 +602,6 @@ bool DiagramHelper::isSeriesAttachedToMainAxis( return (nAxisIndex==0); } -//static bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis , const uno::Reference< chart2::XDataSeries >& xDataSeries , const uno::Reference< chart2::XDiagram >& xDiagram @@ -659,7 +647,6 @@ bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis return bChanged; } -//static uno::Reference< XAxis > DiagramHelper::getAttachedAxis( const uno::Reference< XDataSeries >& xSeries, const uno::Reference< XDiagram >& xDiagram ) @@ -667,7 +654,6 @@ uno::Reference< XAxis > DiagramHelper::getAttachedAxis( return AxisHelper::getAxis( 1, DiagramHelper::isSeriesAttachedToMainAxis( xSeries ), xDiagram ); } -//static uno::Reference< XChartType > DiagramHelper::getChartTypeOfSeries( const uno::Reference< chart2::XDiagram >& xDiagram , const uno::Reference< XDataSeries >& xGivenDataSeries ) @@ -717,7 +703,6 @@ uno::Reference< XChartType > DiagramHelper::getChartTypeOfSeries( return 0; } -// static ::std::vector< Reference< XDataSeries > > DiagramHelper::getDataSeriesFromDiagram( const Reference< XDiagram > & xDiagram ) @@ -864,7 +849,6 @@ std::vector< Reference< XAxis > > lcl_getAxisHoldingCategoriesFromDiagram( } // anonymous namespace -//static bool DiagramHelper::isCategoryDiagram( const Reference< XDiagram >& xDiagram ) { @@ -903,7 +887,6 @@ bool DiagramHelper::isCategoryDiagram( return false; } -// static void DiagramHelper::setCategoriesToDiagram( const Reference< chart2::data::XLabeledDataSequence >& xCategories, const Reference< XDiagram >& xDiagram, @@ -935,7 +918,6 @@ void DiagramHelper::setCategoriesToDiagram( } } -// static Reference< data::XLabeledDataSequence > DiagramHelper::getCategoriesFromDiagram( const Reference< XDiagram > & xDiagram ) @@ -1030,7 +1012,6 @@ Sequence< rtl::OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( return aRet; } -//static Sequence< rtl::OUString > DiagramHelper::getExplicitSimpleCategories( const Reference< XChartDocument >& xChartDoc ) { @@ -1232,7 +1213,6 @@ sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberF return nRet; } -// static Sequence< Reference< XChartType > > DiagramHelper::getChartTypesFromDiagram( const Reference< XDiagram > & xDiagram ) @@ -1262,7 +1242,6 @@ Sequence< Reference< XChartType > > return ContainerHelper::ContainerToSequence( aResult ); } -//static bool DiagramHelper::areChartTypesCompatible( const Reference< ::chart2::XChartType >& xFirstType, const Reference< ::chart2::XChartType >& xSecondType ) { @@ -1522,7 +1501,6 @@ bool DiagramHelper::isPieOrDonutChart( const ::com::sun::star::uno::Reference< return false; } -// static sal_Int32 DiagramHelper::getGeometry3D( const uno::Reference< chart2::XDiagram > & xDiagram, bool& rbFound, bool& rbAmbiguous ) @@ -1569,7 +1547,6 @@ sal_Int32 DiagramHelper::getGeometry3D( return nCommonGeom; } -// static void DiagramHelper::setGeometry3D( const Reference< chart2::XDiagram > & xDiagram, sal_Int32 nNewGeometry ) @@ -1585,7 +1562,6 @@ void DiagramHelper::setGeometry3D( } } -//static sal_Int32 DiagramHelper::getCorrectedMissingValueTreatment( const Reference< chart2::XDiagram > & xDiagram, const Reference< chart2::XChartType >& xChartType ) @@ -1613,7 +1589,6 @@ sal_Int32 DiagramHelper::getCorrectedMissingValueTreatment( return nResult; } -//static DiagramPositioningMode DiagramHelper::getDiagramPositioningMode( const uno::Reference< chart2::XDiagram > & xDiagram ) { @@ -1645,7 +1620,6 @@ void lcl_ensureRange0to1( double& rValue ) rValue=1.0; } -//static bool DiagramHelper::setDiagramPositioning( const uno::Reference< frame::XModel >& xChartModel, const awt::Rectangle& rPosRect /*100th mm*/ ) { @@ -1691,7 +1665,6 @@ bool DiagramHelper::setDiagramPositioning( const uno::Reference< frame::XModel > return bChanged; } -//static awt::Rectangle DiagramHelper::getDiagramRectangleFromModel( const uno::Reference< frame::XModel >& xChartModel ) { awt::Rectangle aRet(-1,-1,-1,-1); @@ -1708,8 +1681,8 @@ awt::Rectangle DiagramHelper::getDiagramRectangleFromModel( const uno::Reference xDiaProps->getPropertyValue(C2U("RelativeSize") ) >>= aRelSize; awt::Size aAbsSize( - aRelSize.Primary * aPageSize.Width, - aRelSize.Secondary * aPageSize.Height ); + static_cast< sal_Int32 >( aRelSize.Primary * aPageSize.Width ), + static_cast< sal_Int32 >( aRelSize.Secondary * aPageSize.Height )); awt::Point aAbsPos( static_cast< sal_Int32 >( aRelPos.Primary * aPageSize.Width ), @@ -1722,7 +1695,6 @@ awt::Rectangle DiagramHelper::getDiagramRectangleFromModel( const uno::Reference return aRet; } -//static bool DiagramHelper::switchDiagramPositioningToExcludingPositioning( const uno::Reference< frame::XModel >& xChartModel , bool bResetModifiedState, bool bConvertAlsoFromAutoPositioning ) diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx index 7468d8bb7896..c8aa400d1be5 100644..100755 --- a/chart2/source/tools/ErrorBar.cxx +++ b/chart2/source/tools/ErrorBar.cxx @@ -107,49 +107,72 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEDEFAULT )); } -void lcl_AddDefaultsToMap( - ::chart::tPropertyValueMap & rOutMap ) +struct StaticErrorBarDefaults_Initializer { - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_ERROR_BAR_STYLE, ::com::sun::star::chart::ErrorBarStyle::NONE ); - ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_ERROR_BAR_POS_ERROR, 0.0 ); - ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_ERROR_BAR_NEG_ERROR, 0.0 ); - ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_ERROR_BAR_WEIGHT, 1.0 ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_ERROR_BAR_SHOW_POS_ERROR, true ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_ERROR_BAR_SHOW_NEG_ERROR, true ); -} + ::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_ERROR_BAR_STYLE, ::com::sun::star::chart::ErrorBarStyle::NONE ); + ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_ERROR_BAR_POS_ERROR, 0.0 ); + ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_ERROR_BAR_NEG_ERROR, 0.0 ); + ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_ERROR_BAR_WEIGHT, 1.0 ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_ERROR_BAR_SHOW_POS_ERROR, true ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_ERROR_BAR_SHOW_NEG_ERROR, true ); + } +}; + +struct StaticErrorBarDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticErrorBarDefaults_Initializer > +{ +}; -const uno::Sequence< Property > & lcl_GetPropertySequence() +struct StaticErrorBarInfoHelper_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 ); ::chart::LineProperties::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 StaticErrorBarInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticErrorBarInfoHelper_Initializer > { - static ::cppu::OPropertyArrayHelper aArrayHelper( - lcl_GetPropertySequence(), - /* bSorted = */ sal_True ); +}; - return aArrayHelper; -} +struct StaticErrorBarInfo_Initializer +{ + uno::Reference< beans::XPropertySetInfo >* operator()() + { + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticErrorBarInfoHelper::get() ) ); + return &xPropertySetInfo; + } +}; + +struct StaticErrorBarInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticErrorBarInfo_Initializer > +{ +}; bool lcl_isInternalData( const uno::Reference< chart2::data::XLabeledDataSequence > & xLSeq ) { @@ -208,50 +231,23 @@ uno::Reference< util::XCloneable > SAL_CALL ErrorBar::createClone() uno::Any ErrorBar::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 ); - LineProperties::AddDefaultsToMap( aStaticDefaults ); - } - - tPropertyValueMap::const_iterator aFound( - aStaticDefaults.find( nHandle )); - - if( aFound == aStaticDefaults.end()) + const tPropertyValueMap& rStaticDefaults = *StaticErrorBarDefaults::get(); + tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); + if( aFound == rStaticDefaults.end() ) return uno::Any(); - return (*aFound).second; - // \-- } ::cppu::IPropertyArrayHelper & SAL_CALL ErrorBar::getInfoHelper() { - return lcl_getInfoHelper(); + return *StaticErrorBarInfoHelper::get(); } - // ____ XPropertySet ____ -uno::Reference< beans::XPropertySetInfo > SAL_CALL - ErrorBar::getPropertySetInfo() +uno::Reference< beans::XPropertySetInfo > SAL_CALL ErrorBar::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 *StaticErrorBarInfo::get(); } // ____ XModifyBroadcaster ____ diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index ef2d6ac22bf2..9e2987be1ee4 100644..100755 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -87,9 +87,9 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2: { uno::Reference< data::XDataProvider > xDataProvider( xChartDoc->getDataProvider() ); - if( xDataProvider.is() ) + OUString aCatgoriesRange( DataSourceHelper::getRangeFromValues( m_xOriginalCategories ) ); + if( xDataProvider.is() && aCatgoriesRange.getLength() ) { - OUString aCatgoriesRange( DataSourceHelper::getRangeFromValues( m_xOriginalCategories ) ); const bool bFirstCellAsLabel = false; const bool bHasCategories = false; const uno::Sequence< sal_Int32 > aSequenceMapping; @@ -410,7 +410,6 @@ Sequence< OUString > lcl_getExplicitSimpleCategories( return aRet; } -//static Sequence< OUString > ExplicitCategoriesProvider::getExplicitSimpleCategories( const SplitCategoriesProvider& rSplitCategoriesProvider ) { @@ -574,7 +573,6 @@ std::vector< ComplexCategory > ExplicitCategoriesProvider::getCategoriesByLevel return aRet; } -// static OUString ExplicitCategoriesProvider::getCategoryByIndex( const Reference< XCoordinateSystem >& xCooSysModel , const uno::Reference< frame::XModel >& xChartModel diff --git a/chart2/source/tools/FillProperties.cxx b/chart2/source/tools/FillProperties.cxx index ee23727c321b..f95bbfd166e0 100644..100755 --- a/chart2/source/tools/FillProperties.cxx +++ b/chart2/source/tools/FillProperties.cxx @@ -136,7 +136,6 @@ void lcl_AddPropertiesToVector_without_BitmapProperties( ::std::vector< ::com::s | beans::PropertyAttribute::MAYBEDEFAULT )); } -//static void lcl_AddPropertiesToVector_only_BitmapProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties ) { rOutProperties.push_back( diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index 88de8c94e977..b7df7e6d27a4 100644..100755 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -379,11 +379,13 @@ InternalDataProvider::InternalDataProvider( const Reference< chart2::XChartDocum if( xSeq.is() ) aDataSeq = xSeq->getData(); sal_Int32 nLength = aDataSeq.getLength(); - if( static_cast< sal_Int32 >(aNewCategories.size()) < nLength ) + sal_Int32 nCatLength = static_cast< sal_Int32 >(aNewCategories.size()); + if( nCatLength < nLength ) aNewCategories.resize( nLength ); - + else if( nLength < nCatLength ) + aDataSeq.realloc( nCatLength ); transform( aNewCategories.begin(), aNewCategories.end(), aDataSeq.getConstArray(), - aNewCategories.begin(), lcl_setAnyAtLevel(nL) ); + aNewCategories.begin(), lcl_setStringAtLevel(nL) ); } if( !nLevelCount ) { diff --git a/chart2/source/tools/LegendHelper.cxx b/chart2/source/tools/LegendHelper.cxx index 4e778db1a68c..af170e971a5b 100644..100755 --- a/chart2/source/tools/LegendHelper.cxx +++ b/chart2/source/tools/LegendHelper.cxx @@ -46,7 +46,6 @@ namespace chart //............................................................................. -//static Reference< chart2::XLegend > LegendHelper::showLegend( const Reference< frame::XModel >& xModel , const uno::Reference< uno::XComponentContext >& xContext ) { @@ -78,7 +77,6 @@ Reference< chart2::XLegend > LegendHelper::showLegend( const Reference< frame::X return xLegend; } -//static void LegendHelper::hideLegend( const Reference< frame::XModel >& xModel ) { uno::Reference< chart2::XLegend > xLegend = LegendHelper::getLegend( xModel, 0, false ); @@ -89,7 +87,6 @@ void LegendHelper::hideLegend( const Reference< frame::XModel >& xModel ) } } -// static uno::Reference< chart2::XLegend > LegendHelper::getLegend( const uno::Reference< frame::XModel >& xModel , const uno::Reference< uno::XComponentContext >& xContext @@ -127,7 +124,6 @@ uno::Reference< chart2::XLegend > LegendHelper::getLegend( return xResult; } -// static bool LegendHelper::hasLegend( const uno::Reference< chart2::XDiagram > & xDiagram ) { bool bReturn = false; diff --git a/chart2/source/tools/LineProperties.cxx b/chart2/source/tools/LineProperties.cxx index 95cf95e21a86..889efb029103 100644..100755 --- a/chart2/source/tools/LineProperties.cxx +++ b/chart2/source/tools/LineProperties.cxx @@ -108,7 +108,6 @@ void LineProperties::AddDefaultsToMap( ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_JOINT, drawing::LineJoint_ROUND ); } -//static bool LineProperties::IsLineVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xLineProperties ) { @@ -137,7 +136,6 @@ bool LineProperties::IsLineVisible( const ::com::sun::star::uno::Reference< return bRet; } -//static void LineProperties::SetLineVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xLineProperties ) { @@ -162,7 +160,6 @@ void LineProperties::SetLineVisible( const ::com::sun::star::uno::Reference< } } -//static void LineProperties::SetLineInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xLineProperties ) { diff --git a/chart2/source/tools/NamedFillProperties.cxx b/chart2/source/tools/NamedFillProperties.cxx index f904c34c1df1..de9cffde7897 100644..100755 --- a/chart2/source/tools/NamedFillProperties.cxx +++ b/chart2/source/tools/NamedFillProperties.cxx @@ -93,7 +93,6 @@ void NamedFillProperties::AddDefaultsToMap( { } -// static OUString NamedFillProperties::GetPropertyNameForHandle( sal_Int32 nHandle ) { //will return e.g. "FillGradientName" for PROP_FILL_GRADIENT_NAME diff --git a/chart2/source/tools/NamedLineProperties.cxx b/chart2/source/tools/NamedLineProperties.cxx index 02680abf690e..3379b3804e52 100644..100755 --- a/chart2/source/tools/NamedLineProperties.cxx +++ b/chart2/source/tools/NamedLineProperties.cxx @@ -81,7 +81,6 @@ void NamedLineProperties::AddDefaultsToMap( { } -// static OUString NamedLineProperties::GetPropertyNameForHandle( sal_Int32 nHandle ) { //will return e.g. "LineDashName" for PROP_LINE_DASH_NAME diff --git a/chart2/source/tools/NamedProperties.cxx b/chart2/source/tools/NamedProperties.cxx index 4fcb536b3279..5a4e0b2d16da 100644..100755 --- a/chart2/source/tools/NamedProperties.cxx +++ b/chart2/source/tools/NamedProperties.cxx @@ -47,7 +47,6 @@ void NamedProperties::AddPropertiesToVector( NamedLineProperties::AddPropertiesToVector( rOutProperties ); } -// static OUString NamedProperties::GetPropertyNameForHandle( sal_Int32 nHandle ) { OUString aName = NamedFillProperties::GetPropertyNameForHandle( nHandle ); diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 0599f9317aed..accbdd27bfa8 100644..100755 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -340,7 +340,6 @@ bool ObjectIdentifier::operator<( const ObjectIdentifier& rOID ) const return bReturn; } -//static OUString ObjectIdentifier::createClassifiedIdentifierForObject( const Reference< uno::XInterface >& xObject , const Reference< frame::XModel >& xChartModel ) @@ -424,14 +423,12 @@ OUString ObjectIdentifier::createClassifiedIdentifierForObject( return aRet; } -//static OUString ObjectIdentifier::createClassifiedIdentifierForParticle( const OUString& rParticle ) { return ObjectIdentifier::createClassifiedIdentifierForParticles( rParticle, OUString() ); } -//static OUString ObjectIdentifier::createClassifiedIdentifierForParticles( const OUString& rParentParticle , const OUString& rChildParticle @@ -458,7 +455,6 @@ OUString ObjectIdentifier::createClassifiedIdentifierForParticles( return aRet.makeStringAndClear(); } -//static OUString ObjectIdentifier::createParticleForDiagram( const Reference< XDiagram >& /*xDiagram*/ , const Reference< frame::XModel >& /*xChartModel*/ ) @@ -468,7 +464,6 @@ OUString ObjectIdentifier::createParticleForDiagram( return aRet; } -//static OUString ObjectIdentifier::createParticleForCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys , const Reference< frame::XModel >& xChartModel ) @@ -497,7 +492,6 @@ OUString ObjectIdentifier::createParticleForCoordinateSystem( return aRet.makeStringAndClear(); } -//static OUString ObjectIdentifier::createParticleForAxis( sal_Int32 nDimensionIndex , sal_Int32 nAxisIndex ) @@ -511,7 +505,6 @@ OUString ObjectIdentifier::createParticleForAxis( return aRet.makeStringAndClear(); } -//static OUString ObjectIdentifier::createParticleForGrid( sal_Int32 nDimensionIndex , sal_Int32 nAxisIndex ) @@ -525,7 +518,6 @@ OUString ObjectIdentifier::createParticleForGrid( return aRet.makeStringAndClear(); } -//static OUString ObjectIdentifier::createClassifiedIdentifierForGrid( const Reference< XAxis >& xAxis , const Reference< frame::XModel >& xChartModel @@ -544,7 +536,6 @@ OUString ObjectIdentifier::createClassifiedIdentifierForGrid( return aGridCID; } -//static OUString ObjectIdentifier::createParticleForSeries( sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex , sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex ) @@ -565,7 +556,6 @@ OUString ObjectIdentifier::createParticleForSeries( return aRet.makeStringAndClear(); } -//static OUString ObjectIdentifier::createParticleForLegend( const Reference< XLegend >& /*xLegend*/ , const Reference< frame::XModel >& xChartModel ) @@ -583,7 +573,6 @@ OUString ObjectIdentifier::createParticleForLegend( return aRet.makeStringAndClear(); } -//static OUString ObjectIdentifier::createClassifiedIdentifier( enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES , const OUString& rParticleID )//e.g. SeriesID @@ -592,7 +581,6 @@ OUString ObjectIdentifier::createClassifiedIdentifier( eObjectType, rParticleID, m_aEmptyString ); } -//static OUString ObjectIdentifier::createClassifiedIdentifierWithParent( enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID , const OUString& rParticleID //e.g. Point Index or SubGrid Index @@ -619,13 +607,11 @@ OUString ObjectIdentifier::createClassifiedIdentifierWithParent( return aRet.makeStringAndClear(); } -//static const OUString& ObjectIdentifier::getPieSegmentDragMethodServiceName() { return m_aPieSegmentDragMethodServiceName; } -//static OUString ObjectIdentifier::createPieSegmentDragParameterString( sal_Int32 nOffsetPercent , const awt::Point& rMinimumPosition @@ -643,7 +629,6 @@ OUString ObjectIdentifier::createPieSegmentDragParameterString( return aRet.makeStringAndClear(); } -//static bool ObjectIdentifier::parsePieSegmentDragParameterString( const OUString& rDragParameterString , sal_Int32& rOffsetPercent @@ -681,7 +666,6 @@ bool ObjectIdentifier::parsePieSegmentDragParameterString( return true; } -//static OUString ObjectIdentifier::getDragMethodServiceName( const OUString& rCID ) { OUString aRet; @@ -707,7 +691,6 @@ OUString ObjectIdentifier::getDragMethodServiceName( const OUString& rCID ) return aRet; } -//static OUString ObjectIdentifier::getDragParameterString( const OUString& rCID ) { OUString aRet; @@ -733,7 +716,6 @@ OUString ObjectIdentifier::getDragParameterString( const OUString& rCID ) return aRet; } -//static bool ObjectIdentifier::isDragableObject( const OUString& rClassifiedIdentifier ) { ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier ); @@ -768,7 +750,6 @@ bool ObjectIdentifier::isDragableObject() return bReturn; } -//static bool ObjectIdentifier::isRotateableObject( const OUString& rClassifiedIdentifier ) { ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier ); @@ -783,7 +764,6 @@ bool ObjectIdentifier::isRotateableObject( const OUString& rClassifiedIdentifier return false; } -//static bool ObjectIdentifier::isMultiClickObject( const OUString& rClassifiedIdentifier ) { //the name of a shape is it's ClassifiedIdentifier @@ -846,7 +826,6 @@ bool ObjectIdentifier::areIdenticalObjects( const OUString& rCID1, const OUStrin return false; } -//static OUString ObjectIdentifier::getStringForType( ObjectType eObjectType ) { OUString aRet; @@ -933,7 +912,6 @@ OUString ObjectIdentifier::getStringForType( ObjectType eObjectType ) return aRet; } -//static ObjectType ObjectIdentifier::getObjectType( const OUString& rCID ) { ObjectType eRet; @@ -1020,7 +998,6 @@ ObjectType ObjectIdentifier::getObjectType() return eObjectType; } -//static OUString ObjectIdentifier::createDataCurveCID( const OUString& rSeriesParticle , sal_Int32 nCurveIndex @@ -1031,7 +1008,6 @@ OUString ObjectIdentifier::createDataCurveCID( return createClassifiedIdentifierWithParent( eType, aParticleID, rSeriesParticle ); } -//static OUString ObjectIdentifier::createDataCurveEquationCID( const OUString& rSeriesParticle , sal_Int32 nCurveIndex ) @@ -1040,7 +1016,6 @@ OUString ObjectIdentifier::createDataCurveEquationCID( return createClassifiedIdentifierWithParent( OBJECTTYPE_DATA_CURVE_EQUATION, aParticleID, rSeriesParticle ); } -//static OUString ObjectIdentifier::addChildParticle( const rtl::OUString& rParticle, const rtl::OUString& rChildParticle ) { OUStringBuffer aRet(rParticle); @@ -1053,7 +1028,6 @@ OUString ObjectIdentifier::addChildParticle( const rtl::OUString& rParticle, con return aRet.makeStringAndClear(); } -//static rtl::OUString ObjectIdentifier::createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex ) { OUStringBuffer aRet( getStringForType( eObjectType ) ); @@ -1065,7 +1039,6 @@ rtl::OUString ObjectIdentifier::createChildParticleWithIndex( ObjectType eObject return aRet.makeStringAndClear(); } -//static sal_Int32 ObjectIdentifier::getIndexFromParticleOrCID( const rtl::OUString& rParticleOrCID ) { sal_Int32 nRet = -1; @@ -1077,7 +1050,6 @@ sal_Int32 ObjectIdentifier::getIndexFromParticleOrCID( const rtl::OUString& rPar return nRet; } -//static OUString ObjectIdentifier::createSeriesSubObjectStub( ObjectType eSubObjectType , const rtl::OUString& rSeriesParticle , const rtl::OUString& rDragMethodServiceName @@ -1091,14 +1063,12 @@ OUString ObjectIdentifier::createSeriesSubObjectStub( ObjectType eSubObjectType , rDragMethodServiceName, rDragParameterString ); } -//static OUString ObjectIdentifier::createPointCID( const OUString& rPointCID_Stub, sal_Int32 nIndex ) { OUString aRet(rPointCID_Stub); return aRet+=OUString::valueOf( nIndex ); } -//static OUString ObjectIdentifier::getParticleID( const OUString& rCID ) { OUString aRet; @@ -1108,7 +1078,6 @@ OUString ObjectIdentifier::getParticleID( const OUString& rCID ) return aRet; } -//static OUString ObjectIdentifier::getFullParentParticle( const OUString& rCID ) { OUString aRet; @@ -1127,7 +1096,6 @@ OUString ObjectIdentifier::getFullParentParticle( const OUString& rCID ) return aRet; } -//static OUString ObjectIdentifier::getObjectID( const rtl::OUString& rCID ) { OUString aRet; @@ -1143,7 +1111,6 @@ OUString ObjectIdentifier::getObjectID( const rtl::OUString& rCID ) return aRet; } -//static bool ObjectIdentifier::isCID( const OUString& rName ) { return rName.getLength() && rName.match( m_aProtocol ); @@ -1157,7 +1124,6 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet( rObjectCID, Reference< frame::XModel >( xChartDocument, uno::UNO_QUERY )); } -//static Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet( const OUString& rObjectCID , const Reference< frame::XModel >& xChartModel ) @@ -1340,7 +1306,6 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet( return xObjectProperties; } -//static Reference< XAxis > ObjectIdentifier::getAxisForCID( const OUString& rObjectCID , const Reference< frame::XModel >& xChartModel ) @@ -1356,7 +1321,6 @@ Reference< XAxis > ObjectIdentifier::getAxisForCID( return AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys ); } -//static Reference< XDataSeries > ObjectIdentifier::getDataSeriesForCID( const OUString& rObjectCID , const Reference< frame::XModel >& xChartModel ) @@ -1383,7 +1347,6 @@ Reference< XDataSeries > ObjectIdentifier::getDataSeriesForCID( return xSeries; } -//static Reference< XDiagram > ObjectIdentifier::getDiagramForCID( const rtl::OUString& rObjectCID , const uno::Reference< frame::XModel >& xChartModel ) @@ -1415,7 +1378,6 @@ TitleHelper::eTitleType ObjectIdentifier::getTitleTypeForCID( const OUString& rC return eRet; } -// static OUString ObjectIdentifier::getSeriesParticleFromCID( const OUString& rCID ) { sal_Int32 nDiagramIndex = -1; @@ -1430,7 +1392,6 @@ OUString ObjectIdentifier::getSeriesParticleFromCID( const OUString& rCID ) return ObjectIdentifier::createParticleForSeries( nDiagramIndex, nCooSysIndex, nChartTypeIndex, nSeriesIndex ); } -//static OUString ObjectIdentifier::getMovedSeriesCID( const ::rtl::OUString& rObjectCID, sal_Bool bForward ) { sal_Int32 nDiagramIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, C2U("CID/D=") ) ); diff --git a/chart2/source/tools/RegressionCurveCalculator.cxx b/chart2/source/tools/RegressionCurveCalculator.cxx index 68e041e668ca..a3d43d2a3d03 100644..100755 --- a/chart2/source/tools/RegressionCurveCalculator.cxx +++ b/chart2/source/tools/RegressionCurveCalculator.cxx @@ -55,7 +55,6 @@ RegressionCurveCalculator::RegressionCurveCalculator() : RegressionCurveCalculator::~RegressionCurveCalculator() {} -// static bool RegressionCurveCalculator::isLinearScaling( const Reference< chart2::XScaling > & xScaling ) { @@ -67,7 +66,6 @@ bool RegressionCurveCalculator::isLinearScaling( return (xServiceName.is() && xServiceName->getServiceName().equals( aLinScalingServiceName )); } -// static bool RegressionCurveCalculator::isLogarithmicScaling( const Reference< chart2::XScaling > & xScaling ) { diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx index b553dbc2d217..df9c4bdadd65 100644..100755 --- a/chart2/source/tools/RegressionCurveHelper.cxx +++ b/chart2/source/tools/RegressionCurveHelper.cxx @@ -88,7 +88,6 @@ namespace chart { //............................................................................. -// static Reference< XRegressionCurve > RegressionCurveHelper::createMeanValueLine( const Reference< XComponentContext > & xContext ) { @@ -96,7 +95,6 @@ Reference< XRegressionCurve > RegressionCurveHelper::createMeanValueLine( new MeanValueRegressionCurve( xContext )); } -// static Reference< XRegressionCurve > RegressionCurveHelper::createRegressionCurveByServiceName( const Reference< XComponentContext > & xContext, ::rtl::OUString aServiceName ) @@ -134,7 +132,6 @@ Reference< XRegressionCurve > RegressionCurveHelper::createRegressionCurveByServ // ------------------------------------------------------------ -// static Reference< XRegressionCurveCalculator > RegressionCurveHelper::createRegressionCurveCalculatorByServiceName( ::rtl::OUString aServiceName ) { @@ -170,7 +167,6 @@ Reference< XRegressionCurveCalculator > RegressionCurveHelper::createRegressionC return xResult; } -// static void RegressionCurveHelper::initializeCurveCalculator( const Reference< XRegressionCurveCalculator > & xOutCurveCalculator, const Reference< data::XDataSource > & xSource, @@ -235,7 +231,6 @@ void RegressionCurveHelper::initializeCurveCalculator( xOutCurveCalculator->recalculateRegression( aXValues, aYValues ); } -// static void RegressionCurveHelper::initializeCurveCalculator( const Reference< XRegressionCurveCalculator > & xOutCurveCalculator, const Reference< XDataSeries > & xSeries, @@ -251,7 +246,6 @@ void RegressionCurveHelper::initializeCurveCalculator( // ---------------------------------------- -// static bool RegressionCurveHelper::hasMeanValueLine( const uno::Reference< XRegressionCurveContainer > & xRegCnt ) { @@ -276,7 +270,6 @@ bool RegressionCurveHelper::hasMeanValueLine( return false; } -// static bool RegressionCurveHelper::isMeanValueLine( const uno::Reference< chart2::XRegressionCurve > & xRegCurve ) { @@ -288,7 +281,6 @@ bool RegressionCurveHelper::isMeanValueLine( return false; } -// static uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::getMeanValueLine( const uno::Reference< chart2::XRegressionCurveContainer > & xRegCnt ) @@ -314,7 +306,6 @@ uno::Reference< chart2::XRegressionCurve > return uno::Reference< chart2::XRegressionCurve >(); } -// static void RegressionCurveHelper::addMeanValueLine( uno::Reference< XRegressionCurveContainer > & xRegCnt, const uno::Reference< XComponentContext > & xContext, @@ -339,7 +330,6 @@ void RegressionCurveHelper::addMeanValueLine( } } -// static void RegressionCurveHelper::removeMeanValueLine( Reference< XRegressionCurveContainer > & xRegCnt ) { @@ -487,7 +477,6 @@ void RegressionCurveHelper::removeEquations( } } -// static void RegressionCurveHelper::replaceOrAddCurveAndReduceToOne( tRegressionType eType, uno::Reference< XRegressionCurveContainer > & xRegCnt, @@ -510,7 +499,6 @@ void RegressionCurveHelper::replaceOrAddCurveAndReduceToOne( } } -// static uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::getFirstCurveNotMeanValueLine( const Reference< XRegressionCurveContainer > & xRegCnt ) { @@ -538,7 +526,6 @@ uno::Reference< chart2::XRegressionCurve > RegressionCurveHelper::getFirstCurveN return NULL; } -// static RegressionCurveHelper::tRegressionType RegressionCurveHelper::getRegressionType( const Reference< XRegressionCurve > & xCurve ) { @@ -586,7 +573,6 @@ RegressionCurveHelper::tRegressionType RegressionCurveHelper::getRegressionType( return eResult; } -// static RegressionCurveHelper::tRegressionType RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine( const Reference< XRegressionCurveContainer > & xRegCnt ) { @@ -650,7 +636,6 @@ OUString RegressionCurveHelper::getUINameForRegressionCurve( const Reference< XR return aResult; } -// static ::std::vector< Reference< chart2::XRegressionCurve > > RegressionCurveHelper::getAllRegressionCurvesNotMeanValueLine( const Reference< chart2::XDiagram > & xDiagram ) @@ -676,7 +661,6 @@ OUString RegressionCurveHelper::getUINameForRegressionCurve( const Reference< XR return aResult; } -// static void RegressionCurveHelper::resetEquationPosition( const Reference< chart2::XRegressionCurve > & xCurve ) { diff --git a/chart2/source/tools/RegressionCurveModel.cxx b/chart2/source/tools/RegressionCurveModel.cxx index cf5be998308e..06e38dbd0f16 100644..100755 --- a/chart2/source/tools/RegressionCurveModel.cxx +++ b/chart2/source/tools/RegressionCurveModel.cxx @@ -63,37 +63,63 @@ static const OUString lcl_aImplementationName_Potential( static const OUString lcl_aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.RegressionCurve" )); -const uno::Sequence< Property > & lcl_GetPropertySequence() +struct StaticXXXDefaults_Initializer { - static uno::Sequence< Property > aPropSeq; + ::chart::tPropertyValueMap* operator()() + { + static ::chart::tPropertyValueMap aStaticDefaults; + lcl_AddDefaultsToMap( aStaticDefaults ); + return &aStaticDefaults; + } +private: + void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) + { + ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + } +}; + +struct StaticXXXDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticXXXDefaults_Initializer > +{ +}; + +struct StaticRegressionCurveInfoHelper_Initializer +{ + ::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 ); - // 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 StaticRegressionCurveInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticRegressionCurveInfoHelper_Initializer > +{ +}; -::cppu::IPropertyArrayHelper & lcl_getInfoHelper() +struct StaticRegressionCurveInfo_Initializer { - static ::cppu::OPropertyArrayHelper aArrayHelper( - lcl_GetPropertySequence(), - /* bSorted = */ sal_True ); + uno::Reference< beans::XPropertySetInfo >* operator()() + { + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticRegressionCurveInfoHelper::get() ) ); + return &xPropertySetInfo; + } +}; - return aArrayHelper; -} +struct StaticRegressionCurveInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticRegressionCurveInfo_Initializer > +{ +}; } // anonymous namespace @@ -240,49 +266,23 @@ void RegressionCurveModel::fireModifyEvent() uno::Any RegressionCurveModel::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 ); - } - - tPropertyValueMap::const_iterator aFound( - aStaticDefaults.find( nHandle )); - - if( aFound == aStaticDefaults.end()) + const tPropertyValueMap& rStaticDefaults = *StaticXXXDefaults::get(); + tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); + if( aFound == rStaticDefaults.end() ) return uno::Any(); - return (*aFound).second; - // \-- } ::cppu::IPropertyArrayHelper & SAL_CALL RegressionCurveModel::getInfoHelper() { - return lcl_getInfoHelper(); + return *StaticRegressionCurveInfoHelper::get(); } - // ____ XPropertySet ____ -uno::Reference< beans::XPropertySetInfo > SAL_CALL - RegressionCurveModel::getPropertySetInfo() +uno::Reference< beans::XPropertySetInfo > SAL_CALL RegressionCurveModel::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 *StaticRegressionCurveInfo::get(); } // ================================================================================ diff --git a/chart2/source/tools/RegressionEquation.cxx b/chart2/source/tools/RegressionEquation.cxx index ea16e5b7702a..cc9156569a8f 100644..100755 --- a/chart2/source/tools/RegressionEquation.cxx +++ b/chart2/source/tools/RegressionEquation.cxx @@ -118,32 +118,51 @@ void lcl_AddPropertiesToVector( | beans::PropertyAttribute::MAYBEVOID )); } -void lcl_AddDefaultsToMap( - ::chart::tPropertyValueMap & rOutMap ) +struct StaticRegressionEquationDefaults_Initializer { - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SHOW, false ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SHOW_CORRELATION_COEFF, false ); -// ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SEPARATOR, ::rtl::OUString( sal_Unicode( '\n' ))); - - // 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 ); - - 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_EQUATION_SHOW, false ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SHOW_CORRELATION_COEFF, false ); + //::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SEPARATOR, ::rtl::OUString( sal_Unicode( '\n' ))); + + // 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 ); + + 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 uno::Sequence< Property > & lcl_GetPropertySequence() +struct StaticRegressionEquationDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticRegressionEquationDefaults_Initializer > { - static uno::Sequence< Property > aPropSeq; +}; - // /-- - MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( 0 == aPropSeq.getLength() ) +struct StaticRegressionEquationInfoHelper_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 ); @@ -151,25 +170,31 @@ const uno::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; -} +}; -::cppu::IPropertyArrayHelper & lcl_getInfoHelper() +struct StaticRegressionEquationInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticRegressionEquationInfoHelper_Initializer > { - static ::cppu::OPropertyArrayHelper aArrayHelper( - lcl_GetPropertySequence(), - /* bSorted = */ sal_True ); +}; - return aArrayHelper; -} +struct StaticRegressionEquationInfo_Initializer +{ + uno::Reference< beans::XPropertySetInfo >* operator()() + { + static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( + ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticRegressionEquationInfoHelper::get() ) ); + return &xPropertySetInfo; + } +}; + +struct StaticRegressionEquationInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticRegressionEquationInfo_Initializer > +{ +}; } // anonymous namespace @@ -206,56 +231,25 @@ uno::Reference< util::XCloneable > SAL_CALL RegressionEquation::createClone() uno::Any RegressionEquation::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 ); - CharacterProperties::AddDefaultsToMap( aStaticDefaults ); - - // overrides a line property - lcl_AddDefaultsToMap( aStaticDefaults ); - } - - tPropertyValueMap::const_iterator aFound( - aStaticDefaults.find( nHandle )); - - if( aFound == aStaticDefaults.end()) + const tPropertyValueMap& rStaticDefaults = *StaticRegressionEquationDefaults::get(); + tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) ); + if( aFound == rStaticDefaults.end() ) return uno::Any(); - return (*aFound).second; - // \-- } ::cppu::IPropertyArrayHelper & SAL_CALL RegressionEquation::getInfoHelper() { - return lcl_getInfoHelper(); + return *StaticRegressionEquationInfoHelper::get(); } // ____ XPropertySet ____ -Reference< beans::XPropertySetInfo > SAL_CALL - RegressionEquation::getPropertySetInfo() +Reference< beans::XPropertySetInfo > SAL_CALL RegressionEquation::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 *StaticRegressionEquationInfo::get(); } - // ____ XModifyBroadcaster ____ void SAL_CALL RegressionEquation::addModifyListener( const uno::Reference< util::XModifyListener >& aListener ) throw (uno::RuntimeException) diff --git a/chart2/source/tools/RelativePositionHelper.cxx b/chart2/source/tools/RelativePositionHelper.cxx index 4d566b1f7f48..45018b755f3b 100644..100755 --- a/chart2/source/tools/RelativePositionHelper.cxx +++ b/chart2/source/tools/RelativePositionHelper.cxx @@ -36,7 +36,6 @@ using namespace ::com::sun::star; namespace chart { -// static chart2::RelativePosition RelativePositionHelper::getReanchoredPosition( const chart2::RelativePosition & rPosition, const chart2::RelativeSize & rObjectSize, @@ -132,7 +131,6 @@ chart2::RelativePosition RelativePositionHelper::getReanchoredPosition( } -// static awt::Point RelativePositionHelper::getUpperLeftCornerOfAnchoredObject( awt::Point aPoint , awt::Size aObjectSize @@ -191,7 +189,6 @@ awt::Point RelativePositionHelper::getUpperLeftCornerOfAnchoredObject( return aResult; } -// static awt::Point RelativePositionHelper::getCenterOfAnchoredObject( awt::Point aPoint , awt::Size aUnrotatedObjectSize diff --git a/chart2/source/tools/RelativeSizeHelper.cxx b/chart2/source/tools/RelativeSizeHelper.cxx index d3da090ca397..3d1949da1732 100644..100755 --- a/chart2/source/tools/RelativeSizeHelper.cxx +++ b/chart2/source/tools/RelativeSizeHelper.cxx @@ -45,7 +45,6 @@ using ::rtl::OUString; namespace chart { -// static double RelativeSizeHelper::calculate( double fValue, const Size & rOldReferenceSize, @@ -61,7 +60,6 @@ double RelativeSizeHelper::calculate( * fValue; } -// static void RelativeSizeHelper::adaptFontSizes( const Reference< XPropertySet > & xTargetProperties, const Size & rOldReferenceSize, diff --git a/chart2/source/tools/StatisticsHelper.cxx b/chart2/source/tools/StatisticsHelper.cxx index 721451c276da..8cec1321c579 100644..100755 --- a/chart2/source/tools/StatisticsHelper.cxx +++ b/chart2/source/tools/StatisticsHelper.cxx @@ -181,7 +181,6 @@ void lcl_setXMLRangePropertyAtDataSequence( namespace chart { -// static double StatisticsHelper::getVariance( const Sequence< double > & rData, bool bUnbiasedEstimator /* = false */ ) @@ -190,7 +189,6 @@ double StatisticsHelper::getVariance( return lcl_getVariance( rData, nValCount, bUnbiasedEstimator ); } -// static double StatisticsHelper::getStandardDeviation( const Sequence< double > & rData ) { double fResult = getVariance( rData ); @@ -200,7 +198,6 @@ double StatisticsHelper::getStandardDeviation( const Sequence< double > & rData return fResult; } -// static double StatisticsHelper::getStandardError( const Sequence< double > & rData ) { sal_Int32 nValCount; @@ -221,7 +218,6 @@ double StatisticsHelper::getStandardError( const Sequence< double > & rData ) return fResult; } -// static Reference< chart2::data::XLabeledDataSequence > StatisticsHelper::getErrorLabeledDataSequenceFromDataSource( const Reference< chart2::data::XDataSource > & xDataSource, bool bPositiveValue, @@ -240,7 +236,6 @@ Reference< chart2::data::XLabeledDataSequence > StatisticsHelper::getErrorLabele return xResult; } -// static Reference< chart2::data::XDataSequence > StatisticsHelper::getErrorDataSequenceFromDataSource( const Reference< chart2::data::XDataSource > & xDataSource, bool bPositiveValue, @@ -256,7 +251,6 @@ Reference< chart2::data::XDataSequence > StatisticsHelper::getErrorDataSequenceF return xLSeq->getValues(); } -// static double StatisticsHelper::getErrorFromDataSource( const Reference< chart2::data::XDataSource > & xDataSource, sal_Int32 nIndex, @@ -286,7 +280,6 @@ double StatisticsHelper::getErrorFromDataSource( return fResult; } -// static void StatisticsHelper::setErrorDataSequence( const Reference< chart2::data::XDataSource > & xDataSource, const Reference< chart2::data::XDataProvider > & xDataProvider, @@ -318,7 +311,6 @@ void StatisticsHelper::setErrorDataSequence( } } -// static Reference< beans::XPropertySet > StatisticsHelper::addErrorBars( const Reference< chart2::XDataSeries > & xDataSeries, const Reference< uno::XComponentContext > & xContext, @@ -348,7 +340,6 @@ Reference< beans::XPropertySet > StatisticsHelper::addErrorBars( return xErrorBar; } -// static Reference< beans::XPropertySet > StatisticsHelper::getErrorBars( const Reference< chart2::XDataSeries > & xDataSeries, bool bYError /* = true */ ) @@ -363,7 +354,6 @@ Reference< beans::XPropertySet > StatisticsHelper::getErrorBars( return xErrorBar; } -// static bool StatisticsHelper::hasErrorBars( const Reference< chart2::XDataSeries > & xDataSeries, bool bYError /* = true */ ) @@ -376,7 +366,6 @@ bool StatisticsHelper::hasErrorBars( nStyle != ::com::sun::star::chart::ErrorBarStyle::NONE ); } -// static void StatisticsHelper::removeErrorBars( const Reference< chart2::XDataSeries > & xDataSeries, bool bYError /* = true */ ) @@ -387,7 +376,6 @@ void StatisticsHelper::removeErrorBars( ::com::sun::star::chart::ErrorBarStyle::NONE )); } -// static bool StatisticsHelper::usesErrorBarRanges( const Reference< chart2::XDataSeries > & xDataSeries, bool bYError /* = true */ ) diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx index 44ed73eade43..e6be4a7ce4e0 100644..100755 --- a/chart2/source/tools/ThreeDHelper.cxx +++ b/chart2/source/tools/ThreeDHelper.cxx @@ -1172,7 +1172,6 @@ void ThreeDHelper::setCameraDistance( } } -//static double ThreeDHelper::CameraDistanceToPerspective( double fCameraDistance ) { double fRet = fCameraDistance; @@ -1188,7 +1187,6 @@ double ThreeDHelper::CameraDistanceToPerspective( double fCameraDistance ) return fRet; } -//static double ThreeDHelper::PerspectiveToCameraDistance( double fPerspective ) { double fRet = fPerspective; @@ -1204,7 +1202,6 @@ double ThreeDHelper::PerspectiveToCameraDistance( double fPerspective ) return fRet; } -//static ThreeDLookScheme ThreeDHelper::detectScheme( const uno::Reference< XDiagram >& xDiagram ) { ThreeDLookScheme aScheme = ThreeDLookScheme_Unknown; @@ -1278,7 +1275,6 @@ void ThreeDHelper::setScheme( const uno::Reference< XDiagram >& xDiagram, ThreeD } -//static void ThreeDHelper::set3DSettingsToDefault( const uno::Reference< beans::XPropertySet >& xSceneProperties ) { Reference< beans::XPropertyState > xState( xSceneProperties, uno::UNO_QUERY ); @@ -1291,7 +1287,6 @@ void ThreeDHelper::set3DSettingsToDefault( const uno::Reference< beans::XPropert ThreeDHelper::setDefaultIllumination( xSceneProperties ); } -//static void ThreeDHelper::setDefaultRotation( const uno::Reference< beans::XPropertySet >& xSceneProperties, bool bPieOrDonut ) { if( !xSceneProperties.is() ) @@ -1307,14 +1302,12 @@ void ThreeDHelper::setDefaultRotation( const uno::Reference< beans::XPropertySet uno::makeAny( BaseGFXHelper::B3DHomMatrixToHomogenMatrix( aSceneRotation ))); } -//static void ThreeDHelper::setDefaultRotation( const uno::Reference< beans::XPropertySet >& xSceneProperties ) { bool bPieOrDonut( DiagramHelper::isPieOrDonutChart( uno::Reference< XDiagram >(xSceneProperties, uno::UNO_QUERY) ) ); ThreeDHelper::setDefaultRotation( xSceneProperties, bPieOrDonut ); } -//static void ThreeDHelper::setDefaultIllumination( const uno::Reference< beans::XPropertySet >& xSceneProperties ) { if( !xSceneProperties.is() ) @@ -1341,7 +1334,6 @@ void ThreeDHelper::setDefaultIllumination( const uno::Reference< beans::XPropert lcl_setLightsForScheme( xSceneProperties, aScheme ); } -//static void ThreeDHelper::getRoundedEdgesAndObjectLines( const uno::Reference< XDiagram > & xDiagram , sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines ) @@ -1441,7 +1433,6 @@ void ThreeDHelper::getRoundedEdgesAndObjectLines( ASSERT_EXCEPTION( e ); } } -//static void ThreeDHelper::setRoundedEdgesAndObjectLines( const uno::Reference< XDiagram > & xDiagram , sal_Int32 nRoundedEdges, sal_Int32 nObjectLines ) @@ -1471,7 +1462,6 @@ void ThreeDHelper::setRoundedEdgesAndObjectLines( } } -//static CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( const Reference< beans::XPropertySet >& xSceneProperties ) { CuboidPlanePosition eRet(CuboidPlanePosition_Left); @@ -1488,7 +1478,6 @@ CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeft return eRet; } -//static CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( const Reference< beans::XPropertySet >& xSceneProperties ) { CuboidPlanePosition eRet(CuboidPlanePosition_Back); @@ -1505,7 +1494,6 @@ CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBack return eRet; } -//static CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( const Reference< beans::XPropertySet >& xSceneProperties ) { CuboidPlanePosition eRet(CuboidPlanePosition_Bottom); diff --git a/chart2/source/tools/WrappedIgnoreProperty.cxx b/chart2/source/tools/WrappedIgnoreProperty.cxx index aaa6c545a799..c98b80582616 100644..100755 --- a/chart2/source/tools/WrappedIgnoreProperty.cxx +++ b/chart2/source/tools/WrappedIgnoreProperty.cxx @@ -92,7 +92,6 @@ beans::PropertyState WrappedIgnoreProperty::getPropertyState( const Reference< b : beans::PropertyState_DIRECT_VALUE ); } -//static void WrappedIgnoreProperties::addIgnoreLineProperties( std::vector< WrappedProperty* >& rList ) { rList.push_back( new WrappedIgnoreProperty( C2U( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID ) ) ); @@ -104,14 +103,12 @@ void WrappedIgnoreProperties::addIgnoreLineProperties( std::vector< WrappedPrope rList.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_ROUND ) ) ); } -//static void WrappedIgnoreProperties::addIgnoreFillProperties( std::vector< WrappedProperty* >& rList ) { addIgnoreFillProperties_without_BitmapProperties( rList ); addIgnoreFillProperties_only_BitmapProperties( rList ); } -//static void WrappedIgnoreProperties::addIgnoreFillProperties_without_BitmapProperties( ::std::vector< WrappedProperty* >& rList ) { rList.push_back( new WrappedIgnoreProperty( C2U( "FillStyle" ), uno::makeAny( drawing::FillStyle_SOLID ) ) ); @@ -126,7 +123,6 @@ void WrappedIgnoreProperties::addIgnoreFillProperties_without_BitmapProperties( rList.push_back( new WrappedIgnoreProperty( C2U( "FillBackground" ), uno::makeAny( sal_Bool(sal_False) ) ) ); } -//static void WrappedIgnoreProperties::addIgnoreFillProperties_only_BitmapProperties( ::std::vector< WrappedProperty* >& rList ) { // rList.push_back( new WrappedIgnoreProperty( C2U( "FillBitmapName" ), uno::makeAny( ::rtl::OUString() ) ) ); diff --git a/chart2/source/tools/WrappedPropertySet.cxx b/chart2/source/tools/WrappedPropertySet.cxx index 843aeb261a5f..9b752634a264 100644..100755 --- a/chart2/source/tools/WrappedPropertySet.cxx +++ b/chart2/source/tools/WrappedPropertySet.cxx @@ -66,8 +66,7 @@ Reference< beans::XPropertyState > WrappedPropertySet::getInnerPropertyState() void WrappedPropertySet::clearWrappedPropertySet() { - // /-- - ::osl::MutexGuard aGuard( m_aMutex ); + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );//do not use different mutex than is already used for static property sequence //delete all wrapped properties if(m_pWrappedPropertyMap) @@ -84,22 +83,27 @@ void WrappedPropertySet::clearWrappedPropertySet() DELETEZ(m_pWrappedPropertyMap); m_xInfo = NULL; - // \-- } //XPropertySet Reference< beans::XPropertySetInfo > SAL_CALL WrappedPropertySet::getPropertySetInfo( ) throw (uno::RuntimeException) { - if( !m_xInfo.is() ) + Reference< beans::XPropertySetInfo > xInfo = m_xInfo; + if( !xInfo.is() ) { - // /-- - ::osl::MutexGuard aGuard( m_aMutex ); - if( !m_xInfo.is() ) + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );//do not use different mutex than is already used for static property sequence + xInfo = m_xInfo; + if( !xInfo.is() ) { - m_xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ); + xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() ); + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); + m_xInfo = xInfo; } - // \-- + } + else + { + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); } return m_xInfo; } @@ -435,16 +439,21 @@ Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyDefaults( const Sequence ::cppu::IPropertyArrayHelper& WrappedPropertySet::getInfoHelper() { - if(!m_pPropertyArrayHelper) + ::cppu::OPropertyArrayHelper* p = m_pPropertyArrayHelper; + if(!p) { - // /-- - ::osl::MutexGuard aGuard( m_aMutex ); - if(!m_pPropertyArrayHelper) + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );//do not use different mutex than is already used for static property sequence + p = m_pPropertyArrayHelper; + if(!p) { - sal_Bool bSorted = sal_True; - m_pPropertyArrayHelper = new ::cppu::OPropertyArrayHelper( getPropertySequence(), bSorted ); + p = new ::cppu::OPropertyArrayHelper( getPropertySequence(), sal_True ); + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); + m_pPropertyArrayHelper = p; } - // \-- + } + else + { + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); } return *m_pPropertyArrayHelper; } @@ -453,14 +462,15 @@ Sequence< Any > SAL_CALL WrappedPropertySet::getPropertyDefaults( const Sequence tWrappedPropertyMap& WrappedPropertySet::getWrappedPropertyMap() { - if(!m_pWrappedPropertyMap) + tWrappedPropertyMap* p = m_pWrappedPropertyMap; + if(!p) { - // /-- - ::osl::MutexGuard aGuard( m_aMutex ); - if(!m_pWrappedPropertyMap) + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );//do not use different mutex than is already used for static property sequence + p = m_pWrappedPropertyMap; + if(!p) { std::vector< WrappedProperty* > aPropList( createWrappedProperties() ); - m_pWrappedPropertyMap = new tWrappedPropertyMap(); + p = new tWrappedPropertyMap(); for( std::vector< WrappedProperty* >::const_iterator aIt = aPropList.begin(); aIt!=aPropList.end(); ++aIt ) { @@ -474,18 +484,24 @@ tWrappedPropertyMap& WrappedPropertySet::getWrappedPropertyMap() OSL_ENSURE( false, "missing property in property list" ); delete pProperty;//we are owner or the created WrappedProperties } - else if( m_pWrappedPropertyMap->find( nHandle ) != m_pWrappedPropertyMap->end() ) + else if( p->find( nHandle ) != p->end() ) { //duplicate Wrapped property OSL_ENSURE( false, "duplicate Wrapped property" ); delete pProperty;//we are owner or the created WrappedProperties } else - (*m_pWrappedPropertyMap)[ nHandle ] = pProperty; + (*p)[ nHandle ] = pProperty; } } + + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); + m_pWrappedPropertyMap = p; } - // \-- + } + else + { + OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER(); } return *m_pWrappedPropertyMap; } diff --git a/chart2/source/view/axes/TickmarkHelper.cxx b/chart2/source/view/axes/TickmarkHelper.cxx new file mode 100644 index 000000000000..f4f717722bed --- /dev/null +++ b/chart2/source/view/axes/TickmarkHelper.cxx @@ -0,0 +1,934 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_chart2.hxx" +#include "TickmarkHelper.hxx" +#include "ViewDefines.hxx" +#include <rtl/math.hxx> +#include <tools/debug.hxx> +#include <memory> + +//............................................................................. +namespace chart +{ +//............................................................................. +using namespace ::com::sun::star; +using namespace ::com::sun::star::chart2; +using namespace ::rtl::math; +using ::basegfx::B2DVector; + +TickInfo::TickInfo() +: fScaledTickValue( 0.0 ) +, fUnscaledTickValue( 0.0 ) +, aTickScreenPosition(0.0,0.0) +, bPaintIt( true ) +, xTextShape( NULL ) +, nFactorForLimitedTextWidth(1) +{ +} + +void TickInfo::updateUnscaledValue( const uno::Reference< XScaling >& xInverseScaling ) +{ + if( xInverseScaling.is() ) + this->fUnscaledTickValue = xInverseScaling->doScaling( this->fScaledTickValue ); + else + this->fUnscaledTickValue = this->fScaledTickValue; +} + +sal_Int32 TickInfo::getScreenDistanceBetweenTicks( const TickInfo& rOherTickInfo ) const +{ + //return the positive distance between the two first tickmarks in screen values + + B2DVector aDistance = rOherTickInfo.aTickScreenPosition - aTickScreenPosition; + sal_Int32 nRet = static_cast<sal_Int32>(aDistance.getLength()); + if(nRet<0) + nRet *= -1; + return nRet; +} + +PureTickIter::PureTickIter( ::std::vector< TickInfo >& rTickInfoVector ) + : m_rTickVector(rTickInfoVector) + , m_aTickIter(m_rTickVector.begin()) +{ +} +PureTickIter::~PureTickIter() +{ +} +TickInfo* PureTickIter::firstInfo() +{ + m_aTickIter = m_rTickVector.begin(); + if(m_aTickIter!=m_rTickVector.end()) + return &*m_aTickIter; + return 0; +} +TickInfo* PureTickIter::nextInfo() +{ + m_aTickIter++; + if(m_aTickIter!=m_rTickVector.end()) + return &*m_aTickIter; + return 0; +} + +EquidistantTickIter::EquidistantTickIter( const uno::Sequence< uno::Sequence< double > >& rTicks + , const ExplicitIncrementData& rIncrement + , sal_Int32 nMinDepth, sal_Int32 nMaxDepth ) + : m_pSimpleTicks(&rTicks) + , m_pInfoTicks(0) + , m_rIncrement(rIncrement) + , m_nMinDepth(0), m_nMaxDepth(0) + , m_nTickCount(0), m_pnPositions(NULL) + , m_pnPreParentCount(NULL), m_pbIntervalFinished(NULL) + , m_nCurrentDepth(-1), m_nCurrentPos(-1), m_fCurrentValue( 0.0 ) +{ + initIter( nMinDepth, nMaxDepth ); +} + +EquidistantTickIter::EquidistantTickIter( ::std::vector< ::std::vector< TickInfo > >& rTicks + , const ExplicitIncrementData& rIncrement + , sal_Int32 nMinDepth, sal_Int32 nMaxDepth ) + : m_pSimpleTicks(NULL) + , m_pInfoTicks(&rTicks) + , m_rIncrement(rIncrement) + , m_nMinDepth(0), m_nMaxDepth(0) + , m_nTickCount(0), m_pnPositions(NULL) + , m_pnPreParentCount(NULL), m_pbIntervalFinished(NULL) + , m_nCurrentDepth(-1), m_nCurrentPos(-1), m_fCurrentValue( 0.0 ) +{ + initIter( nMinDepth, nMaxDepth ); +} + +void EquidistantTickIter::initIter( sal_Int32 /*nMinDepth*/, sal_Int32 nMaxDepth ) +{ + m_nMaxDepth = nMaxDepth; + if(nMaxDepth<0 || m_nMaxDepth>getMaxDepth()) + m_nMaxDepth=getMaxDepth(); + + sal_Int32 nDepth = 0; + for( nDepth = 0; nDepth<=m_nMaxDepth ;nDepth++ ) + m_nTickCount += getTickCount(nDepth); + + if(!m_nTickCount) + return; + + m_pnPositions = new sal_Int32[m_nMaxDepth+1]; + + m_pnPreParentCount = new sal_Int32[m_nMaxDepth+1]; + m_pbIntervalFinished = new bool[m_nMaxDepth+1]; + m_pnPreParentCount[0] = 0; + m_pbIntervalFinished[0] = false; + double fParentValue = getTickValue(0,0); + for( nDepth = 1; nDepth<=m_nMaxDepth ;nDepth++ ) + { + m_pbIntervalFinished[nDepth] = false; + + sal_Int32 nPreParentCount = 0; + sal_Int32 nCount = getTickCount(nDepth); + for(sal_Int32 nN = 0; nN<nCount; nN++) + { + if(getTickValue(nDepth,nN) < fParentValue) + nPreParentCount++; + else + break; + } + m_pnPreParentCount[nDepth] = nPreParentCount; + if(nCount) + { + double fNextParentValue = getTickValue(nDepth,0); + if( fNextParentValue < fParentValue ) + fParentValue = fNextParentValue; + } + } +} + +EquidistantTickIter::~EquidistantTickIter() +{ + delete[] m_pnPositions; + delete[] m_pnPreParentCount; + delete[] m_pbIntervalFinished; +} + +sal_Int32 EquidistantTickIter::getStartDepth() const +{ + //find the depth of the first visible tickmark: + //it is the depth of the smallest value + sal_Int32 nReturnDepth=0; + double fMinValue = DBL_MAX; + for(sal_Int32 nDepth = 0; nDepth<=m_nMaxDepth ;nDepth++ ) + { + sal_Int32 nCount = getTickCount(nDepth); + if( !nCount ) + continue; + double fThisValue = getTickValue(nDepth,0); + if(fThisValue<fMinValue) + { + nReturnDepth = nDepth; + fMinValue = fThisValue; + } + } + return nReturnDepth; +} + +double* EquidistantTickIter::firstValue() +{ + if( gotoFirst() ) + { + m_fCurrentValue = getTickValue(m_nCurrentDepth, m_pnPositions[m_nCurrentDepth]); + return &m_fCurrentValue; + } + return NULL; +} + +TickInfo* EquidistantTickIter::firstInfo() +{ + if( m_pInfoTicks && gotoFirst() ) + return &(*m_pInfoTicks)[m_nCurrentDepth][m_pnPositions[m_nCurrentDepth]]; + return NULL; +} + +sal_Int32 EquidistantTickIter::getIntervalCount( sal_Int32 nDepth ) +{ + if(nDepth>m_rIncrement.SubIncrements.getLength() || nDepth<0) + return 0; + + if(!nDepth) + return m_nTickCount; + + return m_rIncrement.SubIncrements[nDepth-1].IntervalCount; +} + +bool EquidistantTickIter::isAtLastPartTick() +{ + if(!m_nCurrentDepth) + return false; + sal_Int32 nIntervalCount = getIntervalCount( m_nCurrentDepth ); + if(!nIntervalCount || nIntervalCount == 1) + return true; + if( m_pbIntervalFinished[m_nCurrentDepth] ) + return false; + sal_Int32 nPos = m_pnPositions[m_nCurrentDepth]+1; + if(m_pnPreParentCount[m_nCurrentDepth]) + nPos += nIntervalCount-1 - m_pnPreParentCount[m_nCurrentDepth]; + bool bRet = nPos && nPos % (nIntervalCount-1) == 0; + if(!nPos && !m_pnPreParentCount[m_nCurrentDepth] + && m_pnPositions[m_nCurrentDepth-1]==-1 ) + bRet = true; + return bRet; +} + +bool EquidistantTickIter::gotoFirst() +{ + if( m_nMaxDepth<0 ) + return false; + if( !m_nTickCount ) + return false; + + for(sal_Int32 nDepth = 0; nDepth<=m_nMaxDepth ;nDepth++ ) + m_pnPositions[nDepth] = -1; + + m_nCurrentPos = 0; + m_nCurrentDepth = getStartDepth(); + m_pnPositions[m_nCurrentDepth] = 0; + return true; +} + +bool EquidistantTickIter::gotoNext() +{ + if( m_nCurrentPos < 0 ) + return false; + m_nCurrentPos++; + + if( m_nCurrentPos >= m_nTickCount ) + return false; + + if( m_nCurrentDepth==m_nMaxDepth && isAtLastPartTick() ) + { + do + { + m_pbIntervalFinished[m_nCurrentDepth] = true; + m_nCurrentDepth--; + } + while( m_nCurrentDepth && isAtLastPartTick() ); + } + else if( m_nCurrentDepth<m_nMaxDepth ) + { + do + { + m_nCurrentDepth++; + } + while( m_nCurrentDepth<m_nMaxDepth ); + } + m_pbIntervalFinished[m_nCurrentDepth] = false; + m_pnPositions[m_nCurrentDepth] = m_pnPositions[m_nCurrentDepth]+1; + return true; +} + +bool EquidistantTickIter::gotoIndex( sal_Int32 nTickIndex ) +{ + if( nTickIndex < 0 ) + return false; + if( nTickIndex >= m_nTickCount ) + return false; + + if( nTickIndex < m_nCurrentPos ) + if( !gotoFirst() ) + return false; + + while( nTickIndex > m_nCurrentPos ) + if( !gotoNext() ) + return false; + + return true; +} + +sal_Int32 EquidistantTickIter::getCurrentIndex() const +{ + return m_nCurrentPos; +} +sal_Int32 EquidistantTickIter::getMaxIndex() const +{ + return m_nTickCount-1; +} + +double* EquidistantTickIter::nextValue() +{ + if( gotoNext() ) + { + m_fCurrentValue = getTickValue(m_nCurrentDepth, m_pnPositions[m_nCurrentDepth]); + return &m_fCurrentValue; + } + return NULL; +} + +TickInfo* EquidistantTickIter::nextInfo() +{ + if( m_pInfoTicks && gotoNext() && + static_cast< sal_Int32 >( + (*m_pInfoTicks)[m_nCurrentDepth].size()) > m_pnPositions[m_nCurrentDepth] ) + { + return &(*m_pInfoTicks)[m_nCurrentDepth][m_pnPositions[m_nCurrentDepth]]; + } + return NULL; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +double TickmarkHelper::getMinimumAtIncrement( double fMin, const ExplicitIncrementData& rIncrement ) +{ + //the returned value will be <= fMin and on a Major Tick given by rIncrement + if(rIncrement.Distance<=0.0) + return fMin; + + double fRet = rIncrement.BaseValue + + floor( approxSub( fMin, rIncrement.BaseValue ) + / rIncrement.Distance) + *rIncrement.Distance; + + if( fRet > fMin ) + { + if( !approxEqual(fRet, fMin) ) + fRet -= rIncrement.Distance; + } + return fRet; +} +double TickmarkHelper::getMaximumAtIncrement( double fMax, const ExplicitIncrementData& rIncrement ) +{ + //the returned value will be >= fMax and on a Major Tick given by rIncrement + if(rIncrement.Distance<=0.0) + return fMax; + + double fRet = rIncrement.BaseValue + + floor( approxSub( fMax, rIncrement.BaseValue ) + / rIncrement.Distance) + *rIncrement.Distance; + + if( fRet < fMax ) + { + if( !approxEqual(fRet, fMax) ) + fRet += rIncrement.Distance; + } + return fRet; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- + +TickmarkHelper::TickmarkHelper( + const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement ) + : m_rScale( rScale ) + , m_rIncrement( rIncrement ) + , m_xInverseScaling(NULL) + , m_pfCurrentValues(NULL) +{ + //@todo: make sure that the scale is valid for the scaling + + m_pfCurrentValues = new double[getTickDepth()]; + + if( m_rScale.Scaling.is() ) + { + m_xInverseScaling = m_rScale.Scaling->getInverseScaling(); + DBG_ASSERT( m_xInverseScaling.is(), "each Scaling needs to return a inverse Scaling" ); + } + + double fMin = m_fScaledVisibleMin = m_rScale.Minimum; + if( m_xInverseScaling.is() ) + { + m_fScaledVisibleMin = m_rScale.Scaling->doScaling(m_fScaledVisibleMin); + if(m_rIncrement.PostEquidistant ) + fMin = m_fScaledVisibleMin; + } + + double fMax = m_fScaledVisibleMax = m_rScale.Maximum; + if( m_xInverseScaling.is() ) + { + m_fScaledVisibleMax = m_rScale.Scaling->doScaling(m_fScaledVisibleMax); + if(m_rIncrement.PostEquidistant ) + fMax = m_fScaledVisibleMax; + } + + //-- + m_fOuterMajorTickBorderMin = TickmarkHelper::getMinimumAtIncrement( fMin, m_rIncrement ); + m_fOuterMajorTickBorderMax = TickmarkHelper::getMaximumAtIncrement( fMax, m_rIncrement ); + //-- + + m_fOuterMajorTickBorderMin_Scaled = m_fOuterMajorTickBorderMin; + m_fOuterMajorTickBorderMax_Scaled = m_fOuterMajorTickBorderMax; + if(!m_rIncrement.PostEquidistant && m_xInverseScaling.is() ) + { + m_fOuterMajorTickBorderMin_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMin); + m_fOuterMajorTickBorderMax_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMax); + + //check validity of new range: m_fOuterMajorTickBorderMin <-> m_fOuterMajorTickBorderMax + //it is assumed here, that the original range in the given Scale is valid + if( !rtl::math::isFinite(m_fOuterMajorTickBorderMin_Scaled) ) + { + m_fOuterMajorTickBorderMin += m_rIncrement.Distance; + m_fOuterMajorTickBorderMin_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMin); + } + if( !rtl::math::isFinite(m_fOuterMajorTickBorderMax_Scaled) ) + { + m_fOuterMajorTickBorderMax -= m_rIncrement.Distance; + m_fOuterMajorTickBorderMax_Scaled = m_rScale.Scaling->doScaling(m_fOuterMajorTickBorderMax); + } + } +} + +TickmarkHelper* TickmarkHelper::createShiftedTickmarkHelper() const +{ + ExplicitIncrementData aShiftedIncrement( m_rIncrement ); + aShiftedIncrement.BaseValue = m_rIncrement.BaseValue-m_rIncrement.Distance/2.0; + return new TickmarkHelper( m_rScale, aShiftedIncrement ); +} + +TickmarkHelper::~TickmarkHelper() +{ + delete[] m_pfCurrentValues; +} + +sal_Int32 TickmarkHelper::getTickDepth() const +{ + return m_rIncrement.SubIncrements.getLength() + 1; +} + +sal_Int32 TickmarkHelper::getMaxTickCount( sal_Int32 nDepth ) const +{ + //return the maximum amount of ticks + //possibly open intervals at the two ends of the region are handled as if they were completely visible + //(this is necessary for calculating the sub ticks at the borders correctly) + + if( nDepth >= getTickDepth() ) + return 0; + if( m_fOuterMajorTickBorderMax < m_fOuterMajorTickBorderMin ) + return 0; + if( m_rIncrement.Distance<=0.0) + return 0; + + double fSub; + if(m_rIncrement.PostEquidistant ) + fSub = approxSub( m_fScaledVisibleMax, m_fScaledVisibleMin ); + else + fSub = approxSub( m_rScale.Maximum, m_rScale.Minimum ); + + if (!isFinite(fSub)) + return 0; + + sal_Int32 nIntervalCount = static_cast<sal_Int32>( fSub / m_rIncrement.Distance ); + + nIntervalCount+=3; + for(sal_Int32 nN=0; nN<nDepth-1; nN++) + { + if( m_rIncrement.SubIncrements[nN].IntervalCount>1 ) + nIntervalCount *= m_rIncrement.SubIncrements[nN].IntervalCount; + } + + sal_Int32 nTickCount = nIntervalCount; + if(nDepth>0 && m_rIncrement.SubIncrements[nDepth-1].IntervalCount>1) + nTickCount = nIntervalCount * (m_rIncrement.SubIncrements[nDepth-1].IntervalCount-1); + + return nTickCount; +} + +double* TickmarkHelper::getMajorTick( sal_Int32 nTick ) const +{ + m_pfCurrentValues[0] = m_fOuterMajorTickBorderMin + nTick*m_rIncrement.Distance; + + if(m_pfCurrentValues[0]>m_fOuterMajorTickBorderMax) + { + if( !approxEqual(m_pfCurrentValues[0],m_fOuterMajorTickBorderMax) ) + return NULL; + } + if(m_pfCurrentValues[0]<m_fOuterMajorTickBorderMin) + { + if( !approxEqual(m_pfCurrentValues[0],m_fOuterMajorTickBorderMin) ) + return NULL; + } + + //return always the value after scaling + if(!m_rIncrement.PostEquidistant && m_xInverseScaling.is() ) + m_pfCurrentValues[0] = m_rScale.Scaling->doScaling( m_pfCurrentValues[0] ); + + return &m_pfCurrentValues[0]; +} + +double* TickmarkHelper::getMinorTick( sal_Int32 nTick, sal_Int32 nDepth + , double fStartParentTick, double fNextParentTick ) const +{ + //check validity of arguments + { + //DBG_ASSERT( fStartParentTick < fNextParentTick, "fStartParentTick >= fNextParentTick"); + if(fStartParentTick >= fNextParentTick) + return NULL; + if(nDepth>m_rIncrement.SubIncrements.getLength() || nDepth<=0) + return NULL; + + //subticks are only calculated if they are laying between parent ticks: + if(nTick<=0) + return NULL; + if(nTick>=m_rIncrement.SubIncrements[nDepth-1].IntervalCount) + return NULL; + } + + bool bPostEquidistant = m_rIncrement.SubIncrements[nDepth-1].PostEquidistant; + + double fAdaptedStartParent = fStartParentTick; + double fAdaptedNextParent = fNextParentTick; + + if( !bPostEquidistant && m_xInverseScaling.is() ) + { + fAdaptedStartParent = m_xInverseScaling->doScaling(fStartParentTick); + fAdaptedNextParent = m_xInverseScaling->doScaling(fNextParentTick); + } + + double fDistance = (fAdaptedNextParent - fAdaptedStartParent)/m_rIncrement.SubIncrements[nDepth-1].IntervalCount; + + m_pfCurrentValues[nDepth] = fAdaptedStartParent + nTick*fDistance; + + //return always the value after scaling + if(!bPostEquidistant && m_xInverseScaling.is() ) + m_pfCurrentValues[nDepth] = m_rScale.Scaling->doScaling( m_pfCurrentValues[nDepth] ); + + if( !isWithinOuterBorder( m_pfCurrentValues[nDepth] ) ) + return NULL; + + return &m_pfCurrentValues[nDepth]; +} + +bool TickmarkHelper::isWithinOuterBorder( double fScaledValue ) const +{ + if(fScaledValue>m_fOuterMajorTickBorderMax_Scaled) + return false; + if(fScaledValue<m_fOuterMajorTickBorderMin_Scaled) + return false; + + return true; +} + + +bool TickmarkHelper::isVisible( double fScaledValue ) const +{ + if(fScaledValue>m_fScaledVisibleMax) + { + if( !approxEqual(fScaledValue,m_fScaledVisibleMax) ) + return false; + } + if(fScaledValue<m_fScaledVisibleMin) + { + if( !approxEqual(fScaledValue,m_fScaledVisibleMin) ) + return false; + } + return true; +} + +void TickmarkHelper::getAllTicks( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const +{ + uno::Sequence< uno::Sequence< double > > aAllTicks; + + //create point sequences for each tick depth + sal_Int32 nDepthCount = this->getTickDepth(); + sal_Int32 nMaxMajorTickCount = this->getMaxTickCount( 0 ); + + aAllTicks.realloc(nDepthCount); + aAllTicks[0].realloc(nMaxMajorTickCount); + + sal_Int32 nRealMajorTickCount = 0; + double* pValue = NULL; + for( sal_Int32 nMajorTick=0; nMajorTick<nMaxMajorTickCount; nMajorTick++ ) + { + pValue = this->getMajorTick( nMajorTick ); + if(!pValue) + continue; + aAllTicks[0][nRealMajorTickCount] = *pValue; + nRealMajorTickCount++; + } + if(!nRealMajorTickCount) + return; + aAllTicks[0].realloc(nRealMajorTickCount); + + if(nDepthCount>0) + this->addSubTicks( 1, aAllTicks ); + + //so far we have added all ticks between the outer major tick marks + //this was necessary to create sub ticks correctly + //now we reduce all ticks to the visible ones that lie between the real borders + sal_Int32 nDepth = 0; + sal_Int32 nTick = 0; + for( nDepth = 0; nDepth < nDepthCount; nDepth++) + { + sal_Int32 nInvisibleAtLowerBorder = 0; + sal_Int32 nInvisibleAtUpperBorder = 0; + //we need only to check all ticks within the first major interval at each border + sal_Int32 nCheckCount = 1; + for(sal_Int32 nN=0; nN<nDepth; nN++) + { + if( m_rIncrement.SubIncrements[nN].IntervalCount>1 ) + nCheckCount *= m_rIncrement.SubIncrements[nN].IntervalCount; + } + uno::Sequence< double >& rTicks = aAllTicks[nDepth]; + sal_Int32 nCount = rTicks.getLength(); + //check lower border + for( nTick=0; nTick<nCheckCount && nTick<nCount; nTick++) + { + if( !isVisible( rTicks[nTick] ) ) + nInvisibleAtLowerBorder++; + } + //check upper border + for( nTick=nCount-1; nTick>nCount-1-nCheckCount && nTick>=0; nTick--) + { + if( !isVisible( rTicks[nTick] ) ) + nInvisibleAtUpperBorder++; + } + //resize sequence + if( !nInvisibleAtLowerBorder && !nInvisibleAtUpperBorder) + continue; + if( !nInvisibleAtLowerBorder ) + rTicks.realloc(nCount-nInvisibleAtUpperBorder); + else + { + sal_Int32 nNewCount = nCount-nInvisibleAtUpperBorder-nInvisibleAtLowerBorder; + if(nNewCount<0) + nNewCount=0; + + uno::Sequence< double > aOldTicks(rTicks); + rTicks.realloc(nNewCount); + for(nTick = 0; nTick<nNewCount; nTick++) + rTicks[nTick] = aOldTicks[nInvisibleAtLowerBorder+nTick]; + } + } + + //fill return value + rAllTickInfos.resize(aAllTicks.getLength()); + for( nDepth=0 ;nDepth<aAllTicks.getLength(); nDepth++ ) + { + sal_Int32 nCount = aAllTicks[nDepth].getLength(); + rAllTickInfos[nDepth].resize( nCount ); + for(sal_Int32 nN = 0; nN<nCount; nN++) + { + rAllTickInfos[nDepth][nN].fScaledTickValue = aAllTicks[nDepth][nN]; + } + } +} + +void TickmarkHelper::getAllTicksShifted( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const +{ + std::auto_ptr< TickmarkHelper > apShiftedTickmarkHelper( createShiftedTickmarkHelper() ); + apShiftedTickmarkHelper->getAllTicks( rAllTickInfos ); +} + +void TickmarkHelper::addSubTicks( sal_Int32 nDepth, uno::Sequence< uno::Sequence< double > >& rParentTicks ) const +{ + EquidistantTickIter aIter( rParentTicks, m_rIncrement, 0, nDepth-1 ); + double* pfNextParentTick = aIter.firstValue(); + if(!pfNextParentTick) + return; + double fLastParentTick = *pfNextParentTick; + pfNextParentTick = aIter.nextValue(); + if(!pfNextParentTick) + return; + + sal_Int32 nMaxSubTickCount = this->getMaxTickCount( nDepth ); + if(!nMaxSubTickCount) + return; + + uno::Sequence< double > aSubTicks(nMaxSubTickCount); + sal_Int32 nRealSubTickCount = 0; + sal_Int32 nIntervalCount = m_rIncrement.SubIncrements[nDepth-1].IntervalCount; + + double* pValue = NULL; + for(; pfNextParentTick; fLastParentTick=*pfNextParentTick, pfNextParentTick = aIter.nextValue()) + { + for( sal_Int32 nPartTick = 1; nPartTick<nIntervalCount; nPartTick++ ) + { + pValue = this->getMinorTick( nPartTick, nDepth + , fLastParentTick, *pfNextParentTick ); + if(!pValue) + continue; + + aSubTicks[nRealSubTickCount] = *pValue; + nRealSubTickCount++; + } + } + + aSubTicks.realloc(nRealSubTickCount); + rParentTicks[nDepth] = aSubTicks; + if(m_rIncrement.SubIncrements.getLength()>nDepth) + addSubTicks( nDepth+1, rParentTicks ); +} + +//----------------------------------------------------------------------------- +// ___TickmarkHelper_2D___ +//----------------------------------------------------------------------------- +TickmarkHelper_2D::TickmarkHelper_2D( + const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement + //, double fStrech_SceneToScreen, double fOffset_SceneToScreen ) + , const B2DVector& rStartScreenPos, const B2DVector& rEndScreenPos + , const B2DVector& rAxisLineToLabelLineShift ) + : TickmarkHelper( rScale, rIncrement ) + , m_aAxisStartScreenPosition2D(rStartScreenPos) + , m_aAxisEndScreenPosition2D(rEndScreenPos) + , m_aAxisLineToLabelLineShift(rAxisLineToLabelLineShift) + , m_fStrech_LogicToScreen(1.0) + , m_fOffset_LogicToScreen(0.0) +{ + double fWidthY = m_fScaledVisibleMax - m_fScaledVisibleMin; + if( AxisOrientation_MATHEMATICAL==m_rScale.Orientation ) + { + m_fStrech_LogicToScreen = 1.0/fWidthY; + m_fOffset_LogicToScreen = -m_fScaledVisibleMin; + } + else + { + B2DVector aSwap(m_aAxisStartScreenPosition2D); + m_aAxisStartScreenPosition2D = m_aAxisEndScreenPosition2D; + m_aAxisEndScreenPosition2D = aSwap; + + m_fStrech_LogicToScreen = -1.0/fWidthY; + m_fOffset_LogicToScreen = -m_fScaledVisibleMax; + } +} + +TickmarkHelper* TickmarkHelper_2D::createShiftedTickmarkHelper() const +{ + ExplicitIncrementData aShiftedIncrement( m_rIncrement ); + aShiftedIncrement.BaseValue = m_rIncrement.BaseValue-m_rIncrement.Distance/2.0; + + ::basegfx::B2DVector aStart( m_aAxisStartScreenPosition2D ); + ::basegfx::B2DVector aEnd( m_aAxisEndScreenPosition2D ); + if( AxisOrientation_MATHEMATICAL==m_rScale.Orientation ) + std::swap( aStart, aEnd ); + + return new TickmarkHelper_2D( m_rScale, aShiftedIncrement, aStart, aEnd, m_aAxisLineToLabelLineShift ); +} + +TickmarkHelper_2D::~TickmarkHelper_2D() +{ +} + +bool TickmarkHelper_2D::isHorizontalAxis() const +{ + return ( m_aAxisStartScreenPosition2D.getY() == m_aAxisEndScreenPosition2D.getY() ); +} +bool TickmarkHelper_2D::isVerticalAxis() const +{ + return ( m_aAxisStartScreenPosition2D.getX() == m_aAxisEndScreenPosition2D.getX() ); +} + +sal_Int32 TickmarkHelper_2D::getTickScreenDistance( TickIter& rIter ) +{ + //return the positive distance between the two first tickmarks in screen values + //if there are less than two tickmarks -1 is returned + + const TickInfo* pFirstTickInfo = rIter.firstInfo(); + const TickInfo* pSecondTickInfo = rIter.nextInfo(); + if(!pSecondTickInfo || !pFirstTickInfo) + return -1; + + return pFirstTickInfo->getScreenDistanceBetweenTicks( *pSecondTickInfo ); +} + +B2DVector TickmarkHelper_2D::getTickScreenPosition2D( double fScaledLogicTickValue ) const +{ + B2DVector aRet(m_aAxisStartScreenPosition2D); + aRet += (m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D) + *((fScaledLogicTickValue+m_fOffset_LogicToScreen)*m_fStrech_LogicToScreen); + return aRet; +} + +void TickmarkHelper_2D::addPointSequenceForTickLine( drawing::PointSequenceSequence& rPoints + , sal_Int32 nSequenceIndex + , double fScaledLogicTickValue, double fInnerDirectionSign + , const TickmarkProperties& rTickmarkProperties + , bool bPlaceAtLabels ) const +{ + if( fInnerDirectionSign==0.0 ) + fInnerDirectionSign = 1.0; + + B2DVector aTickScreenPosition = this->getTickScreenPosition2D(fScaledLogicTickValue); + if( bPlaceAtLabels ) + aTickScreenPosition += m_aAxisLineToLabelLineShift; + + B2DVector aMainDirection = m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D; + aMainDirection.normalize(); + B2DVector aOrthoDirection(-aMainDirection.getY(),aMainDirection.getX()); + aOrthoDirection *= fInnerDirectionSign; + aOrthoDirection.normalize(); + + B2DVector aStart = aTickScreenPosition + aOrthoDirection*rTickmarkProperties.RelativePos; + B2DVector aEnd = aStart - aOrthoDirection*rTickmarkProperties.Length; + + rPoints[nSequenceIndex].realloc(2); + rPoints[nSequenceIndex][0].X = static_cast<sal_Int32>(aStart.getX()); + rPoints[nSequenceIndex][0].Y = static_cast<sal_Int32>(aStart.getY()); + rPoints[nSequenceIndex][1].X = static_cast<sal_Int32>(aEnd.getX()); + rPoints[nSequenceIndex][1].Y = static_cast<sal_Int32>(aEnd.getY()); +} + +B2DVector TickmarkHelper_2D::getDistanceAxisTickToText( const AxisProperties& rAxisProperties, bool bIncludeFarAwayDistanceIfSo, bool bIncludeSpaceBetweenTickAndText ) const +{ + bool bFarAwayLabels = false; + if( ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START == rAxisProperties.m_eLabelPos + || ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END == rAxisProperties.m_eLabelPos ) + bFarAwayLabels = true; + + double fInnerDirectionSign = rAxisProperties.m_fInnerDirectionSign; + if( fInnerDirectionSign==0.0 ) + fInnerDirectionSign = 1.0; + + B2DVector aMainDirection = m_aAxisEndScreenPosition2D-m_aAxisStartScreenPosition2D; + aMainDirection.normalize(); + B2DVector aOrthoDirection(-aMainDirection.getY(),aMainDirection.getX()); + aOrthoDirection *= fInnerDirectionSign; + aOrthoDirection.normalize(); + + B2DVector aStart(0,0), aEnd(0,0); + if( bFarAwayLabels ) + { + TickmarkProperties aProps( AxisProperties::getBiggestTickmarkProperties() ); + aStart = aOrthoDirection*aProps.RelativePos; + aEnd = aStart - aOrthoDirection*aProps.Length; + } + else + { + for( sal_Int32 nN=rAxisProperties.m_aTickmarkPropertiesList.size();nN--;) + { + const TickmarkProperties& rProps = rAxisProperties.m_aTickmarkPropertiesList[nN]; + B2DVector aNewStart = aOrthoDirection*rProps.RelativePos; + B2DVector aNewEnd = aNewStart - aOrthoDirection*rProps.Length; + if(aNewStart.getLength()>aStart.getLength()) + aStart=aNewStart; + if(aNewEnd.getLength()>aEnd.getLength()) + aEnd=aNewEnd; + } + } + + B2DVector aLabelDirection(aStart); + if( rAxisProperties.m_fInnerDirectionSign != rAxisProperties.m_fLabelDirectionSign ) + aLabelDirection = aEnd; + + B2DVector aOrthoLabelDirection(aOrthoDirection); + if( rAxisProperties.m_fInnerDirectionSign != rAxisProperties.m_fLabelDirectionSign ) + aOrthoLabelDirection*=-1.0; + aOrthoLabelDirection.normalize(); + if( bIncludeSpaceBetweenTickAndText ) + aLabelDirection += aOrthoLabelDirection*AXIS2D_TICKLABELSPACING; + if( bFarAwayLabels && bIncludeFarAwayDistanceIfSo ) + aLabelDirection += m_aAxisLineToLabelLineShift; + return aLabelDirection; +} + +void TickmarkHelper_2D::createPointSequenceForAxisMainLine( drawing::PointSequenceSequence& rPoints ) const +{ + rPoints[0].realloc(2); + rPoints[0][0].X = static_cast<sal_Int32>(m_aAxisStartScreenPosition2D.getX()); + rPoints[0][0].Y = static_cast<sal_Int32>(m_aAxisStartScreenPosition2D.getY()); + rPoints[0][1].X = static_cast<sal_Int32>(m_aAxisEndScreenPosition2D.getX()); + rPoints[0][1].Y = static_cast<sal_Int32>(m_aAxisEndScreenPosition2D.getY()); +} + +void TickmarkHelper_2D::updateScreenValues( ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos ) const +{ + //get the transformed screen values for all tickmarks in rAllTickInfos + ::std::vector< ::std::vector< TickInfo > >::iterator aDepthIter = rAllTickInfos.begin(); + const ::std::vector< ::std::vector< TickInfo > >::const_iterator aDepthEnd = rAllTickInfos.end(); + for( ; aDepthIter != aDepthEnd; aDepthIter++ ) + { + ::std::vector< TickInfo >::iterator aTickIter = (*aDepthIter).begin(); + const ::std::vector< TickInfo >::const_iterator aTickEnd = (*aDepthIter).end(); + for( ; aTickIter != aTickEnd; aTickIter++ ) + { + TickInfo& rTickInfo = (*aTickIter); + rTickInfo.aTickScreenPosition = + this->getTickScreenPosition2D( rTickInfo.fScaledTickValue ); + } + } +} + +//----------------------------------------------------------------------------- +// ___TickmarkHelper_3D___ +//----------------------------------------------------------------------------- +TickmarkHelper_3D::TickmarkHelper_3D( + const ExplicitScaleData& rScale, const ExplicitIncrementData& rIncrement ) + : TickmarkHelper( rScale, rIncrement ) +{ +} + +TickmarkHelper* TickmarkHelper_3D::createShiftedTickmarkHelper() const +{ + ExplicitIncrementData aShiftedIncrement( m_rIncrement ); + aShiftedIncrement.BaseValue = m_rIncrement.BaseValue-m_rIncrement.Distance/2.0; + return new TickmarkHelper_3D( m_rScale, aShiftedIncrement ); +} + +TickmarkHelper_3D::~TickmarkHelper_3D() +{ +} + +//............................................................................. +} //namespace chart +//............................................................................. diff --git a/chart2/source/view/axes/VAxisProperties.cxx b/chart2/source/view/axes/VAxisProperties.cxx index d700ee9d27be..9f710d926e0c 100644 --- a/chart2/source/view/axes/VAxisProperties.cxx +++ b/chart2/source/view/axes/VAxisProperties.cxx @@ -157,7 +157,6 @@ TickmarkProperties AxisProperties::makeTickmarkPropertiesForComplexCategories( return aTickmarkProperties; } -//static TickmarkProperties AxisProperties::getBiggestTickmarkProperties() { TickmarkProperties aTickmarkProperties; diff --git a/chart2/source/view/axes/VCartesianGrid.cxx b/chart2/source/view/axes/VCartesianGrid.cxx index 0baa9b2b6e9a..ff93feefa228 100644 --- a/chart2/source/view/axes/VCartesianGrid.cxx +++ b/chart2/source/view/axes/VCartesianGrid.cxx @@ -192,7 +192,6 @@ VCartesianGrid::~VCartesianGrid() m_pPosHelper = NULL; } -//static void VCartesianGrid::fillLinePropertiesFromGridModel( ::std::vector<VLineProperties>& rLinePropertiesList , const Sequence< Reference< beans::XPropertySet > > & rGridPropertiesList ) { diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx index a99ab4368d60..42e6042d7e70 100644 --- a/chart2/source/view/axes/VCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCoordinateSystem.cxx @@ -61,7 +61,6 @@ using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; -//static VCoordinateSystem* VCoordinateSystem::createCoordinateSystem( const Reference< XCoordinateSystem >& xCooSysModel ) { diff --git a/chart2/source/view/axes/VPolarGrid.cxx b/chart2/source/view/axes/VPolarGrid.cxx index c3554fd4876b..30becdf4725d 100644 --- a/chart2/source/view/axes/VPolarGrid.cxx +++ b/chart2/source/view/axes/VPolarGrid.cxx @@ -77,7 +77,6 @@ void VPolarGrid::getAllTickInfos( sal_Int32 nDimensionIndex, ::std::vector< ::st aTickFactory.getAllTicks( rAllTickInfos ); } -//static void VPolarGrid::createLinePointSequence_ForAngleAxis( drawing::PointSequenceSequence& rPoints , ::std::vector< ::std::vector< TickInfo > >& rAllTickInfos diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 6b2f916b03ec..c37842e19888 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -2137,7 +2137,6 @@ std::vector< ViewLegendEntry > SAL_CALL VSeriesPlotter::createLegendEntriesForCh return std::vector< ViewLegendEntry >(); } -//static VSeriesPlotter* VSeriesPlotter::createSeriesPlotter( const uno::Reference<XChartType>& xChartTypeModel , sal_Int32 nDimensionCount diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index 525f0a8de951..fe83c0eea7e2 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -65,7 +65,7 @@ ChartItemPool::ChartItemPool(): SvULongs aTmp; ppPoolDefaults[SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS,aTmp); ppPoolDefaults[SCHATTR_DATADESCR_NO_PERCENTVALUE - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE); - ppPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_VALUE - SCHATTR_START] = new SfxInt32Item(SCHATTR_PERCENT_NUMBERFORMAT_VALUE, 0); + ppPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_VALUE - SCHATTR_START] = new SfxUInt32Item(SCHATTR_PERCENT_NUMBERFORMAT_VALUE, 0); ppPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_SOURCE - SCHATTR_START] = new SfxBoolItem(SCHATTR_PERCENT_NUMBERFORMAT_SOURCE); //legend @@ -217,7 +217,6 @@ SfxMapUnit ChartItemPool::GetMetric(USHORT /* nWhich */) const return SFX_MAPUNIT_100TH_MM; } -// static SfxItemPool* ChartItemPool::CreateChartItemPool() { return new ChartItemPool(); diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 4f39cac39c9d..72b40adfed88 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -118,7 +118,6 @@ using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Any; using rtl::OUString; -//static const uno::Sequence<sal_Int8>& ExplicitValueProvider::getUnoTunnelId() { static uno::Sequence<sal_Int8> * pSeq = 0; @@ -135,7 +134,6 @@ const uno::Sequence<sal_Int8>& ExplicitValueProvider::getUnoTunnelId() return *pSeq; } -//static ExplicitValueProvider* ExplicitValueProvider::getExplicitValueProvider( const Reference< uno::XInterface >& xChartView ) { @@ -1839,7 +1837,6 @@ bool lcl_getPropertySwapXAndYAxis( const uno::Reference< XDiagram >& xDiagram ) } -//static sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( const Reference< chart2::XAxis >& xAxis , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem @@ -1908,7 +1905,6 @@ sal_Int32 ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabe return nFormat; } -//static awt::Rectangle ExplicitValueProvider::addAxisTitleSizes( const Reference< frame::XModel >& xChartModel , const Reference< uno::XInterface >& xChartView @@ -1976,7 +1972,6 @@ awt::Rectangle ExplicitValueProvider::addAxisTitleSizes( return aRet; } -//static awt::Rectangle ExplicitValueProvider::substractAxisTitleSizes( const Reference< frame::XModel >& xChartModel , const Reference< uno::XInterface >& xChartView diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx index 577f450172b5..83544d6a8f2b 100644 --- a/chart2/source/view/main/DrawModelWrapper.cxx +++ b/chart2/source/view/main/DrawModelWrapper.cxx @@ -370,7 +370,6 @@ SdrObject* DrawModelWrapper::getNamedSdrObject( const rtl::OUString& rName ) return getNamedSdrObject( rName, GetPage(0) ); } -//static SdrObject* DrawModelWrapper::getNamedSdrObject( const String& rObjectCID, SdrObjList* pSearchList ) { if(!pSearchList || rObjectCID.Len()==0) @@ -390,7 +389,6 @@ SdrObject* DrawModelWrapper::getNamedSdrObject( const String& rObjectCID, SdrObj return 0; } -//static bool DrawModelWrapper::removeShape( const uno::Reference< drawing::XShape >& xShape ) { uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY ); diff --git a/chart2/source/view/main/LabelPositionHelper.cxx b/chart2/source/view/main/LabelPositionHelper.cxx index 24ec5a285468..cd954f53b7ba 100644 --- a/chart2/source/view/main/LabelPositionHelper.cxx +++ b/chart2/source/view/main/LabelPositionHelper.cxx @@ -67,7 +67,6 @@ awt::Point LabelPositionHelper::transformSceneToScreenPosition( const drawing::P rScenePosition3D, m_xLogicTarget, m_pShapeFactory, m_nDimensionCount ); } -//static void LabelPositionHelper::changeTextAdjustment( tAnySequence& rPropValues, const tNameSequence& rPropNames, LabelAlignment eAlignment) { //HorizontalAdjustment @@ -107,7 +106,6 @@ void lcl_doDynamicFontResize( uno::Any* pAOldAndNewFontHeightAny } } -//static void LabelPositionHelper::doDynamicFontResize( tAnySequence& rPropValues , const tNameSequence& rPropNames , const uno::Reference< beans::XPropertySet >& xAxisModelProps @@ -431,7 +429,6 @@ void lcl_correctRotation_Right_Bottom( double& rfXCorrection, double& rfYCorrect }//end anonymous namespace -//static void LabelPositionHelper::correctPositionForRotation( const uno::Reference< drawing::XShape >& xShape2DText , LabelAlignment eLabelAlignment, const double fRotationAngle, bool bRotateAroundCenter ) { diff --git a/chart2/source/view/main/PlottingPositionHelper.cxx b/chart2/source/view/main/PlottingPositionHelper.cxx index 3f77115d9cf4..e257581d664b 100644 --- a/chart2/source/view/main/PlottingPositionHelper.cxx +++ b/chart2/source/view/main/PlottingPositionHelper.cxx @@ -212,7 +212,6 @@ drawing::Position3D PlottingPositionHelper::transformScaledLogicToScene( return SequenceToPosition3D(aSeq); } -//static awt::Point PlottingPositionHelper::transformSceneToScreenPosition( const drawing::Position3D& rScenePosition3D , const uno::Reference< drawing::XShapes >& xSceneTarget , ShapeFactory* pShapeFactory diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx index 1979582763fa..99b7c0bd2ae0 100644 --- a/chart2/source/view/main/PropertyMapper.cxx +++ b/chart2/source/view/main/PropertyMapper.cxx @@ -58,7 +58,6 @@ void lcl_overwriteOrAppendValues( } // anonymous namespace -//static void PropertyMapper::setMappedProperties( const uno::Reference< beans::XPropertySet >& xTarget , const uno::Reference< beans::XPropertySet >& xSource @@ -193,7 +192,6 @@ uno::Any* PropertyMapper::getValuePointerForLimitedSpace( tAnySequence& rPropVal //Schatten UNO_NAME_CHAR_SHADOWED bool */ -//static const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForCharacterProperties() { //shape property -- chart model object property @@ -260,7 +258,6 @@ const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForCharacterProper return m_aShapePropertyMapForCharacterProperties; } -//static const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForParagraphProperties() { //shape property -- chart model object property @@ -277,7 +274,6 @@ const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForParagraphProper return m_aShapePropertyMapForParagraphProperties; } -//static const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForFillProperties() { //shape property -- chart model object property @@ -306,7 +302,6 @@ const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForFillProperties( return m_aShapePropertyMapForFillProperties; } -//static const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForLineProperties() { //shape property -- chart model object property @@ -322,7 +317,6 @@ const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForLineProperties( return m_aShapePropertyMapForLineProperties; } -//static const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForFillAndLineProperties() { static tMakePropertyNameMap m_aShapePropertyMapForFillAndLineProperties = @@ -334,7 +328,6 @@ const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForFillAndLineProp return m_aShapePropertyMapForFillAndLineProperties; } -//static const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForTextShapeProperties() { static tMakePropertyNameMap m_aShapePropertyMapForTextShapeProperties = @@ -357,7 +350,6 @@ const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForTextShapeProper return m_aShapePropertyMapForTextShapeProperties; } -//static const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForLineSeriesProperties() { //shape property -- chart model object property @@ -374,7 +366,6 @@ const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForLineSeriesPrope return m_aShapePropertyMapForLineSeriesProperties; } -//static const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForFilledSeriesProperties() { //shape property -- chart model object property @@ -410,7 +401,6 @@ const tMakePropertyNameMap& PropertyMapper::getPropertyNameMapForFilledSeriesPro return m_aShapePropertyMapForFilledSeriesProperties; } -// static void PropertyMapper::setMultiProperties( const tNameSequence& rNames , const tAnySequence& rValues diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 721cabd15d83..311b5e076e9a 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -80,7 +80,6 @@ namespace chart //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -//static void ShapeFactory::setShapeName( const uno::Reference< drawing::XShape >& xShape , const rtl::OUString& rName ) { @@ -104,7 +103,6 @@ void ShapeFactory::setShapeName( const uno::Reference< drawing::XShape >& xShape //----------------------------------------------------------------------------- -//static rtl::OUString ShapeFactory::getShapeName( const uno::Reference< drawing::XShape >& xShape ) { rtl::OUString aRet; @@ -1961,7 +1959,6 @@ uno::Reference< drawing::XShape > return xShape; } -//static rtl::OUString ShapeFactory::getStackedString( const rtl::OUString& rString, bool bStacked ) { sal_Int32 nLen = rString.getLength(); @@ -1982,7 +1979,6 @@ rtl::OUString ShapeFactory::getStackedString( const rtl::OUString& rString, bool return aStackStr.makeStringAndClear(); } -//static bool ShapeFactory::hasPolygonAnyLines( drawing::PolyPolygonShape3D& rPoly) { // #i67757# check all contained polygons, if at least one polygon contains 2 or more points, return true @@ -1992,7 +1988,6 @@ bool ShapeFactory::hasPolygonAnyLines( drawing::PolyPolygonShape3D& rPoly) return false; } -//static bool ShapeFactory::isPolygonEmptyOrSinglePoint( drawing::PolyPolygonShape3D& rPoly) { // true, if empty polypolygon or one polygon with one point @@ -2000,7 +1995,6 @@ bool ShapeFactory::isPolygonEmptyOrSinglePoint( drawing::PolyPolygonShape3D& rPo ((rPoly.SequenceX.getLength() == 1) && (rPoly.SequenceX[0].getLength() <= 1)); } -//static void ShapeFactory::closePolygon( drawing::PolyPolygonShape3D& rPoly) { DBG_ASSERT( rPoly.SequenceX.getLength() <= 1, "ShapeFactory::closePolygon - single polygon expected" ); @@ -2011,7 +2005,6 @@ void ShapeFactory::closePolygon( drawing::PolyPolygonShape3D& rPoly) AddPointToPoly( rPoly, aFirst ); } -//static awt::Size ShapeFactory::calculateNewSizeRespectingAspectRatio( const awt::Size& rTargetSize , const awt::Size& rSourceSizeWithCorrectAspectRatio ) @@ -2027,7 +2020,6 @@ awt::Size ShapeFactory::calculateNewSizeRespectingAspectRatio( return aNewSize; } -//static awt::Point ShapeFactory::calculateTopLeftPositionToCenterObject( const awt::Point& rTargetAreaPosition , const awt::Size& rTargetAreaSize @@ -2039,7 +2031,6 @@ awt::Point ShapeFactory::calculateTopLeftPositionToCenterObject( return aNewPosition; } -//static ::basegfx::B2IRectangle ShapeFactory::getRectangleOfShape( const uno::Reference< drawing::XShape >& xShape ) { @@ -2055,7 +2046,6 @@ awt::Point ShapeFactory::calculateTopLeftPositionToCenterObject( } -//static awt::Size ShapeFactory::getSizeAfterRotation( const uno::Reference< drawing::XShape >& xShape, double fRotationAngleDegree ) { diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index e247060fe8d4..fbc74bad05a5 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -651,7 +651,6 @@ void VLegend::setDefaultWritingMode( sal_Int16 nDefaultWritingMode ) // ---------------------------------------- -// static bool VLegend::isVisible( const Reference< XLegend > & xLegend ) { if( ! xLegend.is()) diff --git a/chart2/source/view/main/VLegendSymbolFactory.cxx b/chart2/source/view/main/VLegendSymbolFactory.cxx index 958a8defe0b6..d29b28e8dbe9 100644 --- a/chart2/source/view/main/VLegendSymbolFactory.cxx +++ b/chart2/source/view/main/VLegendSymbolFactory.cxx @@ -104,7 +104,6 @@ void lcl_setPropetiesToShape( namespace chart { -// static Reference< drawing::XShape > VLegendSymbolFactory::createSymbol( const Reference< drawing::XShapes > xSymbolContainer, chart2::LegendSymbolStyle eStyle, |