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 #ifndef _L10N_TRANSLITERATION_NUMTOCHAR_H_
24 #define _L10N_TRANSLITERATION_NUMTOCHAR_H_
25 
26 namespace com { namespace sun { namespace star { namespace i18n {
27 
28 static const sal_Int16 NumberChar_HalfWidth 	= 0;
29 static const sal_Int16 NumberChar_FullWidth 	= 1;
30 static const sal_Int16 NumberChar_Lower_zh 	= 2;
31 static const sal_Int16 NumberChar_Upper_zh 	= 3;
32 static const sal_Int16 NumberChar_Upper_zh_TW 	= 4;
33 static const sal_Int16 NumberChar_Modern_ja 	= 5;
34 static const sal_Int16 NumberChar_Traditional_ja= 6;
35 static const sal_Int16 NumberChar_Lower_ko 	= 7;
36 static const sal_Int16 NumberChar_Upper_ko 	= 8;
37 static const sal_Int16 NumberChar_Hangul_ko 	= 9;
38 static const sal_Int16 NumberChar_Indic_ar 	= 10;
39 static const sal_Int16 NumberChar_EastIndic_ar  = 11;
40 static const sal_Int16 NumberChar_Indic_hi 	= 12;
41 static const sal_Int16 NumberChar_th 		= 13;
42 static const sal_Int16 NumberChar_Count 	= 14;
43 
44 static const sal_Unicode NumberChar[][10] = {
45 //	0	1	2	3	4	5	6	7	8	9
46     { 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039 }, // Half Width (Ascii)
47     { 0xFF10, 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15, 0xFF16, 0xFF17, 0xFF18, 0xFF19 }, // Full Width
48     { 0x3007, 0x4E00, 0x4E8c, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Chinese Lower
49     { 0x96F6, 0x58F9, 0x8D30, 0x53C1, 0x8086, 0x4F0D, 0x9646, 0x67D2, 0x634C, 0x7396 }, // S. Chinese Upper
50     { 0x96F6, 0x58F9, 0x8CB3, 0x53C3, 0x8086, 0x4F0D, 0x9678, 0x67D2, 0x634C, 0x7396 }, // T. Chinese Upper
51     { 0x3007, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Japanese Modern
52     { 0x96F6, 0x58F1, 0x5F10, 0x53C2, 0x56DB, 0x4F0D, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Japanese Trad.
53     { 0x3007, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Korean Lower
54     { 0xF9B2, 0x58F9, 0x8CB3, 0x53C3, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Korean Upper
55     { 0xC601, 0xC77C, 0xC774, 0xC0BC, 0xC0AC, 0xC624, 0xC721, 0xCE60, 0xD314, 0xAD6C }, // Korean Hangul
56     { 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, 0x0668, 0x0669 }, // Arabic Indic
57     { 0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5, 0x06F6, 0x06F7, 0x06F8, 0x06F9 }, // Est. Arabic Indic
58     { 0x0966, 0x0967, 0x0968, 0x0969, 0x096A, 0x096B, 0x096C, 0x096D, 0x096E, 0x096F }, // Indic
59     { 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59 }  // Thai
60 };
61 
62 // not used
63 #if 0
64 static sal_Unicode DecimalChar[] = {
65     0x002E, // Half Width (Ascii)
66     0xFF0E, // Full Width
67     0xFF0E, // Chinese Lower
68     0x70B9, // S. Chinese Upper
69     0x9EDE, // T. Chinese Upper
70     0x30FB, // Japanese Modern
71     0x30FB, // Japanese Trad.
72     0xFF0E, // Korean Lower
73     0x9EDE, // Korean Upper
74     0xC810, // Korean Hangul
75     0x066B, // Arabic Indic
76     0x002E, // Est. Arabic Indic
77     0x002E, // Indic
78     0x002E  // Thai
79 };
80 #endif
81 
82 // not used
83 #if 0
84 static sal_Unicode MinusChar[] = {
85     0x002D, // Half Width (Ascii)
86     0xFF0D, // Full Width
87     0xFF0D, // Chinese Lower
88     0x8D1F, // S. Chinese Upper
89     0x5069, // T. Chinese Upper
90     0x2212, // Japanese Modern
91     0x2212, // Japanese Trad.
92     0xFF0D, // Korean Lower
93     0x5069, // Korean Upper
94     0xFF0D, // Korean Hangul ???
95     0x002D, // Arabic Indic
96     0x002D, // Est. Arabic Indic
97     0x002D, // Indic
98     0x002D, // Thai
99 };
100 #endif
101 
102 #define NUMBER_ZERO     NumberChar[NumberChar_HalfWidth][0]	// 0x0030
103 #define NUMBER_ONE  	NumberChar[NumberChar_HalfWidth][1]     // 0x0031
104 #define NUMBER_NINE  	NumberChar[NumberChar_HalfWidth][9]     // 0x0039
105 #define NUMBER_DECIMAL  DecimalChar[0]
106 #define NUMBER_MINUS  	MinusChar[0]
107 #define isNumber(n) 	( NUMBER_ZERO <= n && n <= NUMBER_NINE )
108 #define isDecimal(n) 	( n == NUMBER_DECIMAL )
109 #define isMinus(n) 	( n == NUMBER_MINUS )
110 
111 const sal_Int16 Multiplier_Lower_zh 	= 0;
112 const sal_Int16 Multiplier_Upper_zh 	= 1;
113 const sal_Int16 Multiplier_Lower_zh_TW 	= 2;
114 const sal_Int16 Multiplier_Upper_zh_TW 	= 3;
115 const sal_Int16 Multiplier_Hangul_ko 	= 4;
116 const sal_Int16 Multiplier_Modern_ja 	= 5;
117 const sal_Int16 Multiplier_Traditional_ja = 6;
118 const sal_Int16 Multiplier_Count	= 7;
119 
120 const sal_Int16 ExponentCount_CJK 	= 6;
121 
122 // not used
123 #if 0
124 static sal_Int16 MultiplierExponent_CJK[ExponentCount_CJK] = {
125     	12, 	8, 	4, 	3, 	2, 	1
126 };
127 static sal_Unicode MultiplierChar_CJK[][ExponentCount_CJK] = {
128     0x5146, 0x4EBF, 0x4E07, 0x5343, 0x767E, 0x5341,	// S. Chinese Lower
129     0x5146, 0x4EBF, 0x4E07, 0x4EDF, 0x4F70, 0x62FE,	// S. Chinese Upper
130     0x5146, 0x5104, 0x842C, 0x5343, 0x767E, 0x5341,	// T. Chinese & Korean Lower
131     0x5146, 0x5104, 0x842C, 0x4EDF, 0x4F70, 0x62FE,	// T. Chinese & Korean Upper
132     0xC870, 0xC5B5, 0xB9CC, 0xCC9C, 0xBC31, 0xC2ED,	// Korean Hangul
133     0x5146, 0x5104, 0x4E07, 0x5343, 0x767E, 0x5341,	// Japanese Modern
134     0x5146, 0x5104, 0x842C, 0x9621, 0x767E, 0x62FE,	// Japanese Traditional
135 };
136 #endif
137 
138 const sal_Int16 ExponentCount_short_CJK 	= 2;
139 
140 // not used
141 #if 0
142 static sal_Int16 MultiplierExponent_short_CJK[ExponentCount_short_CJK] = {
143     	8, 	4,
144 };
145 
146 static sal_Unicode MultiplierChar_short_CJK[][ExponentCount_short_CJK] = {
147     0x4EBF, 0x4E07, // S. Chinese Lower
148     0x4EBF, 0x4E07, // S. Chinese Upper
149     0x5104, 0x842C, // T. Chinese & Korean Lower
150     0x5104, 0x842C, // T. Chinese & Korean Upper
151     0xC5B5, 0xB9CC, // Korean Hangul
152     0x5104, 0x4E07, // Japanese Modern
153     0x5104, 0x842C, // Japanese Traditional
154 };
155 #endif
156 
157 } } } }
158 
159 #endif // _L10N_TRANSLITERATION_NUMTOCHAR_H_
160