diff options
author | Thomas Lange <tl@openoffice.org> | 2001-06-21 08:00:49 +0000 |
---|---|---|
committer | Thomas Lange <tl@openoffice.org> | 2001-06-21 08:00:49 +0000 |
commit | f8546cdb5de0c788933bfee86659c3e1c56af4e8 (patch) | |
tree | 33e0de528832b3bfa4aeb58e433968eff92cdfd6 /linguistic/source | |
parent | 4867969b363babdf6d915d2ee0b37feeba07a803 (diff) |
#88571# remove entries for languages with no listed service implementation-name
Diffstat (limited to 'linguistic/source')
-rw-r--r-- | linguistic/source/hyphdsp.cxx | 48 | ||||
-rw-r--r-- | linguistic/source/spelldsp.cxx | 44 | ||||
-rw-r--r-- | linguistic/source/thesdsp.cxx | 40 |
3 files changed, 75 insertions, 57 deletions
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx index f050a5f36701..c7dd8db4897c 100644 --- a/linguistic/source/hyphdsp.cxx +++ b/linguistic/source/hyphdsp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: hyphdsp.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: tl $ $Date: 2001-06-13 10:55:07 $ + * last change: $Author: tl $ $Date: 2001-06-21 09:00:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -287,7 +287,7 @@ BOOL SAL_CALL HyphenatorDispatcher::hasLocale(const Locale& rLocale) throw(RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return 0 != aSvcList.Seek( LocaleToLanguage( rLocale ) ); + return 0 != aSvcList.Get( LocaleToLanguage( rLocale ) ); } @@ -306,7 +306,7 @@ Reference< XHyphenatedWord > SAL_CALL return xRes; // search for entry with that language - LangSvcEntry_Hyph *pEntry = aSvcList.Seek( nLanguage ); + LangSvcEntry_Hyph *pEntry = aSvcList.Get( nLanguage ); BOOL bWordModified = FALSE; if (!pEntry) @@ -416,7 +416,7 @@ Reference< XHyphenatedWord > SAL_CALL return xRes; // search for entry with that language - LangSvcEntry_Hyph *pEntry = aSvcList.Seek( nLanguage ); + LangSvcEntry_Hyph *pEntry = aSvcList.Get( nLanguage ); BOOL bWordModified = FALSE; if (!pEntry) @@ -526,7 +526,7 @@ Reference< XPossibleHyphens > SAL_CALL return xRes; // search for entry with that language - LangSvcEntry_Hyph *pEntry = aSvcList.Seek( nLanguage ); + LangSvcEntry_Hyph *pEntry = aSvcList.Get( nLanguage ); if (!pEntry) { @@ -621,25 +621,31 @@ void HyphenatorDispatcher::SetServiceList( const Locale &rLocale, { MutexGuard aGuard( GetLinguMutex() ); + INT16 nLanguage = LocaleToLanguage( rLocale ); + INT32 nLen = rSvcImplNames.getLength(); DBG_ASSERT( nLen <= 1, "unexpected size of sequence" ); - OUString aSvcImplName( nLen ? rSvcImplNames.getConstArray()[0] : OUString() ); - // search for entry with that language - INT16 nLanguage = LocaleToLanguage( rLocale ); - LangSvcEntry_Hyph *pEntry = aSvcList.Seek( nLanguage ); - - if (pEntry) - { - pEntry->aSvcImplName = aSvcImplName; - pEntry->aSvcRef = NULL; - pEntry->aFlags = SvcFlags(); - } + if (0 == nLen) + // remove entry + aSvcList.Remove( nLanguage ); else { - pEntry = new LangSvcEntry_Hyph( aSvcImplName ); - aSvcList.Insert( nLanguage, pEntry ); - DBG_ASSERT( aSvcList.Seek( nLanguage ), "lng : Insert failed" ); + // modify/add entry + LangSvcEntry_Hyph *pEntry = aSvcList.Get( nLanguage ); + const OUString &rSvcImplName = rSvcImplNames.getConstArray()[0]; + if (pEntry) + { + pEntry->aSvcImplName = rSvcImplName; + pEntry->aSvcRef = NULL; + pEntry->aFlags = SvcFlags(); + } + else + { + pEntry = new LangSvcEntry_Hyph( rSvcImplName ); + aSvcList.Insert( nLanguage, pEntry ); + DBG_ASSERT( aSvcList.Get( nLanguage ), "lng : Insert failed" ); + } } } @@ -654,7 +660,7 @@ Sequence< OUString > // search for entry with that language and use data from that INT16 nLanguage = LocaleToLanguage( rLocale ); HyphenatorDispatcher *pThis = (HyphenatorDispatcher *) this; - const LangSvcEntry_Hyph *pEntry = pThis->aSvcList.Seek( nLanguage ); + const LangSvcEntry_Hyph *pEntry = pThis->aSvcList.Get( nLanguage ); if (pEntry) aRes.getArray()[0] = pEntry->aSvcImplName; else diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index 31f7d3b7d159..074d89b678b1 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: spelldsp.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: tl $ $Date: 2001-06-13 10:54:15 $ + * last change: $Author: tl $ $Date: 2001-06-21 09:00:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -240,7 +240,7 @@ sal_Bool SAL_CALL SpellCheckerDispatcher::hasLanguage( sal_Int16 nLanguage ) throw(RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return 0 != aSvcList.Seek( nLanguage ); + return 0 != aSvcList.Get( nLanguage ); } @@ -306,7 +306,7 @@ BOOL SpellCheckerDispatcher::isValid_Impl( return bRes; // search for entry with that language - SeqLangSvcEntry_Spell *pEntry = aSvcList.Seek( nLanguage ); + SeqLangSvcEntry_Spell *pEntry = aSvcList.Get( nLanguage ); if (!pEntry) { @@ -545,7 +545,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( return xRes; // search for entry with that language - SeqLangSvcEntry_Spell *pEntry = aSvcList.Seek( nLanguage ); + SeqLangSvcEntry_Spell *pEntry = aSvcList.Get( nLanguage ); if (!pEntry) { @@ -747,23 +747,29 @@ void SpellCheckerDispatcher::SetServiceList( const Locale &rLocale, if (pExtCache) pExtCache->Flush(); // new services may spell differently... - // search for entry with that language INT16 nLanguage = LocaleToLanguage( rLocale ); - SeqLangSvcEntry_Spell *pEntry = aSvcList.Seek( nLanguage ); - if (pEntry) - { - INT32 nLen = rSvcImplNames.getLength(); - pEntry->aSvcImplNames = rSvcImplNames; - pEntry->aSvcRefs = Sequence< Reference < XSpellChecker > > ( nLen ); - pEntry->aSvc1Refs = Sequence< Reference < XSpellChecker1 > >( nLen ); - pEntry->aFlags = SvcFlags(); - } + if (0 == rSvcImplNames.getLength()) + // remove entry + aSvcList.Remove( nLanguage ); else { - pEntry = new SeqLangSvcEntry_Spell( rSvcImplNames ); - aSvcList.Insert( nLanguage, pEntry ); - DBG_ASSERT( aSvcList.Seek( nLanguage ), "lng : Insert failed" ); + // modify/add entry + SeqLangSvcEntry_Spell *pEntry = aSvcList.Get( nLanguage ); + if (pEntry) + { + INT32 nLen = rSvcImplNames.getLength(); + pEntry->aSvcImplNames = rSvcImplNames; + pEntry->aSvcRefs = Sequence< Reference < XSpellChecker > > ( nLen ); + pEntry->aSvc1Refs = Sequence< Reference < XSpellChecker1 > >( nLen ); + pEntry->aFlags = SvcFlags(); + } + else + { + pEntry = new SeqLangSvcEntry_Spell( rSvcImplNames ); + aSvcList.Insert( nLanguage, pEntry ); + DBG_ASSERT( aSvcList.Get( nLanguage ), "lng : Insert failed" ); + } } } @@ -778,7 +784,7 @@ Sequence< OUString > // search for entry with that language and use data from that INT16 nLanguage = LocaleToLanguage( rLocale ); SpellCheckerDispatcher *pThis = (SpellCheckerDispatcher *) this; - const SeqLangSvcEntry_Spell *pEntry = pThis->aSvcList.Seek( nLanguage ); + const SeqLangSvcEntry_Spell *pEntry = pThis->aSvcList.Get( nLanguage ); if (pEntry) aRes = pEntry->aSvcImplNames; diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx index 61888d04ed1a..c3583c90475e 100644 --- a/linguistic/source/thesdsp.cxx +++ b/linguistic/source/thesdsp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: thesdsp.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: tl $ $Date: 2001-06-13 10:55:50 $ + * last change: $Author: tl $ $Date: 2001-06-21 09:00:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -179,7 +179,7 @@ sal_Bool SAL_CALL throw(RuntimeException) { MutexGuard aGuard( GetLinguMutex() ); - return 0 != aSvcList.Seek( LocaleToLanguage( rLocale ) ); + return 0 != aSvcList.Get( LocaleToLanguage( rLocale ) ); } @@ -198,7 +198,7 @@ Sequence< Reference< XMeaning > > SAL_CALL return aMeanings; // search for entry with that language - SeqLangSvcEntry_Thes *pEntry = aSvcList.Seek( nLanguage ); + SeqLangSvcEntry_Thes *pEntry = aSvcList.Get( nLanguage ); if (!pEntry) { @@ -283,22 +283,28 @@ void ThesaurusDispatcher::SetServiceList( const Locale &rLocale, { MutexGuard aGuard( GetLinguMutex() ); - // search for entry with that language INT16 nLanguage = LocaleToLanguage( rLocale ); - SeqLangSvcEntry_Thes *pEntry = aSvcList.Seek( nLanguage ); - if (pEntry) - { - pEntry->aSvcImplNames = rSvcImplNames; - pEntry->aSvcRefs = Sequence< Reference < XThesaurus > >( - rSvcImplNames.getLength() ); - pEntry->aFlags = SvcFlags(); - } + if (0 == rSvcImplNames.getLength()) + // remove entry + aSvcList.Remove( nLanguage ); else { - pEntry = new SeqLangSvcEntry_Thes( rSvcImplNames ); - aSvcList.Insert( nLanguage, pEntry ); - DBG_ASSERT( aSvcList.Seek( nLanguage ), "lng : Insert failed" ); + // modify/add entry + SeqLangSvcEntry_Thes *pEntry = aSvcList.Get( nLanguage ); + if (pEntry) + { + pEntry->aSvcImplNames = rSvcImplNames; + pEntry->aSvcRefs = Sequence< Reference < XThesaurus > >( + rSvcImplNames.getLength() ); + pEntry->aFlags = SvcFlags(); + } + else + { + pEntry = new SeqLangSvcEntry_Thes( rSvcImplNames ); + aSvcList.Insert( nLanguage, pEntry ); + DBG_ASSERT( aSvcList.Get( nLanguage ), "lng : Insert failed" ); + } } } @@ -313,7 +319,7 @@ Sequence< OUString > // search for entry with that language and use data from that INT16 nLanguage = LocaleToLanguage( rLocale ); ThesaurusDispatcher *pThis = (ThesaurusDispatcher *) this; - const SeqLangSvcEntry_Thes *pEntry = pThis->aSvcList.Seek( nLanguage ); + const SeqLangSvcEntry_Thes *pEntry = pThis->aSvcList.Get( nLanguage ); if (pEntry) aRes = pEntry->aSvcImplNames; |