From 6c7d6924511f3006f64fb9d3eadd289778098571 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 29 Jul 2021 11:22:28 +0200 Subject: rtl::Static -> static local in a handful cases, like a map or a vector, we don't need init on demand at all, the default constructor can be laid out at compile time Change-Id: I2d404584b5aa23db7b1f779e160e04e72dd2aa74 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119656 Tested-by: Jenkins Reviewed-by: Noel Grandin --- toolkit/source/controls/geometrycontrolmodel.cxx | 31 +++++++++++------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'toolkit') diff --git a/toolkit/source/controls/geometrycontrolmodel.cxx b/toolkit/source/controls/geometrycontrolmodel.cxx index 53a7f02d45ef..ee6dfb6d2a07 100644 --- a/toolkit/source/controls/geometrycontrolmodel.cxx +++ b/toolkit/source/controls/geometrycontrolmodel.cxx @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -438,15 +437,15 @@ typedef std::vector< ::std::vector< sal_Int32 > > IntArrayArray; // for creating class-unique PropertySetInfo's, we need some info: - namespace { struct ServiceSpecifierMap : public rtl::Static< HashMapString2Int, ServiceSpecifierMap > {}; } + namespace { HashMapString2Int gServiceSpecifierMap; } // this one maps from a String, which is the service specifier for our // aggregate, to a unique id - namespace { struct AggregateProperties : public rtl::Static< PropSeqArray, AggregateProperties > {}; } + namespace { PropSeqArray gAggregateProperties; } // this one contains the properties which belong to all the unique ids // in ServiceSpecifierMap - namespace { struct AmbiguousPropertyIds : public rtl::Static< IntArrayArray, AmbiguousPropertyIds > {}; } + namespace { IntArrayArray gAmbiguousPropertyIds; } // the ids of the properties which we as well as our aggregate supply // For such props, we let our base class handle them, and whenever such // a prop is set, we forward this to our aggregate. @@ -470,16 +469,14 @@ throw IllegalArgumentException(); } - HashMapString2Int &rMap = ServiceSpecifierMap::get(); - HashMapString2Int::iterator aPropMapIdPos = rMap.find( m_sServiceSpecifier ); - if ( rMap.end() == aPropMapIdPos ) + HashMapString2Int::iterator aPropMapIdPos = gServiceSpecifierMap.find( m_sServiceSpecifier ); + if ( gServiceSpecifierMap.end() == aPropMapIdPos ) { - PropSeqArray &rAggProperties = AggregateProperties::get(); - m_nPropertyMapId = rAggProperties.size(); - rAggProperties.push_back( xPI->getProperties() ); - AmbiguousPropertyIds::get().emplace_back( ); + m_nPropertyMapId = gAggregateProperties.size(); + gAggregateProperties.push_back( xPI->getProperties() ); + gAmbiguousPropertyIds.emplace_back( ); - rMap[ m_sServiceSpecifier ] = m_nPropertyMapId; + gServiceSpecifierMap[ m_sServiceSpecifier ] = m_nPropertyMapId; } else m_nPropertyMapId = aPropMapIdPos->second; @@ -512,18 +509,18 @@ ::cppu::IPropertyArrayHelper* OCommonGeometryControlModel::createArrayHelper( sal_Int32 _nId ) const { OSL_ENSURE( _nId == m_nPropertyMapId, "OCommonGeometryControlModel::createArrayHelper: invalid argument!" ); - OSL_ENSURE( _nId < static_cast(AggregateProperties::get().size()), "OCommonGeometryControlModel::createArrayHelper: invalid status info (1)!" ); - OSL_ENSURE( _nId < static_cast(AmbiguousPropertyIds::get().size()), "OCommonGeometryControlModel::createArrayHelper: invalid status info (2)!" ); + OSL_ENSURE( _nId < static_cast(gAggregateProperties.size()), "OCommonGeometryControlModel::createArrayHelper: invalid status info (1)!" ); + OSL_ENSURE( _nId < static_cast(gAmbiguousPropertyIds.size()), "OCommonGeometryControlModel::createArrayHelper: invalid status info (2)!" ); // our own properties Sequence< Property > aProps; OPropertyContainer::describeProperties( aProps ); // the aggregate properties - Sequence< Property > aAggregateProps = AggregateProperties::get()[ _nId ]; + Sequence< Property > aAggregateProps = gAggregateProperties[ _nId ]; // look for duplicates, and remember them - IntArrayArray::value_type& rDuplicateIds = AmbiguousPropertyIds::get()[ _nId ]; + IntArrayArray::value_type& rDuplicateIds = gAmbiguousPropertyIds[ _nId ]; // for this, sort the aggregate properties ::std::sort( aAggregateProps.begin(), @@ -589,7 +586,7 @@ OGeometryControlModel_Base::setFastPropertyValue_NoBroadcast( _nHandle, _rValue ); // look if this id is one we recognized as duplicate - IntArrayArray::value_type& rDuplicateIds = AmbiguousPropertyIds::get()[ m_nPropertyMapId ]; + IntArrayArray::value_type& rDuplicateIds = gAmbiguousPropertyIds[ m_nPropertyMapId ]; if ( std::any_of(rDuplicateIds.begin(), rDuplicateIds.end(), Int32Equal( _nHandle )) ) { -- cgit