diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-08-10 19:43:29 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-08-10 22:59:52 +0200 |
commit | 91e4d876098aaa7ac18a03e20cbc2789fba98041 (patch) | |
tree | 4a65ccfcf752496fe4ed8aee8809259122d44e3d /lingucomponent | |
parent | 14daeaa9c15f5c9278f861d5109f26d366cc0897 (diff) |
Combine MacSpellChecker p/xPropHelper
Change-Id: Ie5b5ea4863ce39f53ab4ebe2e02dc7ed141627ba
Reviewed-on: https://gerrit.libreoffice.org/77248
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'lingucomponent')
-rw-r--r-- | lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx | 5 | ||||
-rw-r--r-- | lingucomponent/source/spellcheck/macosxspell/macspellimp.mm | 21 |
2 files changed, 11 insertions, 15 deletions
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx index e26d353455fe..a750a849144e 100644 --- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx +++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx @@ -70,8 +70,7 @@ class MacSpellChecker : UITextChecker * pChecker; #endif ::comphelper::OInterfaceContainerHelper2 aEvtListeners; - Reference< XPropertyChangeListener > xPropHelper; - linguistic::PropertyHelper_Spell * pPropHelper; + rtl::Reference< linguistic::PropertyHelper_Spell > xPropHelper; bool bDisposing; MacSpellChecker(const MacSpellChecker &) = delete; @@ -80,7 +79,7 @@ class MacSpellChecker : linguistic::PropertyHelper_Spell & GetPropHelper_Impl(); linguistic::PropertyHelper_Spell & GetPropHelper() { - return pPropHelper ? *pPropHelper : GetPropHelper_Impl(); + return xPropHelper.is() ? *xPropHelper.get() : GetPropHelper_Impl(); } sal_Int16 GetSpellFailure( const OUString &rWord, const Locale &rLocale ); diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm index 4c97ead10acb..31af179f4eaf 100644 --- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm +++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm @@ -52,7 +52,6 @@ MacSpellChecker::MacSpellChecker() : aDLocs = nullptr; aDNames = nullptr; bDisposing = false; - pPropHelper = nullptr; numdict = 0; #ifndef IOS NSApplicationLoad(); @@ -74,22 +73,21 @@ MacSpellChecker::~MacSpellChecker() aDLocs = nullptr; if (aDNames) delete[] aDNames; aDNames = nullptr; - if (pPropHelper) - pPropHelper->RemoveAsPropListener(); + if (xPropHelper.is()) + xPropHelper->RemoveAsPropListener(); } PropertyHelper_Spell & MacSpellChecker::GetPropHelper_Impl() { - if (!pPropHelper) + if (!xPropHelper.is()) { Reference< XLinguProperties > xPropSet( GetLinguProperties() ); - pPropHelper = new PropertyHelper_Spell( static_cast<XSpellChecker *>(this), xPropSet ); - xPropHelper = pPropHelper; - pPropHelper->AddAsPropListener(); //! after a reference is established + xPropHelper = new PropertyHelper_Spell( static_cast<XSpellChecker *>(this), xPropSet ); + xPropHelper->AddAsPropListener(); } - return *pPropHelper; + return *xPropHelper.get(); } @@ -570,7 +568,7 @@ void SAL_CALL { MutexGuard aGuard( GetLinguMutex() ); - if (!pPropHelper) + if (!xPropHelper.is()) { sal_Int32 nLen = rArguments.getLength(); if (2 == nLen) @@ -583,9 +581,8 @@ void SAL_CALL //! And the reference to the UNO-functions while increasing //! the ref-count and will implicitly free the memory //! when the object is no longer used. - pPropHelper = new PropertyHelper_Spell( static_cast<XSpellChecker *>(this), xPropSet ); - xPropHelper = pPropHelper; - pPropHelper->AddAsPropListener(); //! after a reference is established + xPropHelper = new PropertyHelper_Spell( static_cast<XSpellChecker *>(this), xPropSet ); + xPropHelper->AddAsPropListener(); } else OSL_FAIL( "wrong number of arguments in sequence" ); |