From dd11d240263c55d7185f88f9901c63a7cb281115 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 30 May 2011 15:31:27 +0100 Subject: use well behaved singletons --- unotools/inc/unotools/fontcfg.hxx | 4 ++-- unotools/source/config/fontcfg.cxx | 24 ++++++++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'unotools') diff --git a/unotools/inc/unotools/fontcfg.hxx b/unotools/inc/unotools/fontcfg.hxx index 136147a095d4..7932bc5cda46 100644 --- a/unotools/inc/unotools/fontcfg.hxx +++ b/unotools/inc/unotools/fontcfg.hxx @@ -93,8 +93,8 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration rtl::OUString tryLocale( const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rType ) const; - DefaultFontConfiguration(); public: + DefaultFontConfiguration(); ~DefaultFontConfiguration(); static DefaultFontConfiguration& get(); @@ -207,8 +207,8 @@ private: unsigned long getSubstType( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, const rtl::OUString& rType ) const; void readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const; - FontSubstConfiguration(); public: + FontSubstConfiguration(); ~FontSubstConfiguration(); static FontSubstConfiguration& get(); diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index 5786e96af8cc..46d92d121a66 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -96,10 +97,18 @@ static const char* getKeyType( int nKeyType ) } } +namespace +{ + class theDefaultFontConfiguration + : public rtl::Static + { + }; +} + DefaultFontConfiguration& DefaultFontConfiguration::get() { - static DefaultFontConfiguration aDefaultFontConfiguration; - return aDefaultFontConfiguration; + return theDefaultFontConfiguration::get(); } DefaultFontConfiguration::DefaultFontConfiguration() @@ -370,10 +379,17 @@ OUString DefaultFontConfiguration::getUserInterfaceFont( const Locale& rLocale ) * FontSubstConfigItem::get */ +namespace +{ + class theFontSubstConfiguration + : public rtl::Static + { + }; +} + FontSubstConfiguration& FontSubstConfiguration::get() { - static FontSubstConfiguration aFontSubstConfiguration; - return aFontSubstConfiguration; + return theFontSubstConfiguration::get(); } /* -- cgit v1.2.3