summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Hong <khong@openoffice.org>2002-06-18 21:36:32 +0000
committerKarl Hong <khong@openoffice.org>2002-06-18 21:36:32 +0000
commitb0173b2e4c1ce13cd8b2a8e44ad618d6625dce7a (patch)
tree7934adbeecc7e3ba51832b213affc95125ddb7ce
parentabc65d5612cb2c525183e61e4c0e94a756093188 (diff)
#99877#First implementation for XExtendedIndexEntrySupplier
-rw-r--r--i18npool/inc/indexentrysupplier.hxx82
-rw-r--r--i18npool/inc/indexentrysupplier_asian.hxx41
-rw-r--r--i18npool/inc/indexentrysupplier_default.hxx42
-rw-r--r--i18npool/source/registerservices/registerservices.cxx36
4 files changed, 135 insertions, 66 deletions
diff --git a/i18npool/inc/indexentrysupplier.hxx b/i18npool/inc/indexentrysupplier.hxx
index 94130168ebbe..b8b82b925fb4 100644
--- a/i18npool/inc/indexentrysupplier.hxx
+++ b/i18npool/inc/indexentrysupplier.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: indexentrysupplier.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: er $ $Date: 2002-03-26 17:57:44 $
+ * last change: $Author: khong $ $Date: 2002-06-18 22:34:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,7 +61,7 @@
#ifndef _I18N_INDEXENTRYSUPPLIER_HXX_
#define _I18N_INDEXENTRYSUPPLIER_HXX_
-#include <com/sun/star/i18n/XIndexEntrySupplier.hpp>
+#include <drafts/com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp>
#include <cppuhelper/implbase2.hxx> // helper for implementations
#include <com/sun/star/i18n/XCharacterClassification.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -74,37 +74,73 @@ namespace com { namespace sun { namespace star { namespace i18n {
// ----------------------------------------------------
class IndexEntrySupplier : public cppu::WeakImplHelper2
<
- XIndexEntrySupplier,
+ drafts::com::sun::star::i18n::XExtendedIndexEntrySupplier,
com::sun::star::lang::XServiceInfo
>
{
- rtl::OUString aServiceName;
- com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF;
- com::sun::star::uno::Reference < XIndexEntrySupplier > xIES;
-
- com::sun::star::lang::Locale aLocale;
- rtl::OUString aSortAlgorithm;
- sal_Bool SAL_CALL createLocaleSpecificIndexEntrySupplier(const rtl::OUString& name) throw( com::sun::star::uno::RuntimeException );
- com::sun::star::uno::Reference < XIndexEntrySupplier > SAL_CALL getLocaleSpecificIndexEntrySupplier(
- const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm) throw (com::sun::star::uno::RuntimeException);
-
-protected:
- sal_Char *implementationName;
-
public:
IndexEntrySupplier( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
- IndexEntrySupplier() {};
// Methods
+ virtual com::sun::star::uno::Sequence < com::sun::star::lang::Locale > SAL_CALL getLocaleList()
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual com::sun::star::uno::Sequence < rtl::OUString > SAL_CALL getAlgorithmList(
+ const com::sun::star::lang::Locale& rLocale )
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL loadAlgorithm(
+ const com::sun::star::lang::Locale& rLocale,
+ const rtl::OUString& SortAlgorithm, sal_Int32 collatorOptions )
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL usePhoneticEntry(
+ const com::sun::star::lang::Locale& rLocale )
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getPhoneticCandidate( const rtl::OUString& IndexEntry,
+ const com::sun::star::lang::Locale& rLocale )
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& IndexEntry,
+ const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale )
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int16 SAL_CALL compareIndexEntry( const rtl::OUString& IndexEntry1,
+ const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1,
+ const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2,
+ const com::sun::star::lang::Locale& rLocale2 )
+ throw (com::sun::star::uno::RuntimeException);
+
virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& IndexEntry,
- const com::sun::star::lang::Locale& aLocale, const rtl::OUString& SortAlgorithm ) throw (com::sun::star::uno::RuntimeException);
+ const com::sun::star::lang::Locale& rLocale, const rtl::OUString& SortAlgorithm )
+ throw (com::sun::star::uno::RuntimeException);
+
virtual rtl::OUString SAL_CALL getIndexFollowPageWord( sal_Bool MorePages,
- const com::sun::star::lang::Locale& aLocale ) throw (com::sun::star::uno::RuntimeException);
+ const com::sun::star::lang::Locale& rLocale )
+ throw (com::sun::star::uno::RuntimeException);
//XServiceInfo
- virtual rtl::OUString SAL_CALL getImplementationName() throw( com::sun::star::uno::RuntimeException );
- virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( com::sun::star::uno::RuntimeException );
- virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( com::sun::star::uno::RuntimeException );
+ virtual rtl::OUString SAL_CALL getImplementationName()
+ throw( com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
+ throw( com::sun::star::uno::RuntimeException );
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw( com::sun::star::uno::RuntimeException );
+
+private:
+ rtl::OUString aServiceName;
+ com::sun::star::uno::Reference < XExtendedIndexEntrySupplier > xIES;
+ com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF;
+ sal_Bool SAL_CALL createLocaleSpecificIndexEntrySupplier(const rtl::OUString& name) throw( com::sun::star::uno::RuntimeException );
+ com::sun::star::uno::Reference < XExtendedIndexEntrySupplier > SAL_CALL getLocaleSpecificIndexEntrySupplier(
+ const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm) throw (com::sun::star::uno::RuntimeException);
+
+protected:
+ sal_Char *implementationName;
+ com::sun::star::lang::Locale aLocale;
+ rtl::OUString aSortAlgorithm;
+ friend sal_Bool SAL_CALL operator == (const com::sun::star::lang::Locale& l1, const com::sun::star::lang::Locale& l2);
};
} } } }
diff --git a/i18npool/inc/indexentrysupplier_asian.hxx b/i18npool/inc/indexentrysupplier_asian.hxx
index 5f8e15d30bc7..dae5c160781f 100644
--- a/i18npool/inc/indexentrysupplier_asian.hxx
+++ b/i18npool/inc/indexentrysupplier_asian.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: indexentrysupplier_asian.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: khong $ $Date: 2002-05-31 04:53:29 $
+ * last change: $Author: khong $ $Date: 2002-06-18 22:34:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,7 +62,7 @@
#ifndef _I18N_INDEXENTRYSUPPLIER_CJK_HXX_
#define _I18N_INDEXENTRYSUPPLIER_CJK_HXX_
-#include <indexentrysupplier.hxx>
+#include <indexentrysupplier_default.hxx>
namespace com { namespace sun { namespace star { namespace i18n {
@@ -70,52 +70,57 @@ namespace com { namespace sun { namespace star { namespace i18n {
// class IndexEntrySupplier_CJK
// ----------------------------------------------------
-class IndexEntrySupplier_CJK : public IndexEntrySupplier {
+class IndexEntrySupplier_CJK : public IndexEntrySupplier_Unicode {
public:
- IndexEntrySupplier_CJK () {
+ IndexEntrySupplier_CJK( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ) : IndexEntrySupplier_Unicode(rxMSF) {
implementationName = "com.sun.star.i18n.IndexEntrySupplier_CJK";
};
- ~IndexEntrySupplier_CJK () {};
- virtual rtl::OUString SAL_CALL getIndexString( const rtl::OUString & IndexEntry, const sal_Unicode idxStr[],
+ virtual rtl::OUString SAL_CALL getIndexString( const sal_Unicode ch, const sal_Unicode idxStr[],
const sal_uInt16 idx1[], const sal_uInt16 idx2[]) throw (com::sun::star::uno::RuntimeException);
- virtual rtl::OUString SAL_CALL getIndexString( const rtl::OUString & IndexEntry,
+ virtual rtl::OUString SAL_CALL getIndexString( const sal_Unicode ch,
const sal_uInt16 idx1[], const sal_Unicode idx2[]) throw (com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL compareIndexKey( const rtl::OUString& IndexEntry1,
+ const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1,
+ const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2,
+ const com::sun::star::lang::Locale& rLocale2 )
+ throw (com::sun::star::uno::RuntimeException);
};
-#define INDEXENTRYSUPPLIER_CJK( algorithm ) \
+#define INDEXENTRYSUPPLIER_CJK( algorithm, UsePhonetic ) \
class IndexEntrySupplier_##algorithm : public IndexEntrySupplier_CJK {\
public:\
- IndexEntrySupplier_##algorithm () {\
+ IndexEntrySupplier_##algorithm (const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF) : IndexEntrySupplier_CJK (rxMSF) {\
implementationName = "com.sun.star.i18n.IndexEntrySupplier_##algorithm";\
+ usePhonetic = UsePhonetic;\
};\
virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& rIndexEntry,\
const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm ) throw (com::sun::star::uno::RuntimeException);\
};
#if defined( INDEXENTRYSUPPLIER_zh_pinyin ) || defined( INDEXENTRYSUPPLIER_ALL )
-INDEXENTRYSUPPLIER_CJK( zh_pinyin )
+INDEXENTRYSUPPLIER_CJK( zh_pinyin, sal_False )
#endif
#if defined( INDEXENTRYSUPPLIER_zh_stroke ) || defined( INDEXENTRYSUPPLIER_ALL )
-INDEXENTRYSUPPLIER_CJK( zh_stroke )
+INDEXENTRYSUPPLIER_CJK( zh_stroke, sal_False )
#endif
#if defined( INDEXENTRYSUPPLIER_zh_radical ) || defined( INDEXENTRYSUPPLIER_ALL )
-INDEXENTRYSUPPLIER_CJK( zh_radical )
+INDEXENTRYSUPPLIER_CJK( zh_radical, sal_False )
#endif
#if defined( INDEXENTRYSUPPLIER_zh_zhuyin ) || defined( INDEXENTRYSUPPLIER_ALL )
-INDEXENTRYSUPPLIER_CJK( zh_zhuyin )
+INDEXENTRYSUPPLIER_CJK( zh_zhuyin, sal_False )
#endif
#if defined( INDEXENTRYSUPPLIER_zh_TW_radical ) || defined( INDEXENTRYSUPPLIER_ALL )
-INDEXENTRYSUPPLIER_CJK( zh_TW_radical )
+INDEXENTRYSUPPLIER_CJK( zh_TW_radical, sal_False )
#endif
#if defined( INDEXENTRYSUPPLIER_zh_TW_stroke ) || defined( INDEXENTRYSUPPLIER_ALL )
-INDEXENTRYSUPPLIER_CJK( zh_TW_stroke )
+INDEXENTRYSUPPLIER_CJK( zh_TW_stroke, sal_False )
#endif
#if defined( INDEXENTRYSUPPLIER_ko_dict ) || defined( INDEXENTRYSUPPLIER_ALL )
-INDEXENTRYSUPPLIER_CJK( ko_dict )
+INDEXENTRYSUPPLIER_CJK( ko_dict, sal_False )
#endif
#if defined( INDEXENTRYSUPPLIER_ja_phonetic ) || defined( INDEXENTRYSUPPLIER_ALL )
-INDEXENTRYSUPPLIER_CJK( ja_phonetic )
+INDEXENTRYSUPPLIER_CJK( ja_phonetic, sal_True )
#endif
#undef INDEXENTRYSUPPLIER_CJK
diff --git a/i18npool/inc/indexentrysupplier_default.hxx b/i18npool/inc/indexentrysupplier_default.hxx
index c4f8d32519bc..ab9c003ff3d3 100644
--- a/i18npool/inc/indexentrysupplier_default.hxx
+++ b/i18npool/inc/indexentrysupplier_default.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: indexentrysupplier_default.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: er $ $Date: 2002-03-28 00:32:33 $
+ * last change: $Author: khong $ $Date: 2002-06-18 22:34:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,6 +63,7 @@
#define _I18N_INDEXENTRYSUPPLIER_UNICODE_HXX_
#include <indexentrysupplier.hxx>
+#include <collatorImpl.hxx>
namespace com { namespace sun { namespace star { namespace i18n {
@@ -72,13 +73,40 @@ namespace com { namespace sun { namespace star { namespace i18n {
class IndexEntrySupplier_Unicode : public IndexEntrySupplier {
public:
- IndexEntrySupplier_Unicode () {
- implementationName = "com.sun.star.i18n.IndexEntrySupplier_Unicode";
- };
- ~IndexEntrySupplier_Unicode () {};
+ IndexEntrySupplier_Unicode( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
+ ~IndexEntrySupplier_Unicode();
+
+ virtual sal_Bool SAL_CALL loadAlgorithm(
+ const com::sun::star::lang::Locale& rLocale,
+ const rtl::OUString& SortAlgorithm, sal_Int32 collatorOptions )
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getIndexKey( const rtl::OUString& IndexEntry,
+ const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale )
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int16 SAL_CALL compareIndexEntry( const rtl::OUString& IndexEntry1,
+ const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1,
+ const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2,
+ const com::sun::star::lang::Locale& rLocale2 )
+ throw (com::sun::star::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getIndexCharacter( const rtl::OUString& rIndexEntry,
- const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm ) throw (com::sun::star::uno::RuntimeException);
+ const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rSortAlgorithm )
+ throw (com::sun::star::uno::RuntimeException);
+
+protected:
+ sal_Bool usePhonetic;
+ CollatorImpl *collator;
+ virtual const rtl::OUString& SAL_CALL getEntry( const rtl::OUString& IndexEntry,
+ const rtl::OUString& PhoneticEntry, const com::sun::star::lang::Locale& rLocale )
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int16 SAL_CALL compareIndexKey( const rtl::OUString& IndexEntry1,
+ const rtl::OUString& PhoneticEntry1, const com::sun::star::lang::Locale& rLocale1,
+ const rtl::OUString& IndexEntry2, const ::rtl::OUString& PhoneticEntry2,
+ const com::sun::star::lang::Locale& rLocale2 )
+ throw (com::sun::star::uno::RuntimeException);
};
} } } }
diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx
index 2391c5b58b84..c034bfa17f7c 100644
--- a/i18npool/source/registerservices/registerservices.cxx
+++ b/i18npool/source/registerservices/registerservices.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: registerservices.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: khong $ $Date: 2002-05-31 07:02:49 $
+ * last change: $Author: khong $ $Date: 2002-06-18 22:36:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -172,22 +172,22 @@ IMPL_CREATEINSTANCE_MSF( NumberFormatCodeMapper )
IMPL_CREATEINSTANCE( LocaleData )
IMPL_CREATEINSTANCE_MSF( DefaultNumberingProvider )
IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_zh_pinyin )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_zh_radical )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_zh_stroke )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_zh_zhuyin )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_zh_TW_radical )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_zh_TW_stroke )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_ko_dict )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_ja_phonetic )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_alphanumeric )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_nl_alphanumeric )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_da_alphanumeric )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_ar_alphanumeric )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_he_alphanumeric )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_hi_alphanumeric )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_th_alphanumeric )
-IMPL_CREATEINSTANCE( IndexEntrySupplier_Unicode )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_zh_pinyin )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_zh_radical )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_zh_stroke )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_zh_zhuyin )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_zh_TW_radical )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_zh_TW_stroke )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ko_dict )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ja_phonetic )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_alphanumeric )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_nl_alphanumeric )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_da_alphanumeric )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ar_alphanumeric )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_he_alphanumeric )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_hi_alphanumeric )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_th_alphanumeric )
+IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_Unicode )
IMPL_CREATEINSTANCE_MSF( CalendarImpl )
IMPL_CREATEINSTANCE( Calendar_gregorian )
IMPL_CREATEINSTANCE( Calendar_hanja_yoil )