From 151316b6010c45078e0a031f0ba07d6117c0109d Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 9 Nov 2021 18:46:58 +0200 Subject: rtl::Static to thread-safe static Change-Id: Iff3489ee171cf2eaecbd1aad6f942a1468f76512 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124928 Tested-by: Jenkins Reviewed-by: Noel Grandin --- drawinglayer/source/attribute/fillgradientattribute.cxx | 12 +++++++----- drawinglayer/source/attribute/fillgraphicattribute.cxx | 9 ++++++--- drawinglayer/source/attribute/fillhatchattribute.cxx | 12 +++++++----- drawinglayer/source/attribute/fontattribute.cxx | 9 +++++---- drawinglayer/source/attribute/lineattribute.cxx | 12 +++++++----- drawinglayer/source/attribute/linestartendattribute.cxx | 12 +++++++----- drawinglayer/source/attribute/materialattribute3d.cxx | 10 ++++++---- drawinglayer/source/attribute/sdrfillattribute.cxx | 12 +++++++----- drawinglayer/source/attribute/sdrfillgraphicattribute.cxx | 12 +++++++----- drawinglayer/source/attribute/sdrlightattribute3d.cxx | 7 ------- drawinglayer/source/attribute/sdrlightingattribute3d.cxx | 12 +++++++----- drawinglayer/source/attribute/sdrlineattribute.cxx | 12 +++++++----- drawinglayer/source/attribute/sdrlinestartendattribute.cxx | 12 +++++++----- drawinglayer/source/attribute/sdrobjectattribute3d.cxx | 7 ------- drawinglayer/source/attribute/sdrsceneattribute3d.cxx | 12 +++++++----- drawinglayer/source/attribute/sdrshadowattribute.cxx | 12 +++++++----- drawinglayer/source/attribute/strokeattribute.cxx | 12 +++++++----- drawinglayer/source/geometry/viewinformation2d.cxx | 9 +++++---- drawinglayer/source/geometry/viewinformation3d.cxx | 12 +++++++----- drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx | 1 - 20 files changed, 113 insertions(+), 95 deletions(-) (limited to 'drawinglayer') diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx b/drawinglayer/source/attribute/fillgradientattribute.cxx index 0e42954e35e6..b8b06e20bbbf 100644 --- a/drawinglayer/source/attribute/fillgradientattribute.cxx +++ b/drawinglayer/source/attribute/fillgradientattribute.cxx @@ -19,7 +19,6 @@ #include #include -#include namespace drawinglayer::attribute @@ -92,8 +91,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< FillGradientAttribute::ImplType, theGlobalDefault > {}; + FillGradientAttribute::ImplType& theGlobalDefault() + { + static FillGradientAttribute::ImplType SINGLETON; + return SINGLETON; + } } FillGradientAttribute::FillGradientAttribute( @@ -111,7 +113,7 @@ namespace drawinglayer::attribute } FillGradientAttribute::FillGradientAttribute() - : mpFillGradientAttribute(theGlobalDefault::get()) + : mpFillGradientAttribute(theGlobalDefault()) { } @@ -123,7 +125,7 @@ namespace drawinglayer::attribute bool FillGradientAttribute::isDefault() const { - return mpFillGradientAttribute.same_object(theGlobalDefault::get()); + return mpFillGradientAttribute.same_object(theGlobalDefault()); } FillGradientAttribute& FillGradientAttribute::operator=(const FillGradientAttribute&) = default; diff --git a/drawinglayer/source/attribute/fillgraphicattribute.cxx b/drawinglayer/source/attribute/fillgraphicattribute.cxx index 95ed10e60dac..b36520d4f981 100644 --- a/drawinglayer/source/attribute/fillgraphicattribute.cxx +++ b/drawinglayer/source/attribute/fillgraphicattribute.cxx @@ -86,8 +86,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< FillGraphicAttribute::ImplType, theGlobalDefault > {}; + FillGraphicAttribute::ImplType& theGlobalDefault() + { + static FillGraphicAttribute::ImplType SINGLETON; + return SINGLETON; + } } FillGraphicAttribute::FillGraphicAttribute( @@ -109,7 +112,7 @@ namespace drawinglayer::attribute bool FillGraphicAttribute::isDefault() const { - return mpFillGraphicAttribute.same_object(theGlobalDefault::get()); + return mpFillGraphicAttribute.same_object(theGlobalDefault()); } FillGraphicAttribute& FillGraphicAttribute::operator=(const FillGraphicAttribute&) = default; diff --git a/drawinglayer/source/attribute/fillhatchattribute.cxx b/drawinglayer/source/attribute/fillhatchattribute.cxx index 19739a2c3dcf..bc892a024842 100644 --- a/drawinglayer/source/attribute/fillhatchattribute.cxx +++ b/drawinglayer/source/attribute/fillhatchattribute.cxx @@ -19,7 +19,6 @@ #include #include -#include namespace drawinglayer::attribute @@ -82,8 +81,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< FillHatchAttribute::ImplType, theGlobalDefault > {}; + FillHatchAttribute::ImplType& theGlobalDefault() + { + static FillHatchAttribute::ImplType SINGLETON; + return SINGLETON; + } } FillHatchAttribute::FillHatchAttribute( @@ -100,7 +102,7 @@ namespace drawinglayer::attribute } FillHatchAttribute::FillHatchAttribute() - : mpFillHatchAttribute(theGlobalDefault::get()) + : mpFillHatchAttribute(theGlobalDefault()) { } @@ -112,7 +114,7 @@ namespace drawinglayer::attribute bool FillHatchAttribute::isDefault() const { - return mpFillHatchAttribute.same_object(theGlobalDefault::get()); + return mpFillHatchAttribute.same_object(theGlobalDefault()); } FillHatchAttribute& FillHatchAttribute::operator=(const FillHatchAttribute&) = default; diff --git a/drawinglayer/source/attribute/fontattribute.cxx b/drawinglayer/source/attribute/fontattribute.cxx index 470f3f882bd5..8ae3836d8aa7 100644 --- a/drawinglayer/source/attribute/fontattribute.cxx +++ b/drawinglayer/source/attribute/fontattribute.cxx @@ -18,7 +18,6 @@ */ #include -#include #include namespace drawinglayer::attribute @@ -92,9 +91,11 @@ public: namespace { -struct theGlobalDefault : public rtl::Static +FontAttribute::ImplType& theGlobalDefault() { -}; + static FontAttribute::ImplType SINGLETON; + return SINGLETON; +} } FontAttribute::FontAttribute(const OUString& rFamilyName, const OUString& rStyleName, @@ -106,7 +107,7 @@ FontAttribute::FontAttribute(const OUString& rFamilyName, const OUString& rStyle } FontAttribute::FontAttribute() - : mpFontAttribute(theGlobalDefault::get()) + : mpFontAttribute(theGlobalDefault()) { } diff --git a/drawinglayer/source/attribute/lineattribute.cxx b/drawinglayer/source/attribute/lineattribute.cxx index 3809fd606bfc..d4f2418c1354 100644 --- a/drawinglayer/source/attribute/lineattribute.cxx +++ b/drawinglayer/source/attribute/lineattribute.cxx @@ -19,7 +19,6 @@ #include #include -#include namespace drawinglayer::attribute @@ -75,8 +74,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< LineAttribute::ImplType, theGlobalDefault > {}; + LineAttribute::ImplType& theGlobalDefault() + { + static LineAttribute::ImplType SINGLETON; + return SINGLETON; + } } LineAttribute::LineAttribute( @@ -96,7 +98,7 @@ namespace drawinglayer::attribute } LineAttribute::LineAttribute() - : mpLineAttribute(theGlobalDefault::get()) + : mpLineAttribute(theGlobalDefault()) { } @@ -106,7 +108,7 @@ namespace drawinglayer::attribute bool LineAttribute::isDefault() const { - return mpLineAttribute.same_object(theGlobalDefault::get()); + return mpLineAttribute.same_object(theGlobalDefault()); } LineAttribute& LineAttribute::operator=(const LineAttribute&) = default; diff --git a/drawinglayer/source/attribute/linestartendattribute.cxx b/drawinglayer/source/attribute/linestartendattribute.cxx index 32d66713a2e4..57a680db377c 100644 --- a/drawinglayer/source/attribute/linestartendattribute.cxx +++ b/drawinglayer/source/attribute/linestartendattribute.cxx @@ -20,7 +20,6 @@ #include #include #include -#include namespace drawinglayer::attribute @@ -65,8 +64,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< LineStartEndAttribute::ImplType, theGlobalDefault > {}; + LineStartEndAttribute::ImplType& theGlobalDefault() + { + static LineStartEndAttribute::ImplType SINGLETON; + return SINGLETON; + } } LineStartEndAttribute::LineStartEndAttribute( @@ -79,7 +81,7 @@ namespace drawinglayer::attribute } LineStartEndAttribute::LineStartEndAttribute() - : mpLineStartEndAttribute(theGlobalDefault::get()) + : mpLineStartEndAttribute(theGlobalDefault()) { } @@ -89,7 +91,7 @@ namespace drawinglayer::attribute bool LineStartEndAttribute::isDefault() const { - return mpLineStartEndAttribute.same_object(theGlobalDefault::get()); + return mpLineStartEndAttribute.same_object(theGlobalDefault()); } LineStartEndAttribute& LineStartEndAttribute::operator=(const LineStartEndAttribute&) = default; diff --git a/drawinglayer/source/attribute/materialattribute3d.cxx b/drawinglayer/source/attribute/materialattribute3d.cxx index e5eeeb021c57..7206ad54bed9 100644 --- a/drawinglayer/source/attribute/materialattribute3d.cxx +++ b/drawinglayer/source/attribute/materialattribute3d.cxx @@ -19,7 +19,6 @@ #include #include -#include namespace drawinglayer::attribute @@ -70,8 +69,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< MaterialAttribute3D::ImplType, theGlobalDefault > {}; + MaterialAttribute3D::ImplType& theGlobalDefault() + { + static MaterialAttribute3D::ImplType SINGLETON; + return SINGLETON; + } } MaterialAttribute3D::MaterialAttribute3D( @@ -91,7 +93,7 @@ namespace drawinglayer::attribute } MaterialAttribute3D::MaterialAttribute3D() - : mpMaterialAttribute3D(theGlobalDefault::get()) + : mpMaterialAttribute3D(theGlobalDefault()) { } diff --git a/drawinglayer/source/attribute/sdrfillattribute.cxx b/drawinglayer/source/attribute/sdrfillattribute.cxx index 198d7a4236b2..b582ee0a11d0 100644 --- a/drawinglayer/source/attribute/sdrfillattribute.cxx +++ b/drawinglayer/source/attribute/sdrfillattribute.cxx @@ -22,7 +22,6 @@ #include #include #include -#include namespace drawinglayer::attribute @@ -77,8 +76,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< SdrFillAttribute::ImplType, theGlobalDefault > {}; + SdrFillAttribute::ImplType& theGlobalDefault() + { + static SdrFillAttribute::ImplType SINGLETON; + return SINGLETON; + } } SdrFillAttribute::SdrFillAttribute( @@ -93,7 +95,7 @@ namespace drawinglayer::attribute } SdrFillAttribute::SdrFillAttribute() - : mpSdrFillAttribute(theGlobalDefault::get()) + : mpSdrFillAttribute(theGlobalDefault()) { } @@ -105,7 +107,7 @@ namespace drawinglayer::attribute bool SdrFillAttribute::isDefault() const { - return mpSdrFillAttribute.same_object(theGlobalDefault::get()); + return mpSdrFillAttribute.same_object(theGlobalDefault()); } SdrFillAttribute& SdrFillAttribute::operator=(const SdrFillAttribute&) = default; diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx index bc71fc9602eb..14f53cf03db3 100644 --- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx +++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx @@ -23,7 +23,6 @@ #include #include -#include #include @@ -99,8 +98,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< SdrFillGraphicAttribute::ImplType, theGlobalDefault > {}; + SdrFillGraphicAttribute::ImplType& theGlobalDefault() + { + static SdrFillGraphicAttribute::ImplType SINGLETON; + return SINGLETON; + } } SdrFillGraphicAttribute::SdrFillGraphicAttribute( @@ -128,7 +130,7 @@ namespace drawinglayer::attribute } SdrFillGraphicAttribute::SdrFillGraphicAttribute() - : mpSdrFillGraphicAttribute(theGlobalDefault::get()) + : mpSdrFillGraphicAttribute(theGlobalDefault()) { } @@ -140,7 +142,7 @@ namespace drawinglayer::attribute bool SdrFillGraphicAttribute::isDefault() const { - return mpSdrFillGraphicAttribute.same_object(theGlobalDefault::get()); + return mpSdrFillGraphicAttribute.same_object(theGlobalDefault()); } SdrFillGraphicAttribute& SdrFillGraphicAttribute::operator=(const SdrFillGraphicAttribute&) = default; diff --git a/drawinglayer/source/attribute/sdrlightattribute3d.cxx b/drawinglayer/source/attribute/sdrlightattribute3d.cxx index 56f0b384129a..511590f5ffd4 100644 --- a/drawinglayer/source/attribute/sdrlightattribute3d.cxx +++ b/drawinglayer/source/attribute/sdrlightattribute3d.cxx @@ -20,7 +20,6 @@ #include #include #include -#include namespace drawinglayer::attribute @@ -57,12 +56,6 @@ namespace drawinglayer::attribute } }; - namespace - { - struct theGlobalDefault : - public rtl::Static< Sdr3DLightAttribute::ImplType, theGlobalDefault > {}; - } - Sdr3DLightAttribute::Sdr3DLightAttribute( const basegfx::BColor& rColor, const basegfx::B3DVector& rDirection, diff --git a/drawinglayer/source/attribute/sdrlightingattribute3d.cxx b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx index 90fcc193c271..4f9b75cd1ff2 100644 --- a/drawinglayer/source/attribute/sdrlightingattribute3d.cxx +++ b/drawinglayer/source/attribute/sdrlightingattribute3d.cxx @@ -21,7 +21,6 @@ #include #include #include -#include namespace drawinglayer::attribute @@ -58,8 +57,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< SdrLightingAttribute::ImplType, theGlobalDefault > {}; + SdrLightingAttribute::ImplType& theGlobalDefault() + { + static SdrLightingAttribute::ImplType SINGLETON; + return SINGLETON; + } } SdrLightingAttribute::SdrLightingAttribute( @@ -71,7 +73,7 @@ namespace drawinglayer::attribute } SdrLightingAttribute::SdrLightingAttribute() - : mpSdrLightingAttribute(theGlobalDefault::get()) + : mpSdrLightingAttribute(theGlobalDefault()) { } @@ -84,7 +86,7 @@ namespace drawinglayer::attribute bool SdrLightingAttribute::isDefault() const { - return mpSdrLightingAttribute.same_object(theGlobalDefault::get()); + return mpSdrLightingAttribute.same_object(theGlobalDefault()); } SdrLightingAttribute& SdrLightingAttribute::operator=(const SdrLightingAttribute&) = default; diff --git a/drawinglayer/source/attribute/sdrlineattribute.cxx b/drawinglayer/source/attribute/sdrlineattribute.cxx index 8224314058fa..f8d4aefb0a95 100644 --- a/drawinglayer/source/attribute/sdrlineattribute.cxx +++ b/drawinglayer/source/attribute/sdrlineattribute.cxx @@ -19,7 +19,6 @@ #include #include -#include namespace drawinglayer::attribute @@ -85,8 +84,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< SdrLineAttribute::ImplType, theGlobalDefault > {}; + SdrLineAttribute::ImplType& theGlobalDefault() + { + static SdrLineAttribute::ImplType SINGLETON; + return SINGLETON; + } } SdrLineAttribute::SdrLineAttribute( @@ -111,7 +113,7 @@ namespace drawinglayer::attribute } SdrLineAttribute::SdrLineAttribute() - : mpSdrLineAttribute(theGlobalDefault::get()) + : mpSdrLineAttribute(theGlobalDefault()) { } @@ -123,7 +125,7 @@ namespace drawinglayer::attribute bool SdrLineAttribute::isDefault() const { - return mpSdrLineAttribute.same_object(theGlobalDefault::get()); + return mpSdrLineAttribute.same_object(theGlobalDefault()); } SdrLineAttribute& SdrLineAttribute::operator=(const SdrLineAttribute&) = default; diff --git a/drawinglayer/source/attribute/sdrlinestartendattribute.cxx b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx index f23c7b2459b2..aa052236cd72 100644 --- a/drawinglayer/source/attribute/sdrlinestartendattribute.cxx +++ b/drawinglayer/source/attribute/sdrlinestartendattribute.cxx @@ -19,7 +19,6 @@ #include #include -#include namespace drawinglayer::attribute @@ -93,8 +92,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< SdrLineStartEndAttribute::ImplType, theGlobalDefault > {}; + SdrLineStartEndAttribute::ImplType& theGlobalDefault() + { + static SdrLineStartEndAttribute::ImplType SINGLETON; + return SINGLETON; + } } SdrLineStartEndAttribute::SdrLineStartEndAttribute( @@ -112,7 +114,7 @@ namespace drawinglayer::attribute } SdrLineStartEndAttribute::SdrLineStartEndAttribute() - : mpSdrLineStartEndAttribute(theGlobalDefault::get()) + : mpSdrLineStartEndAttribute(theGlobalDefault()) { } @@ -124,7 +126,7 @@ namespace drawinglayer::attribute bool SdrLineStartEndAttribute::isDefault() const { - return mpSdrLineStartEndAttribute.same_object(theGlobalDefault::get()); + return mpSdrLineStartEndAttribute.same_object(theGlobalDefault()); } SdrLineStartEndAttribute& SdrLineStartEndAttribute::operator=(const SdrLineStartEndAttribute&) = default; diff --git a/drawinglayer/source/attribute/sdrobjectattribute3d.cxx b/drawinglayer/source/attribute/sdrobjectattribute3d.cxx index 78e919d9ab3f..dad8a07eebc5 100644 --- a/drawinglayer/source/attribute/sdrobjectattribute3d.cxx +++ b/drawinglayer/source/attribute/sdrobjectattribute3d.cxx @@ -19,7 +19,6 @@ #include #include -#include namespace drawinglayer::attribute @@ -96,12 +95,6 @@ namespace drawinglayer::attribute } }; - namespace - { - struct theGlobalDefault : - public rtl::Static< Sdr3DObjectAttribute::ImplType, theGlobalDefault > {}; - } - Sdr3DObjectAttribute::Sdr3DObjectAttribute( css::drawing::NormalsKind aNormalsKind, css::drawing::TextureProjectionMode aTextureProjectionX, diff --git a/drawinglayer/source/attribute/sdrsceneattribute3d.cxx b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx index 128abf2027cf..840fe2e3074c 100644 --- a/drawinglayer/source/attribute/sdrsceneattribute3d.cxx +++ b/drawinglayer/source/attribute/sdrsceneattribute3d.cxx @@ -18,7 +18,6 @@ */ #include -#include namespace drawinglayer::attribute @@ -76,8 +75,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< SdrSceneAttribute::ImplType, theGlobalDefault > {}; + SdrSceneAttribute::ImplType& theGlobalDefault() + { + static SdrSceneAttribute::ImplType SINGLETON; + return SINGLETON; + } } SdrSceneAttribute::SdrSceneAttribute( @@ -92,7 +94,7 @@ namespace drawinglayer::attribute } SdrSceneAttribute::SdrSceneAttribute() - : mpSdrSceneAttribute(theGlobalDefault::get()) + : mpSdrSceneAttribute(theGlobalDefault()) { } @@ -104,7 +106,7 @@ namespace drawinglayer::attribute bool SdrSceneAttribute::isDefault() const { - return mpSdrSceneAttribute.same_object(theGlobalDefault::get()); + return mpSdrSceneAttribute.same_object(theGlobalDefault()); } SdrSceneAttribute& SdrSceneAttribute::operator=(const SdrSceneAttribute&) = default; diff --git a/drawinglayer/source/attribute/sdrshadowattribute.cxx b/drawinglayer/source/attribute/sdrshadowattribute.cxx index 5d0090186757..6e046f1f07c7 100644 --- a/drawinglayer/source/attribute/sdrshadowattribute.cxx +++ b/drawinglayer/source/attribute/sdrshadowattribute.cxx @@ -20,7 +20,6 @@ #include #include #include -#include namespace drawinglayer::attribute @@ -74,8 +73,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< SdrShadowAttribute::ImplType, theGlobalDefault > {}; + SdrShadowAttribute::ImplType& theGlobalDefault() + { + static SdrShadowAttribute::ImplType SINGLETON; + return SINGLETON; + } } @@ -91,7 +93,7 @@ namespace drawinglayer::attribute } SdrShadowAttribute::SdrShadowAttribute() - : mpSdrShadowAttribute(theGlobalDefault::get()) + : mpSdrShadowAttribute(theGlobalDefault()) { } @@ -103,7 +105,7 @@ namespace drawinglayer::attribute bool SdrShadowAttribute::isDefault() const { - return mpSdrShadowAttribute.same_object(theGlobalDefault::get()); + return mpSdrShadowAttribute.same_object(theGlobalDefault()); } SdrShadowAttribute& SdrShadowAttribute::operator=(const SdrShadowAttribute&) = default; diff --git a/drawinglayer/source/attribute/strokeattribute.cxx b/drawinglayer/source/attribute/strokeattribute.cxx index b04a023aa7ac..d925eb65acbe 100644 --- a/drawinglayer/source/attribute/strokeattribute.cxx +++ b/drawinglayer/source/attribute/strokeattribute.cxx @@ -18,7 +18,6 @@ */ #include -#include #include @@ -67,8 +66,11 @@ namespace drawinglayer::attribute namespace { - struct theGlobalDefault : - public rtl::Static< StrokeAttribute::ImplType, theGlobalDefault > {}; + StrokeAttribute::ImplType& theGlobalDefault() + { + static StrokeAttribute::ImplType SINGLETON; + return SINGLETON; + } } StrokeAttribute::StrokeAttribute( @@ -80,7 +82,7 @@ namespace drawinglayer::attribute } StrokeAttribute::StrokeAttribute() - : mpStrokeAttribute(theGlobalDefault::get()) + : mpStrokeAttribute(theGlobalDefault()) { } @@ -92,7 +94,7 @@ namespace drawinglayer::attribute bool StrokeAttribute::isDefault() const { - return mpStrokeAttribute.same_object(theGlobalDefault::get()); + return mpStrokeAttribute.same_object(theGlobalDefault()); } StrokeAttribute& StrokeAttribute::operator=(const StrokeAttribute&) = default; diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx index e15f2082acd1..125689939b21 100644 --- a/drawinglayer/source/geometry/viewinformation2d.cxx +++ b/drawinglayer/source/geometry/viewinformation2d.cxx @@ -25,7 +25,6 @@ #include #include #include -#include #include using namespace com::sun::star; @@ -161,9 +160,11 @@ public: namespace { -struct theGlobalDefault : public rtl::Static +ViewInformation2D::ImplType& theGlobalDefault() { -}; + static ViewInformation2D::ImplType SINGLETON; + return SINGLETON; +} } ViewInformation2D::ViewInformation2D(const basegfx::B2DHomMatrix& rObjectTransformation, @@ -178,7 +179,7 @@ ViewInformation2D::ViewInformation2D(const basegfx::B2DHomMatrix& rObjectTransfo } ViewInformation2D::ViewInformation2D() - : mpViewInformation2D(theGlobalDefault::get()) + : mpViewInformation2D(theGlobalDefault()) { } diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx b/drawinglayer/source/geometry/viewinformation3d.cxx index 84dd3ccfe79d..a2a444ab3543 100644 --- a/drawinglayer/source/geometry/viewinformation3d.cxx +++ b/drawinglayer/source/geometry/viewinformation3d.cxx @@ -22,7 +22,6 @@ #include #include #include -#include #include @@ -277,8 +276,11 @@ namespace drawinglayer::geometry { namespace { - struct theGlobalDefault : - public rtl::Static< ViewInformation3D::ImplType, theGlobalDefault > {}; + ViewInformation3D::ImplType& theGlobalDefault() + { + static ViewInformation3D::ImplType SINGLETON; + return SINGLETON; + } } ViewInformation3D::ViewInformation3D( @@ -300,7 +302,7 @@ namespace drawinglayer::geometry } ViewInformation3D::ViewInformation3D() - : mpViewInformation3D(theGlobalDefault::get()) + : mpViewInformation3D(theGlobalDefault()) { } @@ -312,7 +314,7 @@ namespace drawinglayer::geometry bool ViewInformation3D::isDefault() const { - return mpViewInformation3D.same_object(theGlobalDefault::get()); + return mpViewInformation3D.same_object(theGlobalDefault()); } ViewInformation3D& ViewInformation3D::operator=(const ViewInformation3D&) = default; diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx index 6756e8946f4c..645958ae6a29 100644 --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx @@ -25,7 +25,6 @@ #include #include #include -#include namespace drawinglayer::primitive3d -- cgit