diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-05-20 08:57:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-05-20 15:23:09 +0100 |
commit | b8a1e3926a759a533aad03ab2467addf6a73a66c (patch) | |
tree | 1298f502458c9e78b3ec640ec74df544020e603d | |
parent | 800d9494a7bda0603e977b96a770828e8bf530fb (diff) |
make this a well-behaved singleton
-rw-r--r-- | editeng/source/misc/acorrcfg.cxx | 21 |
1 files 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 <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> +#include <rtl/instance.hxx> + 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<OUString>& /* aPropertyNames */ ) Load(sal_False); } -SvxAutoCorrCfg* SvxAutoCorrCfg::Get() +namespace +{ + class theSvxAutoCorrCfg : public rtl::Static<SvxAutoCorrCfg, theSvxAutoCorrCfg>{}; +} + +SvxAutoCorrCfg& SvxAutoCorrCfg::Get() { - if( !pAutoCorrCfg ) - pAutoCorrCfg = new SvxAutoCorrCfg; - return pAutoCorrCfg; + return theSvxAutoCorrCfg::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |