[Libreoffice-commits] core.git: basic/source bridges/source canvas/source chart2/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 17 20:41:17 UTC 2021
basic/source/basmgr/vbahelper.cxx | 7
basic/source/classes/global.cxx | 5
basic/source/classes/sb.cxx | 19 +-
basic/source/classes/sbunoobj.cxx | 14 -
basic/source/comp/token.cxx | 7
basic/source/runtime/runtime.cxx | 19 +-
bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx | 6
canvas/source/cairo/cairo_canvashelper.cxx | 21 --
canvas/source/cairo/cairo_devicehelper.cxx | 15 -
canvas/source/tools/canvastools.cxx | 24 ---
canvas/source/vcl/devicehelper.cxx | 18 +-
chart2/source/model/template/StockChartTypeTemplate.cxx | 80 +++-------
chart2/source/tools/RegressionCurveModel.cxx | 62 ++------
chart2/source/tools/RegressionEquation.cxx | 122 ++++++----------
14 files changed, 152 insertions(+), 267 deletions(-)
New commits:
commit 4dc40659044566280c202e26cab97d682ae6ab54
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 17 11:38:31 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 17 22:40:40 2021 +0200
rtl::Static -> thread-safe static local
Change-Id: I9f8fe250813f4f376dc46c6f3d7e25e90fdbb50e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120566
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/basic/source/basmgr/vbahelper.cxx b/basic/source/basmgr/vbahelper.cxx
index 83165374a8f1..7fa101a8259e 100644
--- a/basic/source/basmgr/vbahelper.cxx
+++ b/basic/source/basmgr/vbahelper.cxx
@@ -27,7 +27,6 @@
#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <comphelper/processfactory.hxx>
-#include <rtl/instance.hxx>
namespace basic::vba {
@@ -145,8 +144,6 @@ struct CurrDirPool
std::map< OUString, OUString > maCurrDirs;
};
-struct StaticCurrDirPool : public ::rtl::Static< CurrDirPool, StaticCurrDirPool > {};
-
} // namespace
@@ -167,7 +164,9 @@ void registerCurrentDirectory( const uno::Reference< frame::XModel >& rxModel, c
if( rPath.isEmpty() )
return;
- CurrDirPool& rPool = StaticCurrDirPool::get();
+ static CurrDirPool StaticCurrDirPool;
+
+ CurrDirPool& rPool = StaticCurrDirPool;
::osl::MutexGuard aGuard( rPool.maMutex );
try
{
diff --git a/basic/source/classes/global.cxx b/basic/source/classes/global.cxx
index 1e72e242d94b..d2e3622b4d6f 100644
--- a/basic/source/classes/global.cxx
+++ b/basic/source/classes/global.cxx
@@ -10,7 +10,6 @@
#include <comphelper/processfactory.hxx>
#include <i18nlangtag/lang.h>
#include <i18nutil/transliteration.hxx>
-#include <rtl/instance.hxx>
#include <unotools/transliterationwrapper.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
@@ -35,12 +34,12 @@ namespace
utl::TransliterationWrapper& getTransliteration() { return m_aTransliteration; }
};
- class theTransliterationWrapper : public rtl::Static<lclTransliterationWrapper, theTransliterationWrapper> {};
}
utl::TransliterationWrapper& SbGlobal::GetTransliteration()
{
- return theTransliterationWrapper::get().getTransliteration();
+ static lclTransliterationWrapper theTransliterationWrapper;
+ return theTransliterationWrapper.getTransliteration();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index e4ee5b508451..f0ab981d62a5 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -177,31 +177,31 @@ namespace {
typedef ::rtl::Reference< DocBasicItem > DocBasicItemRef;
-class GaDocBasicItems : public rtl::Static<std::unordered_map< const StarBASIC *, DocBasicItemRef >,GaDocBasicItems> {};
+std::unordered_map< const StarBASIC *, DocBasicItemRef > gaDocBasicItems;
const DocBasicItem* lclFindDocBasicItem( const StarBASIC* pDocBasic )
{
- auto it = GaDocBasicItems::get().find( pDocBasic );
- auto end = GaDocBasicItems::get().end();
+ auto it = gaDocBasicItems.find( pDocBasic );
+ auto end = gaDocBasicItems.end();
return (it != end) ? it->second.get() : nullptr;
}
void lclInsertDocBasicItem( StarBASIC& rDocBasic )
{
- DocBasicItemRef& rxDocBasicItem = GaDocBasicItems::get()[ &rDocBasic ];
+ DocBasicItemRef& rxDocBasicItem = gaDocBasicItems[ &rDocBasic ];
rxDocBasicItem.set( new DocBasicItem( rDocBasic ) );
rxDocBasicItem->startListening();
}
void lclRemoveDocBasicItem( StarBASIC& rDocBasic )
{
- auto it = GaDocBasicItems::get().find( &rDocBasic );
- if( it != GaDocBasicItems::get().end() )
+ auto it = gaDocBasicItems.find( &rDocBasic );
+ if( it != gaDocBasicItems.end() )
{
it->second->stopListening();
- GaDocBasicItems::get().erase( it );
+ gaDocBasicItems.erase( it );
}
- for( auto& rEntry : GaDocBasicItems::get() )
+ for( auto& rEntry : gaDocBasicItems )
{
rEntry.second->clearDependingVarsOnDelete( rDocBasic );
}
@@ -1914,8 +1914,7 @@ Reference< frame::XModel > StarBASIC::GetModelFromBasic( SbxObject* pBasic )
void StarBASIC::DetachAllDocBasicItems()
{
- std::unordered_map< const StarBASIC *, DocBasicItemRef >& rItems = GaDocBasicItems::get();
- for (auto const& item : rItems)
+ for (auto const& item : gaDocBasicItems)
{
DocBasicItemRef xItem = item.second;
xItem->setDisposed(true);
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index edf112eca9e3..4131980848ba 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -449,30 +449,28 @@ typedef std::vector< ObjectItem > NativeObjectWrapperVector;
namespace {
-class GaNativeObjectWrapperVector : public rtl::Static<NativeObjectWrapperVector, GaNativeObjectWrapperVector> {};
+NativeObjectWrapperVector gaNativeObjectWrapperVector;
}
void clearNativeObjectWrapperVector()
{
- GaNativeObjectWrapperVector::get().clear();
+ gaNativeObjectWrapperVector.clear();
}
static sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj )
{
- NativeObjectWrapperVector &rNativeObjectWrapperVector = GaNativeObjectWrapperVector::get();
- sal_uInt32 nIndex = rNativeObjectWrapperVector.size();
- rNativeObjectWrapperVector.emplace_back( pNativeObj );
+ sal_uInt32 nIndex = gaNativeObjectWrapperVector.size();
+ gaNativeObjectWrapperVector.emplace_back( pNativeObj );
return nIndex;
}
static SbxObject* lcl_getNativeObject( sal_uInt32 nIndex )
{
SbxObjectRef xRetObj;
- NativeObjectWrapperVector &rNativeObjectWrapperVector = GaNativeObjectWrapperVector::get();
- if( nIndex < rNativeObjectWrapperVector.size() )
+ if( nIndex < gaNativeObjectWrapperVector.size() )
{
- ObjectItem& rItem = rNativeObjectWrapperVector[ nIndex ];
+ ObjectItem& rItem = gaNativeObjectWrapperVector[ nIndex ];
xRetObj = rItem.m_xNativeObj;
}
return xRetObj.get();
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index bf47a1b2aaa8..9be47bf41ba1 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -21,7 +21,6 @@
#include <array>
#include <basic/sberrors.hxx>
-#include <rtl/instance.hxx>
#include <sal/macros.h>
#include <basiccharclass.hxx>
#include <token.hxx>
@@ -192,8 +191,6 @@ public:
{ return m_pTokenCanBeLabelTab[eTok]; }
};
-class StaticTokenLabelInfo: public ::rtl::Static< TokenLabelInfo, StaticTokenLabelInfo >{};
-
}
// #i109076
@@ -546,7 +543,9 @@ special:
bool SbiTokenizer::MayBeLabel( bool bNeedsColon )
{
- if( eCurTok == SYMBOL || StaticTokenLabelInfo::get().canTokenBeLabel( eCurTok ) )
+ static TokenLabelInfo gaStaticTokenLabelInfo;
+
+ if( eCurTok == SYMBOL || gaStaticTokenLabelInfo.canTokenBeLabel( eCurTok ) )
{
return !bNeedsColon || DoesColonFollow();
}
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index e88065225793..b100e93cac20 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1769,17 +1769,16 @@ typedef std::unordered_map< SbxVariable*, DimAsNewRecoverItem,
namespace {
-class GaDimAsNewRecoverHash : public rtl::Static<DimAsNewRecoverHash, GaDimAsNewRecoverHash> {};
+DimAsNewRecoverHash gaDimAsNewRecoverHash;
}
void removeDimAsNewRecoverItem( SbxVariable* pVar )
{
- DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get();
- DimAsNewRecoverHash::iterator it = rDimAsNewRecoverHash.find( pVar );
- if( it != rDimAsNewRecoverHash.end() )
+ DimAsNewRecoverHash::iterator it = gaDimAsNewRecoverHash.find( pVar );
+ if( it != gaDimAsNewRecoverHash.end() )
{
- rDimAsNewRecoverHash.erase( it );
+ gaDimAsNewRecoverHash.erase( it );
}
}
@@ -1950,9 +1949,8 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
if( xPrevVarObj.is() )
{
// Object is overwritten with NULL, instantiate init object
- DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get();
- DimAsNewRecoverHash::iterator it = rDimAsNewRecoverHash.find( refVar.get() );
- if( it != rDimAsNewRecoverHash.end() )
+ DimAsNewRecoverHash::iterator it = gaDimAsNewRecoverHash.find( refVar.get() );
+ if( it != gaDimAsNewRecoverHash.end() )
{
const DimAsNewRecoverItem& rItem = it->second;
if( rItem.m_pClassModule != nullptr )
@@ -1985,16 +1983,15 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
OUString aObjClass = pValObj->GetClassName();
SbClassModuleObject* pClassModuleObj = dynamic_cast<SbClassModuleObject*>( pValObjBase );
- DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get();
if( pClassModuleObj != nullptr )
{
SbModule* pClassModule = pClassModuleObj->getClassModule();
- rDimAsNewRecoverHash[refVar.get()] =
+ gaDimAsNewRecoverHash[refVar.get()] =
DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), pClassModule );
}
else if( aObjClass.equalsIgnoreAsciiCase( "Collection" ) )
{
- rDimAsNewRecoverHash[refVar.get()] =
+ gaDimAsNewRecoverHash[refVar.get()] =
DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), nullptr );
}
}
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx
index 322656c126e5..d72295039282 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx
@@ -29,7 +29,6 @@
#include <dlfcn.h>
#include <osl/mutex.hxx>
-#include <rtl/instance.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustring.hxx>
#include <sal/log.hxx>
@@ -265,12 +264,11 @@ std::type_info * RTTI::getRTTI(typelib_TypeDescription const & pTypeDescr)
return rtti;
}
-struct theRttiFactory: public rtl::Static<RTTI, theRttiFactory> {};
-
}
std::type_info * x86_64::getRtti(typelib_TypeDescription const & type) {
- return theRttiFactory::get().getRTTI(type);
+ static RTTI theRttiFactory;
+ return theRttiFactory.getRTTI(type);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index 7805da9bb56d..32124af830f9 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -41,7 +41,6 @@
#include <com/sun/star/util/Endianness.hpp>
#include <comphelper/sequence.hxx>
#include <cppuhelper/implbase.hxx>
-#include <rtl/instance.hxx>
#include <rtl/math.hxx>
#include <tools/diagnose_ex.h>
#include <vcl/bitmapex.hxx>
@@ -1973,22 +1972,16 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas::
}
};
- struct CairoNoAlphaColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>,
- CairoNoAlphaColorSpaceHolder>
+ uno::Reference<rendering::XIntegerBitmapColorSpace>& GetCairoNoAlphaColorSpace()
{
- uno::Reference<rendering::XIntegerBitmapColorSpace> operator()()
- {
- return new CairoNoAlphaColorSpace();
- }
+ static uno::Reference<rendering::XIntegerBitmapColorSpace> SPACE = new CairoNoAlphaColorSpace();
+ return SPACE;
};
- struct CairoColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>,
- CairoColorSpaceHolder>
+ uno::Reference<rendering::XIntegerBitmapColorSpace>& GetCairoColorSpace()
{
- uno::Reference<rendering::XIntegerBitmapColorSpace> operator()()
- {
- return new CairoColorSpace();
- }
+ static uno::Reference<rendering::XIntegerBitmapColorSpace> SPACE = new CairoColorSpace();
+ return SPACE;
};
}
@@ -2012,7 +2005,7 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas::
aLayout.ScanLineBytes = nWidth*4;
aLayout.ScanLineStride = aLayout.ScanLineBytes;
aLayout.PlaneStride = 0;
- aLayout.ColorSpace = mbHaveAlpha ? CairoColorSpaceHolder::get() : CairoNoAlphaColorSpaceHolder::get();
+ aLayout.ColorSpace = mbHaveAlpha ? GetCairoColorSpace() : GetCairoNoAlphaColorSpace();
aLayout.Palette.clear();
aLayout.IsMsbFirst = false;
diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx
index e802e79cc2dd..1c44b4225560 100644
--- a/canvas/source/cairo/cairo_devicehelper.cxx
+++ b/canvas/source/cairo/cairo_devicehelper.cxx
@@ -210,22 +210,11 @@ namespace cairocanvas
return uno::Any();
}
- namespace
- {
- struct DeviceColorSpace: public rtl::StaticWithInit<uno::Reference<rendering::XColorSpace>,
- DeviceColorSpace>
- {
- uno::Reference<rendering::XColorSpace> operator()()
- {
- return vcl::unotools::createStandardColorSpace();
- }
- };
- }
-
uno::Reference<rendering::XColorSpace> const & DeviceHelper::getColorSpace() const
{
+ static uno::Reference<rendering::XColorSpace> SPACE = vcl::unotools::createStandardColorSpace();
// always the same
- return DeviceColorSpace::get();
+ return SPACE;
}
void DeviceHelper::dumpScreenContent() const
diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx
index 02af4bb333db..b9b6190df18d 100644
--- a/canvas/source/tools/canvastools.cxx
+++ b/canvas/source/tools/canvastools.cxx
@@ -51,7 +51,6 @@
#include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp>
#include <com/sun/star/util/Endianness.hpp>
#include <cppuhelper/implbase.hxx>
-#include <rtl/instance.hxx>
#include <sal/log.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/diagnose_ex.h>
@@ -843,33 +842,18 @@ namespace canvas::tools
}
};
- struct StandardColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>,
- StandardColorSpaceHolder>
- {
- uno::Reference<rendering::XIntegerBitmapColorSpace> operator()()
- {
- return new StandardColorSpace();
- }
- };
-
- struct StandardNoAlphaColorSpaceHolder : public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>,
- StandardNoAlphaColorSpaceHolder>
- {
- uno::Reference<rendering::XIntegerBitmapColorSpace> operator()()
- {
- return new StandardNoAlphaColorSpace();
- }
- };
}
uno::Reference<rendering::XIntegerBitmapColorSpace> const & getStdColorSpace()
{
- return StandardColorSpaceHolder::get();
+ static uno::Reference<rendering::XIntegerBitmapColorSpace> SPACE = new StandardColorSpace();
+ return SPACE;
}
uno::Reference<rendering::XIntegerBitmapColorSpace> const & getStdColorSpaceWithoutAlpha()
{
- return StandardNoAlphaColorSpaceHolder::get();
+ static uno::Reference<rendering::XIntegerBitmapColorSpace> SPACE = new StandardNoAlphaColorSpace();
+ return SPACE;
}
rendering::IntegerBitmapLayout getStdMemoryLayout( const geometry::IntegerSize2D& rBmpSize )
diff --git a/canvas/source/vcl/devicehelper.cxx b/canvas/source/vcl/devicehelper.cxx
index b9d4138aade1..a16ede0f5236 100644
--- a/canvas/source/vcl/devicehelper.cxx
+++ b/canvas/source/vcl/devicehelper.cxx
@@ -22,7 +22,6 @@
#include <basegfx/utils/canvastools.hxx>
#include <basegfx/utils/unopolypolygon.hxx>
#include <canvas/canvastools.hxx>
-#include <rtl/instance.hxx>
#include <tools/stream.hxx>
#include <vcl/canvastools.hxx>
#include <vcl/dibtools.hxx>
@@ -174,22 +173,23 @@ namespace vclcanvas
namespace
{
- struct DeviceColorSpace: public rtl::StaticWithInit<uno::Reference<rendering::XColorSpace>,
- DeviceColorSpace>
+ uno::Reference<rendering::XColorSpace>& GetDeviceColorSpace()
{
- uno::Reference<rendering::XColorSpace> operator()()
+ static uno::Reference<rendering::XColorSpace> xColorSpace =
+ []()
{
- uno::Reference< rendering::XColorSpace > xColorSpace = canvas::tools::getStdColorSpace();
- assert( xColorSpace.is() );
- return xColorSpace;
- }
+ auto xTmp = canvas::tools::getStdColorSpace();
+ assert( xTmp.is() );
+ return xTmp;
+ }();
+ return xColorSpace;
};
}
uno::Reference<rendering::XColorSpace> const & DeviceHelper::getColorSpace() const
{
// always the same
- return DeviceColorSpace::get();
+ return GetDeviceColorSpace();
}
void DeviceHelper::dumpScreenContent() const
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx
index 7eb0e1ca51da..464325ef10d1 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.cxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.cxx
@@ -78,65 +78,41 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT );
}
-struct StaticStockChartTypeTemplateDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_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 );
- }
-};
-
-struct StaticStockChartTypeTemplateDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticStockChartTypeTemplateDefaults_Initializer >
+::chart::tPropertyValueMap& GetStaticStockChartTypeTemplateDefaults()
{
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ [](){
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_STOCKCHARTTYPE_TEMPLATE_VOLUME, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_STOCKCHARTTYPE_TEMPLATE_OPEN, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_STOCKCHARTTYPE_TEMPLATE_LOW_HIGH, true );
+ ::chart::PropertyHelper::setPropertyValueDefault( aTmp, PROP_STOCKCHARTTYPE_TEMPLATE_JAPANESE, false );
+ return aTmp;
+ }();
+ return aStaticDefaults;
};
-struct StaticStockChartTypeTemplateInfoHelper_Initializer
+::cppu::OPropertyArrayHelper& GetStaticStockChartTypeTemplateInfoHelper()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
+ static ::cppu::OPropertyArrayHelper aPropHelper =
+ [](){
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
-private:
- static Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticStockChartTypeTemplateInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticStockChartTypeTemplateInfoHelper_Initializer >
-{
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
-struct StaticStockChartTypeTemplateInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticStockChartTypeTemplateInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-struct StaticStockChartTypeTemplateInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticStockChartTypeTemplateInfo_Initializer >
+uno::Reference< beans::XPropertySetInfo >& GetStaticStockChartTypeTemplateInfo()
{
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(GetStaticStockChartTypeTemplateInfoHelper() ) );
+ return xPropertySetInfo;
};
} // anonymous namespace
@@ -172,7 +148,7 @@ StockChartTypeTemplate::~StockChartTypeTemplate()
// ____ OPropertySet ____
uno::Any StockChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticStockChartTypeTemplateDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = GetStaticStockChartTypeTemplateDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
return uno::Any();
@@ -181,13 +157,13 @@ uno::Any StockChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
::cppu::IPropertyArrayHelper & SAL_CALL StockChartTypeTemplate::getInfoHelper()
{
- return *StaticStockChartTypeTemplateInfoHelper::get();
+ return GetStaticStockChartTypeTemplateInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL StockChartTypeTemplate::getPropertySetInfo()
{
- return *StaticStockChartTypeTemplateInfo::get();
+ return GetStaticStockChartTypeTemplateInfo();
}
sal_Int32 StockChartTypeTemplate::getAxisCountByDimension( sal_Int32 nDimension )
diff --git a/chart2/source/tools/RegressionCurveModel.cxx b/chart2/source/tools/RegressionCurveModel.cxx
index 0fb7662830af..03ff810fe1ef 100644
--- a/chart2/source/tools/RegressionCurveModel.cxx
+++ b/chart2/source/tools/RegressionCurveModel.cxx
@@ -99,31 +99,21 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::BOUND );
}
-struct StaticXXXDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- ::chart::LinePropertiesHelper::AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-};
-
-struct StaticXXXDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticXXXDefaults_Initializer >
-{
+::chart::tPropertyValueMap GetStaticXXXDefaults()
+{
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ [](){
+ ::chart::tPropertyValueMap aTmp;
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aTmp );
+ return aTmp;
+ }();
+ return aStaticDefaults;
};
-struct StaticRegressionCurveInfoHelper_Initializer
+::cppu::OPropertyArrayHelper& GetStaticRegressionCurveInfoHelper()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static uno::Sequence< Property > lcl_GetPropertySequence()
- {
+ static ::cppu::OPropertyArrayHelper aPropHelper =
+ [](){
std::vector< css::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
@@ -132,25 +122,15 @@ private:
::chart::PropertyNameLess() );
return comphelper::containerToSequence( aProperties );
- }
-};
-
-struct StaticRegressionCurveInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticRegressionCurveInfoHelper_Initializer >
-{
-};
-
-struct StaticRegressionCurveInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticRegressionCurveInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
+ }();
+ return aPropHelper;
};
-struct StaticRegressionCurveInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticRegressionCurveInfo_Initializer >
+uno::Reference< beans::XPropertySetInfo >& GetStaticRegressionCurveInfo()
{
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(GetStaticRegressionCurveInfoHelper() ) );
+ return xPropertySetInfo;
};
} // anonymous namespace
@@ -286,7 +266,7 @@ void RegressionCurveModel::fireModifyEvent()
// ____ OPropertySet ____
uno::Any RegressionCurveModel::GetDefaultValue( sal_Int32 nHandle ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticXXXDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = GetStaticXXXDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
return uno::Any();
@@ -295,13 +275,13 @@ uno::Any RegressionCurveModel::GetDefaultValue( sal_Int32 nHandle ) const
::cppu::IPropertyArrayHelper & SAL_CALL RegressionCurveModel::getInfoHelper()
{
- return *StaticRegressionCurveInfoHelper::get();
+ return GetStaticRegressionCurveInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL RegressionCurveModel::getPropertySetInfo()
{
- return *StaticRegressionCurveInfo::get();
+ return GetStaticRegressionCurveInfo();
}
// needed by MSC compiler
diff --git a/chart2/source/tools/RegressionEquation.cxx b/chart2/source/tools/RegressionEquation.cxx
index 1c46dc69f054..021ad686af6f 100644
--- a/chart2/source/tools/RegressionEquation.cxx
+++ b/chart2/source/tools/RegressionEquation.cxx
@@ -105,84 +105,58 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID );
}
-struct StaticRegressionEquationDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- static void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap );
- ::chart::FillProperties::AddDefaultsToMap( rOutMap );
- ::chart::CharacterProperties::AddDefaultsToMap( rOutMap );
-
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SHOW, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_XNAME, OUString("x") );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_YNAME, OUString("f(x)") );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SHOW_CORRELATION_COEFF, false );
- //::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_EQUATION_SEPARATOR, OUString( '\n' ));
-
- // override other defaults
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE );
- ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LinePropertiesHelper::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 );
- }
-};
-
-struct StaticRegressionEquationDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticRegressionEquationDefaults_Initializer >
+::chart::tPropertyValueMap& GetStaticRegressionEquationDefaults()
{
+ static ::chart::tPropertyValueMap aStaticDefaults =
+ [](){
+ ::chart::tPropertyValueMap aOutMap;
+ ::chart::LinePropertiesHelper::AddDefaultsToMap( aOutMap );
+ ::chart::FillProperties::AddDefaultsToMap( aOutMap );
+ ::chart::CharacterProperties::AddDefaultsToMap( aOutMap );
+
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_EQUATION_SHOW, false );
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_EQUATION_XNAME, OUString("x") );
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_EQUATION_YNAME, OUString("f(x)") );
+ ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_EQUATION_SHOW_CORRELATION_COEFF, false );
+ //::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_EQUATION_SEPARATOR, OUString( '\n' ));
+
+ // override other defaults
+ ::chart::PropertyHelper::setPropertyValue( aOutMap, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE );
+ ::chart::PropertyHelper::setPropertyValue( aOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE );
+
+ float fDefaultCharHeight = 10.0;
+ ::chart::PropertyHelper::setPropertyValue( aOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( aOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
+ ::chart::PropertyHelper::setPropertyValue( aOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
+ return aOutMap;
+ }();
+ return aStaticDefaults;
};
-struct StaticRegressionEquationInfoHelper_Initializer
+::cppu::OPropertyArrayHelper& GetStaticRegressionEquationInfoHelper()
{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- static uno::Sequence< Property > lcl_GetPropertySequence()
- {
- std::vector< css::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
- ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
- ::chart::FillProperties::AddPropertiesToVector( aProperties );
- ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
- ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
-
- std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return comphelper::containerToSequence( aProperties );
- }
-
-};
-
-struct StaticRegressionEquationInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticRegressionEquationInfoHelper_Initializer >
-{
-};
-
-struct StaticRegressionEquationInfo_Initializer
-{
- uno::Reference< beans::XPropertySetInfo >* operator()()
- {
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticRegressionEquationInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
+ static ::cppu::OPropertyArrayHelper aPropHelper =
+ [](){
+ std::vector< css::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ return comphelper::containerToSequence( aProperties );
+ }();
+ return aPropHelper;
};
-struct StaticRegressionEquationInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticRegressionEquationInfo_Initializer >
+const uno::Reference< beans::XPropertySetInfo > & GetStaticRegressionEquationInfo()
{
+ static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
+ ::cppu::OPropertySetHelper::createPropertySetInfo(GetStaticRegressionEquationInfoHelper()) );
+ return xPropertySetInfo;
};
} // anonymous namespace
@@ -213,7 +187,7 @@ uno::Reference< util::XCloneable > SAL_CALL RegressionEquation::createClone()
// ____ OPropertySet ____
uno::Any RegressionEquation::GetDefaultValue( sal_Int32 nHandle ) const
{
- const tPropertyValueMap& rStaticDefaults = *StaticRegressionEquationDefaults::get();
+ const tPropertyValueMap& rStaticDefaults = GetStaticRegressionEquationDefaults();
tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
if( aFound == rStaticDefaults.end() )
return uno::Any();
@@ -222,13 +196,13 @@ uno::Any RegressionEquation::GetDefaultValue( sal_Int32 nHandle ) const
::cppu::IPropertyArrayHelper & SAL_CALL RegressionEquation::getInfoHelper()
{
- return *StaticRegressionEquationInfoHelper::get();
+ return GetStaticRegressionEquationInfoHelper();
}
// ____ XPropertySet ____
Reference< beans::XPropertySetInfo > SAL_CALL RegressionEquation::getPropertySetInfo()
{
- return *StaticRegressionEquationInfo::get();
+ return GetStaticRegressionEquationInfo();
}
// ____ XModifyBroadcaster ____
More information about the Libreoffice-commits
mailing list