diff options
author | Karl Hong <khong@openoffice.org> | 2002-07-25 03:38:12 +0000 |
---|---|---|
committer | Karl Hong <khong@openoffice.org> | 2002-07-25 03:38:12 +0000 |
commit | bad692c5d3d036e612cde156c1bd7b89aa0b2248 (patch) | |
tree | 967647563ab0487d35eb1cdd62c8c95dc16802de /i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx | |
parent | 8c1d2fdcc70cadfde538e6a257c74f4457f7e2d2 (diff) |
#95565#add phonetic entry for CJK index modules
Diffstat (limited to 'i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx')
-rw-r--r-- | i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx | 73 |
1 files changed, 69 insertions, 4 deletions
diff --git a/i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx b/i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx index 82981a324ddd..5615aa81dba0 100644 --- a/i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx +++ b/i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx @@ -2,9 +2,9 @@ * * $RCSfile: indexentrysupplier_ja_phonetic.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: khong $Date: 2002/05/31 04:51:19 $ + * last change: $Author: khong $Date: 2002/06/18 22:29:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,12 +62,77 @@ #define INDEXENTRYSUPPLIER_ja_phonetic #include <indexentrysupplier_asian.hxx> #include <data/indexdata_ja_phonetic.h> +#include <strings.h> namespace com { namespace sun { namespace star { namespace i18n { rtl::OUString SAL_CALL IndexEntrySupplier_ja_phonetic::getIndexCharacter( const rtl::OUString& rIndexEntry, - const lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm ) throw (com::sun::star::uno::RuntimeException) { - return IndexEntrySupplier_CJK::getIndexString(rIndexEntry.toChar(), idx1, idx2); + const lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm ) + throw (com::sun::star::uno::RuntimeException) +{ + return IndexEntrySupplier_CJK::getIndexString(rIndexEntry.toChar(), idx, + strstr(implementationName, "syllable") ? syllable : consonant); +} + +rtl::OUString SAL_CALL IndexEntrySupplier_ja_phonetic::getIndexKey( const rtl::OUString& IndexEntry, + const rtl::OUString& PhoneticEntry, const lang::Locale& rLocale ) + throw (com::sun::star::uno::RuntimeException) +{ + return IndexEntrySupplier_CJK::getIndexString( + PhoneticEntry.getLength() > 0 ? PhoneticEntry.toChar() : IndexEntry.toChar(), idx, + strstr(implementationName, "syllable") ? syllable : consonant); +} + +sal_Int16 SAL_CALL IndexEntrySupplier_ja_phonetic::compareIndexEntry( + const rtl::OUString& IndexEntry1, const rtl::OUString& PhoneticEntry1, const lang::Locale& rLocale1, + const rtl::OUString& IndexEntry2, const rtl::OUString& PhoneticEntry2, const lang::Locale& rLocale2 ) + throw (com::sun::star::uno::RuntimeException) +{ + sal_Int16 result = collator->compareString( + IndexEntrySupplier_ja_phonetic::getIndexKey(IndexEntry1, PhoneticEntry1, rLocale1), + IndexEntrySupplier_ja_phonetic::getIndexKey(IndexEntry2, PhoneticEntry2, rLocale2)); + + if (result == 0) + return collator->compareString( + PhoneticEntry1.getLength() > 0 ? PhoneticEntry1 : IndexEntry1, + PhoneticEntry2.getLength() > 0 ? PhoneticEntry2 : IndexEntry2); + else + return result; +} + +static sal_Char first[] = "ja_phonetic_alphanumeric_first"; +sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable::loadAlgorithm( + const com::sun::star::lang::Locale& rLocale, const rtl::OUString& SortAlgorithm, + sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException) +{ + aSortAlgorithm = SortAlgorithm; + aLocale = rLocale; + return collator->loadCollatorAlgorithm(rtl::OUString::createFromAscii(first), rLocale, collatorOptions) == 0; +} +sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_consonant::loadAlgorithm( + const com::sun::star::lang::Locale& rLocale, const rtl::OUString& SortAlgorithm, + sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException) +{ + aSortAlgorithm = SortAlgorithm; + aLocale = rLocale; + return collator->loadCollatorAlgorithm(rtl::OUString::createFromAscii(first), rLocale, collatorOptions) == 0; +} +static sal_Char last[] = "ja_phonetic_alphanumeric_last"; +sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_syllable::loadAlgorithm( + const com::sun::star::lang::Locale& rLocale, const rtl::OUString& SortAlgorithm, + sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException) +{ + aSortAlgorithm = SortAlgorithm; + aLocale = rLocale; + return collator->loadCollatorAlgorithm(rtl::OUString::createFromAscii(last), rLocale, collatorOptions) == 0; +} +sal_Bool SAL_CALL IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_consonant::loadAlgorithm( + const com::sun::star::lang::Locale& rLocale, const rtl::OUString& SortAlgorithm, + sal_Int32 collatorOptions ) throw (com::sun::star::uno::RuntimeException) +{ + aSortAlgorithm = SortAlgorithm; + aLocale = rLocale; + return collator->loadCollatorAlgorithm(rtl::OUString::createFromAscii(last), rLocale, collatorOptions) == 0; } } } } } |