diff options
Diffstat (limited to 'linguistic/source')
-rw-r--r-- | linguistic/source/spelldsp.cxx | 13 | ||||
-rw-r--r-- | linguistic/source/spelldsp.hxx | 6 |
2 files changed, 8 insertions, 11 deletions
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index 49009b70c3d5..6cd6c8003233 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -185,9 +185,6 @@ SpellCheckerDispatcher::SpellCheckerDispatcher( LngSvcMgr &rLngSvcMgr ) : SpellCheckerDispatcher::~SpellCheckerDispatcher() { - ClearSvcList(); - delete m_pCache; - delete m_pCharClass; } @@ -422,9 +419,9 @@ bool SpellCheckerDispatcher::isValid_Impl( bRes = !xTmp->isNegative(); } else { setCharClass(LanguageTag(nLanguage)); - CapType ct = capitalType(aChkWord, m_pCharClass); + CapType ct = capitalType(aChkWord, m_pCharClass.get()); if (ct == CapType::INITCAP || ct == CapType::ALLCAP) { - Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass), nLanguage ) ); + Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass.get()), nLanguage ) ); if (xTmp2.is()) { bRes = !xTmp2->isNegative(); } @@ -663,10 +660,10 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( else { setCharClass(LanguageTag(nLanguage)); - CapType ct = capitalType(aChkWord, m_pCharClass); + CapType ct = capitalType(aChkWord, m_pCharClass.get()); if (ct == CapType::INITCAP || ct == CapType::ALLCAP) { - Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass), nLanguage ) ); + Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, m_pCharClass.get()), nLanguage ) ); if (xTmp2.is()) { if (xTmp2->isNegative()) // negative entry found @@ -842,7 +839,7 @@ void SpellCheckerDispatcher::FlushSpellCache() void SpellCheckerDispatcher::setCharClass(const LanguageTag& rLanguageTag) { if (!m_pCharClass) - m_pCharClass = new CharClass(rLanguageTag); + m_pCharClass.reset( new CharClass(rLanguageTag) ); m_pCharClass->setLanguageTag(rLanguageTag); } diff --git a/linguistic/source/spelldsp.hxx b/linguistic/source/spelldsp.hxx index 9d165dd87347..d84d11a4513a 100644 --- a/linguistic/source/spelldsp.hxx +++ b/linguistic/source/spelldsp.hxx @@ -58,8 +58,8 @@ class SpellCheckerDispatcher : css::uno::Reference< css::linguistic2::XSearchableDictionaryList > m_xDicList; LngSvcMgr &m_rMgr; - mutable linguistic::SpellCache *m_pCache; // Spell Cache (holds known words) - CharClass *m_pCharClass; + mutable std::unique_ptr<linguistic::SpellCache> m_pCache; // Spell Cache (holds known words) + std::unique_ptr<CharClass> m_pCharClass; SpellCheckerDispatcher(const SpellCheckerDispatcher &) = delete; SpellCheckerDispatcher & operator = (const SpellCheckerDispatcher &) = delete; @@ -120,7 +120,7 @@ private: inline linguistic::SpellCache & SpellCheckerDispatcher::GetCache() const { if (!m_pCache) - m_pCache = new linguistic::SpellCache(); + m_pCache.reset(new linguistic::SpellCache()); return *m_pCache; } |