diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-07-07 11:59:15 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-07-07 11:59:15 +0000 |
commit | deb0e7aaeafc910c6d231899c04bcbeec1f391bc (patch) | |
tree | 2e93a214057e10a18c76fe030f09cd3a718a204b /lingucomponent/source/thesaurus | |
parent | a52d240b7e1b40c363a00e4441a0d4b59c9209c7 (diff) |
INTEGRATION: CWS tl53 (1.15.8); FILE MERGED
2008/06/25 13:31:46 tl 1.15.8.2: #i90975# fiy for dictionary extensions with multiple locales
2008/06/25 10:09:49 tl 1.15.8.1: #i90975# fiy for dictionary extensions with multiple locales
Diffstat (limited to 'lingucomponent/source/thesaurus')
-rw-r--r-- | lingucomponent/source/thesaurus/libnth/nthesimp.cxx | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx index 2bbb58ad4c9d..517b9ae17e59 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: nthesimp.cxx,v $ - * $Revision: 1.15 $ + * $Revision: 1.16 $ * * This file is part of OpenOffice.org. * @@ -201,6 +201,10 @@ Sequence< Locale > SAL_CALL Thesaurus::getLocales() aSuppLocales[k++] = aTmp; } + //! now have one dictionary entry for each locale + //! (this is necessary in order to allow for several locales for one dictionary) + numthes = aSuppLocales.getLength(); + // add dictionary information aThes = new MyThes* [numthes]; aTEncs = new rtl_TextEncoding [numthes]; @@ -214,22 +218,32 @@ Sequence< Locale > SAL_CALL Thesaurus::getLocales() if (aDictIt->aLocaleNames.getLength() > 0 && aDictIt->aLocations.getLength() > 0) { - aThes[k] = NULL; - aTEncs[k] = 0; - // currently HunSpell supports only one language per dictionary... - aTLocs[k] = MsLangId::convertLanguageToLocale( - MsLangId::convertIsoStringToLanguage( aDictIt->aLocaleNames[0] )); - aCharSetInfo[k] = new CharClass( aTLocs[k] ); - // also both files have to be in the same directory and the - // file names must only differ in the extension (.aff/.dic). - // Thus we use the first location only and strip the extension part. - rtl::OUString aLocation = aDictIt->aLocations[0]; - sal_Int32 nPos = aLocation.lastIndexOf( '.' ); - aLocation = aLocation.copy( 0, nPos ); - aTNames[k] = aLocation; + uno::Sequence< rtl::OUString > aLocaleNames( aDictIt->aLocaleNames ); + sal_Int32 nLocales = aLocaleNames.getLength(); + + // currently only one language per dictionary is supported in the actual implementation... + // Thus here we work-around this by adding the same dictionary several times. + // Once for each of it's supported locales. + for (sal_Int32 i = 0; i < nLocales; ++i) + { + aThes[k] = NULL; + aTEncs[k] = 0; + aTLocs[k] = MsLangId::convertLanguageToLocale( + MsLangId::convertIsoStringToLanguage( aDictIt->aLocaleNames[i] )); + aCharSetInfo[k] = new CharClass( aTLocs[k] ); + // also both files have to be in the same directory and the + // file names must only differ in the extension (.aff/.dic). + // Thus we use the first location only and strip the extension part. + rtl::OUString aLocation = aDictIt->aLocations[0]; + sal_Int32 nPos = aLocation.lastIndexOf( '.' ); + aLocation = aLocation.copy( 0, nPos ); + aTNames[k] = aLocation; + + ++k; + } } - ++k; } + DBG_ASSERT( k == numdict, "index mismatch?" ); } else { |