1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "sal/config.h"
34 #include "rtl/textenc.h"
35 #include "sal/types.h"
37 #define NOTABUNI_START 0xFF
38 #define NOTABUNI_END 0x00
40 #define NOTABCHAR_START 0xFFFF
41 #define NOTABCHAR_END 0x0000
43 #define SAME8090UNI_START 0x80
44 #define SAME8090UNI_END 0x9F
45 static sal_uInt16
const aImpl8090SameToUniTab
[SAME8090UNI_END
48 = { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, /* 0x80 */
49 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
50 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, /* 0x90 */
51 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F };
53 #define SAME8090CHAR_START 0x0080
54 #define SAME8090CHAR_END 0x009F
55 static sal_uChar
const aImpl8090SameToCharTab
[SAME8090CHAR_END
58 = { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x0080 */
59 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
60 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x0090 */
61 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F };
63 #define SAMEA0FFCHAR_START 0x00A0
64 #define SAMEA0FFCHAR_END 0x00FF
65 static sal_uChar
const aImplA0FFSameToCharTab
[SAMEA0FFCHAR_END
68 = { 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, /* 0x00A0 */
69 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,
70 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, /* 0x00B0 */
71 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,
72 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, /* 0x00C0 */
73 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
74 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, /* 0x00D0 */
75 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
76 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, /* 0x00E0 */
77 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
78 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, /* 0x00F0 */
79 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF };
81 static sal_uInt16
const aImplDoubleByteIdentifierTab
[1] = { 0 };
83 #include "tcvtarb1.tab"
84 #include "tcvteas1.tab"
85 #include "tcvtest1.tab"
86 #include "tcvtjp1.tab"
87 #include "tcvtjp2.tab"
88 #include "tcvtjp3.tab"
89 #include "tcvtjp4.tab"
90 #include "tcvtjp5.tab"
91 #include "tcvtjp6.tab"
92 #include "tcvtkr1.tab"
93 #include "tcvtkr2.tab"
94 #include "tcvtkr4.tab"
95 #include "tcvtkr5.tab"
96 #include "tcvtkr6.tab"
97 #include "tcvtlat1.tab"
98 #include "tcvtscn1.tab"
99 #include "tcvtscn2.tab"
100 #include "tcvtscn3.tab"
101 #include "tcvtscn4.tab"
102 #include "tcvtscn5.tab"
103 #include "tcvtscn6.tab"
104 #include "tcvtsym1.tab"
105 #include "tcvttcn1.tab"
106 #include "tcvttcn2.tab"
107 #include "tcvttcn6.tab"
108 #include "tcvtuni1.tab"
109 #include "convertiscii.tab"
111 #include "convertbig5hkscs.tab"
112 #include "converteuctw.tab"
113 #include "convertgb18030.tab"
114 #include "convertiso2022cn.tab"
115 #include "convertiso2022jp.tab"
116 #include "convertiso2022kr.tab"
117 #include "convertadobe.tab"
119 extern "C" SAL_DLLPUBLIC_EXPORT ImplTextEncodingData
const *
120 sal_getFullTextEncodingData( rtl_TextEncoding nEncoding
)
123 nEncoding
!= RTL_TEXTENCODING_ASCII_US
&&
124 nEncoding
!= RTL_TEXTENCODING_ISO_8859_1
&&
125 nEncoding
!= RTL_TEXTENCODING_JAVA_UTF8
&&
126 nEncoding
!= RTL_TEXTENCODING_MS_1252
&&
127 nEncoding
!= RTL_TEXTENCODING_UTF8
);
128 // handled by Impl_getTextEncodingData
129 static ImplTextEncodingData
const * const aData
[]
130 = { NULL
, /* DONTKNOW */
131 NULL
, /* MS_1252, see above */
132 &aImplAPPLEROMANTextEncodingData
, /* APPLE_ROMAN */
133 &aImplIBM437TextEncodingData
, /* IBM_437 */
134 &aImplIBM850TextEncodingData
, /* IBM_850 */
135 &aImplIBM860TextEncodingData
, /* IBM_860 */
136 &aImplIBM861TextEncodingData
, /* IBM_861 */
137 &aImplIBM863TextEncodingData
, /* IBM_863 */
138 &aImplIBM865TextEncodingData
, /* IBM_865 */
139 NULL
, /* reserved (SYSTEM) */
140 &aImplSYMBOLTextEncodingData
, /* SYMBOL */
141 NULL
, /* ASCII_US, see above */
142 NULL
, /* ISO_8859_1, see above */
143 &aImplISO88592TextEncodingData
, /* ISO_8859_2 */
144 &aImplISO88593TextEncodingData
, /* ISO_8859_3 */
145 &aImplISO88594TextEncodingData
, /* ISO_8859_4 */
146 &aImplISO88595TextEncodingData
, /* ISO_8859_5 */
147 &aImplISO88596TextEncodingData
, /* ISO_8859_6 */
148 &aImplISO88597TextEncodingData
, /* ISO_8859_7 */
149 &aImplISO88598TextEncodingData
, /* ISO_8859_8 */
150 &aImplISO88599TextEncodingData
, /* ISO_8859_9 */
151 &aImplISO885914TextEncodingData
, /* ISO_8859_14 */
152 &aImplISO885915TextEncodingData
, /* ISO_8859_15 */
153 &aImplIBM737TextEncodingData
, /* IBM_737 */
154 &aImplIBM775TextEncodingData
, /* IBM_775 */
155 &aImplIBM852TextEncodingData
, /* IBM_852 */
156 &aImplIBM855TextEncodingData
, /* IBM_855 */
157 &aImplIBM857TextEncodingData
, /* IBM_857 */
158 &aImplIBM862TextEncodingData
, /* IBM_862 */
159 &aImplIBM864TextEncodingData
, /* IBM_864 */
160 &aImplIBM866TextEncodingData
, /* IBM_866 */
161 &aImplIBM869TextEncodingData
, /* IBM_869 */
162 &aImplMS874TextEncodingData
, /* MS_874 */
163 &aImplMS1250TextEncodingData
, /* MS_1250 */
164 &aImplMS1251TextEncodingData
, /* MS_1251 */
165 &aImplMS1253TextEncodingData
, /* MS_1253 */
166 &aImplMS1254TextEncodingData
, /* MS_1254 */
167 &aImplMS1255TextEncodingData
, /* MS_1255 */
168 &aImplMS1256TextEncodingData
, /* MS_1256 */
169 &aImplMS1257TextEncodingData
, /* MS_1257 */
170 &aImplMS1258TextEncodingData
, /* MS_1258 */
171 NULL
, /* TODO! APPLE_ARABIC */
172 &aImplAPPLECENTEUROTextEncodingData
, /* APPLE_CENTEURO */
173 &aImplAPPLECROATIANTextEncodingData
, /* APPLE_CROATIAN */
174 &aImplAPPLECYRILLICTextEncodingData
, /* APPLE_CYRILLIC */
175 NULL
, /* TODO! APPLE_DEVANAGARI */
176 NULL
, /* TODO! APPLE_FARSI */
177 &aImplAPPLEGREEKTextEncodingData
, /* APPLE_GREEK */
178 NULL
, /* TODO! APPLE_GUJARATI */
179 NULL
, /* TODO! APPLE_GURMUKHI */
180 NULL
, /* TODO! APPLE_HEBREW */
181 &aImplAPPLEICELANDTextEncodingData
, /* APPLE_ICELAND */
182 &aImplAPPLEROMANIANTextEncodingData
, /* APPLE_ROMANIAN */
183 NULL
, /* TODO! APPLE_THAI */
184 &aImplAPPLETURKISHTextEncodingData
, /* APPLE_TURKISH */
185 &aImplAPPLEUKRAINIANTextEncodingData
, /* APPLE_UKRAINIAN */
186 &aImplAPPLECHINSIMPTextEncodingData
, /* APPLE_CHINSIMP */
187 &aImplAPPLECHINTRADTextEncodingData
, /* APPLE_CHINTRAD */
188 &aImplAPPLEJAPANESETextEncodingData
, /* APPLE_JAPANESE */
189 &aImplAPPLEKOREANTextEncodingData
, /* APPLE_KOREAN */
190 &aImplMS932TextEncodingData
, /* MS_932 */
191 &aImplMS936TextEncodingData
, /* MS_936 */
192 &aImplMS949TextEncodingData
, /* MS_949 */
193 &aImplMS950TextEncodingData
, /* MS_950 */
194 &aImplSJISTextEncodingData
, /* SHIFT_JIS */
195 &aImplGB2312TextEncodingData
, /* GB_2312 */
196 &aImplGBT12345TextEncodingData
, /* GBT_12345 */
197 &aImplGBKTextEncodingData
, /* GBK */
198 &aImplBIG5TextEncodingData
, /* BIG5 */
199 &aImplEUCJPTextEncodingData
, /* EUC_JP */
200 &aImplEUCCNTextEncodingData
, /* EUC_CN */
201 &aImplEucTwTextEncodingData
, /* EUC_TW */
202 &aImplIso2022JpTextEncodingData
, /* ISO_2022_JP */
203 &aImplIso2022CnTextEncodingData
, /* ISO_2022_CN */
204 &aImplKOI8RTextEncodingData
, /* KOI8_R */
205 &aImplUTF7TextEncodingData
, /* UTF7 */
206 NULL
, /* UTF8, see above */
207 &aImplISO885910TextEncodingData
, /* ISO_8859_10 */
208 &aImplISO885913TextEncodingData
, /* ISO_8859_13 */
209 &aImplEUCKRTextEncodingData
, /* EUC_KR */
210 &aImplIso2022KrTextEncodingData
, /* ISO_2022_KR */
211 &aImplJISX0201TextEncodingData
, /* JIS_X_0201 */
212 &aImplJISX0208TextEncodingData
, /* JIS_X_0208 */
213 &aImplJISX0212TextEncodingData
, /* JIS_X_0212 */
214 &aImplMS1361TextEncodingData
, /* MS_1361 */
215 &aImplGb18030TextEncodingData
, /* GB_18030 */
216 &aImplBig5HkscsTextEncodingData
, /* BIG5_HKSCS */
217 &aImplTis620TextEncodingData
, /* TIS_620 */
218 &aImplKoi8UTextEncodingData
, /* KOI8_U */
219 &aImplIsciiDevanagariTextEncodingData
, /* ISCII_DEVANAGARI */
220 NULL
, /* JAVA_UTF8, see above */
221 &adobeStandardEncodingData
, /* ADOBE_STANDARD */
222 &adobeSymbolEncodingData
, /* ADOBE_SYMBOL */
223 &aImplPT154TextEncodingData
}; /* PT154 */
225 nEncoding
< SAL_N_ELEMENTS(aData
) ? aData
[nEncoding
] : NULL
;
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */