From 5577eb6c1100bd865b8a54b68adf5e3a7848bba3 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Tue, 1 Jul 2008 14:48:39 +0000 Subject: INTEGRATION: CWS native156 (1.27.14); FILE MERGED 2008/06/25 13:33:56 mba 1.27.14.1: #i90975#: support multiple locales per dictionary --- .../hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx | 44 ++++++++++++++-------- 1 file changed, 29 insertions(+), 15 deletions(-) (limited to 'lingucomponent') diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx index be56bdde4e3b..d6dbff7162f0 100644 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: hyphenimp.cxx,v $ - * $Revision: 1.27 $ + * $Revision: 1.28 $ * * This file is part of OpenOffice.org. * @@ -198,6 +198,10 @@ Sequence< Locale > SAL_CALL Hyphenator::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) + numdict = aSuppLocales.getLength(); + // add dictionary information aDicts = new HDInfo[numdict]; /* @@ -212,22 +216,32 @@ Sequence< Locale > SAL_CALL Hyphenator::getLocales() if (aDictIt->aLocaleNames.getLength() > 0 && aDictIt->aLocations.getLength() > 0) { - aDicts[k].aPtr = NULL; - aDicts[k].aEnc = 0; - // currently HunSpell supports only one language per dictionary... - aDicts[k].aLoc = MsLangId::convertLanguageToLocale( - MsLangId::convertIsoStringToLanguage( aDictIt->aLocaleNames[0] )); - aDicts[k].apCC = new CharClass( aDicts[k].aLoc ); - // 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 ); - aDicts[k].aName = 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) + { + aDicts[k].aPtr = NULL; + aDicts[k].aEnc = 0; + aDicts[k].aLoc = MsLangId::convertLanguageToLocale( + MsLangId::convertIsoStringToLanguage( aDictIt->aLocaleNames[i] )); + aDicts[k].apCC = new CharClass( aDicts[k].aLoc ); + // 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 ); + aDicts[k].aName = aLocation; + + ++k; + } } - ++k; } + DBG_ASSERT( k == numdict, "index mismatch?" ); } else { -- cgit v1.2.3