1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_i18npool.hxx"
26 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <com/sun/star/registry/XRegistryKey.hpp>
29 
30 #include <cppuhelper/factory.hxx>
31 #include <cppuhelper/weak.hxx>
32 #include <osl/mutex.hxx>
33 
34 #include <localedata.hxx>
35 #include <numberformatcode.hxx>
36 #include <nativenumbersupplier.hxx>
37 #include <defaultnumberingprovider.hxx>
38 #include <servicename.hxx>
39 
40 #define TRANSLITERATION_ALL
41 #include <transliterationImpl.hxx>
42 #include <transliteration_body.hxx>
43 #include <transliteration_caseignore.hxx>
44 #include <transliteration_Ignore.hxx>
45 #include <transliteration_OneToOne.hxx>
46 #include <textToPronounce_zh.hxx>
47 #include <numtotext_cjk.hxx>
48 #include <numtochar.hxx>
49 #include <texttonum.hxx>
50 #include <chartonum.hxx>
51 
52 #include <calendarImpl.hxx>
53 #include <calendar_gregorian.hxx>
54 #include <calendar_hijri.hxx>
55 #include <calendar_jewish.hxx>
56 
57 #define BREAKITERATOR_ALL
58 #include <breakiteratorImpl.hxx>
59 #include <breakiterator_cjk.hxx>
60 #include <breakiterator_th.hxx>
61 #include <breakiterator_unicode.hxx>
62 
63 #include <indexentrysupplier.hxx>
64 #include <indexentrysupplier_asian.hxx>
65 #include <indexentrysupplier_ja_phonetic.hxx>
66 #include <indexentrysupplier_common.hxx>
67 #include <indexentrysupplier_default.hxx>
68 
69 #define CCLASS_ALL
70 #include <characterclassificationImpl.hxx>
71 #include <scripttypedetector.hxx>
72 #include <cclass_unicode.hxx>
73 
74 #define COLLATOR_ALL
75 #include <collatorImpl.hxx>
76 #include <chaptercollator.hxx>
77 #include <collator_unicode.hxx>
78 
79 #include <inputsequencechecker.hxx>
80 #include <inputsequencechecker_th.hxx>
81 #include <inputsequencechecker_hi.hxx>
82 
83 #include <textconversionImpl.hxx>
84 #include <textconversion.hxx>
85 
86 #include <ordinalsuffix.hxx>
87 
88 #define IMPL_CREATEINSTANCE( ImplName ) \
89     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >   \
90         SAL_CALL ImplName##_CreateInstance(                                 \
91             const ::com::sun::star::uno::Reference<                         \
92                     ::com::sun::star::lang::XMultiServiceFactory >& )       \
93 {                                                                           \
94     return ::com::sun::star::uno::Reference <                               \
95             ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* )   \
96                                     new ImplName );                         \
97 }
98 
99 #define IMPL_CREATEINSTANCE_MSF( ImplName ) \
100     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >   \
101         SAL_CALL ImplName##_CreateInstance(                                 \
102             const ::com::sun::star::uno::Reference<                         \
103                     ::com::sun::star::lang::XMultiServiceFactory >& rxMSF ) \
104 {                                                                           \
105     return ::com::sun::star::uno::Reference <                               \
106             ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* )   \
107                                     new ImplName( rxMSF ) );                \
108 }
109 
110 typedef ::com::sun::star::uno::Reference<
111         ::com::sun::star::uno::XInterface > (SAL_CALL *FN_CreateInstance)(
112             const ::com::sun::star::uno::Reference<
113                 ::com::sun::star::lang::XMultiServiceFactory >& );
114 
115 #define IMPL_TRANSLITERATION_ITEM( implName ) \
116     {       TRLT_SERVICELNAME_L10N, \
117         TRLT_IMPLNAME_PREFIX  #implName, \
118         &implName##_CreateInstance }
119 
120 // -------------------------------------------------------------------------------------
121 
122 using namespace ::com::sun::star::i18n;
123 
124 IMPL_CREATEINSTANCE_MSF( NumberFormatCodeMapper )
125 IMPL_CREATEINSTANCE( NativeNumberSupplier )
126 IMPL_CREATEINSTANCE( LocaleData )
127 IMPL_CREATEINSTANCE_MSF( DefaultNumberingProvider )
128 IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier )
129 IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_asian )
130 IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable )
131 IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_consonant )
132 IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_syllable )
133 IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_consonant )
134 IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_Unicode )
135 IMPL_CREATEINSTANCE_MSF( CalendarImpl )
136 IMPL_CREATEINSTANCE( Calendar_gregorian )
137 IMPL_CREATEINSTANCE( Calendar_hanja )
138 IMPL_CREATEINSTANCE( Calendar_gengou )
139 IMPL_CREATEINSTANCE( Calendar_ROC )
140 IMPL_CREATEINSTANCE( Calendar_hijri )
141 IMPL_CREATEINSTANCE( Calendar_jewish )
142 IMPL_CREATEINSTANCE( Calendar_buddhist )
143 IMPL_CREATEINSTANCE_MSF( BreakIteratorImpl )
144 IMPL_CREATEINSTANCE( BreakIterator_Unicode )
145 IMPL_CREATEINSTANCE( BreakIterator_ja )
146 IMPL_CREATEINSTANCE( BreakIterator_zh )
147 IMPL_CREATEINSTANCE( BreakIterator_zh_TW )
148 IMPL_CREATEINSTANCE( BreakIterator_ko )
149 IMPL_CREATEINSTANCE( BreakIterator_th )
150 IMPL_CREATEINSTANCE_MSF( ChapterCollator )
151 IMPL_CREATEINSTANCE_MSF( CollatorImpl )
152 IMPL_CREATEINSTANCE( Collator_Unicode )
153 
154 IMPL_CREATEINSTANCE_MSF( CharacterClassificationImpl )
155 IMPL_CREATEINSTANCE_MSF( cclass_Unicode )
156 IMPL_CREATEINSTANCE_MSF( TransliterationImpl )
157 IMPL_CREATEINSTANCE( ScriptTypeDetector )
158 
159 IMPL_CREATEINSTANCE_MSF( InputSequenceCheckerImpl )
160 IMPL_CREATEINSTANCE( InputSequenceChecker_th )
161 IMPL_CREATEINSTANCE( InputSequenceChecker_hi )
162 
163 IMPL_CREATEINSTANCE_MSF( TextConversionImpl )
164 IMPL_CREATEINSTANCE_MSF( TextConversion_ko )
165 IMPL_CREATEINSTANCE_MSF( TextConversion_zh )
166 
167 IMPL_CREATEINSTANCE( Transliteration_u2l )
168 IMPL_CREATEINSTANCE( Transliteration_l2u )
169 IMPL_CREATEINSTANCE( Transliteration_sentencecase )
170 IMPL_CREATEINSTANCE( Transliteration_titlecase )
171 IMPL_CREATEINSTANCE( Transliteration_togglecase )
172 IMPL_CREATEINSTANCE( Transliteration_caseignore )
173 IMPL_CREATEINSTANCE( hiraganaToKatakana )
174 IMPL_CREATEINSTANCE( katakanaToHiragana )
175 IMPL_CREATEINSTANCE( ignoreKana )
176 IMPL_CREATEINSTANCE( fullwidthToHalfwidth )
177 IMPL_CREATEINSTANCE( halfwidthToFullwidth )
178 IMPL_CREATEINSTANCE( ignoreWidth )
179 
180 IMPL_CREATEINSTANCE( smallToLarge_ja_JP)
181 IMPL_CREATEINSTANCE( largeToSmall_ja_JP)
182 IMPL_CREATEINSTANCE( ignoreTraditionalKanji_ja_JP)
183 IMPL_CREATEINSTANCE( ignoreTraditionalKana_ja_JP)
184 IMPL_CREATEINSTANCE( ignoreMinusSign_ja_JP)
185 IMPL_CREATEINSTANCE( ignoreIterationMark_ja_JP)
186 IMPL_CREATEINSTANCE( ignoreSeparator_ja_JP)
187 IMPL_CREATEINSTANCE( ignoreZiZu_ja_JP)
188 IMPL_CREATEINSTANCE( ignoreBaFa_ja_JP)
189 IMPL_CREATEINSTANCE( ignoreTiJi_ja_JP)
190 IMPL_CREATEINSTANCE( ignoreHyuByu_ja_JP)
191 IMPL_CREATEINSTANCE( ignoreSeZe_ja_JP)
192 IMPL_CREATEINSTANCE( ignoreIandEfollowedByYa_ja_JP)
193 IMPL_CREATEINSTANCE( ignoreKiKuFollowedBySa_ja_JP)
194 IMPL_CREATEINSTANCE( ignoreSize_ja_JP)
195 IMPL_CREATEINSTANCE( ignoreProlongedSoundMark_ja_JP)
196 IMPL_CREATEINSTANCE( ignoreMiddleDot_ja_JP)
197 IMPL_CREATEINSTANCE( ignoreSpace_ja_JP)
198 
199 IMPL_CREATEINSTANCE( TextToChuyin_zh_TW )
200 IMPL_CREATEINSTANCE( TextToPinyin_zh_CN )
201 
202 IMPL_CREATEINSTANCE( NumToCharLower_zh_CN )
203 IMPL_CREATEINSTANCE( NumToCharUpper_zh_CN )
204 IMPL_CREATEINSTANCE( NumToCharLower_zh_TW )
205 IMPL_CREATEINSTANCE( NumToCharUpper_zh_TW )
206 IMPL_CREATEINSTANCE( NumToCharHalfwidth )
207 IMPL_CREATEINSTANCE( NumToCharFullwidth )
208 IMPL_CREATEINSTANCE( NumToCharKanjiShort_ja_JP )
209 IMPL_CREATEINSTANCE( NumToCharKanjiTraditional_ja_JP )
210 IMPL_CREATEINSTANCE( NumToCharHangul_ko )
211 IMPL_CREATEINSTANCE( NumToCharLower_ko )
212 IMPL_CREATEINSTANCE( NumToCharUpper_ko )
213 IMPL_CREATEINSTANCE( NumToCharIndic_ar )
214 IMPL_CREATEINSTANCE( NumToCharEastIndic_ar )
215 IMPL_CREATEINSTANCE( NumToCharIndic_hi )
216 IMPL_CREATEINSTANCE( NumToChar_th )
217 
218 IMPL_CREATEINSTANCE( CharToNumLower_zh_CN )
219 IMPL_CREATEINSTANCE( CharToNumUpper_zh_CN )
220 IMPL_CREATEINSTANCE( CharToNumLower_zh_TW )
221 IMPL_CREATEINSTANCE( CharToNumUpper_zh_TW )
222 IMPL_CREATEINSTANCE( CharToNumFullwidth )
223 IMPL_CREATEINSTANCE( CharToNumKanjiShort_ja_JP )
224 IMPL_CREATEINSTANCE( CharToNumKanjiTraditional_ja_JP )
225 IMPL_CREATEINSTANCE( CharToNumHangul_ko )
226 IMPL_CREATEINSTANCE( CharToNumLower_ko )
227 IMPL_CREATEINSTANCE( CharToNumUpper_ko )
228 IMPL_CREATEINSTANCE( CharToNumIndic_ar )
229 IMPL_CREATEINSTANCE( CharToNumEastIndic_ar )
230 IMPL_CREATEINSTANCE( CharToNumIndic_hi )
231 IMPL_CREATEINSTANCE( CharToNum_th )
232 
233 IMPL_CREATEINSTANCE( NumToTextLower_zh_CN )
234 IMPL_CREATEINSTANCE( NumToTextUpper_zh_CN )
235 IMPL_CREATEINSTANCE( NumToTextLower_zh_TW )
236 IMPL_CREATEINSTANCE( NumToTextUpper_zh_TW )
237 IMPL_CREATEINSTANCE( NumToTextFullwidth_zh_CN )
238 IMPL_CREATEINSTANCE( NumToTextFullwidth_zh_TW )
239 IMPL_CREATEINSTANCE( NumToTextFullwidth_ja_JP )
240 IMPL_CREATEINSTANCE( NumToTextFullwidth_ko )
241 IMPL_CREATEINSTANCE( NumToTextKanjiLongModern_ja_JP )
242 IMPL_CREATEINSTANCE( NumToTextKanjiLongTraditional_ja_JP )
243 IMPL_CREATEINSTANCE( NumToTextKanjiShortModern_ja_JP )
244 IMPL_CREATEINSTANCE( NumToTextKanjiShortTraditional_ja_JP )
245 IMPL_CREATEINSTANCE( NumToTextFormalHangul_ko )
246 IMPL_CREATEINSTANCE( NumToTextFormalLower_ko )
247 IMPL_CREATEINSTANCE( NumToTextFormalUpper_ko )
248 IMPL_CREATEINSTANCE( NumToTextInformalHangul_ko )
249 IMPL_CREATEINSTANCE( NumToTextInformalUpper_ko )
250 IMPL_CREATEINSTANCE( NumToTextInformalLower_ko )
251 
252 IMPL_CREATEINSTANCE( TextToNumLower_zh_CN )
253 IMPL_CREATEINSTANCE( TextToNumUpper_zh_CN )
254 IMPL_CREATEINSTANCE( TextToNumLower_zh_TW )
255 IMPL_CREATEINSTANCE( TextToNumUpper_zh_TW )
256 IMPL_CREATEINSTANCE( TextToNumKanjiLongModern_ja_JP )
257 IMPL_CREATEINSTANCE( TextToNumKanjiLongTraditional_ja_JP )
258 IMPL_CREATEINSTANCE( TextToNumFormalHangul_ko )
259 IMPL_CREATEINSTANCE( TextToNumFormalLower_ko )
260 IMPL_CREATEINSTANCE( TextToNumFormalUpper_ko )
261 IMPL_CREATEINSTANCE( TextToNumInformalHangul_ko )
262 IMPL_CREATEINSTANCE( TextToNumInformalUpper_ko )
263 IMPL_CREATEINSTANCE( TextToNumInformalLower_ko )
264 
265 IMPL_CREATEINSTANCE( NumToTextDate_zh )
266 IMPL_CREATEINSTANCE( NumToTextAIUFullWidth_ja_JP )
267 IMPL_CREATEINSTANCE( NumToTextAIUHalfWidth_ja_JP )
268 IMPL_CREATEINSTANCE( NumToTextIROHAFullWidth_ja_JP )
269 IMPL_CREATEINSTANCE( NumToTextIROHAHalfWidth_ja_JP )
270 IMPL_CREATEINSTANCE( NumToTextCircledNumber )
271 IMPL_CREATEINSTANCE( NumToTextHangulJamo_ko )
272 IMPL_CREATEINSTANCE( NumToTextHangulSyllable_ko )
273 IMPL_CREATEINSTANCE( NumToTextHangulCircledJamo_ko )
274 IMPL_CREATEINSTANCE( NumToTextHangulCircledSyllable_ko )
275 IMPL_CREATEINSTANCE( NumToTextTianGan_zh )
276 IMPL_CREATEINSTANCE( NumToTextDiZi_zh )
277 
278 IMPL_CREATEINSTANCE( fullwidthKatakanaToHalfwidthKatakana )
279 IMPL_CREATEINSTANCE( halfwidthKatakanaToFullwidthKatakana )
280 IMPL_CREATEINSTANCE( fullwidthToHalfwidthLikeASC )
281 IMPL_CREATEINSTANCE( halfwidthToFullwidthLikeJIS )
282 
283 IMPL_CREATEINSTANCE_MSF( OrdinalSuffix )
284 
285 static const struct InstancesArray {
286         const sal_Char* pServiceNm;
287         const sal_Char* pImplementationNm;
288         FN_CreateInstance pFn;
289 } aInstances[] = {
290     {   "com.sun.star.i18n.LocaleData",
291         "com.sun.star.i18n.LocaleData",
292         & LocaleData_CreateInstance },
293     {   "com.sun.star.i18n.NumberFormatMapper",
294         "com.sun.star.i18n.NumberFormatCodeMapper",
295         & NumberFormatCodeMapper_CreateInstance },
296     {   "com.sun.star.i18n.NativeNumberSupplier",
297         "com.sun.star.i18n.NativeNumberSupplier",
298         & NativeNumberSupplier_CreateInstance },
299     {   "com.sun.star.text.DefaultNumberingProvider",
300         "com.sun.star.text.DefaultNumberingProvider",
301         &DefaultNumberingProvider_CreateInstance },
302     {   "com.sun.star.i18n.IndexEntrySupplier",
303         "com.sun.star.i18n.IndexEntrySupplier",
304         &IndexEntrySupplier_CreateInstance },
305     {   "com.sun.star.i18n.IndexEntrySupplier_asian",
306         "com.sun.star.i18n.IndexEntrySupplier_asian",
307         &IndexEntrySupplier_asian_CreateInstance },
308     {   "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric first)",
309         "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric first)",
310         &IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable_CreateInstance },
311     {   "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric last)",
312         "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric last)",
313         &IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_syllable_CreateInstance },
314     {   "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric first) (grouped by syllable)",
315         "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric first) (grouped by syllable)",
316         &IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable_CreateInstance },
317     {   "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric first) (grouped by consonant)",
318         "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric first) (grouped by consonant)",
319         &IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_consonant_CreateInstance },
320     {   "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric last) (grouped by syllable)",
321         "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric last) (grouped by syllable)",
322         &IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_syllable_CreateInstance },
323     {   "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric last) (grouped by consonant)",
324         "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric last) (grouped by consonant)",
325         &IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_consonant_CreateInstance },
326     {       "com.sun.star.i18n.IndexEntrySupplier_Unicode",
327         "com.sun.star.i18n.IndexEntrySupplier_Unicode",
328         &IndexEntrySupplier_Unicode_CreateInstance },
329     {   "com.sun.star.i18n.LocaleCalendar",
330         "com.sun.star.i18n.CalendarImpl",
331         &CalendarImpl_CreateInstance },
332     {   "com.sun.star.i18n.Calendar_gregorian",
333         "com.sun.star.i18n.Calendar_gregorian",
334         &Calendar_gregorian_CreateInstance },
335     {   "com.sun.star.i18n.Calendar_gengou",
336         "com.sun.star.i18n.Calendar_gengou",
337         &Calendar_gengou_CreateInstance },
338     {   "com.sun.star.i18n.Calendar_ROC",
339         "com.sun.star.i18n.Calendar_ROC",
340         &Calendar_ROC_CreateInstance },
341     {   "com.sun.star.i18n.Calendar_hanja_yoil",
342         "com.sun.star.i18n.Calendar_hanja_yoil",
343         &Calendar_hanja_CreateInstance },
344     {   "com.sun.star.i18n.Calendar_hanja",
345         "com.sun.star.i18n.Calendar_hanja",
346         &Calendar_hanja_CreateInstance },
347     {   "com.sun.star.i18n.Calendar_hijri",
348         "com.sun.star.i18n.Calendar_hijri",
349         &Calendar_hijri_CreateInstance },
350     {   "com.sun.star.i18n.Calendar_jewish",
351         "com.sun.star.i18n.Calendar_jewish",
352         &Calendar_jewish_CreateInstance },
353     {   "com.sun.star.i18n.Calendar_buddhist",
354         "com.sun.star.i18n.Calendar_buddhist",
355         &Calendar_buddhist_CreateInstance },
356     {   "com.sun.star.i18n.BreakIterator",
357         "com.sun.star.i18n.BreakIterator",
358         &BreakIteratorImpl_CreateInstance },
359     {   "com.sun.star.i18n.BreakIterator_Unicode",
360         "com.sun.star.i18n.BreakIterator_Unicode",
361         &BreakIterator_Unicode_CreateInstance },
362     {   "com.sun.star.i18n.BreakIterator_ja",
363         "com.sun.star.i18n.BreakIterator_ja",
364         &BreakIterator_ja_CreateInstance },
365     {   "com.sun.star.i18n.BreakIterator_zh",
366         "com.sun.star.i18n.BreakIterator_zh",
367         &BreakIterator_zh_CreateInstance },
368     {   "com.sun.star.i18n.BreakIterator_zh_TW",
369         "com.sun.star.i18n.BreakIterator_zh_TW",
370         &BreakIterator_zh_TW_CreateInstance },
371     {   "com.sun.star.i18n.BreakIterator_ko",
372         "com.sun.star.i18n.BreakIterator_ko",
373         &BreakIterator_ko_CreateInstance },
374     {   "com.sun.star.i18n.BreakIterator_th",
375         "com.sun.star.i18n.BreakIterator_th",
376         &BreakIterator_th_CreateInstance },
377     {   "com.sun.star.i18n.Collator",
378         "com.sun.star.i18n.Collator",
379         &CollatorImpl_CreateInstance },
380     {   "com.sun.star.i18n.ChapterCollator",
381         "com.sun.star.i18n.ChapterCollator",
382         &ChapterCollator_CreateInstance },
383     {   "com.sun.star.i18n.Collator_Unicode",
384         "com.sun.star.i18n.Collator_Unicode",
385         &Collator_Unicode_CreateInstance },
386     {   "com.sun.star.i18n.ScriptTypeDetector",
387         "com.sun.star.i18n.ScriptTypeDetector",
388         &ScriptTypeDetector_CreateInstance },
389     {   "com.sun.star.i18n.CharacterClassification",
390         "com.sun.star.i18n.CharacterClassification",
391         &CharacterClassificationImpl_CreateInstance },
392     {   "com.sun.star.i18n.CharacterClassification_Unicode",
393         "com.sun.star.i18n.CharacterClassification_Unicode",
394         &cclass_Unicode_CreateInstance },
395     {   "com.sun.star.i18n.InputSequenceChecker",
396         "com.sun.star.i18n.InputSequenceChecker",
397         &InputSequenceCheckerImpl_CreateInstance },
398     {   "com.sun.star.i18n.InputSequenceChecker_th",
399         "com.sun.star.i18n.InputSequenceChecker_th",
400         &InputSequenceChecker_th_CreateInstance },
401     {   "com.sun.star.i18n.InputSequenceChecker_hi",
402         "com.sun.star.i18n.InputSequenceChecker_hi",
403         &InputSequenceChecker_hi_CreateInstance },
404     {   "com.sun.star.i18n.TextConversion",
405         "com.sun.star.i18n.TextConversion",
406         &TextConversionImpl_CreateInstance },
407     {   "com.sun.star.i18n.TextConversion_ko",
408         "com.sun.star.i18n.TextConversion_ko",
409         &TextConversion_ko_CreateInstance },
410     {   "com.sun.star.i18n.TextConversion_zh",
411         "com.sun.star.i18n.TextConversion_zh",
412         &TextConversion_zh_CreateInstance },
413     {   TRLT_SERVICELNAME,
414         TRLT_IMPLNAME ,
415         &TransliterationImpl_CreateInstance },
416     {   TRLT_SERVICELNAME_L10N,
417         TRLT_IMPLNAME_PREFIX  "UPPERCASE_LOWERCASE",
418         &Transliteration_u2l_CreateInstance },
419     {   TRLT_SERVICELNAME_L10N,
420         TRLT_IMPLNAME_PREFIX  "LOWERCASE_UPPERCASE",
421         &Transliteration_l2u_CreateInstance },
422     {   TRLT_SERVICELNAME_L10N,
423         TRLT_IMPLNAME_PREFIX  "SENTENCE_CASE",
424         &Transliteration_sentencecase_CreateInstance },
425     {   TRLT_SERVICELNAME_L10N,
426         TRLT_IMPLNAME_PREFIX  "TITLE_CASE",
427         &Transliteration_titlecase_CreateInstance },
428     {   TRLT_SERVICELNAME_L10N,
429         TRLT_IMPLNAME_PREFIX  "TOGGLE_CASE",
430         &Transliteration_togglecase_CreateInstance },
431     {   TRLT_SERVICELNAME_L10N,
432         TRLT_IMPLNAME_PREFIX  "IGNORE_CASE",
433         &Transliteration_caseignore_CreateInstance },
434     {   TRLT_SERVICELNAME_L10N,
435         TRLT_IMPLNAME_PREFIX  "HIRAGANA_KATAKANA",
436         &hiraganaToKatakana_CreateInstance },
437     {   TRLT_SERVICELNAME_L10N,
438         TRLT_IMPLNAME_PREFIX  "KATAKANA_HIRAGANA",
439         &katakanaToHiragana_CreateInstance },
440     {   TRLT_SERVICELNAME_L10N,
441         TRLT_IMPLNAME_PREFIX  "IGNORE_KANA",
442         &ignoreKana_CreateInstance },
443     {   TRLT_SERVICELNAME_L10N,
444         TRLT_IMPLNAME_PREFIX  "FULLWIDTH_HALFWIDTH",
445         &fullwidthToHalfwidth_CreateInstance },
446     {   TRLT_SERVICELNAME_L10N,
447         TRLT_IMPLNAME_PREFIX  "HALFWIDTH_FULLWIDTH",
448         &halfwidthToFullwidth_CreateInstance },
449     {   TRLT_SERVICELNAME_L10N,
450         TRLT_IMPLNAME_PREFIX  "IGNORE_WIDTH",
451         &ignoreWidth_CreateInstance },
452     IMPL_TRANSLITERATION_ITEM (smallToLarge_ja_JP),
453     IMPL_TRANSLITERATION_ITEM (largeToSmall_ja_JP),
454     IMPL_TRANSLITERATION_ITEM (ignoreTraditionalKanji_ja_JP),
455     IMPL_TRANSLITERATION_ITEM (ignoreTraditionalKana_ja_JP),
456     IMPL_TRANSLITERATION_ITEM (ignoreKana),
457     IMPL_TRANSLITERATION_ITEM (ignoreMinusSign_ja_JP),
458     IMPL_TRANSLITERATION_ITEM (ignoreIterationMark_ja_JP),
459     IMPL_TRANSLITERATION_ITEM (ignoreSeparator_ja_JP),
460     IMPL_TRANSLITERATION_ITEM (ignoreZiZu_ja_JP),
461     IMPL_TRANSLITERATION_ITEM (ignoreBaFa_ja_JP),
462     IMPL_TRANSLITERATION_ITEM (ignoreTiJi_ja_JP),
463     IMPL_TRANSLITERATION_ITEM (ignoreHyuByu_ja_JP),
464     IMPL_TRANSLITERATION_ITEM (ignoreSeZe_ja_JP),
465     IMPL_TRANSLITERATION_ITEM (ignoreIandEfollowedByYa_ja_JP),
466     IMPL_TRANSLITERATION_ITEM (ignoreKiKuFollowedBySa_ja_JP),
467     IMPL_TRANSLITERATION_ITEM (ignoreSize_ja_JP),
468     IMPL_TRANSLITERATION_ITEM (ignoreProlongedSoundMark_ja_JP),
469     IMPL_TRANSLITERATION_ITEM (ignoreMiddleDot_ja_JP),
470     IMPL_TRANSLITERATION_ITEM (ignoreSpace_ja_JP),
471     IMPL_TRANSLITERATION_ITEM (TextToPinyin_zh_CN),
472     IMPL_TRANSLITERATION_ITEM (TextToChuyin_zh_TW),
473 
474     IMPL_TRANSLITERATION_ITEM (NumToCharUpper_zh_CN),
475     IMPL_TRANSLITERATION_ITEM (NumToCharLower_zh_CN),
476     IMPL_TRANSLITERATION_ITEM (NumToCharUpper_zh_TW),
477     IMPL_TRANSLITERATION_ITEM (NumToCharLower_zh_TW),
478     IMPL_TRANSLITERATION_ITEM (NumToCharHalfwidth),
479     IMPL_TRANSLITERATION_ITEM (NumToCharFullwidth),
480     IMPL_TRANSLITERATION_ITEM (NumToCharKanjiShort_ja_JP),
481     IMPL_TRANSLITERATION_ITEM (NumToCharKanjiTraditional_ja_JP),
482     IMPL_TRANSLITERATION_ITEM (NumToCharLower_ko),
483     IMPL_TRANSLITERATION_ITEM (NumToCharUpper_ko),
484     IMPL_TRANSLITERATION_ITEM (NumToCharHangul_ko),
485     IMPL_TRANSLITERATION_ITEM (NumToCharIndic_ar),
486     IMPL_TRANSLITERATION_ITEM (NumToCharEastIndic_ar),
487     IMPL_TRANSLITERATION_ITEM (NumToCharIndic_hi),
488     IMPL_TRANSLITERATION_ITEM (NumToChar_th),
489 
490     IMPL_TRANSLITERATION_ITEM (CharToNumUpper_zh_CN),
491     IMPL_TRANSLITERATION_ITEM (CharToNumLower_zh_CN),
492     IMPL_TRANSLITERATION_ITEM (CharToNumUpper_zh_TW),
493     IMPL_TRANSLITERATION_ITEM (CharToNumLower_zh_TW),
494     IMPL_TRANSLITERATION_ITEM (CharToNumFullwidth),
495     IMPL_TRANSLITERATION_ITEM (CharToNumKanjiShort_ja_JP),
496     IMPL_TRANSLITERATION_ITEM (CharToNumKanjiTraditional_ja_JP),
497     IMPL_TRANSLITERATION_ITEM (CharToNumLower_ko),
498     IMPL_TRANSLITERATION_ITEM (CharToNumUpper_ko),
499     IMPL_TRANSLITERATION_ITEM (CharToNumHangul_ko),
500     IMPL_TRANSLITERATION_ITEM (CharToNumIndic_ar),
501     IMPL_TRANSLITERATION_ITEM (CharToNumEastIndic_ar),
502     IMPL_TRANSLITERATION_ITEM (CharToNumIndic_hi),
503     IMPL_TRANSLITERATION_ITEM (CharToNum_th),
504 
505     IMPL_TRANSLITERATION_ITEM (NumToTextUpper_zh_CN),
506     IMPL_TRANSLITERATION_ITEM (NumToTextLower_zh_CN),
507     IMPL_TRANSLITERATION_ITEM (NumToTextUpper_zh_TW),
508     IMPL_TRANSLITERATION_ITEM (NumToTextLower_zh_TW),
509     IMPL_TRANSLITERATION_ITEM (NumToTextFullwidth_zh_CN),
510     IMPL_TRANSLITERATION_ITEM (NumToTextFullwidth_zh_TW),
511     IMPL_TRANSLITERATION_ITEM (NumToTextFullwidth_ja_JP),
512     IMPL_TRANSLITERATION_ITEM (NumToTextFullwidth_ko),
513     IMPL_TRANSLITERATION_ITEM (NumToTextKanjiLongModern_ja_JP),
514     IMPL_TRANSLITERATION_ITEM (NumToTextKanjiLongTraditional_ja_JP),
515     IMPL_TRANSLITERATION_ITEM (NumToTextKanjiShortModern_ja_JP),
516     IMPL_TRANSLITERATION_ITEM (NumToTextKanjiShortTraditional_ja_JP),
517     IMPL_TRANSLITERATION_ITEM (NumToTextInformalHangul_ko),
518     IMPL_TRANSLITERATION_ITEM (NumToTextInformalLower_ko),
519     IMPL_TRANSLITERATION_ITEM (NumToTextInformalUpper_ko),
520     IMPL_TRANSLITERATION_ITEM (NumToTextFormalHangul_ko),
521     IMPL_TRANSLITERATION_ITEM (NumToTextFormalLower_ko),
522     IMPL_TRANSLITERATION_ITEM (NumToTextFormalUpper_ko),
523 
524     IMPL_TRANSLITERATION_ITEM (TextToNumUpper_zh_CN),
525     IMPL_TRANSLITERATION_ITEM (TextToNumLower_zh_CN),
526     IMPL_TRANSLITERATION_ITEM (TextToNumUpper_zh_TW),
527     IMPL_TRANSLITERATION_ITEM (TextToNumLower_zh_TW),
528     IMPL_TRANSLITERATION_ITEM (TextToNumKanjiLongModern_ja_JP),
529     IMPL_TRANSLITERATION_ITEM (TextToNumKanjiLongTraditional_ja_JP),
530     IMPL_TRANSLITERATION_ITEM (TextToNumInformalHangul_ko),
531     IMPL_TRANSLITERATION_ITEM (TextToNumInformalLower_ko),
532     IMPL_TRANSLITERATION_ITEM (TextToNumInformalUpper_ko),
533     IMPL_TRANSLITERATION_ITEM (TextToNumFormalHangul_ko),
534     IMPL_TRANSLITERATION_ITEM (TextToNumFormalLower_ko),
535     IMPL_TRANSLITERATION_ITEM (TextToNumFormalUpper_ko),
536 
537     IMPL_TRANSLITERATION_ITEM (NumToTextDate_zh),
538     IMPL_TRANSLITERATION_ITEM (NumToTextAIUFullWidth_ja_JP),
539     IMPL_TRANSLITERATION_ITEM (NumToTextAIUHalfWidth_ja_JP),
540     IMPL_TRANSLITERATION_ITEM (NumToTextIROHAFullWidth_ja_JP),
541     IMPL_TRANSLITERATION_ITEM (NumToTextIROHAHalfWidth_ja_JP),
542     IMPL_TRANSLITERATION_ITEM (NumToTextCircledNumber),
543     IMPL_TRANSLITERATION_ITEM (NumToTextHangulJamo_ko),
544     IMPL_TRANSLITERATION_ITEM (NumToTextHangulSyllable_ko),
545     IMPL_TRANSLITERATION_ITEM (NumToTextHangulCircledJamo_ko),
546     IMPL_TRANSLITERATION_ITEM (NumToTextHangulCircledSyllable_ko),
547     IMPL_TRANSLITERATION_ITEM (NumToTextTianGan_zh),
548     IMPL_TRANSLITERATION_ITEM (NumToTextDiZi_zh),
549 
550     {   "com.sun.star.i18n.OrdinalSuffix",
551         "com.sun.star.i18n.OrdinalSuffix",
552         & OrdinalSuffix_CreateInstance },
553 
554     {   TRLT_SERVICELNAME_L10N,
555         TRLT_IMPLNAME_PREFIX  "FULLWIDTHKATAKANA_HALFWIDTHKATAKANA",
556         &fullwidthKatakanaToHalfwidthKatakana_CreateInstance },
557     {   TRLT_SERVICELNAME_L10N,
558         TRLT_IMPLNAME_PREFIX  "HALFWIDTHKATAKANA_FULLWIDTHKATAKANA",
559         &halfwidthKatakanaToFullwidthKatakana_CreateInstance },
560     {   TRLT_SERVICELNAME_L10N,
561         TRLT_IMPLNAME_PREFIX  "FULLWIDTH_HALFWIDTH_LIKE_ASC",
562         &fullwidthToHalfwidthLikeASC_CreateInstance },
563     {   TRLT_SERVICELNAME_L10N,
564         TRLT_IMPLNAME_PREFIX  "HALFWIDTH_FULLWIDTH_LIKE_JIS",
565         &halfwidthToFullwidthLikeJIS_CreateInstance },
566 // add here new services !!
567     { 0, 0, 0 }
568 };
569 
570 
571 extern "C"
572 {
573 
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)574 void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** /*ppEnv*/ )
575 {
576     *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
577 }
578 
component_getFactory(const sal_Char * sImplementationName,void * _pServiceManager,void *)579 void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* /*_pRegistryKey*/ )
580 {
581     void* pRet = NULL;
582 
583     ::com::sun::star::lang::XMultiServiceFactory* pServiceManager =
584         reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >
585             ( _pServiceManager );
586     ::com::sun::star::uno::Reference<
587             ::com::sun::star::lang::XSingleServiceFactory > xFactory;
588 
589     for( const InstancesArray* pArr = aInstances; pArr->pServiceNm; ++pArr )
590     {
591         if( 0 == rtl_str_compare( sImplementationName, pArr->pImplementationNm ) )
592         {
593             ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames(1);
594             aServiceNames.getArray()[0] =
595                 ::rtl::OUString::createFromAscii( pArr->pServiceNm );
596             xFactory = ::cppu::createSingleFactory(
597                     pServiceManager, aServiceNames.getArray()[0],
598                     *pArr->pFn, aServiceNames );
599             break;
600         }
601     }
602 
603     if ( xFactory.is() )
604     {
605         xFactory->acquire();
606         pRet = xFactory.get();
607     }
608 
609     return pRet;
610 }
611 
612 }   // "C"
613