1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mapping.h,v $
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 ************************************************************************/
37 typedef unsigned short hchar
;
45 #define DEFAULT_VALUE 0x25a1
46 const struct FormulaEntry FormulaMapTab
[] = {
109 {"angstrom", 0x212b},
110 {"vartheta", 0x03d1},
112 {"varsigma", 0x04aa},
113 {"varupsilon", 0x03d2},
119 {"smallsum", 0x03a3},
131 {"bigsqcap", 0x2293},
132 {"bigsqcup", 0x2294},
133 {"bigoplus", 0x2295},
134 {"bigominus", 0x2296},
135 {"bigotimes", 0x2297},
144 {"bigwedge", 0x22c0},
146 {"superset", 0x2283},
148 {"subseteq", 0x2286},
149 {"supseteq", 0x2287},
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
166 {"biguplus", 0x228e},
180 {"emptyset", 0x2205},
181 {"therefore", 0x2234},
183 {"identical", 0x2237},
185 {"noteq", 0x2260}, // !=
198 {"dsum", 0x2214}, // add
200 {"prime", DEFAULT_VALUE
}, // '
208 {"LNOT", DEFAULT_VALUE
},
211 {"leftarrow", 0x2190},
213 {"rightarrow", 0x2192},
214 {"downarrow", 0x2193},
215 {"Leftarrow", 0x21d0},
217 {"Rightarrow", 0x21d2},
218 {"Downarrow", 0x21d3},
219 {"updownarrow", 0x2195},
220 {"Updownarrow", 0x21d5},
221 {"leftrightarrow", 0x2194},
222 {"Leftrightarrow", 0x21d4},
227 {"hookleft", 0x21a9},
228 {"hookleftarrow", 0x21a9},
229 {"hookright", 0x21aa},
230 {"hookrightarrow", 0x21aa},
239 {"triangle", 0x2206},
240 {"triangled", 0x2207},
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
},
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
},
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
},
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
},
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
},
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
},
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
},
363 {",", DEFAULT_VALUE
},
364 {":", DEFAULT_VALUE
},
365 {";", DEFAULT_VALUE
},
366 {"!", DEFAULT_VALUE
},
367 {"quad", DEFAULT_VALUE
},
368 {"qquad", DEFAULT_VALUE
}, // double size of character
373 hchar
*getMathMLEntity(const char *tex
, hchar
*buf
)
375 static int tabSize
= sizeof( FormulaMapTab
) / sizeof( FormulaMapTab
[0] );
378 for( i
= 0 ; i
< tabSize
; i
++ ){
379 if( !strcmp(tex
, FormulaMapTab
[i
].tex
) ) {
380 buf
[0] = FormulaMapTab
[i
].ucs
;
387 for( i
= 0 ; i
< len
; i
++ )
394 char *getMathMLEntity(const char *tex
, char *buf
)