diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-05-30 15:31:27 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-06-01 15:21:54 +0100 |
commit | dd11d240263c55d7185f88f9901c63a7cb281115 (patch) | |
tree | 36d6a8899066efc771ddecaf350a0c7b64b6c96f /unotools | |
parent | f90cb6c111d5ea7db3b9c71b6bcb9572e12876a3 (diff) |
use well behaved singletons
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/inc/unotools/fontcfg.hxx | 4 | ||||
-rw-r--r-- | unotools/source/config/fontcfg.cxx | 24 |
2 files changed, 22 insertions, 6 deletions
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 <unotools/configpathes.hxx> #include <unotools/syslocale.hxx> #include <rtl/ustrbuf.hxx> +#include <rtl/instance.hxx> #include <sal/macros.h> #include <tools/debug.hxx> @@ -96,10 +97,18 @@ static const char* getKeyType( int nKeyType ) } } +namespace +{ + class theDefaultFontConfiguration + : public rtl::Static<DefaultFontConfiguration, + theDefaultFontConfiguration> + { + }; +} + 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, theFontSubstConfiguration> + { + }; +} + FontSubstConfiguration& FontSubstConfiguration::get() { - static FontSubstConfiguration aFontSubstConfiguration; - return aFontSubstConfiguration; + return theFontSubstConfiguration::get(); } /* |