diff options
Diffstat (limited to 'lingucomponent/source')
6 files changed, 28 insertions, 44 deletions
diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx index 0c128305a..6cc84e3fd 100644 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx @@ -108,19 +108,19 @@ Hyphenator::~Hyphenator() if (aDicts[i].aPtr) hnj_hyphen_free(aDicts[i].aPtr); } + delete pPropHelper; } delete[] aDicts; } -PropertyHelper_Hyphen & Hyphenator::GetPropHelper_Impl() +PropertyHelper_Hyphenation& Hyphenator::GetPropHelper_Impl() { if (!pPropHelper) { Reference< XPropertySet > xPropSet( GetLinguProperties(), UNO_QUERY ); - pPropHelper = new PropertyHelper_Hyphen ((XHyphenator *) this, xPropSet ); - xPropHelper = pPropHelper; + pPropHelper = new PropertyHelper_Hyphenation ((XHyphenator *) this, xPropSet ); pPropHelper->AddAsPropListener(); //! after a reference is established } return *pPropHelper; @@ -289,7 +289,7 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const ::rtl::OUStri char *lcword; int k = 0; - PropertyHelper_Hyphen & rHelper = GetPropHelper(); + PropertyHelper_Hyphenation& rHelper = GetPropHelper(); rHelper.SetTmpPropVals(aProperties); sal_Int16 minTrail = rHelper.GetMinTrailing(); sal_Int16 minLead = rHelper.GetMinLeading(); @@ -502,13 +502,13 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const ::rtl::OUStri sal_Int16 nPos = (sal_Int16) ((nHyphenationPosAltHyph < nHyphenationPos) ? nHyphenationPosAltHyph : nHyphenationPos); // dicretionary hyphenation - xRes = new HyphenatedWord( aWord, LocaleToLanguage( aLocale ), nPos, + xRes = HyphenatedWord::CreateHyphenatedWord( aWord, LocaleToLanguage( aLocale ), nPos, aWord.replaceAt(nHyphenationPosAlt + 1, cut[nHyphenationPos], repHyph), (sal_Int16) nHyphenationPosAltHyph); } else { - xRes = new HyphenatedWord( aWord, LocaleToLanguage( aLocale ), + xRes = HyphenatedWord::CreateHyphenatedWord( aWord, LocaleToLanguage( aLocale ), (sal_Int16)nHyphenationPos, aWord, (sal_Int16) nHyphenationPos); } } @@ -554,7 +554,7 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const char *lcword; int k; - PropertyHelper_Hyphen & rHelper = GetPropHelper(); + PropertyHelper_Hyphenation& rHelper = GetPropHelper(); rHelper.SetTmpPropVals(aProperties); sal_Int16 minTrail = rHelper.GetMinTrailing(); sal_Int16 minLead = rHelper.GetMinLeading(); @@ -707,7 +707,7 @@ Reference< XPossibleHyphens > SAL_CALL Hyphenator::createPossibleHyphens( const hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear(); - xRes = new PossibleHyphens( aWord, LocaleToLanguage( aLocale ), + xRes = PossibleHyphens::CreatePossibleHyphens( aWord, LocaleToLanguage( aLocale ), hyphenatedWord, aHyphPos ); delete[] hyphens; @@ -818,7 +818,6 @@ sal_Bool SAL_CALL Hyphenator::removeLinguServiceEventListener( sal_Bool bRes = sal_False; if (!bDisposing && rxLstnr.is()) { - DBG_ASSERT( xPropHelper.is(), "xPropHelper non existent" ); bRes = GetPropHelper().removeLinguServiceEventListener( rxLstnr ); } return bRes; @@ -851,8 +850,7 @@ void SAL_CALL Hyphenator::initialize( const Sequence< Any >& rArguments ) //! And the reference to the UNO-functions while increasing //! the ref-count and will implicitly free the memory //! when the object is not longer used. - pPropHelper = new PropertyHelper_Hyphen( (XHyphenator *) this, xPropSet ); - xPropHelper = pPropHelper; + pPropHelper = new PropertyHelper_Hyphenation( (XHyphenator *) this, xPropSet ); pPropHelper->AddAsPropListener(); //! after a reference is established } else { diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx index e0e984908..07815d43e 100644 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx +++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.hxx @@ -88,17 +88,16 @@ class Hyphenator : sal_Int32 numdict; ::cppu::OInterfaceContainerHelper aEvtListeners; - Reference< XPropertyChangeListener > xPropHelper; Reference< XMultiServiceFactory > rSMgr; - linguistic::PropertyHelper_Hyphen * pPropHelper; + linguistic::PropertyHelper_Hyphenation* pPropHelper; sal_Bool bDisposing; // disallow copy-constructor and assignment-operator for now Hyphenator(const Hyphenator &); Hyphenator & operator = (const Hyphenator &); - linguistic::PropertyHelper_Hyphen & GetPropHelper_Impl(); - linguistic::PropertyHelper_Hyphen & GetPropHelper() + linguistic::PropertyHelper_Hyphenation& GetPropHelper_Impl(); + linguistic::PropertyHelper_Hyphenation& GetPropHelper() { return pPropHelper ? *pPropHelper : GetPropHelper_Impl(); } diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx index 3a9854b72..13246bd3c 100644 --- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx +++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx @@ -107,18 +107,15 @@ SpellChecker::~SpellChecker() aDLocs = NULL; delete[] aDNames; aDNames = NULL; - if (xPropHelper.is()) - pPropHelper->RemoveAsPropListener(); } -PropertyHelper_Spell & SpellChecker::GetPropHelper_Impl() +PropertyHelper_Spelling & SpellChecker::GetPropHelper_Impl() { if (!pPropHelper) { Reference< XPropertySet > xPropSet( GetLinguProperties(), UNO_QUERY ); - pPropHelper = new PropertyHelper_Spell( (XSpellChecker *) this, xPropSet ); - xPropHelper = pPropHelper; + pPropHelper = new PropertyHelper_Spelling( (XSpellChecker *) this, xPropSet ); pPropHelper->AddAsPropListener(); //! after a reference is established } return *pPropHelper; @@ -388,7 +385,7 @@ sal_Bool SAL_CALL SpellChecker::isValid( const OUString& rWord, const Locale& rL // You'll probably like to use a simplier solution than the provided // one using the PropertyHelper_Spell. - PropertyHelper_Spell &rHelper = GetPropHelper(); + PropertyHelper_Spelling& rHelper = GetPropHelper(); rHelper.SetTmpPropVals( rProperties ); sal_Int16 nFailure = GetSpellFailure( rWord, rLocale ); @@ -477,12 +474,8 @@ Reference< XSpellAlternatives > } // now return an empty alternative for no suggestions or the list of alternatives if some found - SpellAlternatives *pAlt = new SpellAlternatives; String aTmp(rWord); - pAlt->SetWordLanguage( aTmp, nLang ); - pAlt->SetFailureType( SpellFailure::SPELLING_ERROR ); - pAlt->SetAlternatives( aStr ); - xRes = pAlt; + xRes = SpellAlternatives::CreateSpellAlternatives( aTmp, nLang, SpellFailure::SPELLING_ERROR, aStr ); return xRes; } return xRes; @@ -549,7 +542,6 @@ sal_Bool SAL_CALL SpellChecker::removeLinguServiceEventListener( sal_Bool bRes = sal_False; if (!bDisposing && rxLstnr.is()) { - DBG_ASSERT( xPropHelper.is(), "xPropHelper non existent" ); bRes = GetPropHelper().removeLinguServiceEventListener( rxLstnr ); } return bRes; @@ -582,8 +574,7 @@ void SAL_CALL SpellChecker::initialize( const Sequence< Any >& rArguments ) //! And the reference to the UNO-functions while increasing //! the ref-count and will implicitly free the memory //! when the object is not longer used. - pPropHelper = new PropertyHelper_Spell( (XSpellChecker *) this, xPropSet ); - xPropHelper = pPropHelper; + pPropHelper = new PropertyHelper_Spelling( (XSpellChecker *) this, xPropSet ); pPropHelper->AddAsPropListener(); //! after a reference is established } else { @@ -603,7 +594,6 @@ void SAL_CALL SpellChecker::dispose() bDisposing = sal_True; EventObject aEvtObj( (XSpellChecker *) this ); aEvtListeners.disposeAndClear( aEvtObj ); - xPropHelper.clear(); } } diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.hxx b/lingucomponent/source/spellcheck/spell/sspellimp.hxx index 45ac8a6a8..09417d4dc 100644 --- a/lingucomponent/source/spellcheck/spell/sspellimp.hxx +++ b/lingucomponent/source/spellcheck/spell/sspellimp.hxx @@ -77,16 +77,15 @@ class SpellChecker : sal_Int32 numdict; ::cppu::OInterfaceContainerHelper aEvtListeners; - Reference< XPropertyChangeListener > xPropHelper; - linguistic::PropertyHelper_Spell * pPropHelper; + linguistic::PropertyHelper_Spelling* pPropHelper; sal_Bool bDisposing; // disallow copy-constructor and assignment-operator for now SpellChecker(const SpellChecker &); SpellChecker & operator = (const SpellChecker &); - linguistic::PropertyHelper_Spell & GetPropHelper_Impl(); - linguistic::PropertyHelper_Spell & GetPropHelper() + linguistic::PropertyHelper_Spelling& GetPropHelper_Impl(); + linguistic::PropertyHelper_Spelling& GetPropHelper() { return pPropHelper ? *pPropHelper : GetPropHelper_Impl(); } diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx index e2f7363e9..ccbf55fe5 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx @@ -139,17 +139,17 @@ Thesaurus::~Thesaurus() if (pPropHelper) pPropHelper->RemoveAsPropListener(); + delete pPropHelper; } -PropertyHelper_Thes & Thesaurus::GetPropHelper_Impl() +PropertyHelper_Thesaurus& Thesaurus::GetPropHelper_Impl() { if (!pPropHelper) { Reference< XPropertySet > xPropSet( GetLinguProperties(), UNO_QUERY ); - pPropHelper = new PropertyHelper_Thes( (XThesaurus *) this, xPropSet ); - xPropHelper = pPropHelper; + pPropHelper = new PropertyHelper_Thesaurus( (XThesaurus *) this, xPropSet ); pPropHelper->AddAsPropListener(); //! after a reference is established } return *pPropHelper; @@ -344,7 +344,7 @@ Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL Thes mentry * pmean = NULL; sal_Int32 nmean = 0; - PropertyHelper_Thes &rHelper = GetPropHelper(); + PropertyHelper_Thesaurus &rHelper = GetPropHelper(); rHelper.SetTmpPropVals( rProperties ); MyThes * pTH = NULL; @@ -603,8 +603,7 @@ void SAL_CALL Thesaurus::initialize( const Sequence< Any >& rArguments ) //! And the reference to the UNO-functions while increasing //! the ref-count and will implicitly free the memory //! when the object is not longer used. - pPropHelper = new PropertyHelper_Thes( (XThesaurus *) this, xPropSet ); - xPropHelper = pPropHelper; + pPropHelper = new PropertyHelper_Thesaurus( (XThesaurus *) this, xPropSet ); pPropHelper->AddAsPropListener(); //! after a reference is established } else diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.hxx b/lingucomponent/source/thesaurus/libnth/nthesimp.hxx index 78c948b9b..ab4783302 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.hxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.hxx @@ -86,8 +86,7 @@ class Thesaurus : Sequence< Locale > aSuppLocales; ::cppu::OInterfaceContainerHelper aEvtListeners; - Reference< XPropertyChangeListener > xPropHelper; - linguistic::PropertyHelper_Thes * pPropHelper; + linguistic::PropertyHelper_Thesaurus* pPropHelper; sal_Bool bDisposing; CharClass ** aCharSetInfo; MyThes ** aThes; @@ -105,8 +104,8 @@ class Thesaurus : Thesaurus(const Thesaurus &); Thesaurus & operator = (const Thesaurus &); - linguistic::PropertyHelper_Thes & GetPropHelper_Impl(); - linguistic::PropertyHelper_Thes & GetPropHelper() + linguistic::PropertyHelper_Thesaurus& GetPropHelper_Impl(); + linguistic::PropertyHelper_Thesaurus& GetPropHelper() { return pPropHelper ? *pPropHelper : GetPropHelper_Impl(); } |