1*449ab281SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*449ab281SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*449ab281SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*449ab281SAndrew Rist  * distributed with this work for additional information
6*449ab281SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*449ab281SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*449ab281SAndrew Rist  * "License"); you may not use this file except in compliance
9*449ab281SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*449ab281SAndrew Rist  *
11*449ab281SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*449ab281SAndrew Rist  *
13*449ab281SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*449ab281SAndrew Rist  * software distributed under the License is distributed on an
15*449ab281SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*449ab281SAndrew Rist  * KIND, either express or implied.  See the License for the
17*449ab281SAndrew Rist  * specific language governing permissions and limitations
18*449ab281SAndrew Rist  * under the License.
19*449ab281SAndrew Rist  *
20*449ab281SAndrew Rist  *************************************************************/
21*449ab281SAndrew Rist 
22*449ab281SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_i18npool.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // prevent internal compiler error with MSVC6SP3
28cdf0e10cSrcweir #include <utility>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #define TRANSLITERATION_ProlongedSoundMark_ja_JP
31cdf0e10cSrcweir #include <transliteration_Ignore.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir using namespace com::sun::star::uno;
34cdf0e10cSrcweir using namespace com::sun::star::lang;
35cdf0e10cSrcweir using namespace rtl;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace i18n {
38cdf0e10cSrcweir 
39cdf0e10cSrcweir static sal_Unicode table_normalwidth[] = {
40cdf0e10cSrcweir     //  0x0000,   // 0x3040
41cdf0e10cSrcweir     0x3041,       // 0x3041 HIRAGANA LETTER SMALL A
42cdf0e10cSrcweir     0x3042,       // 0x3042 HIRAGANA LETTER A
43cdf0e10cSrcweir     0x3043,       // 0x3043 HIRAGANA LETTER SMALL I
44cdf0e10cSrcweir     0x3044,       // 0x3044 HIRAGANA LETTER I
45cdf0e10cSrcweir     0x3045,       // 0x3045 HIRAGANA LETTER SMALL U
46cdf0e10cSrcweir     0x3046,       // 0x3046 HIRAGANA LETTER U
47cdf0e10cSrcweir     0x3047,       // 0x3047 HIRAGANA LETTER SMALL E
48cdf0e10cSrcweir     0x3048,       // 0x3048 HIRAGANA LETTER E
49cdf0e10cSrcweir     0x3049,       // 0x3049 HIRAGANA LETTER SMALL O
50cdf0e10cSrcweir     0x304a,       // 0x304a HIRAGANA LETTER O
51cdf0e10cSrcweir     0x3042,       // 0x304b HIRAGANA LETTER KA
52cdf0e10cSrcweir     0x3042,       // 0x304c HIRAGANA LETTER GA
53cdf0e10cSrcweir     0x3044,       // 0x304d HIRAGANA LETTER KI
54cdf0e10cSrcweir     0x3044,       // 0x304e HIRAGANA LETTER GI
55cdf0e10cSrcweir     0x3046,       // 0x304f HIRAGANA LETTER KU
56cdf0e10cSrcweir     0x3046,       // 0x3050 HIRAGANA LETTER GU
57cdf0e10cSrcweir     0x3048,       // 0x3051 HIRAGANA LETTER KE
58cdf0e10cSrcweir     0x3048,       // 0x3052 HIRAGANA LETTER GE
59cdf0e10cSrcweir     0x304a,       // 0x3053 HIRAGANA LETTER KO
60cdf0e10cSrcweir     0x304a,       // 0x3054 HIRAGANA LETTER GO
61cdf0e10cSrcweir     0x3042,       // 0x3055 HIRAGANA LETTER SA
62cdf0e10cSrcweir     0x3042,       // 0x3056 HIRAGANA LETTER ZA
63cdf0e10cSrcweir     0x3044,       // 0x3057 HIRAGANA LETTER SI
64cdf0e10cSrcweir     0x3044,       // 0x3058 HIRAGANA LETTER ZI
65cdf0e10cSrcweir     0x3046,       // 0x3059 HIRAGANA LETTER SU
66cdf0e10cSrcweir     0x3046,       // 0x305a HIRAGANA LETTER ZU
67cdf0e10cSrcweir     0x3048,       // 0x305b HIRAGANA LETTER SE
68cdf0e10cSrcweir     0x3048,       // 0x305c HIRAGANA LETTER ZE
69cdf0e10cSrcweir     0x304a,       // 0x305d HIRAGANA LETTER SO
70cdf0e10cSrcweir     0x304a,       // 0x305e HIRAGANA LETTER ZO
71cdf0e10cSrcweir     0x3042,       // 0x305f HIRAGANA LETTER TA
72cdf0e10cSrcweir     0x3042,       // 0x3060 HIRAGANA LETTER DA
73cdf0e10cSrcweir     0x3044,       // 0x3061 HIRAGANA LETTER TI
74cdf0e10cSrcweir     0x3044,       // 0x3062 HIRAGANA LETTER DI
75cdf0e10cSrcweir     0x3045,       // 0x3063 HIRAGANA LETTER SMALL TU
76cdf0e10cSrcweir     0x3046,       // 0x3064 HIRAGANA LETTER TU
77cdf0e10cSrcweir     0x3046,       // 0x3065 HIRAGANA LETTER DU
78cdf0e10cSrcweir     0x3048,       // 0x3066 HIRAGANA LETTER TE
79cdf0e10cSrcweir     0x3048,       // 0x3067 HIRAGANA LETTER DE
80cdf0e10cSrcweir     0x304a,       // 0x3068 HIRAGANA LETTER TO
81cdf0e10cSrcweir     0x304a,       // 0x3069 HIRAGANA LETTER DO
82cdf0e10cSrcweir     0x3042,       // 0x306a HIRAGANA LETTER NA
83cdf0e10cSrcweir     0x3044,       // 0x306b HIRAGANA LETTER NI
84cdf0e10cSrcweir     0x3046,       // 0x306c HIRAGANA LETTER NU
85cdf0e10cSrcweir     0x3048,       // 0x306d HIRAGANA LETTER NE
86cdf0e10cSrcweir     0x304a,       // 0x306e HIRAGANA LETTER NO
87cdf0e10cSrcweir     0x3042,       // 0x306f HIRAGANA LETTER HA
88cdf0e10cSrcweir     0x3042,       // 0x3070 HIRAGANA LETTER BA
89cdf0e10cSrcweir     0x3042,       // 0x3071 HIRAGANA LETTER PA
90cdf0e10cSrcweir     0x3044,       // 0x3072 HIRAGANA LETTER HI
91cdf0e10cSrcweir     0x3044,       // 0x3073 HIRAGANA LETTER BI
92cdf0e10cSrcweir     0x3044,       // 0x3074 HIRAGANA LETTER PI
93cdf0e10cSrcweir     0x3046,       // 0x3075 HIRAGANA LETTER HU
94cdf0e10cSrcweir     0x3046,       // 0x3076 HIRAGANA LETTER BU
95cdf0e10cSrcweir     0x3046,       // 0x3077 HIRAGANA LETTER PU
96cdf0e10cSrcweir     0x3048,       // 0x3078 HIRAGANA LETTER HE
97cdf0e10cSrcweir     0x3048,       // 0x3079 HIRAGANA LETTER BE
98cdf0e10cSrcweir     0x3048,       // 0x307a HIRAGANA LETTER PE
99cdf0e10cSrcweir     0x304a,       // 0x307b HIRAGANA LETTER HO
100cdf0e10cSrcweir     0x304a,       // 0x307c HIRAGANA LETTER BO
101cdf0e10cSrcweir     0x304a,       // 0x307d HIRAGANA LETTER PO
102cdf0e10cSrcweir     0x3042,       // 0x307e HIRAGANA LETTER MA
103cdf0e10cSrcweir     0x3044,       // 0x307f HIRAGANA LETTER MI
104cdf0e10cSrcweir     0x3046,       // 0x3080 HIRAGANA LETTER MU
105cdf0e10cSrcweir     0x3048,       // 0x3081 HIRAGANA LETTER ME
106cdf0e10cSrcweir     0x304a,       // 0x3082 HIRAGANA LETTER MO
107cdf0e10cSrcweir     0x3041,       // 0x3083 HIRAGANA LETTER SMALL YA
108cdf0e10cSrcweir     0x3042,       // 0x3084 HIRAGANA LETTER YA
109cdf0e10cSrcweir     0x3045,       // 0x3085 HIRAGANA LETTER SMALL YU
110cdf0e10cSrcweir     0x3046,       // 0x3086 HIRAGANA LETTER YU
111cdf0e10cSrcweir     0x3049,       // 0x3087 HIRAGANA LETTER SMALL YO
112cdf0e10cSrcweir     0x304a,       // 0x3088 HIRAGANA LETTER YO
113cdf0e10cSrcweir     0x3042,       // 0x3089 HIRAGANA LETTER RA
114cdf0e10cSrcweir     0x3044,       // 0x308a HIRAGANA LETTER RI
115cdf0e10cSrcweir     0x3046,       // 0x308b HIRAGANA LETTER RU
116cdf0e10cSrcweir     0x3048,       // 0x308c HIRAGANA LETTER RE
117cdf0e10cSrcweir     0x304a,       // 0x308d HIRAGANA LETTER RO
118cdf0e10cSrcweir     0x3041,       // 0x308e HIRAGANA LETTER SMALL WA
119cdf0e10cSrcweir     0x3042,       // 0x308f HIRAGANA LETTER WA
120cdf0e10cSrcweir     0x3044,       // 0x3090 HIRAGANA LETTER WI
121cdf0e10cSrcweir     0x3048,       // 0x3091 HIRAGANA LETTER WE
122cdf0e10cSrcweir     0x304a,       // 0x3092 HIRAGANA LETTER WO
123cdf0e10cSrcweir     0x0000,       // 0x3093 HIRAGANA LETTER N
124cdf0e10cSrcweir     0x3046,       // 0x3094 HIRAGANA LETTER VU
125cdf0e10cSrcweir     0x0000,       // 0x3095
126cdf0e10cSrcweir     0x0000,       // 0x3096
127cdf0e10cSrcweir     0x0000,       // 0x3097
128cdf0e10cSrcweir     0x0000,       // 0x3098
129cdf0e10cSrcweir     0x0000,       // 0x3099 COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK
130cdf0e10cSrcweir     0x0000,       // 0x309a COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
131cdf0e10cSrcweir     0x0000,       // 0x309b KATAKANA-HIRAGANA VOICED SOUND MARK
132cdf0e10cSrcweir     0x0000,       // 0x309c KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK
133cdf0e10cSrcweir     0x0000,       // 0x309d HIRAGANA ITERATION MARK
134cdf0e10cSrcweir     0x0000,       // 0x309e HIRAGANA VOICED ITERATION MARK
135cdf0e10cSrcweir     0x0000,       // 0x309f
136cdf0e10cSrcweir     0x0000,       // 0x30a0
137cdf0e10cSrcweir     0x30a1,       // 0x30a1 KATAKANA LETTER SMALL A
138cdf0e10cSrcweir     0x30a2,       // 0x30a2 KATAKANA LETTER A
139cdf0e10cSrcweir     0x30a3,       // 0x30a3 KATAKANA LETTER SMALL I
140cdf0e10cSrcweir     0x30a4,       // 0x30a4 KATAKANA LETTER I
141cdf0e10cSrcweir     0x30a5,       // 0x30a5 KATAKANA LETTER SMALL U
142cdf0e10cSrcweir     0x30a6,       // 0x30a6 KATAKANA LETTER U
143cdf0e10cSrcweir     0x30a7,       // 0x30a7 KATAKANA LETTER SMALL E
144cdf0e10cSrcweir     0x30a8,       // 0x30a8 KATAKANA LETTER E
145cdf0e10cSrcweir     0x30a9,       // 0x30a9 KATAKANA LETTER SMALL O
146cdf0e10cSrcweir     0x30aa,       // 0x30aa KATAKANA LETTER O
147cdf0e10cSrcweir     0x30a2,       // 0x30ab KATAKANA LETTER KA
148cdf0e10cSrcweir     0x30a2,       // 0x30ac KATAKANA LETTER GA
149cdf0e10cSrcweir     0x30a4,       // 0x30ad KATAKANA LETTER KI
150cdf0e10cSrcweir     0x30a4,       // 0x30ae KATAKANA LETTER GI
151cdf0e10cSrcweir     0x30a6,       // 0x30af KATAKANA LETTER KU
152cdf0e10cSrcweir     0x30a6,       // 0x30b0 KATAKANA LETTER GU
153cdf0e10cSrcweir     0x30a8,       // 0x30b1 KATAKANA LETTER KE
154cdf0e10cSrcweir     0x30a8,       // 0x30b2 KATAKANA LETTER GE
155cdf0e10cSrcweir     0x30aa,       // 0x30b3 KATAKANA LETTER KO
156cdf0e10cSrcweir     0x30aa,       // 0x30b4 KATAKANA LETTER GO
157cdf0e10cSrcweir     0x30a2,       // 0x30b5 KATAKANA LETTER SA
158cdf0e10cSrcweir     0x30a2,       // 0x30b6 KATAKANA LETTER ZA
159cdf0e10cSrcweir     0x30a4,       // 0x30b7 KATAKANA LETTER SI
160cdf0e10cSrcweir     0x30a4,       // 0x30b8 KATAKANA LETTER ZI
161cdf0e10cSrcweir     0x30a6,       // 0x30b9 KATAKANA LETTER SU
162cdf0e10cSrcweir     0x30a6,       // 0x30ba KATAKANA LETTER ZU
163cdf0e10cSrcweir     0x30a8,       // 0x30bb KATAKANA LETTER SE
164cdf0e10cSrcweir     0x30a8,       // 0x30bc KATAKANA LETTER ZE
165cdf0e10cSrcweir     0x30aa,       // 0x30bd KATAKANA LETTER SO
166cdf0e10cSrcweir     0x30aa,       // 0x30be KATAKANA LETTER ZO
167cdf0e10cSrcweir     0x30a2,       // 0x30bf KATAKANA LETTER TA
168cdf0e10cSrcweir     0x30a2,       // 0x30c0 KATAKANA LETTER DA
169cdf0e10cSrcweir     0x30a4,       // 0x30c1 KATAKANA LETTER TI
170cdf0e10cSrcweir     0x30a4,       // 0x30c2 KATAKANA LETTER DI
171cdf0e10cSrcweir     0x30a5,       // 0x30c3 KATAKANA LETTER SMALL TU
172cdf0e10cSrcweir     0x30a6,       // 0x30c4 KATAKANA LETTER TU
173cdf0e10cSrcweir     0x30a6,       // 0x30c5 KATAKANA LETTER DU
174cdf0e10cSrcweir     0x30a8,       // 0x30c6 KATAKANA LETTER TE
175cdf0e10cSrcweir     0x30a8,       // 0x30c7 KATAKANA LETTER DE
176cdf0e10cSrcweir     0x30aa,       // 0x30c8 KATAKANA LETTER TO
177cdf0e10cSrcweir     0x30aa,       // 0x30c9 KATAKANA LETTER DO
178cdf0e10cSrcweir     0x30a2,       // 0x30ca KATAKANA LETTER NA
179cdf0e10cSrcweir     0x30a4,       // 0x30cb KATAKANA LETTER NI
180cdf0e10cSrcweir     0x30a6,       // 0x30cc KATAKANA LETTER NU
181cdf0e10cSrcweir     0x30a8,       // 0x30cd KATAKANA LETTER NE
182cdf0e10cSrcweir     0x30aa,       // 0x30ce KATAKANA LETTER NO
183cdf0e10cSrcweir     0x30a2,       // 0x30cf KATAKANA LETTER HA
184cdf0e10cSrcweir     0x30a2,       // 0x30d0 KATAKANA LETTER BA
185cdf0e10cSrcweir     0x30a2,       // 0x30d1 KATAKANA LETTER PA
186cdf0e10cSrcweir     0x30a4,       // 0x30d2 KATAKANA LETTER HI
187cdf0e10cSrcweir     0x30a4,       // 0x30d3 KATAKANA LETTER BI
188cdf0e10cSrcweir     0x30a4,       // 0x30d4 KATAKANA LETTER PI
189cdf0e10cSrcweir     0x30a6,       // 0x30d5 KATAKANA LETTER HU
190cdf0e10cSrcweir     0x30a6,       // 0x30d6 KATAKANA LETTER BU
191cdf0e10cSrcweir     0x30a6,       // 0x30d7 KATAKANA LETTER PU
192cdf0e10cSrcweir     0x30a8,       // 0x30d8 KATAKANA LETTER HE
193cdf0e10cSrcweir     0x30a8,       // 0x30d9 KATAKANA LETTER BE
194cdf0e10cSrcweir     0x30a8,       // 0x30da KATAKANA LETTER PE
195cdf0e10cSrcweir     0x30aa,       // 0x30db KATAKANA LETTER HO
196cdf0e10cSrcweir     0x30aa,       // 0x30dc KATAKANA LETTER BO
197cdf0e10cSrcweir     0x30aa,       // 0x30dd KATAKANA LETTER PO
198cdf0e10cSrcweir     0x30a2,       // 0x30de KATAKANA LETTER MA
199cdf0e10cSrcweir     0x30a4,       // 0x30df KATAKANA LETTER MI
200cdf0e10cSrcweir     0x30a6,       // 0x30e0 KATAKANA LETTER MU
201cdf0e10cSrcweir     0x30a8,       // 0x30e1 KATAKANA LETTER ME
202cdf0e10cSrcweir     0x30aa,       // 0x30e2 KATAKANA LETTER MO
203cdf0e10cSrcweir     0x30a1,       // 0x30e3 KATAKANA LETTER SMALL YA
204cdf0e10cSrcweir     0x30a2,       // 0x30e4 KATAKANA LETTER YA
205cdf0e10cSrcweir     0x30a5,       // 0x30e5 KATAKANA LETTER SMALL YU
206cdf0e10cSrcweir     0x30a6,       // 0x30e6 KATAKANA LETTER YU
207cdf0e10cSrcweir     0x30a9,       // 0x30e7 KATAKANA LETTER SMALL YO
208cdf0e10cSrcweir     0x30aa,       // 0x30e8 KATAKANA LETTER YO
209cdf0e10cSrcweir     0x30a2,       // 0x30e9 KATAKANA LETTER RA
210cdf0e10cSrcweir     0x30a4,       // 0x30ea KATAKANA LETTER RI
211cdf0e10cSrcweir     0x30a6,       // 0x30eb KATAKANA LETTER RU
212cdf0e10cSrcweir     0x30a8,       // 0x30ec KATAKANA LETTER RE
213cdf0e10cSrcweir     0x30aa,       // 0x30ed KATAKANA LETTER RO
214cdf0e10cSrcweir     0x30a1,       // 0x30ee KATAKANA LETTER SMALL WA
215cdf0e10cSrcweir     0x30a2,       // 0x30ef KATAKANA LETTER WA
216cdf0e10cSrcweir     0x30a4,       // 0x30f0 KATAKANA LETTER WI
217cdf0e10cSrcweir     0x30a8,       // 0x30f1 KATAKANA LETTER WE
218cdf0e10cSrcweir     0x30aa,       // 0x30f2 KATAKANA LETTER WO
219cdf0e10cSrcweir     0x0000,       // 0x30f3 KATAKANA LETTER N
220cdf0e10cSrcweir     0x30a6,       // 0x30f4 KATAKANA LETTER VU
221cdf0e10cSrcweir     0x30a1,       // 0x30f5 KATAKANA LETTER SMALL KA
222cdf0e10cSrcweir     0x30a7,       // 0x30f6 KATAKANA LETTER SMALL KE
223cdf0e10cSrcweir     0x30a2,       // 0x30f7 KATAKANA LETTER VA
224cdf0e10cSrcweir     0x30a4,       // 0x30f8 KATAKANA LETTER VI
225cdf0e10cSrcweir     0x30a8,       // 0x30f9 KATAKANA LETTER VE
226cdf0e10cSrcweir     0x30aa        // 0x30fa KATAKANA LETTER VO
227cdf0e10cSrcweir     //  0x0000,   // 0x30fb KATAKANA MIDDLE DOT
228cdf0e10cSrcweir     //  0x0000,   // 0x30fc KATAKANA-HIRAGANA PROLONGED SOUND MARK
229cdf0e10cSrcweir     //  0x0000,   // 0x30fd KATAKANA ITERATION MARK
230cdf0e10cSrcweir     //  0x0000,   // 0x30fe KATAKANA VOICED ITERATION MARK
231cdf0e10cSrcweir     //  0x0000    // 0x30ff
232cdf0e10cSrcweir };
233cdf0e10cSrcweir 
234cdf0e10cSrcweir static sal_Unicode table_halfwidth[] = {
235cdf0e10cSrcweir     //  0x0000,   // 0xff61 HALFWIDTH IDEOGRAPHIC FULL STOP
236cdf0e10cSrcweir     //  0x0000,   // 0xff62 HALFWIDTH LEFT CORNER BRACKET
237cdf0e10cSrcweir     //  0x0000,   // 0xff63 HALFWIDTH RIGHT CORNER BRACKET
238cdf0e10cSrcweir     //  0x0000,   // 0xff64 HALFWIDTH IDEOGRAPHIC COMMA
239cdf0e10cSrcweir     //  0x0000,   // 0xff65 HALFWIDTH KATAKANA MIDDLE DOT
240cdf0e10cSrcweir     0xff75,       // 0xff66 HALFWIDTH KATAKANA LETTER WO
241cdf0e10cSrcweir     0xff67,       // 0xff67 HALFWIDTH KATAKANA LETTER SMALL A
242cdf0e10cSrcweir     0xff68,       // 0xff68 HALFWIDTH KATAKANA LETTER SMALL I
243cdf0e10cSrcweir     0xff69,       // 0xff69 HALFWIDTH KATAKANA LETTER SMALL U
244cdf0e10cSrcweir     0xff6a,       // 0xff6a HALFWIDTH KATAKANA LETTER SMALL E
245cdf0e10cSrcweir     0xff6b,       // 0xff6b HALFWIDTH KATAKANA LETTER SMALL O
246cdf0e10cSrcweir     0xff67,       // 0xff6c HALFWIDTH KATAKANA LETTER SMALL YA
247cdf0e10cSrcweir     0xff69,       // 0xff6d HALFWIDTH KATAKANA LETTER SMALL YU
248cdf0e10cSrcweir     0xff6b,       // 0xff6e HALFWIDTH KATAKANA LETTER SMALL YO
249cdf0e10cSrcweir     0xff69,       // 0xff6f HALFWIDTH KATAKANA LETTER SMALL TU
250cdf0e10cSrcweir     0x0000,       // 0xff70 HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK
251cdf0e10cSrcweir     0xff71,       // 0xff71 HALFWIDTH KATAKANA LETTER A
252cdf0e10cSrcweir     0xff72,       // 0xff72 HALFWIDTH KATAKANA LETTER I
253cdf0e10cSrcweir     0xff73,       // 0xff73 HALFWIDTH KATAKANA LETTER U
254cdf0e10cSrcweir     0xff74,       // 0xff74 HALFWIDTH KATAKANA LETTER E
255cdf0e10cSrcweir     0xff75,       // 0xff75 HALFWIDTH KATAKANA LETTER O
256cdf0e10cSrcweir     0xff71,       // 0xff76 HALFWIDTH KATAKANA LETTER KA
257cdf0e10cSrcweir     0xff72,       // 0xff77 HALFWIDTH KATAKANA LETTER KI
258cdf0e10cSrcweir     0xff73,       // 0xff78 HALFWIDTH KATAKANA LETTER KU
259cdf0e10cSrcweir     0xff74,       // 0xff79 HALFWIDTH KATAKANA LETTER KE
260cdf0e10cSrcweir     0xff75,       // 0xff7a HALFWIDTH KATAKANA LETTER KO
261cdf0e10cSrcweir     0xff71,       // 0xff7b HALFWIDTH KATAKANA LETTER SA
262cdf0e10cSrcweir     0xff72,       // 0xff7c HALFWIDTH KATAKANA LETTER SI
263cdf0e10cSrcweir     0xff73,       // 0xff7d HALFWIDTH KATAKANA LETTER SU
264cdf0e10cSrcweir     0xff74,       // 0xff7e HALFWIDTH KATAKANA LETTER SE
265cdf0e10cSrcweir     0xff75,       // 0xff7f HALFWIDTH KATAKANA LETTER SO
266cdf0e10cSrcweir     0xff71,       // 0xff80 HALFWIDTH KATAKANA LETTER TA
267cdf0e10cSrcweir     0xff72,       // 0xff81 HALFWIDTH KATAKANA LETTER TI
268cdf0e10cSrcweir     0xff73,       // 0xff82 HALFWIDTH KATAKANA LETTER TU
269cdf0e10cSrcweir     0xff74,       // 0xff83 HALFWIDTH KATAKANA LETTER TE
270cdf0e10cSrcweir     0xff75,       // 0xff84 HALFWIDTH KATAKANA LETTER TO
271cdf0e10cSrcweir     0xff71,       // 0xff85 HALFWIDTH KATAKANA LETTER NA
272cdf0e10cSrcweir     0xff72,       // 0xff86 HALFWIDTH KATAKANA LETTER NI
273cdf0e10cSrcweir     0xff73,       // 0xff87 HALFWIDTH KATAKANA LETTER NU
274cdf0e10cSrcweir     0xff74,       // 0xff88 HALFWIDTH KATAKANA LETTER NE
275cdf0e10cSrcweir     0xff75,       // 0xff89 HALFWIDTH KATAKANA LETTER NO
276cdf0e10cSrcweir     0xff71,       // 0xff8a HALFWIDTH KATAKANA LETTER HA
277cdf0e10cSrcweir     0xff72,       // 0xff8b HALFWIDTH KATAKANA LETTER HI
278cdf0e10cSrcweir     0xff73,       // 0xff8c HALFWIDTH KATAKANA LETTER HU
279cdf0e10cSrcweir     0xff74,       // 0xff8d HALFWIDTH KATAKANA LETTER HE
280cdf0e10cSrcweir     0xff75,       // 0xff8e HALFWIDTH KATAKANA LETTER HO
281cdf0e10cSrcweir     0xff71,       // 0xff8f HALFWIDTH KATAKANA LETTER MA
282cdf0e10cSrcweir     0xff72,       // 0xff90 HALFWIDTH KATAKANA LETTER MI
283cdf0e10cSrcweir     0xff73,       // 0xff91 HALFWIDTH KATAKANA LETTER MU
284cdf0e10cSrcweir     0xff74,       // 0xff92 HALFWIDTH KATAKANA LETTER ME
285cdf0e10cSrcweir     0xff75,       // 0xff93 HALFWIDTH KATAKANA LETTER MO
286cdf0e10cSrcweir     0xff71,       // 0xff94 HALFWIDTH KATAKANA LETTER YA
287cdf0e10cSrcweir     0xff73,       // 0xff95 HALFWIDTH KATAKANA LETTER YU
288cdf0e10cSrcweir     0xff75,       // 0xff96 HALFWIDTH KATAKANA LETTER YO
289cdf0e10cSrcweir     0xff71,       // 0xff97 HALFWIDTH KATAKANA LETTER RA
290cdf0e10cSrcweir     0xff72,       // 0xff98 HALFWIDTH KATAKANA LETTER RI
291cdf0e10cSrcweir     0xff73,       // 0xff99 HALFWIDTH KATAKANA LETTER RU
292cdf0e10cSrcweir     0xff74,       // 0xff9a HALFWIDTH KATAKANA LETTER RE
293cdf0e10cSrcweir     0xff75,       // 0xff9b HALFWIDTH KATAKANA LETTER RO
294cdf0e10cSrcweir     0xff71        // 0xff9c HALFWIDTH KATAKANA LETTER WA
295cdf0e10cSrcweir     //  0x0000,   // 0xff9d HALFWIDTH KATAKANA LETTER N
296cdf0e10cSrcweir     //  0x0000,   // 0xff9e HALFWIDTH KATAKANA VOICED SOUND MARK
297cdf0e10cSrcweir     //  0x0000    // 0xff9f HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK
298cdf0e10cSrcweir };
299cdf0e10cSrcweir 
300cdf0e10cSrcweir 
301cdf0e10cSrcweir OUString SAL_CALL
302cdf0e10cSrcweir ignoreProlongedSoundMark_ja_JP::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
303cdf0e10cSrcweir   throw(RuntimeException)
304cdf0e10cSrcweir {
305cdf0e10cSrcweir     // Create a string buffer which can hold nCount + 1 characters.
306cdf0e10cSrcweir     // The reference count is 0 now.
307cdf0e10cSrcweir     rtl_uString * newStr = x_rtl_uString_new_WithLength( nCount ); // defined in x_rtl_ustring.h
308cdf0e10cSrcweir     sal_Unicode * dst = newStr->buffer;
309cdf0e10cSrcweir     const sal_Unicode * src = inStr.getStr() + startPos;
310cdf0e10cSrcweir 
311cdf0e10cSrcweir     sal_Int32 *p = 0;
312cdf0e10cSrcweir 	sal_Int32 position = 0;
313cdf0e10cSrcweir 
314cdf0e10cSrcweir     if (useOffset) {
315cdf0e10cSrcweir         // Allocate nCount length to offset argument.
316cdf0e10cSrcweir         offset.realloc( nCount );
317cdf0e10cSrcweir         p = offset.getArray();
318cdf0e10cSrcweir         position = startPos;
319cdf0e10cSrcweir     }
320cdf0e10cSrcweir 
321cdf0e10cSrcweir     //
322cdf0e10cSrcweir     sal_Unicode previousChar = *src ++;
323cdf0e10cSrcweir     sal_Unicode currentChar;
324cdf0e10cSrcweir 
325cdf0e10cSrcweir     // Conversion
326cdf0e10cSrcweir     while (-- nCount > 0) {
327cdf0e10cSrcweir         currentChar = *src ++;
328cdf0e10cSrcweir 
329cdf0e10cSrcweir         if (currentChar == 0x30fc || // KATAKANA-HIRAGANA PROLONGED SOUND MARK
330cdf0e10cSrcweir                 currentChar == 0xff70) { // HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK
331cdf0e10cSrcweir 
332cdf0e10cSrcweir             if (0x3041 <= previousChar && previousChar <= 0x30fa) {
333cdf0e10cSrcweir                 currentChar = table_normalwidth[ previousChar - 0x3041 ];
334cdf0e10cSrcweir             }
335cdf0e10cSrcweir             else if (0xff66 <= previousChar && previousChar <= 0xff9c) {
336cdf0e10cSrcweir                 currentChar = table_halfwidth[ previousChar - 0xff66 ];
337cdf0e10cSrcweir             }
338cdf0e10cSrcweir         }
339cdf0e10cSrcweir 
340cdf0e10cSrcweir         if (useOffset)
341cdf0e10cSrcweir             *p ++ = position ++;
342cdf0e10cSrcweir         *dst ++ = previousChar;
343cdf0e10cSrcweir         previousChar = currentChar;
344cdf0e10cSrcweir     }
345cdf0e10cSrcweir 
346cdf0e10cSrcweir     if (nCount == 0) {
347cdf0e10cSrcweir         if (useOffset)
348cdf0e10cSrcweir             *p = position;
349cdf0e10cSrcweir         *dst ++ = previousChar;
350cdf0e10cSrcweir     }
351cdf0e10cSrcweir 
352cdf0e10cSrcweir     *dst = (sal_Unicode) 0;
353cdf0e10cSrcweir 
354cdf0e10cSrcweir     newStr->length = sal_Int32(dst - newStr->buffer);
355cdf0e10cSrcweir     if (useOffset)
356cdf0e10cSrcweir         offset.realloc(newStr->length);
357cdf0e10cSrcweir     return OUString( newStr ); // defined in rtl/usrting. The reference count is increased from 0 to 1.
358cdf0e10cSrcweir 
359cdf0e10cSrcweir }
360cdf0e10cSrcweir 
361cdf0e10cSrcweir } } } }
362