update dev300-m58
[ooovba.git] / hwpfilter / source / mapping.h
blob5c65523da0958f6fd14a5e2207a69672c931e8c9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mapping.h,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __MAPPING_H__
32 #define __MAPPING_H__
34 #include <string.h>
35 #include <stdio.h>
37 typedef unsigned short hchar;
39 struct FormulaEntry{
40 const char *tex;
41 hchar ucs;
44 // empty square
45 #define DEFAULT_VALUE 0x25a1
46 const struct FormulaEntry FormulaMapTab[] = {
47 /* Capital Greek */
48 {"Alpha", 0x0391},
49 {"Beta", 0x0392},
50 {"Gamma", 0x0393},
51 {"Delta", 0x0394},
52 {"Epsilon", 0x0395},
53 {"Zeta", 0x0396},
54 {"Eta", 0x0397},
55 {"Theta", 0x0398},
56 {"Iota", 0x0399},
57 {"Kappa", 0x039a},
58 {"Lambda",0x039b },
59 {"Mu", 0x039c},
60 {"Nu", 0x039d},
61 {"Xi", 0x039e},
62 {"Omicron", 0x039f},
63 {"Pi", 0x03a0},
64 {"Rho", 0x03a1},
65 {"Sigma", 0x03a3},
66 {"Tau", 0x03a4},
67 {"Upsilon", 0x03a5},
68 {"Phi", 0x03a6},
69 {"Chi", 0x03a7},
70 {"Psi", 0x03a8},
71 {"Omega", 0x03a9},
73 /* Small Greek */
74 {"alpha", 0x03b1},
75 {"beta", 0x03b2},
76 {"gamma", 0x03b3},
77 {"delta", 0x03b4},
78 {"epsilon", 0x03b5},
79 {"zeta", 0x03b6},
80 {"eta", 0x03b7},
81 {"theta", 0x03b8},
82 {"iota", 0x03b9},
83 {"kappa", 0x03ba},
84 {"lambda",0x03bb },
85 {"mu", 0x03bc},
86 {"nu", 0x03bd},
87 {"xi", 0x03be},
88 {"omicron", 0x03bf},
89 {"pi", 0x03c0},
90 {"rho", 0x03c1},
91 {"varrho", 0},
92 {"sigma", 0x03c3},
93 {"tau", 0x03c4},
94 {"upsilon", 0x03c5},
95 {"phi", 0x03d5},
96 {"chi", 0x03c7},
97 {"psi", 0x03c8},
98 {"omega", 0x03c9},
100 /* General Symbol */
101 {"aleph", 0x2135},
102 {"hbar", 0x045b},
103 {"imath", 0x2129},
104 {"jmath", 0x2110},
105 {"mho", 0x2127},
106 {"ell", 0x2113},
107 {"wp", 0x2118},
108 {"imag", 0x2111},
109 {"angstrom", 0x212b},
110 {"vartheta", 0x03d1},
111 {"varpi", 0x03d6},
112 {"varsigma", 0x04aa},
113 {"varupsilon", 0x03d2},
114 {"varphi", 0x03c6},
117 // Big Symbol
118 {"sum", 0x2211},
119 {"smallsum", 0x03a3},
120 {"prod", 0x220f},
121 {"amalg", 0x2210},
122 {"int", 0x222b},
123 {"oint", 0x222e},
124 {"cap", 0x22c2},
125 {"cup", 0x22c3},
126 {"uplus", 0x2282},
127 {"vee", 0x22c1},
128 {"wedge", 0x22c0},
129 {"bigcap", 0x22c2},
130 {"bigcup", 0x22c3},
131 {"bigsqcap", 0x2293},
132 {"bigsqcup", 0x2294},
133 {"bigoplus", 0x2295},
134 {"bigominus", 0x2296},
135 {"bigotimes", 0x2297},
136 {"bigodiv", 0x2298},
137 {"bigodot", 0x2299},
138 {"oplus", 0x2295},
139 {"ominus", 0x2296},
140 {"otimes", 0x2297},
141 {"oslash", 0x2298},
142 {"odot", 0x2299},
143 {"bigvee", 0x22c1},
144 {"bigwedge", 0x22c0},
145 {"subset", 0x2282},
146 {"superset", 0x2283},
147 {"supset", 0x2283},
148 {"subseteq", 0x2286},
149 {"supseteq", 0x2287},
150 {"in", 0x2208},
151 {"ni", 0x220b},
152 {"notin", 0x2209},
153 {"notni", 0x220c},
154 {"leq", 0x2264},
155 {"geq", 0x2265},
156 {"sqsubset", 0x228f},
157 {"sqsupset", 0x2290},
158 {"sqsubseteq", 0x2291},
159 {"sqsupseteq", 0x2292},
160 {"mlt", 0x2292}, // much less than
161 {"mgt", 0x2292}, // much greater than
162 {"vmlt", 0x22d8}, // much less than
163 {"vmgt", 0x22d9}, // much greater than
164 {"prec", 0x227a},
165 {"succ", 0x227b},
166 {"biguplus", 0x228e},
168 // Binary Operator
169 {"pm", 0x00b1},
170 {"mp", 0x2213},
171 {"times", 0x00d7},
172 {"div", 0x00f7},
173 {"circ", 0x2218},
174 {"cdot", 0x2219},
175 {"bullet", 0x2022},
176 {"deg", 0x00b0},
177 {"ast", 0x002a},
178 {"star", 0x2205},
179 {"bigcirc", 0x25cb},
180 {"emptyset", 0x2205},
181 {"therefore", 0x2234},
182 {"because", 0x2235},
183 {"identical", 0x2237},
184 {"exists", 0x2203},
185 {"noteq", 0x2260}, // !=
186 {"neq", 0x2260},
187 {"doteq", 0x2250},
188 {"image", 0x2252},
189 {"reimage", 0x2253},
190 {"sim", 0x223c},
191 {"approx", 0x2248},
192 {"simeq", 0x2243},
193 {"cong", 0x2245},
194 {"equiv", 0x2261},
195 {"asymp", 0x224d},
196 {"iso", 0x224e},
197 {"diamond", 0x22c4},
198 {"dsum", 0x2214}, // add
199 {"forall", 0x2200},
200 {"prime", DEFAULT_VALUE}, // '
201 {"partial", 0x2202},
202 {"infty", 0x221e},
203 {"propto", 0x221d},
204 {"xor", 0x22bb},
205 {"del", 0x2207},
206 {"dagger", 0x2020},
207 {"ddagger", 0x2021},
208 {"LNOT", DEFAULT_VALUE},
210 // Arrows
211 {"leftarrow", 0x2190},
212 {"uparrow", 0x2191},
213 {"rightarrow", 0x2192},
214 {"downarrow", 0x2193},
215 {"Leftarrow", 0x21d0},
216 {"Uparrow", 0x21d1},
217 {"Rightarrow", 0x21d2},
218 {"Downarrow", 0x21d3},
219 {"updownarrow", 0x2195},
220 {"Updownarrow", 0x21d5},
221 {"leftrightarrow", 0x2194},
222 {"Leftrightarrow", 0x21d4},
223 {"nwarrow", 0x2196},
224 {"searrow", 0x2198},
225 {"nearrow", 0x2197},
226 {"swarrow", 0x2199},
227 {"hookleft", 0x21a9},
228 {"hookleftarrow", 0x21a9},
229 {"hookright", 0x21aa},
230 {"hookrightarrow", 0x21aa},
231 {"mapsto", 0x21a6},
232 {"vert", 0x2223},
233 {"dline", 0x2225},
235 {"cdots", 0x22ef},
236 {"ldots", 0x2026},
237 {"vdots", 0x22ee},
238 {"ddots", 0x22f1},
239 {"triangle", 0x2206},
240 {"triangled", 0x2207},
241 {"angle", 0x2220},
242 {"msangle", 0x2221},
243 {"sangle", 0x2222},
244 {"rtangle", 0x22be},
245 {"vdash", 0x22a2},
246 {"dashv", 0x22a3},
247 {"bot", 0x22a5},
248 {"top", 0x22a4},
249 {"models", 0x22a8},
251 {"coprod", DEFAULT_VALUE},
252 {"varepsilon", DEFAULT_VALUE},
253 {"setminus", DEFAULT_VALUE},
254 {"sqcap", DEFAULT_VALUE},
255 {"sqcup", DEFAULT_VALUE},
256 {"wr", DEFAULT_VALUE},
257 {"bigtriangleup", DEFAULT_VALUE},
258 {"bigtriangledown", DEFAULT_VALUE},
259 {"triangleleft", DEFAULT_VALUE},
260 {"triangleright", DEFAULT_VALUE},
261 {"lhd", DEFAULT_VALUE},
262 {"rhd", DEFAULT_VALUE},
263 {"unlhd", DEFAULT_VALUE},
264 {"unrhd", DEFAULT_VALUE},
265 {"nabla", DEFAULT_VALUE},
266 {"surd", DEFAULT_VALUE},
267 {"Box", DEFAULT_VALUE},
268 {"Diamond", DEFAULT_VALUE},
269 {"neg", DEFAULT_VALUE},
270 {"flat", DEFAULT_VALUE},
271 {"natural", DEFAULT_VALUE},
272 {"sharp", DEFAULT_VALUE},
273 {"clubsuit", DEFAULT_VALUE},
274 {"diamondsuit", DEFAULT_VALUE},
275 {"heartsuit", DEFAULT_VALUE},
276 {"spadesuit", DEFAULT_VALUE},
277 {"Re", DEFAULT_VALUE},
278 {"Im", DEFAULT_VALUE},
279 {"S", DEFAULT_VALUE},
280 {"P", DEFAULT_VALUE},
281 {"smallint", DEFAULT_VALUE},
282 {"backslash", DEFAULT_VALUE},
284 // Relation Operator
285 {"le", DEFAULT_VALUE},
286 {"ge", DEFAULT_VALUE},
287 {"perp", DEFAULT_VALUE},
288 {"preceq", DEFAULT_VALUE},
289 {"succeq", DEFAULT_VALUE},
290 {"mid", DEFAULT_VALUE},
291 {"ll", DEFAULT_VALUE},
292 {"gg", DEFAULT_VALUE},
293 {"parallel", DEFAULT_VALUE},
294 {"bowtie", DEFAULT_VALUE},
295 {"Join", DEFAULT_VALUE},
296 {"smile", DEFAULT_VALUE},
297 {"frown", DEFAULT_VALUE},
298 {"not", DEFAULT_VALUE},
299 {"mapsto", DEFAULT_VALUE},
301 // Arrows
302 {"to", DEFAULT_VALUE},
304 {"leftharpoonup", DEFAULT_VALUE},
305 {"leftharpoondown", DEFAULT_VALUE},
306 {"longleftarrow", DEFAULT_VALUE},
307 {"Longleftarrow", DEFAULT_VALUE},
308 {"longrightarrow", DEFAULT_VALUE},
309 {"Longrightarrow", DEFAULT_VALUE},
310 {"longleftrightarrow", DEFAULT_VALUE},
311 {"Longleftrightarrow", DEFAULT_VALUE},
312 {"longmapsto", DEFAULT_VALUE},
313 {"rightharpoonup", DEFAULT_VALUE},
314 {"rightharpoondown", DEFAULT_VALUE},
316 // Delimeter
317 {"(", DEFAULT_VALUE},
318 {")", DEFAULT_VALUE},
319 {"[", DEFAULT_VALUE},
320 {"]", DEFAULT_VALUE},
321 {"{", DEFAULT_VALUE},
322 {"}", DEFAULT_VALUE},
323 {"lfloor", DEFAULT_VALUE},
324 {"rfloor", DEFAULT_VALUE},
325 {"lceil", DEFAULT_VALUE},
326 {"rceil", DEFAULT_VALUE},
327 {"langle", DEFAULT_VALUE},
328 {"rangle", DEFAULT_VALUE},
329 {"mid", DEFAULT_VALUE},
331 // Large Delimeter
332 {"rmoustache", DEFAULT_VALUE},
333 {"lmoustache", DEFAULT_VALUE},
334 {"rgroup", DEFAULT_VALUE},
335 {"lgroup", DEFAULT_VALUE},
336 {"arrowvert", DEFAULT_VALUE},
337 {"Arrowvert", DEFAULT_VALUE},
338 {"bracevert", DEFAULT_VALUE},
340 // Accent
341 {"hat", DEFAULT_VALUE},
342 {"breve", DEFAULT_VALUE},
343 {"grave", DEFAULT_VALUE},
344 {"bar", DEFAULT_VALUE},
345 {"ddot", DEFAULT_VALUE},
346 {"check", DEFAULT_VALUE},
347 {"acute", DEFAULT_VALUE},
348 {"tilde", DEFAULT_VALUE},
349 {"dot", DEFAULT_VALUE},
350 {"vec", DEFAULT_VALUE},
352 // Decoration
353 {"overline", DEFAULT_VALUE},
354 {"underline", DEFAULT_VALUE},
355 {"overbrace", DEFAULT_VALUE},
356 {"underbrace", DEFAULT_VALUE},
357 {"widehat", DEFAULT_VALUE},
358 {"widetilde", DEFAULT_VALUE},
359 {"overleftarrow", DEFAULT_VALUE},
360 {"overrightarrow", DEFAULT_VALUE},
362 // Space Symbol
363 {",", DEFAULT_VALUE},
364 {":", DEFAULT_VALUE},
365 {";", DEFAULT_VALUE},
366 {"!", DEFAULT_VALUE},
367 {"quad", DEFAULT_VALUE},
368 {"qquad", DEFAULT_VALUE}, // double size of character
372 #ifndef DEBUG
373 hchar *getMathMLEntity(const char *tex, hchar *buf)
375 static int tabSize = sizeof( FormulaMapTab ) / sizeof( FormulaMapTab[0] );
376 int i, len;
378 for( i = 0 ; i < tabSize ; i++ ){
379 if( !strcmp(tex, FormulaMapTab[i].tex ) ) {
380 buf[0] = FormulaMapTab[i].ucs;
381 buf[1] = '\0';
382 return buf;
385 len = strlen(tex);
387 for( i = 0 ; i < len ; i++ )
388 buf[i] = tex[i];
389 buf[len] = 0;
390 return buf;
393 #else
394 char *getMathMLEntity(const char *tex, char *buf)
396 strcpy(buf,tex);
397 return buf;
399 #endif
401 #endif