From b8a1e3926a759a533aad03ab2467addf6a73a66c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 20 May 2011 08:57:24 +0100 Subject: [PATCH] make this a well-behaved singleton --- editeng/source/misc/acorrcfg.cxx | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index 15a3ddfb2d09..084c09431965 100644 --- a/editeng/source/misc/acorrcfg.cxx +++ b/editeng/source/misc/acorrcfg.cxx @@ -39,15 +39,13 @@ #include #include +#include + using namespace utl; using namespace com::sun::star::uno; using ::rtl::OUString; -#define C2U(cChar) OUString::createFromAscii(cChar) - -static SvxAutoCorrCfg* pAutoCorrCfg = 0; - SvxAutoCorrCfg::SvxAutoCorrCfg() : aBaseConfig(*this), aSwConfig(*this), @@ -230,7 +228,7 @@ void SvxBaseAutoCorrCfg::Load(sal_Bool bInit) } SvxBaseAutoCorrCfg::SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rPar) : - utl::ConfigItem(C2U("Office.Common/AutoCorrect")), + utl::ConfigItem(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/AutoCorrect"))), rParent(rPar) { } @@ -539,7 +537,7 @@ void SvxSwAutoCorrCfg::Load(sal_Bool bInit) } SvxSwAutoCorrCfg::SvxSwAutoCorrCfg(SvxAutoCorrCfg& rPar) : - utl::ConfigItem(C2U("Office.Writer/AutoFunction")), + utl::ConfigItem(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Writer/AutoFunction"))), rParent(rPar) { } @@ -650,11 +648,14 @@ void SvxSwAutoCorrCfg::Notify( const Sequence& /* aPropertyNames */ ) Load(sal_False); } -SvxAutoCorrCfg* SvxAutoCorrCfg::Get() +namespace { - if( !pAutoCorrCfg ) - pAutoCorrCfg = new SvxAutoCorrCfg; - return pAutoCorrCfg; + class theSvxAutoCorrCfg : public rtl::Static{}; +} + +SvxAutoCorrCfg& SvxAutoCorrCfg::Get() +{ + return theSvxAutoCorrCfg::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */