From 54fa72ae4f3a0d5688cc1b1bcaddf1a21f980717 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Tue, 31 Jan 2006 17:37:12 +0000 Subject: INTEGRATION: CWS i18n24 (1.17.36); FILE MERGED 2006/01/10 23:33:12 khong 1.17.36.2: #i60331 extract index data to external library 2006/01/10 23:08:48 khong 1.17.36.1: #i60331 extract index data to external library --- i18npool/source/indexentry/indexentrysupplier.cxx | 61 +++++------------------ 1 file changed, 12 insertions(+), 49 deletions(-) (limited to 'i18npool') diff --git a/i18npool/source/indexentry/indexentrysupplier.cxx b/i18npool/source/indexentry/indexentrysupplier.cxx index f9c12efaf296..8e4fb6d0d759 100644 --- a/i18npool/source/indexentry/indexentrysupplier.cxx +++ b/i18npool/source/indexentry/indexentrysupplier.cxx @@ -4,9 +4,9 @@ * * $RCSfile: indexentrysupplier.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: rt $ $Date: 2005-09-07 17:08:56 $ + * last change: $Author: kz $ $Date: 2006-01-31 18:37:12 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -35,9 +35,6 @@ #include #include #include -#include -#include -#include using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -82,49 +79,10 @@ sal_Bool SAL_CALL IndexEntrySupplier::usePhoneticEntry( const Locale& rLocale ) OUString SAL_CALL IndexEntrySupplier::getPhoneticCandidate( const OUString& rIndexEntry, const Locale& rLocale ) throw (RuntimeException) { - static OUString space(OUString::createFromAscii(" ")); - OUString candidate; - // TODO: the phonetic candidate will be provided by language engine for CJK. - if (rLocale.Language.equalsAscii("zh")) { - sal_Unicode *Str; - sal_uInt16 *Index1, *Index2; - if (rLocale.Country.equalsAscii("TW") || - rLocale.Country.equalsAscii("HK") || - rLocale.Country.equalsAscii("MO")) { - Str = ZhuYinStr_zh; - Index1 = ZhuYinIndex1_zh; - Index2 = ZhuYinIndex2_zh; - } else { - Str = PinYinStr_zh; - Index1 = PinYinIndex1_zh; - Index2 = PinYinIndex2_zh; - } - - for (sal_Int32 i=0; i < rIndexEntry.getLength(); i++) { - sal_Unicode ch = rIndexEntry[i]; - sal_uInt16 address = Index1[ch>>8]; - if (address != 0xFFFF) - address = Index2[address + (ch & 0xFF)]; - if (i > 0) - candidate += space; - if (address != 0xFFFF) - candidate += OUString(&Str[address]); - } - } else if (rLocale.Language.equalsAscii("ja")) { - ; // TODO - } else if (rLocale.Language.equalsAscii("ko")) { - for (sal_Int32 i=0; i < rIndexEntry.getLength(); i++) { - sal_Unicode ch = rIndexEntry[i]; - sal_uInt16 address = PhoneticIndex_ko[ch>>8]; - if (address != 0xFFFF) - address = PhoneticCharacter_ko[address + (ch & 0xFF)]; - if (address != 0xFFFF) - candidate += OUString(&address, 1); - else - candidate += space; - } - } - return candidate; + if (getLocaleSpecificIndexEntrySupplier(rLocale, OUString()).is()) + return xIES->getPhoneticCandidate(rIndexEntry, rLocale); + else + throw RuntimeException(); } OUString SAL_CALL IndexEntrySupplier::getIndexKey( const OUString& rIndexEntry, @@ -175,12 +133,17 @@ IndexEntrySupplier::getLocaleSpecificIndexEntrySupplier(const Locale& rLocale, c rLocale.Country == aLocale.Country && rLocale.Variant == aLocale.Variant) return xIES; else if (xMSF.is()) { + LocaleData ld; aLocale = rLocale; if (rSortAlgorithm.getLength() == 0) - aSortAlgorithm = LocaleData().getDefaultIndexAlgorithm( rLocale ); + aSortAlgorithm = ld.getDefaultIndexAlgorithm( rLocale ); else aSortAlgorithm = rSortAlgorithm; + OUString module = ld.getIndexModuleByAlgorithm(rLocale, aSortAlgorithm); + if (module.getLength() > 0 && createLocaleSpecificIndexEntrySupplier(module)) + return xIES; + sal_Int32 l = rLocale.Language.getLength(); sal_Int32 c = rLocale.Country.getLength(); sal_Int32 v = rLocale.Variant.getLength(); -- cgit