1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "transliterationImpl.hxx"
22 #include "servicename.hxx"
24 #include <com/sun/star/i18n/LocaleData.hpp>
25 #include <com/sun/star/i18n/TransliterationType.hpp>
26 #include <com/sun/star/lang/XComponent.hpp>
28 #include <comphelper/componentcontext.hxx>
29 #include <comphelper/processfactory.hxx>
30 #include <rtl/instance.hxx>
31 #include <rtl/string.h>
32 #include <rtl/ustring.hxx>
33 #include <rtl/ustrbuf.hxx>
37 #if OSL_DEBUG_LEVEL > 1
41 using namespace com::sun::star::uno
;
42 using namespace com::sun::star::lang
;
44 using ::rtl::OUString
;
46 namespace com
{ namespace sun
{ namespace star
{ namespace i18n
{
48 #define ERROR RuntimeException()
50 #define TmItem1( name ) \
51 {TransliterationModules_##name, TransliterationModulesNew_##name, #name}
53 #define TmItem2( name ) \
54 {(TransliterationModules)0, TransliterationModulesNew_##name, #name}
57 static struct TMlist
{
58 TransliterationModules tm
;
59 TransliterationModulesNew tmn
;
60 const sal_Char
*implName
;
61 } TMlist
[] = { // Modules ModulesNew
62 TmItem1 (IGNORE_CASE
), // 0. (1<<8 256) (7)
63 TmItem1 (IGNORE_WIDTH
), // 1. (1<<9 512) (8)
64 TmItem1 (IGNORE_KANA
), // 2. (1<<10 1024) (9)
65 // No enum define for this trans. application has to use impl name to load it
66 // TmItem1 (IGNORE_CASE_SIMPLE), // (1<<11 1024) (66)
68 TmItem1 (ignoreTraditionalKanji_ja_JP
), // 3. (1<<12 4096) (10)
69 TmItem1 (ignoreTraditionalKana_ja_JP
), // 4. (1<<13 8192) (11)
70 TmItem1 (ignoreMinusSign_ja_JP
), // 5. (1<<13 16384) (12)
71 TmItem1 (ignoreIterationMark_ja_JP
), // 6. (1<<14 32768) (13)
72 TmItem1 (ignoreSeparator_ja_JP
), // 7. (1<<15 65536) (14)
73 TmItem1 (ignoreSize_ja_JP
), // 15. (1<<23 16777216) (22)
74 TmItem1 (ignoreMiddleDot_ja_JP
), // 17. (1<<25 67108864) (24)
75 TmItem1 (ignoreSpace_ja_JP
), // 18. (1<<26 134217728) (25)
76 TmItem1 (ignoreZiZu_ja_JP
), // 8. (1<<16 131072) (15)
77 TmItem1 (ignoreBaFa_ja_JP
), // 9. (1<<17 262144) (16)
78 TmItem1 (ignoreTiJi_ja_JP
), // 10. (1<<18 524288) (17)
79 TmItem1 (ignoreHyuByu_ja_JP
), // 11. (1<<19 1048576) (18)
80 TmItem1 (ignoreSeZe_ja_JP
), // 12. (1<<20 2097152) (19)
81 TmItem1 (ignoreIandEfollowedByYa_ja_JP
), // 13. (1<<21 4194304) (20)
82 TmItem1 (ignoreKiKuFollowedBySa_ja_JP
), // 14. (1<<22 8388608) (21)
83 TmItem1 (ignoreProlongedSoundMark_ja_JP
), // 16. (1<<24 33554432) (23)
85 TmItem1 (UPPERCASE_LOWERCASE
), // 19. (1) (1)
86 TmItem1 (LOWERCASE_UPPERCASE
), // 20. (2) (2)
87 TmItem1 (HALFWIDTH_FULLWIDTH
), // 21. (3) (3)
88 TmItem1 (FULLWIDTH_HALFWIDTH
), // 22. (4) (4)
89 TmItem1 (KATAKANA_HIRAGANA
), // 23. (5) (5)
90 TmItem1 (HIRAGANA_KATAKANA
), // 24. (6) (6)
92 TmItem1 (smallToLarge_ja_JP
), // 25. (1<<27 268435456) (26)
93 TmItem1 (largeToSmall_ja_JP
), // 26. (1<<28 536870912) (27)
94 TmItem2 (NumToTextLower_zh_CN
), // 27. () (28)
95 TmItem2 (NumToTextUpper_zh_CN
), // 28. () (29)
96 TmItem2 (NumToTextLower_zh_TW
), // 29. () (30)
97 TmItem2 (NumToTextUpper_zh_TW
), // 30. () (31)
98 TmItem2 (NumToTextFormalHangul_ko
), // 31. () (32)
99 TmItem2 (NumToTextFormalLower_ko
), // 32. () (33)
100 TmItem2 (NumToTextFormalUpper_ko
), // 33. () (34)
101 TmItem2 (NumToTextInformalHangul_ko
), // 34. () (35)
102 TmItem2 (NumToTextInformalLower_ko
), // 35. () (36)
103 TmItem2 (NumToTextInformalUpper_ko
), // 36. () (37)
104 TmItem2 (NumToCharLower_zh_CN
), // 37. () (38)
105 TmItem2 (NumToCharUpper_zh_CN
), // 38. () (39)
106 TmItem2 (NumToCharLower_zh_TW
), // 39. () (40)
107 TmItem2 (NumToCharUpper_zh_TW
), // 40. () (41)
108 TmItem2 (NumToCharHangul_ko
), // 41. () (42)
109 TmItem2 (NumToCharLower_ko
), // 42. () (43)
110 TmItem2 (NumToCharUpper_ko
), // 43. () (44)
111 TmItem2 (NumToCharFullwidth
), // 44. () (45)
112 TmItem2 (NumToCharKanjiShort_ja_JP
), // 45. () (46)
113 TmItem2 (TextToNumLower_zh_CN
), // 46. () (47)
114 TmItem2 (TextToNumUpper_zh_CN
), // 47. () (48)
115 TmItem2 (TextToNumLower_zh_TW
), // 48. () (49)
116 TmItem2 (TextToNumUpper_zh_TW
), // 49. () (50)
117 TmItem2 (TextToNumFormalHangul_ko
), // 50. () (51)
118 TmItem2 (TextToNumFormalLower_ko
), // 51. () (52)
119 TmItem2 (TextToNumFormalUpper_ko
), // 52. () (53)
120 TmItem2 (TextToNumInformalHangul_ko
), // 53. () (54)
121 TmItem2 (TextToNumInformalLower_ko
), // 54. () (55)
122 TmItem2 (TextToNumInformalUpper_ko
), // 55. () (56)
124 TmItem2 (CharToNumLower_zh_CN
), // 56. () (59)
125 TmItem2 (CharToNumUpper_zh_CN
), // 57. () (60)
126 TmItem2 (CharToNumLower_zh_TW
), // 58. () (61)
127 TmItem2 (CharToNumUpper_zh_TW
), // 59. () (62)
128 TmItem2 (CharToNumHangul_ko
), // 60. () (63)
129 TmItem2 (CharToNumLower_ko
), // 61. () (64)
130 TmItem2 (CharToNumUpper_ko
), // 62. () (65)
132 // no enum defined for these trans. application has to use impl name to load them
133 // TmItem2 (NumToCharArabic_Indic), // () (67)
134 // TmItem2 (NumToCharEstern_Arabic_Indic),// () (68)
135 // TmItem2 (NumToCharIndic), // () (69)
136 // TmItem2 (NumToCharThai), // () (70)
137 {(TransliterationModules
)0, (TransliterationModulesNew
)0, NULL
}
140 // Constructor/Destructor
141 TransliterationImpl::TransliterationImpl(const Reference
<XComponentContext
>& xContext
) : mxContext(xContext
)
144 caseignoreOnly
= sal_True
;
146 mxLocaledata
.set(LocaleData::create(xContext
));
149 TransliterationImpl::~TransliterationImpl()
151 mxLocaledata
.clear();
158 TransliterationImpl::getName() throw(RuntimeException
)
160 if (numCascade
== 1 && bodyCascade
[0].is())
161 return bodyCascade
[0]->getName();
163 return ( OUString("Not Loaded"));
168 TransliterationImpl::getType() throw(RuntimeException
)
171 return (TransliterationType::CASCADE
|TransliterationType::IGNORE
);
172 if (numCascade
> 0 && bodyCascade
[0].is())
173 return(bodyCascade
[0]->getType());
178 TransliterationImpl::loadModule( TransliterationModules modType
, const Locale
& rLocale
)
179 throw(RuntimeException
)
182 if (modType
&TransliterationModules_IGNORE_MASK
&& modType
&TransliterationModules_NON_IGNORE_MASK
) {
184 } else if (modType
&TransliterationModules_IGNORE_MASK
) {
185 #define TransliterationModules_IGNORE_CASE_MASK (TransliterationModules_IGNORE_CASE | \
186 TransliterationModules_IGNORE_WIDTH | \
187 TransliterationModules_IGNORE_KANA)
188 sal_Int32 mask
= ((modType
&TransliterationModules_IGNORE_CASE_MASK
) == modType
) ?
189 TransliterationModules_IGNORE_CASE_MASK
: TransliterationModules_IGNORE_MASK
;
190 for (sal_Int16 i
= 0; TMlist
[i
].tm
& mask
; i
++) {
191 if (modType
& TMlist
[i
].tm
)
192 if (loadModuleByName(OUString::createFromAscii(TMlist
[i
].implName
),
193 bodyCascade
[numCascade
], rLocale
))
196 } else if (modType
&TransliterationModules_NON_IGNORE_MASK
) {
197 for (sal_Int16 i
= 0; TMlist
[i
].tm
; i
++) {
198 if (TMlist
[i
].tm
== modType
) {
199 if (loadModuleByName(OUString::createFromAscii(TMlist
[i
].implName
), bodyCascade
[numCascade
], rLocale
))
208 TransliterationImpl::loadModuleNew( const Sequence
< TransliterationModulesNew
> & modType
, const Locale
& rLocale
)
209 throw(RuntimeException
)
212 sal_Int32 mask
= 0, count
= modType
.getLength();
213 if (count
> maxCascade
)
214 throw ERROR
; // could not handle more than maxCascade
215 for (sal_Int16 i
= 0; i
< count
; i
++) {
216 for (sal_Int16 j
= 0; TMlist
[j
].tmn
; j
++) {
217 if (TMlist
[j
].tmn
== modType
[i
]) {
219 mask
= TMlist
[i
].tm
&& (TMlist
[i
].tm
&TransliterationModules_IGNORE_MASK
) ?
220 TransliterationModules_IGNORE_MASK
: TransliterationModules_NON_IGNORE_MASK
;
221 else if (mask
== TransliterationModules_IGNORE_MASK
&&
222 (TMlist
[i
].tm
&TransliterationModules_IGNORE_MASK
) == 0)
223 throw ERROR
; // could not mess up ignore trans. with non_ignore trans.
224 if (loadModuleByName(OUString::createFromAscii(TMlist
[j
].implName
), bodyCascade
[numCascade
], rLocale
))
233 TransliterationImpl::loadModuleByImplName(const OUString
& implName
, const Locale
& rLocale
)
234 throw(RuntimeException
)
237 if (loadModuleByName(implName
, bodyCascade
[numCascade
], rLocale
))
243 TransliterationImpl::loadModulesByImplNames(const Sequence
< OUString
>& implNameList
, const Locale
& rLocale
) throw(RuntimeException
)
245 if (implNameList
.getLength() > maxCascade
|| implNameList
.getLength() <= 0)
249 for (sal_Int32 i
= 0; i
< implNameList
.getLength(); i
++)
250 if (loadModuleByName(implNameList
[i
], bodyCascade
[numCascade
], rLocale
))
255 Sequence
<OUString
> SAL_CALL
256 TransliterationImpl::getAvailableModules( const Locale
& rLocale
, sal_Int16 sType
) throw(RuntimeException
)
258 const Sequence
<OUString
> &translist
= mxLocaledata
->getTransliterations(rLocale
);
259 Sequence
<OUString
> r(translist
.getLength());
260 Reference
<XExtendedTransliteration
> body
;
262 for (sal_Int32 i
= 0; i
< translist
.getLength(); i
++)
264 if (loadModuleByName(translist
[i
], body
, rLocale
)) {
265 if (body
->getType() & sType
)
266 r
[n
++] = translist
[i
];
276 TransliterationImpl::transliterate( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
,
277 Sequence
< sal_Int32
>& offset
) throw(RuntimeException
)
282 if (offset
.getLength() != nCount
)
283 offset
.realloc(nCount
);
286 if ( startPos
== 0 && nCount
== inStr
.getLength() )
287 return bodyCascade
[0]->transliterate( inStr
, 0, nCount
, offset
);
290 OUString tmpStr
= inStr
.copy(startPos
, nCount
);
291 tmpStr
= bodyCascade
[0]->transliterate(tmpStr
, 0, nCount
, offset
);
294 sal_Int32
* pArr
= offset
.getArray();
295 nCount
= offset
.getLength();
296 for (sal_Int32 j
= 0; j
< nCount
; j
++)
304 OUString tmpStr
= inStr
.copy(startPos
, nCount
);
305 sal_Int32
* pArr
= offset
.getArray();
306 for (sal_Int32 j
= 0; j
< nCount
; j
++)
307 pArr
[j
] = startPos
+ j
;
309 sal_Int16 from
= 0, to
= 1, tmp
;
310 Sequence
<sal_Int32
> off
[2];
313 off
[from
].realloc(nCount
);
314 for (sal_Int32 i
= 0; i
< numCascade
; i
++) {
315 tmpStr
= bodyCascade
[i
]->transliterate(tmpStr
, 0, nCount
, off
[from
]);
317 nCount
= tmpStr
.getLength();
319 tmp
= from
; from
= to
; to
= tmp
;
320 for (sal_Int32 j
= 0; j
< nCount
; j
++)
321 off
[to
][j
] = off
[from
][off
[to
][j
]];
331 TransliterationImpl::folding( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
,
332 Sequence
< sal_Int32
>& offset
) throw(RuntimeException
)
337 if (offset
.getLength() != nCount
)
338 offset
.realloc(nCount
);
341 if ( startPos
== 0 && nCount
== inStr
.getLength() )
342 return bodyCascade
[0]->folding( inStr
, 0, nCount
, offset
);
345 OUString tmpStr
= inStr
.copy(startPos
, nCount
);
346 tmpStr
= bodyCascade
[0]->folding(tmpStr
, 0, nCount
, offset
);
349 sal_Int32
* pArr
= offset
.getArray();
350 nCount
= offset
.getLength();
351 for (sal_Int32 j
= 0; j
< nCount
; j
++)
359 OUString tmpStr
= inStr
.copy(startPos
, nCount
);
360 sal_Int32
* pArr
= offset
.getArray();
361 for (sal_Int32 j
= 0; j
< nCount
; j
++)
362 pArr
[j
] = startPos
+ j
;
364 sal_Int16 from
= 0, to
= 1, tmp
;
365 Sequence
<sal_Int32
> off
[2];
368 for (sal_Int32 i
= 0; i
< numCascade
; i
++) {
369 tmpStr
= bodyCascade
[i
]->folding(tmpStr
, 0, nCount
, off
[from
]);
371 nCount
= tmpStr
.getLength();
373 tmp
= from
; from
= to
; to
= tmp
;
374 for (sal_Int32 j
= 0; j
< nCount
; j
++)
375 off
[to
][j
] = off
[from
][off
[to
][j
]];
383 TransliterationImpl::transliterateString2String( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
) throw(RuntimeException
)
387 else if (numCascade
== 1)
388 return bodyCascade
[0]->transliterateString2String( inStr
, startPos
, nCount
);
390 OUString tmpStr
= bodyCascade
[0]->transliterateString2String(inStr
, startPos
, nCount
);
392 for (sal_Int32 i
= 1; i
< numCascade
; i
++)
393 tmpStr
= bodyCascade
[i
]->transliterateString2String(tmpStr
, 0, tmpStr
.getLength());
399 TransliterationImpl::transliterateChar2String( sal_Unicode inChar
) throw(RuntimeException
)
402 return OUString(&inChar
, 1);
403 else if (numCascade
== 1)
404 return bodyCascade
[0]->transliterateChar2String( inChar
);
406 OUString tmpStr
= bodyCascade
[0]->transliterateChar2String(inChar
);
408 for (sal_Int32 i
= 1; i
< numCascade
; i
++)
409 tmpStr
= bodyCascade
[i
]->transliterateString2String(tmpStr
, 0, tmpStr
.getLength());
415 TransliterationImpl::transliterateChar2Char( sal_Unicode inChar
) throw(MultipleCharsOutputException
, RuntimeException
)
417 sal_Unicode tmpChar
= inChar
;
418 for (sal_Int32 i
= 0; i
< numCascade
; i
++)
419 tmpChar
= bodyCascade
[i
]->transliterateChar2Char(tmpChar
);
425 TransliterationImpl::equals(
426 const OUString
& str1
, sal_Int32 pos1
, sal_Int32 nCount1
, sal_Int32
& nMatch1
,
427 const OUString
& str2
, sal_Int32 pos2
, sal_Int32 nCount2
, sal_Int32
& nMatch2
)
428 throw(RuntimeException
)
430 // since this is an API function make it user fail safe
439 if ( !nCount1
|| !nCount2
||
440 pos1
>= str1
.getLength() || pos2
>= str2
.getLength() ||
441 pos1
< 0 || pos2
< 0 ) {
442 nMatch1
= nMatch2
= 0;
443 // two empty strings return true, else false
444 return !nCount1
&& !nCount2
&& pos1
== str1
.getLength() && pos2
== str2
.getLength();
446 if ( pos1
+ nCount1
> str1
.getLength() )
447 nCount1
= str1
.getLength() - pos1
;
448 if ( pos2
+ nCount2
> str2
.getLength() )
449 nCount2
= str2
.getLength() - pos2
;
451 if (caseignoreOnly
&& caseignore
.is())
452 return caseignore
->equals(str1
, pos1
, nCount1
, nMatch1
, str2
, pos2
, nCount2
, nMatch2
);
454 Sequence
<sal_Int32
> offset1
, offset2
;
456 OUString tmpStr1
= folding(str1
, pos1
, nCount1
, offset1
);
457 OUString tmpStr2
= folding(str2
, pos2
, nCount2
, offset2
);
458 // Length of offset1 and offset2 may still be 0 if there was no folding
461 const sal_Unicode
*p1
= tmpStr1
.getStr();
462 const sal_Unicode
*p2
= tmpStr2
.getStr();
463 sal_Int32 i
, nLen
= ::std::min( tmpStr1
.getLength(), tmpStr2
.getLength());
464 for (i
= 0; i
< nLen
; ++i
, ++p1
, ++p2
) {
466 // return number of matched code points so far
467 nMatch1
= (i
< offset1
.getLength()) ? offset1
[i
] : i
;
468 nMatch2
= (i
< offset2
.getLength()) ? offset2
[i
] : i
;
473 if ( tmpStr1
.getLength() != tmpStr2
.getLength() ) {
474 // return number of matched code points so far
475 nMatch1
= (i
<= offset1
.getLength()) ? offset1
[i
-1] + 1 : i
;
476 nMatch2
= (i
<= offset2
.getLength()) ? offset2
[i
-1] + 1 : i
;
487 Sequence
< OUString
> SAL_CALL
488 TransliterationImpl::getRange(const Sequence
< OUString
> &inStrs
,
489 const sal_Int32 length
, sal_Int16 _numCascade
) throw(RuntimeException
)
491 if (_numCascade
>= numCascade
|| ! bodyCascade
[_numCascade
].is())
495 Sequence
< OUString
> ostr(MaxOutput
*length
);
496 for (sal_Int32 j
= 0; j
< length
; j
+=2) {
497 const Sequence
< OUString
>& temp
= bodyCascade
[_numCascade
]->transliterateRange(inStrs
[j
], inStrs
[j
+1]);
499 for ( sal_Int32 k
= 0; k
< temp
.getLength(); k
++) {
500 if ( j_tmp
>= MaxOutput
*length
) throw ERROR
;
501 ostr
[j_tmp
++] = temp
[k
];
506 return this->getRange(ostr
, j_tmp
, ++_numCascade
);
510 Sequence
< OUString
> SAL_CALL
511 TransliterationImpl::transliterateRange( const OUString
& str1
, const OUString
& str2
)
512 throw(RuntimeException
)
515 return bodyCascade
[0]->transliterateRange(str1
, str2
);
517 Sequence
< OUString
> ostr(2);
521 return this->getRange(ostr
, 2, 0);
526 TransliterationImpl::compareSubstring(
527 const OUString
& str1
, sal_Int32 off1
, sal_Int32 len1
,
528 const OUString
& str2
, sal_Int32 off2
, sal_Int32 len2
)
529 throw(RuntimeException
)
531 if (caseignoreOnly
&& caseignore
.is())
532 return caseignore
->compareSubstring(str1
, off1
, len1
, str2
, off2
, len2
);
534 Sequence
<sal_Int32
> offset
;
536 OUString in_str1
= this->transliterate(str1
, off1
, len1
, offset
);
537 OUString in_str2
= this->transliterate(str2
, off2
, len2
, offset
);
538 const sal_Unicode
* unistr1
= in_str1
.getStr();
539 const sal_Unicode
* unistr2
= in_str2
.getStr();
540 sal_Int32 strlen1
= in_str1
.getLength();
541 sal_Int32 strlen2
= in_str2
.getLength();
543 while (strlen1
&& strlen2
) {
544 if (*unistr1
!= *unistr2
)
545 return *unistr1
> *unistr2
? 1 : -1;
547 unistr1
++; unistr2
++; strlen1
--; strlen2
--;
549 return strlen1
== strlen2
? 0 : (strlen1
> strlen2
? 1 : -1);
554 TransliterationImpl::compareString(const OUString
& str1
, const OUString
& str2
) throw (RuntimeException
)
556 if (caseignoreOnly
&& caseignore
.is())
557 return caseignore
->compareString(str1
, str2
);
559 return this->compareSubstring(str1
, 0, str1
.getLength(), str2
, 0, str2
.getLength());
564 TransliterationImpl::clear()
566 for (sal_Int32 i
= 0; i
< numCascade
; i
++)
567 if (bodyCascade
[i
].is())
568 bodyCascade
[i
].clear();
571 caseignoreOnly
= sal_True
;
576 /** structure to cache the last transliteration body used. */
579 ::rtl::OUString Name
;
580 ::com::sun::star::uno::Reference
< ::com::sun::star::i18n::XExtendedTransliteration
> Body
;
582 class theTransBodyMutex
: public rtl::Static
<osl::Mutex
, theTransBodyMutex
> {};
585 void TransliterationImpl::loadBody( OUString
&implName
, Reference
<XExtendedTransliteration
>& body
)
586 throw (RuntimeException
)
588 assert(!implName
.isEmpty());
589 ::osl::MutexGuard
guard(theTransBodyMutex::get());
590 static TransBody lastTransBody
;
591 if (implName
!= lastTransBody
.Name
)
593 lastTransBody
.Body
.set(
594 mxContext
->getServiceManager()->createInstanceWithContext(implName
, mxContext
), UNO_QUERY_THROW
);
595 lastTransBody
.Name
= implName
;
597 body
= lastTransBody
.Body
;
601 TransliterationImpl::loadModuleByName( const OUString
& implName
,
602 Reference
<XExtendedTransliteration
>& body
, const Locale
& rLocale
) throw(RuntimeException
)
604 OUString cname
= OUString(TRLT_IMPLNAME_PREFIX
) + implName
;
605 loadBody(cname
, body
);
607 body
->loadModule((TransliterationModules
)0, rLocale
); // toUpper/toLoad need rLocale
609 // if the module is ignore case/kana/width, load caseignore for equals/compareString mothed
610 for (sal_Int16 i
= 0; i
< 3; i
++) {
611 if (implName
.compareToAscii(TMlist
[i
].implName
) == 0) {
612 if (i
== 0) // current module is caseignore
613 body
->loadModule(TMlist
[0].tm
, rLocale
); // caseingore need to setup module name
614 if (! caseignore
.is()) {
615 OUString bname
= OUString(TRLT_IMPLNAME_PREFIX
) +
616 OUString::createFromAscii(TMlist
[0].implName
);
617 loadBody(bname
, caseignore
);
620 caseignore
->loadModule(TMlist
[i
].tm
, rLocale
);
624 caseignoreOnly
= sal_False
; // has other module than just ignore case/kana/width
629 const sal_Char cTrans
[] = "com.sun.star.i18n.Transliteration";
632 TransliterationImpl::getImplementationName() throw( RuntimeException
)
634 return OUString::createFromAscii(cTrans
);
639 TransliterationImpl::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
641 return !rServiceName
.compareToAscii(cTrans
);
644 Sequence
< OUString
> SAL_CALL
645 TransliterationImpl::getSupportedServiceNames(void) throw( RuntimeException
)
647 Sequence
< OUString
> aRet(1);
648 aRet
[0] = OUString::createFromAscii(cTrans
);
654 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */