merge the formfield patch from ooo-build
[ooovba.git] / svtools / source / svhtml / htmlkywd.cxx
blob29b80ef8c90854974cab329e7c5de8686e835b38
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: htmlkywd.cxx,v $
10 * $Revision: 1.10 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
34 #include <ctype.h>
35 #include <stdlib.h>
36 #include <string.h>
37 #include <limits.h>
39 #include <svtools/svparser.hxx>
40 #include "htmlkywd.hxx"
41 #include "htmltokn.h"
43 // die Tabelle muss noch sortiert werden
44 struct HTML_TokenEntry
46 union
48 const sal_Char *sToken;
49 const String *pUToken;
51 int nToken;
54 // Flag: RTF-Token Tabelle wurde schon sortiert
55 static int __FAR_DATA bSortKeyWords = FALSE;
57 static HTML_TokenEntry __FAR_DATA aHTMLTokenTab[] = {
58 {{OOO_STRING_SVTOOLS_HTML_area}, HTML_AREA}, // Netscape 2.0
59 {{OOO_STRING_SVTOOLS_HTML_base}, HTML_BASE}, // HTML 3.0
60 {{OOO_STRING_SVTOOLS_HTML_comment}, HTML_COMMENT},
61 {{OOO_STRING_SVTOOLS_HTML_doctype}, HTML_DOCTYPE},
62 {{OOO_STRING_SVTOOLS_HTML_embed}, HTML_EMBED}, // Netscape 2.0
63 {{OOO_STRING_SVTOOLS_HTML_figureoverlay}, HTML_FIGUREOVERLAY}, // HTML 3.0
64 {{OOO_STRING_SVTOOLS_HTML_horzrule}, HTML_HORZRULE},
65 {{OOO_STRING_SVTOOLS_HTML_horztab}, HTML_HORZTAB}, // HTML 3.0
66 {{OOO_STRING_SVTOOLS_HTML_image}, HTML_IMAGE},
67 {{OOO_STRING_SVTOOLS_HTML_image2}, HTML_IMAGE},
68 {{OOO_STRING_SVTOOLS_HTML_input}, HTML_INPUT},
69 {{OOO_STRING_SVTOOLS_HTML_isindex}, HTML_ISINDEX}, // HTML 3.0
70 {{OOO_STRING_SVTOOLS_HTML_li}, HTML_LI_ON},
71 {{OOO_STRING_SVTOOLS_HTML_linebreak}, HTML_LINEBREAK},
72 {{OOO_STRING_SVTOOLS_HTML_link}, HTML_LINK}, // HTML 3.0
73 {{OOO_STRING_SVTOOLS_HTML_meta}, HTML_META}, // HTML 3.0
74 {{OOO_STRING_SVTOOLS_HTML_nextid}, HTML_NEXTID}, // HTML 3.0
75 {{OOO_STRING_SVTOOLS_HTML_of}, HTML_OF}, // HTML 3.0
76 {{OOO_STRING_SVTOOLS_HTML_option}, HTML_OPTION},
77 {{OOO_STRING_SVTOOLS_HTML_param}, HTML_PARAM}, // HotJava
78 {{OOO_STRING_SVTOOLS_HTML_range}, HTML_RANGE}, // HTML 3.0
79 {{OOO_STRING_SVTOOLS_HTML_spacer}, HTML_SPACER}, // Netscape 3.0b5
80 {{OOO_STRING_SVTOOLS_HTML_wbr}, HTML_WBR}, // Netscape
82 {{OOO_STRING_SVTOOLS_HTML_abbreviation}, HTML_ABBREVIATION_ON}, // HTML 3.0
83 {{OOO_STRING_SVTOOLS_HTML_above}, HTML_ABOVE_ON}, // HTML 3.0
84 {{OOO_STRING_SVTOOLS_HTML_acronym}, HTML_ACRONYM_ON}, // HTML 3.0
85 {{OOO_STRING_SVTOOLS_HTML_address}, HTML_ADDRESS_ON},
86 {{OOO_STRING_SVTOOLS_HTML_anchor}, HTML_ANCHOR_ON},
87 {{OOO_STRING_SVTOOLS_HTML_applet}, HTML_APPLET_ON}, // HotJava
88 {{OOO_STRING_SVTOOLS_HTML_array}, HTML_ARRAY_ON}, // HTML 3.0
89 {{OOO_STRING_SVTOOLS_HTML_author}, HTML_AUTHOR_ON}, // HTML 3.0
90 {{OOO_STRING_SVTOOLS_HTML_banner}, HTML_BANNER_ON}, // HTML 3.0
91 {{OOO_STRING_SVTOOLS_HTML_bar}, HTML_BAR_ON}, // HTML 3.0
92 {{OOO_STRING_SVTOOLS_HTML_basefont}, HTML_BASEFONT_ON}, // Netscape
93 {{OOO_STRING_SVTOOLS_HTML_below}, HTML_BELOW_ON}, // HTML 3.0
94 {{OOO_STRING_SVTOOLS_HTML_bigprint}, HTML_BIGPRINT_ON}, // HTML 3.0
95 {{OOO_STRING_SVTOOLS_HTML_blink}, HTML_BLINK_ON}, // Netscape
96 {{OOO_STRING_SVTOOLS_HTML_blockquote}, HTML_BLOCKQUOTE_ON},
97 {{OOO_STRING_SVTOOLS_HTML_blockquote30}, HTML_BLOCKQUOTE30_ON}, // HTML 3.0
98 {{OOO_STRING_SVTOOLS_HTML_body}, HTML_BODY_ON},
99 {{OOO_STRING_SVTOOLS_HTML_bold}, HTML_BOLD_ON},
100 {{OOO_STRING_SVTOOLS_HTML_boldtext}, HTML_BOLDTEXT_ON}, // HTML 3.0
101 {{OOO_STRING_SVTOOLS_HTML_box}, HTML_BOX_ON}, // HTML 3.0
102 {{OOO_STRING_SVTOOLS_HTML_caption}, HTML_CAPTION_ON}, // HTML 3.0
103 {{OOO_STRING_SVTOOLS_HTML_center}, HTML_CENTER_ON}, // Netscape
104 {{OOO_STRING_SVTOOLS_HTML_citiation}, HTML_CITIATION_ON},
105 {{OOO_STRING_SVTOOLS_HTML_col}, HTML_COL_ON}, // HTML 3 Table Model Draft
106 {{OOO_STRING_SVTOOLS_HTML_colgroup}, HTML_COLGROUP_ON}, // HTML 3 Table Model Draft
107 {{OOO_STRING_SVTOOLS_HTML_code}, HTML_CODE_ON},
108 {{OOO_STRING_SVTOOLS_HTML_credit}, HTML_CREDIT_ON}, // HTML 3.0
109 {{OOO_STRING_SVTOOLS_HTML_dd}, HTML_DD_ON},
110 {{OOO_STRING_SVTOOLS_HTML_deflist}, HTML_DEFLIST_ON},
111 {{OOO_STRING_SVTOOLS_HTML_deletedtext}, HTML_DELETEDTEXT_ON}, // HTML 3.0
112 {{OOO_STRING_SVTOOLS_HTML_dirlist}, HTML_DIRLIST_ON},
113 {{OOO_STRING_SVTOOLS_HTML_division}, HTML_DIVISION_ON}, // HTML 3.0
114 {{OOO_STRING_SVTOOLS_HTML_dot}, HTML_DOT_ON}, // HTML 3.0
115 {{OOO_STRING_SVTOOLS_HTML_doubledot}, HTML_DOUBLEDOT_ON}, // HTML 3.0
116 {{OOO_STRING_SVTOOLS_HTML_dt}, HTML_DT_ON},
117 {{OOO_STRING_SVTOOLS_HTML_emphasis}, HTML_EMPHASIS_ON},
118 {{OOO_STRING_SVTOOLS_HTML_figure}, HTML_FIGURE_ON}, // HTML 3.0
119 {{OOO_STRING_SVTOOLS_HTML_font}, HTML_FONT_ON}, // Netscpe
120 {{OOO_STRING_SVTOOLS_HTML_footnote}, HTML_FOOTNOTE_ON}, // HTML 3.0
121 {{OOO_STRING_SVTOOLS_HTML_form}, HTML_FORM_ON},
122 {{OOO_STRING_SVTOOLS_HTML_frame}, HTML_FRAME_ON}, // Netscape 2.0
123 {{OOO_STRING_SVTOOLS_HTML_frameset}, HTML_FRAMESET_ON}, // Netscape 2.0
124 {{OOO_STRING_SVTOOLS_HTML_hat}, HTML_HAT_ON}, // HTML 3.0
125 {{OOO_STRING_SVTOOLS_HTML_head}, HTML_HEAD_ON},
126 {{OOO_STRING_SVTOOLS_HTML_head1}, HTML_HEAD1_ON},
127 {{OOO_STRING_SVTOOLS_HTML_head2}, HTML_HEAD2_ON},
128 {{OOO_STRING_SVTOOLS_HTML_head3}, HTML_HEAD3_ON},
129 {{OOO_STRING_SVTOOLS_HTML_head4}, HTML_HEAD4_ON},
130 {{OOO_STRING_SVTOOLS_HTML_head5}, HTML_HEAD5_ON},
131 {{OOO_STRING_SVTOOLS_HTML_head6}, HTML_HEAD6_ON},
132 {{OOO_STRING_SVTOOLS_HTML_html}, HTML_HTML_ON},
133 {{OOO_STRING_SVTOOLS_HTML_iframe}, HTML_IFRAME_ON}, // IE 3.0b2
134 {{OOO_STRING_SVTOOLS_HTML_ilayer}, HTML_ILAYER_ON},
135 {{OOO_STRING_SVTOOLS_HTML_insertedtext}, HTML_INSERTEDTEXT_ON}, // HTML 3.0
136 {{OOO_STRING_SVTOOLS_HTML_italic}, HTML_ITALIC_ON},
137 {{OOO_STRING_SVTOOLS_HTML_item}, HTML_ITEM_ON}, // HTML 3.0
138 {{OOO_STRING_SVTOOLS_HTML_keyboard}, HTML_KEYBOARD_ON},
139 {{OOO_STRING_SVTOOLS_HTML_language}, HTML_LANGUAGE_ON}, // HTML 3.0
140 {{OOO_STRING_SVTOOLS_HTML_layer}, HTML_LAYER_ON},
141 {{OOO_STRING_SVTOOLS_HTML_listheader}, HTML_LISTHEADER_ON}, // HTML 3.0
142 {{OOO_STRING_SVTOOLS_HTML_map}, HTML_MAP_ON}, // Netscape 2.0
143 {{OOO_STRING_SVTOOLS_HTML_math}, HTML_MATH_ON}, // HTML 3.0
144 {{OOO_STRING_SVTOOLS_HTML_menulist}, HTML_MENULIST_ON},
145 {{OOO_STRING_SVTOOLS_HTML_multicol}, HTML_MULTICOL_ON}, // Netscape 3.0b5
146 {{OOO_STRING_SVTOOLS_HTML_nobr}, HTML_NOBR_ON}, // Netscape
147 {{OOO_STRING_SVTOOLS_HTML_noembed}, HTML_NOEMBED_ON}, // Netscape 2.0 ???
148 {{OOO_STRING_SVTOOLS_HTML_noframe}, HTML_NOFRAMES_ON}, // Netscape 2.0 ???
149 {{OOO_STRING_SVTOOLS_HTML_noframes}, HTML_NOFRAMES_ON}, // Netscape 2.0
150 {{OOO_STRING_SVTOOLS_HTML_noscript}, HTML_NOSCRIPT_ON}, // Netscape 3.0
151 {{OOO_STRING_SVTOOLS_HTML_note}, HTML_NOTE_ON}, // HTML 3.0
152 {{OOO_STRING_SVTOOLS_HTML_object}, HTML_OBJECT_ON},
153 {{OOO_STRING_SVTOOLS_HTML_orderlist}, HTML_ORDERLIST_ON},
154 {{OOO_STRING_SVTOOLS_HTML_parabreak}, HTML_PARABREAK_ON},
155 {{OOO_STRING_SVTOOLS_HTML_person}, HTML_PERSON_ON}, // HTML 3.0
156 {{OOO_STRING_SVTOOLS_HTML_plaintext}, HTML_PLAINTEXT_ON}, // HTML 3.0
157 {{OOO_STRING_SVTOOLS_HTML_preformtxt}, HTML_PREFORMTXT_ON},
158 {{OOO_STRING_SVTOOLS_HTML_root}, HTML_ROOT_ON}, // HTML 3.0
159 {{OOO_STRING_SVTOOLS_HTML_row}, HTML_ROW_ON}, // HTML 3.0
160 {{OOO_STRING_SVTOOLS_HTML_sample}, HTML_SAMPLE_ON},
161 {{OOO_STRING_SVTOOLS_HTML_script}, HTML_SCRIPT_ON}, // HTML 3.2
162 {{OOO_STRING_SVTOOLS_HTML_select}, HTML_SELECT_ON},
163 {{OOO_STRING_SVTOOLS_HTML_shortquote}, HTML_SHORTQUOTE_ON}, // HTML 3.0
164 {{OOO_STRING_SVTOOLS_HTML_smallprint}, HTML_SMALLPRINT_ON}, // HTML 3.0
165 {{OOO_STRING_SVTOOLS_HTML_span}, HTML_SPAN_ON}, // Style Sheets
166 {{OOO_STRING_SVTOOLS_HTML_squareroot}, HTML_SQUAREROOT_ON}, // HTML 3.0
167 {{OOO_STRING_SVTOOLS_HTML_strikethrough},HTML_STRIKETHROUGH_ON}, // HTML 3.0
168 {{OOO_STRING_SVTOOLS_HTML_strong}, HTML_STRONG_ON},
169 {{OOO_STRING_SVTOOLS_HTML_style}, HTML_STYLE_ON}, // HTML 3.0
170 {{OOO_STRING_SVTOOLS_HTML_subscript}, HTML_SUBSCRIPT_ON}, // HTML 3.0
171 {{OOO_STRING_SVTOOLS_HTML_superscript}, HTML_SUPERSCRIPT_ON}, // HTML 3.0
172 {{OOO_STRING_SVTOOLS_HTML_table}, HTML_TABLE_ON}, // HTML 3.0
173 {{OOO_STRING_SVTOOLS_HTML_tabledata}, HTML_TABLEDATA_ON}, // HTML 3.0
174 {{OOO_STRING_SVTOOLS_HTML_tableheader}, HTML_TABLEHEADER_ON}, // HTML 3.0
175 {{OOO_STRING_SVTOOLS_HTML_tablerow}, HTML_TABLEROW_ON}, // HTML 3.0
176 {{OOO_STRING_SVTOOLS_HTML_tbody}, HTML_TBODY_ON}, // HTML 3 Table Model Draft
177 {{OOO_STRING_SVTOOLS_HTML_teletype}, HTML_TELETYPE_ON},
178 {{OOO_STRING_SVTOOLS_HTML_text}, HTML_TEXT_ON}, // HTML 3.0
179 {{OOO_STRING_SVTOOLS_HTML_textarea}, HTML_TEXTAREA_ON},
180 {{OOO_STRING_SVTOOLS_HTML_textflow}, HTML_TEXTFLOW_ON},
181 {{OOO_STRING_SVTOOLS_HTML_tfoot}, HTML_TFOOT_ON}, // HTML 3 Table Model Draft
182 {{OOO_STRING_SVTOOLS_HTML_thead}, HTML_THEAD_ON}, // HTML 3 Table Model Draft
183 {{OOO_STRING_SVTOOLS_HTML_tilde}, HTML_TILDE_ON}, // HTML 3.0
184 {{OOO_STRING_SVTOOLS_HTML_title}, HTML_TITLE_ON},
185 {{OOO_STRING_SVTOOLS_HTML_underline}, HTML_UNDERLINE_ON},
186 {{OOO_STRING_SVTOOLS_HTML_unorderlist}, HTML_UNORDERLIST_ON},
187 {{OOO_STRING_SVTOOLS_HTML_variable}, HTML_VARIABLE_ON},
188 {{OOO_STRING_SVTOOLS_HTML_vector}, HTML_VECTOR_ON}, // HTML 3.0
190 {{OOO_STRING_SVTOOLS_HTML_xmp}, HTML_XMP_ON},
191 {{OOO_STRING_SVTOOLS_HTML_listing}, HTML_LISTING_ON},
193 {{OOO_STRING_SVTOOLS_HTML_definstance}, HTML_DEFINSTANCE_ON},
194 {{OOO_STRING_SVTOOLS_HTML_strike}, HTML_STRIKE_ON},
196 {{OOO_STRING_SVTOOLS_HTML_bgsound}, HTML_BGSOUND},
197 {{OOO_STRING_SVTOOLS_HTML_comment2}, HTML_COMMENT2_ON},
198 {{OOO_STRING_SVTOOLS_HTML_marquee}, HTML_MARQUEE_ON},
199 {{OOO_STRING_SVTOOLS_HTML_plaintext2}, HTML_PLAINTEXT2_ON},
201 {{OOO_STRING_SVTOOLS_HTML_sdfield}, HTML_SDFIELD_ON}
205 extern "C"
208 static int
209 #if defined( WNT )
210 __cdecl
211 #endif
212 #if defined( ICC ) && defined( OS2 )
213 _Optlink
214 #endif
215 HTMLKeyCompare( const void *pFirst, const void *pSecond)
217 int nRet = 0;
218 if( -1 == ((HTML_TokenEntry*)pFirst)->nToken )
220 if( -1 == ((HTML_TokenEntry*)pSecond)->nToken )
221 nRet = ((HTML_TokenEntry*)pFirst)->pUToken->CompareTo(
222 *((HTML_TokenEntry*)pSecond)->pUToken );
223 else
224 nRet = ((HTML_TokenEntry*)pFirst)->pUToken->CompareToAscii(
225 ((HTML_TokenEntry*)pSecond)->sToken );
227 else
229 if( -1 == ((HTML_TokenEntry*)pSecond)->nToken )
230 nRet = -1 * ((HTML_TokenEntry*)pSecond)->pUToken->CompareToAscii(
231 ((HTML_TokenEntry*)pFirst)->sToken );
232 else
233 nRet = strcmp( ((HTML_TokenEntry*)pFirst)->sToken,
234 ((HTML_TokenEntry*)pSecond)->sToken );
237 return nRet;
242 int GetHTMLToken( const String& rName )
244 if( !bSortKeyWords )
246 qsort( (void*) aHTMLTokenTab,
247 sizeof( aHTMLTokenTab ) / sizeof( HTML_TokenEntry ),
248 sizeof( HTML_TokenEntry ),
249 HTMLKeyCompare );
250 bSortKeyWords = TRUE;
253 int nRet = 0;
255 if( !rName.CompareToAscii( OOO_STRING_SVTOOLS_HTML_comment, 3UL) )
256 return HTML_COMMENT;
258 void* pFound;
259 HTML_TokenEntry aSrch;
260 aSrch.pUToken = &rName;
261 aSrch.nToken = -1;
263 if( 0 != ( pFound = bsearch( (sal_Char *) &aSrch,
264 (void*) aHTMLTokenTab,
265 sizeof( aHTMLTokenTab ) / sizeof( HTML_TokenEntry ),
266 sizeof( HTML_TokenEntry ),
267 HTMLKeyCompare )))
268 nRet = ((HTML_TokenEntry*)pFound)->nToken;
269 return nRet;
272 /*\f*/
274 struct HTML_CharEntry
276 union
278 const sal_Char *sName;
279 const String *pUName;
281 sal_Unicode cChar;
284 // Flag: RTF-Token Tabelle wurde schon sortiert
285 static int __FAR_DATA bSortCharKeyWords = FALSE;
287 static HTML_CharEntry __FAR_DATA aHTMLCharNameTab[] = {
288 {{OOO_STRING_SVTOOLS_HTML_C_lt}, 60},
289 {{OOO_STRING_SVTOOLS_HTML_C_gt}, 62},
290 {{OOO_STRING_SVTOOLS_HTML_C_amp}, 38},
291 {{OOO_STRING_SVTOOLS_HTML_C_quot}, 34},
293 {{OOO_STRING_SVTOOLS_HTML_C_Agrave}, 192},
294 {{OOO_STRING_SVTOOLS_HTML_C_Aacute}, 193},
295 {{OOO_STRING_SVTOOLS_HTML_C_Acirc}, 194},
296 {{OOO_STRING_SVTOOLS_HTML_C_Atilde}, 195},
297 {{OOO_STRING_SVTOOLS_HTML_C_Auml}, 196},
298 {{OOO_STRING_SVTOOLS_HTML_C_Aring}, 197},
299 {{OOO_STRING_SVTOOLS_HTML_C_AElig}, 198},
300 {{OOO_STRING_SVTOOLS_HTML_C_Ccedil}, 199},
301 {{OOO_STRING_SVTOOLS_HTML_C_Egrave}, 200},
302 {{OOO_STRING_SVTOOLS_HTML_C_Eacute}, 201},
303 {{OOO_STRING_SVTOOLS_HTML_C_Ecirc}, 202},
304 {{OOO_STRING_SVTOOLS_HTML_C_Euml}, 203},
305 {{OOO_STRING_SVTOOLS_HTML_C_Igrave}, 204},
306 {{OOO_STRING_SVTOOLS_HTML_C_Iacute}, 205},
307 {{OOO_STRING_SVTOOLS_HTML_C_Icirc}, 206},
308 {{OOO_STRING_SVTOOLS_HTML_C_Iuml}, 207},
309 {{OOO_STRING_SVTOOLS_HTML_C_ETH}, 208},
310 {{OOO_STRING_SVTOOLS_HTML_C_Ntilde}, 209},
311 {{OOO_STRING_SVTOOLS_HTML_C_Ograve}, 210},
312 {{OOO_STRING_SVTOOLS_HTML_C_Oacute}, 211},
313 {{OOO_STRING_SVTOOLS_HTML_C_Ocirc}, 212},
314 {{OOO_STRING_SVTOOLS_HTML_C_Otilde}, 213},
315 {{OOO_STRING_SVTOOLS_HTML_C_Ouml}, 214},
316 {{OOO_STRING_SVTOOLS_HTML_C_Oslash}, 216},
317 {{OOO_STRING_SVTOOLS_HTML_C_Ugrave}, 217},
318 {{OOO_STRING_SVTOOLS_HTML_C_Uacute}, 218},
319 {{OOO_STRING_SVTOOLS_HTML_C_Ucirc}, 219},
320 {{OOO_STRING_SVTOOLS_HTML_C_Uuml}, 220},
321 {{OOO_STRING_SVTOOLS_HTML_C_Yacute}, 221},
323 {{OOO_STRING_SVTOOLS_HTML_C_THORN}, 222},
324 {{OOO_STRING_SVTOOLS_HTML_C_szlig}, 223},
326 {{OOO_STRING_SVTOOLS_HTML_S_agrave}, 224},
327 {{OOO_STRING_SVTOOLS_HTML_S_aacute}, 225},
328 {{OOO_STRING_SVTOOLS_HTML_S_acirc}, 226},
329 {{OOO_STRING_SVTOOLS_HTML_S_atilde}, 227},
330 {{OOO_STRING_SVTOOLS_HTML_S_auml}, 228},
331 {{OOO_STRING_SVTOOLS_HTML_S_aring}, 229},
332 {{OOO_STRING_SVTOOLS_HTML_S_aelig}, 230},
333 {{OOO_STRING_SVTOOLS_HTML_S_ccedil}, 231},
334 {{OOO_STRING_SVTOOLS_HTML_S_egrave}, 232},
335 {{OOO_STRING_SVTOOLS_HTML_S_eacute}, 233},
336 {{OOO_STRING_SVTOOLS_HTML_S_ecirc}, 234},
337 {{OOO_STRING_SVTOOLS_HTML_S_euml}, 235},
338 {{OOO_STRING_SVTOOLS_HTML_S_igrave}, 236},
339 {{OOO_STRING_SVTOOLS_HTML_S_iacute}, 237},
340 {{OOO_STRING_SVTOOLS_HTML_S_icirc}, 238},
341 {{OOO_STRING_SVTOOLS_HTML_S_iuml}, 239},
342 {{OOO_STRING_SVTOOLS_HTML_S_eth}, 240},
343 {{OOO_STRING_SVTOOLS_HTML_S_ntilde}, 241},
344 {{OOO_STRING_SVTOOLS_HTML_S_ograve}, 242},
345 {{OOO_STRING_SVTOOLS_HTML_S_oacute}, 243},
346 {{OOO_STRING_SVTOOLS_HTML_S_ocirc}, 244},
347 {{OOO_STRING_SVTOOLS_HTML_S_otilde}, 245},
348 {{OOO_STRING_SVTOOLS_HTML_S_ouml}, 246},
349 {{OOO_STRING_SVTOOLS_HTML_S_oslash}, 248},
350 {{OOO_STRING_SVTOOLS_HTML_S_ugrave}, 249},
351 {{OOO_STRING_SVTOOLS_HTML_S_uacute}, 250},
352 {{OOO_STRING_SVTOOLS_HTML_S_ucirc}, 251},
353 {{OOO_STRING_SVTOOLS_HTML_S_uuml}, 252},
354 {{OOO_STRING_SVTOOLS_HTML_S_yacute}, 253},
355 {{OOO_STRING_SVTOOLS_HTML_S_thorn}, 254},
356 {{OOO_STRING_SVTOOLS_HTML_S_yuml}, 255},
358 // Sonderzeichen
359 {{OOO_STRING_SVTOOLS_HTML_S_acute}, 180},
360 {{OOO_STRING_SVTOOLS_HTML_S_brvbar}, 166},
361 {{OOO_STRING_SVTOOLS_HTML_S_cedil}, 184},
362 {{OOO_STRING_SVTOOLS_HTML_S_cent}, 162},
363 {{OOO_STRING_SVTOOLS_HTML_S_copy}, 169},
364 {{OOO_STRING_SVTOOLS_HTML_S_curren}, 164},
365 {{OOO_STRING_SVTOOLS_HTML_S_deg}, 176},
366 {{OOO_STRING_SVTOOLS_HTML_S_divide}, 247},
367 {{OOO_STRING_SVTOOLS_HTML_S_frac12}, 189},
368 {{OOO_STRING_SVTOOLS_HTML_S_frac14}, 188},
369 {{OOO_STRING_SVTOOLS_HTML_S_frac34}, 190},
370 {{OOO_STRING_SVTOOLS_HTML_S_iexcl}, 161},
371 {{OOO_STRING_SVTOOLS_HTML_S_iquest}, 191},
372 {{OOO_STRING_SVTOOLS_HTML_S_laquo}, 171},
373 {{OOO_STRING_SVTOOLS_HTML_S_macr}, 175},
374 {{OOO_STRING_SVTOOLS_HTML_S_micro}, 181},
375 {{OOO_STRING_SVTOOLS_HTML_S_middot}, 183},
376 {{OOO_STRING_SVTOOLS_HTML_S_not}, 172},
377 {{OOO_STRING_SVTOOLS_HTML_S_ordf}, 170},
378 {{OOO_STRING_SVTOOLS_HTML_S_ordm}, 186},
379 {{OOO_STRING_SVTOOLS_HTML_S_para}, 182},
380 {{OOO_STRING_SVTOOLS_HTML_S_plusmn}, 177},
381 {{OOO_STRING_SVTOOLS_HTML_S_pound}, 163},
382 {{OOO_STRING_SVTOOLS_HTML_S_raquo}, 187},
383 {{OOO_STRING_SVTOOLS_HTML_S_reg}, 174},
384 {{OOO_STRING_SVTOOLS_HTML_S_sect}, 167},
385 {{OOO_STRING_SVTOOLS_HTML_S_sup1}, 185},
386 {{OOO_STRING_SVTOOLS_HTML_S_sup2}, 178},
387 {{OOO_STRING_SVTOOLS_HTML_S_sup3}, 179},
388 {{OOO_STRING_SVTOOLS_HTML_S_times}, 215},
389 {{OOO_STRING_SVTOOLS_HTML_S_uml}, 168},
390 {{OOO_STRING_SVTOOLS_HTML_S_yen}, 165},
392 // Netscape kennt noch ein paar in Grossbuchstaben ...
393 {{OOO_STRING_SVTOOLS_HTML_C_LT}, 60},
394 {{OOO_STRING_SVTOOLS_HTML_C_GT}, 62},
395 {{OOO_STRING_SVTOOLS_HTML_C_AMP}, 38},
396 {{OOO_STRING_SVTOOLS_HTML_C_QUOT}, 34},
397 {{OOO_STRING_SVTOOLS_HTML_S_COPY}, 169},
398 {{OOO_STRING_SVTOOLS_HTML_S_REG}, 174},
400 // Sonderzeichen, die zu Tokens konvertiert werden !!!
401 {{OOO_STRING_SVTOOLS_HTML_S_nbsp}, 1},
402 {{OOO_STRING_SVTOOLS_HTML_S_shy}, 2},
405 // HTML4
406 {{OOO_STRING_SVTOOLS_HTML_S_OElig}, 338},
407 {{OOO_STRING_SVTOOLS_HTML_S_oelig}, 339},
408 {{OOO_STRING_SVTOOLS_HTML_S_Scaron}, 352},
409 {{OOO_STRING_SVTOOLS_HTML_S_scaron}, 353},
410 {{OOO_STRING_SVTOOLS_HTML_S_Yuml}, 376},
411 {{OOO_STRING_SVTOOLS_HTML_S_fnof}, 402},
412 {{OOO_STRING_SVTOOLS_HTML_S_circ}, 710},
413 {{OOO_STRING_SVTOOLS_HTML_S_tilde}, 732},
414 {{OOO_STRING_SVTOOLS_HTML_S_Alpha}, 913},
415 {{OOO_STRING_SVTOOLS_HTML_S_Beta}, 914},
416 {{OOO_STRING_SVTOOLS_HTML_S_Gamma}, 915},
417 {{OOO_STRING_SVTOOLS_HTML_S_Delta}, 916},
418 {{OOO_STRING_SVTOOLS_HTML_S_Epsilon}, 917},
419 {{OOO_STRING_SVTOOLS_HTML_S_Zeta}, 918},
420 {{OOO_STRING_SVTOOLS_HTML_S_Eta}, 919},
421 {{OOO_STRING_SVTOOLS_HTML_S_Theta}, 920},
422 {{OOO_STRING_SVTOOLS_HTML_S_Iota}, 921},
423 {{OOO_STRING_SVTOOLS_HTML_S_Kappa}, 922},
424 {{OOO_STRING_SVTOOLS_HTML_S_Lambda}, 923},
425 {{OOO_STRING_SVTOOLS_HTML_S_Mu}, 924},
426 {{OOO_STRING_SVTOOLS_HTML_S_Nu}, 925},
427 {{OOO_STRING_SVTOOLS_HTML_S_Xi}, 926},
428 {{OOO_STRING_SVTOOLS_HTML_S_Omicron}, 927},
429 {{OOO_STRING_SVTOOLS_HTML_S_Pi}, 928},
430 {{OOO_STRING_SVTOOLS_HTML_S_Rho}, 929},
431 {{OOO_STRING_SVTOOLS_HTML_S_Sigma}, 931},
432 {{OOO_STRING_SVTOOLS_HTML_S_Tau}, 932},
433 {{OOO_STRING_SVTOOLS_HTML_S_Upsilon}, 933},
434 {{OOO_STRING_SVTOOLS_HTML_S_Phi}, 934},
435 {{OOO_STRING_SVTOOLS_HTML_S_Chi}, 935},
436 {{OOO_STRING_SVTOOLS_HTML_S_Psi}, 936},
437 {{OOO_STRING_SVTOOLS_HTML_S_Omega}, 937},
438 {{OOO_STRING_SVTOOLS_HTML_S_alpha}, 945},
439 {{OOO_STRING_SVTOOLS_HTML_S_beta}, 946},
440 {{OOO_STRING_SVTOOLS_HTML_S_gamma}, 947},
441 {{OOO_STRING_SVTOOLS_HTML_S_delta}, 948},
442 {{OOO_STRING_SVTOOLS_HTML_S_epsilon}, 949},
443 {{OOO_STRING_SVTOOLS_HTML_S_zeta}, 950},
444 {{OOO_STRING_SVTOOLS_HTML_S_eta}, 951},
445 {{OOO_STRING_SVTOOLS_HTML_S_theta}, 952},
446 {{OOO_STRING_SVTOOLS_HTML_S_iota}, 953},
447 {{OOO_STRING_SVTOOLS_HTML_S_kappa}, 954},
448 {{OOO_STRING_SVTOOLS_HTML_S_lambda}, 955},
449 {{OOO_STRING_SVTOOLS_HTML_S_mu}, 956},
450 {{OOO_STRING_SVTOOLS_HTML_S_nu}, 957},
451 {{OOO_STRING_SVTOOLS_HTML_S_xi}, 958},
452 {{OOO_STRING_SVTOOLS_HTML_S_omicron}, 959},
453 {{OOO_STRING_SVTOOLS_HTML_S_pi}, 960},
454 {{OOO_STRING_SVTOOLS_HTML_S_rho}, 961},
455 {{OOO_STRING_SVTOOLS_HTML_S_sigmaf}, 962},
456 {{OOO_STRING_SVTOOLS_HTML_S_sigma}, 963},
457 {{OOO_STRING_SVTOOLS_HTML_S_tau}, 964},
458 {{OOO_STRING_SVTOOLS_HTML_S_upsilon}, 965},
459 {{OOO_STRING_SVTOOLS_HTML_S_phi}, 966},
460 {{OOO_STRING_SVTOOLS_HTML_S_chi}, 967},
461 {{OOO_STRING_SVTOOLS_HTML_S_psi}, 968},
462 {{OOO_STRING_SVTOOLS_HTML_S_omega}, 969},
463 {{OOO_STRING_SVTOOLS_HTML_S_thetasym}, 977},
464 {{OOO_STRING_SVTOOLS_HTML_S_upsih}, 978},
465 {{OOO_STRING_SVTOOLS_HTML_S_piv}, 982},
466 {{OOO_STRING_SVTOOLS_HTML_S_ensp}, 8194},
467 {{OOO_STRING_SVTOOLS_HTML_S_emsp}, 8195},
468 {{OOO_STRING_SVTOOLS_HTML_S_thinsp}, 8201},
469 {{OOO_STRING_SVTOOLS_HTML_S_zwnj}, 8204},
470 {{OOO_STRING_SVTOOLS_HTML_S_zwj}, 8205},
471 {{OOO_STRING_SVTOOLS_HTML_S_lrm}, 8206},
472 {{OOO_STRING_SVTOOLS_HTML_S_rlm}, 8207},
473 {{OOO_STRING_SVTOOLS_HTML_S_ndash}, 8211},
474 {{OOO_STRING_SVTOOLS_HTML_S_mdash}, 8212},
475 {{OOO_STRING_SVTOOLS_HTML_S_lsquo}, 8216},
476 {{OOO_STRING_SVTOOLS_HTML_S_rsquo}, 8217},
477 {{OOO_STRING_SVTOOLS_HTML_S_sbquo}, 8218},
478 {{OOO_STRING_SVTOOLS_HTML_S_ldquo}, 8220},
479 {{OOO_STRING_SVTOOLS_HTML_S_rdquo}, 8221},
480 {{OOO_STRING_SVTOOLS_HTML_S_bdquo}, 8222},
481 {{OOO_STRING_SVTOOLS_HTML_S_dagger}, 8224},
482 {{OOO_STRING_SVTOOLS_HTML_S_Dagger}, 8225},
483 {{OOO_STRING_SVTOOLS_HTML_S_bull}, 8226},
484 {{OOO_STRING_SVTOOLS_HTML_S_hellip}, 8230},
485 {{OOO_STRING_SVTOOLS_HTML_S_permil}, 8240},
486 {{OOO_STRING_SVTOOLS_HTML_S_prime}, 8242},
487 {{OOO_STRING_SVTOOLS_HTML_S_Prime}, 8243},
488 {{OOO_STRING_SVTOOLS_HTML_S_lsaquo}, 8249},
489 {{OOO_STRING_SVTOOLS_HTML_S_rsaquo}, 8250},
490 {{OOO_STRING_SVTOOLS_HTML_S_oline}, 8254},
491 {{OOO_STRING_SVTOOLS_HTML_S_frasl}, 8260},
492 {{OOO_STRING_SVTOOLS_HTML_S_euro}, 8364},
493 {{OOO_STRING_SVTOOLS_HTML_S_image}, 8465},
494 {{OOO_STRING_SVTOOLS_HTML_S_weierp}, 8472},
495 {{OOO_STRING_SVTOOLS_HTML_S_real}, 8476},
496 {{OOO_STRING_SVTOOLS_HTML_S_trade}, 8482},
497 {{OOO_STRING_SVTOOLS_HTML_S_alefsym}, 8501},
498 {{OOO_STRING_SVTOOLS_HTML_S_larr}, 8592},
499 {{OOO_STRING_SVTOOLS_HTML_S_uarr}, 8593},
500 {{OOO_STRING_SVTOOLS_HTML_S_rarr}, 8594},
501 {{OOO_STRING_SVTOOLS_HTML_S_darr}, 8595},
502 {{OOO_STRING_SVTOOLS_HTML_S_harr}, 8596},
503 {{OOO_STRING_SVTOOLS_HTML_S_crarr}, 8629},
504 {{OOO_STRING_SVTOOLS_HTML_S_lArr}, 8656},
505 {{OOO_STRING_SVTOOLS_HTML_S_uArr}, 8657},
506 {{OOO_STRING_SVTOOLS_HTML_S_rArr}, 8658},
507 {{OOO_STRING_SVTOOLS_HTML_S_dArr}, 8659},
508 {{OOO_STRING_SVTOOLS_HTML_S_hArr}, 8660},
509 {{OOO_STRING_SVTOOLS_HTML_S_forall}, 8704},
510 {{OOO_STRING_SVTOOLS_HTML_S_part}, 8706},
511 {{OOO_STRING_SVTOOLS_HTML_S_exist}, 8707},
512 {{OOO_STRING_SVTOOLS_HTML_S_empty}, 8709},
513 {{OOO_STRING_SVTOOLS_HTML_S_nabla}, 8711},
514 {{OOO_STRING_SVTOOLS_HTML_S_isin}, 8712},
515 {{OOO_STRING_SVTOOLS_HTML_S_notin}, 8713},
516 {{OOO_STRING_SVTOOLS_HTML_S_ni}, 8715},
517 {{OOO_STRING_SVTOOLS_HTML_S_prod}, 8719},
518 {{OOO_STRING_SVTOOLS_HTML_S_sum}, 8721},
519 {{OOO_STRING_SVTOOLS_HTML_S_minus}, 8722},
520 {{OOO_STRING_SVTOOLS_HTML_S_lowast}, 8727},
521 {{OOO_STRING_SVTOOLS_HTML_S_radic}, 8730},
522 {{OOO_STRING_SVTOOLS_HTML_S_prop}, 8733},
523 {{OOO_STRING_SVTOOLS_HTML_S_infin}, 8734},
524 {{OOO_STRING_SVTOOLS_HTML_S_ang}, 8736},
525 {{OOO_STRING_SVTOOLS_HTML_S_and}, 8743},
526 {{OOO_STRING_SVTOOLS_HTML_S_or}, 8744},
527 {{OOO_STRING_SVTOOLS_HTML_S_cap}, 8745},
528 {{OOO_STRING_SVTOOLS_HTML_S_cup}, 8746},
529 {{OOO_STRING_SVTOOLS_HTML_S_int}, 8747},
530 {{OOO_STRING_SVTOOLS_HTML_S_there4}, 8756},
531 {{OOO_STRING_SVTOOLS_HTML_S_sim}, 8764},
532 {{OOO_STRING_SVTOOLS_HTML_S_cong}, 8773},
533 {{OOO_STRING_SVTOOLS_HTML_S_asymp}, 8776},
534 {{OOO_STRING_SVTOOLS_HTML_S_ne}, 8800},
535 {{OOO_STRING_SVTOOLS_HTML_S_equiv}, 8801},
536 {{OOO_STRING_SVTOOLS_HTML_S_le}, 8804},
537 {{OOO_STRING_SVTOOLS_HTML_S_ge}, 8805},
538 {{OOO_STRING_SVTOOLS_HTML_S_sub}, 8834},
539 {{OOO_STRING_SVTOOLS_HTML_S_sup}, 8835},
540 {{OOO_STRING_SVTOOLS_HTML_S_nsub}, 8836},
541 {{OOO_STRING_SVTOOLS_HTML_S_sube}, 8838},
542 {{OOO_STRING_SVTOOLS_HTML_S_supe}, 8839},
543 {{OOO_STRING_SVTOOLS_HTML_S_oplus}, 8853},
544 {{OOO_STRING_SVTOOLS_HTML_S_otimes}, 8855},
545 {{OOO_STRING_SVTOOLS_HTML_S_perp}, 8869},
546 {{OOO_STRING_SVTOOLS_HTML_S_sdot}, 8901},
547 {{OOO_STRING_SVTOOLS_HTML_S_lceil}, 8968},
548 {{OOO_STRING_SVTOOLS_HTML_S_rceil}, 8969},
549 {{OOO_STRING_SVTOOLS_HTML_S_lfloor}, 8970},
550 {{OOO_STRING_SVTOOLS_HTML_S_rfloor}, 8971},
551 {{OOO_STRING_SVTOOLS_HTML_S_lang}, 9001},
552 {{OOO_STRING_SVTOOLS_HTML_S_rang}, 9002},
553 {{OOO_STRING_SVTOOLS_HTML_S_loz}, 9674},
554 {{OOO_STRING_SVTOOLS_HTML_S_spades}, 9824},
555 {{OOO_STRING_SVTOOLS_HTML_S_clubs}, 9827},
556 {{OOO_STRING_SVTOOLS_HTML_S_hearts}, 9829},
557 {{OOO_STRING_SVTOOLS_HTML_S_diams}, 9830}
560 extern "C"
563 static int
564 #if defined( WNT )
565 __cdecl
566 #endif
567 #if defined( ICC ) && defined( OS2 )
568 _Optlink
569 #endif
570 HTMLCharNameCompare( const void *pFirst, const void *pSecond)
572 int nRet = 0;
573 if( USHRT_MAX == ((HTML_CharEntry*)pFirst)->cChar )
575 if( USHRT_MAX == ((HTML_CharEntry*)pSecond)->cChar )
576 nRet = ((HTML_CharEntry*)pFirst)->pUName->CompareTo(
577 *((HTML_CharEntry*)pSecond)->pUName );
578 else
579 nRet = ((HTML_CharEntry*)pFirst)->pUName->CompareToAscii(
580 ((HTML_CharEntry*)pSecond)->sName );
582 else
584 if( USHRT_MAX == ((HTML_CharEntry*)pSecond)->cChar )
585 nRet = -1 * ((HTML_CharEntry*)pSecond)->pUName->CompareToAscii(
586 ((HTML_CharEntry*)pFirst)->sName );
587 else
588 nRet = strcmp( ((HTML_CharEntry*)pFirst)->sName,
589 ((HTML_CharEntry*)pSecond)->sName );
592 return nRet;
597 sal_Unicode GetHTMLCharName( const String& rName )
599 if( !bSortCharKeyWords )
601 qsort( (void*) aHTMLCharNameTab,
602 sizeof( aHTMLCharNameTab ) / sizeof( HTML_CharEntry ),
603 sizeof( HTML_CharEntry ),
604 HTMLCharNameCompare );
605 bSortCharKeyWords = TRUE;
608 sal_Unicode cRet = 0;
609 void* pFound;
610 HTML_CharEntry aSrch;
611 aSrch.pUName = &rName;
612 aSrch.cChar = USHRT_MAX;
614 if( 0 != ( pFound = bsearch( (sal_Char *) &aSrch,
615 (void*) aHTMLCharNameTab,
616 sizeof( aHTMLCharNameTab) / sizeof( HTML_CharEntry ),
617 sizeof( HTML_CharEntry ),
618 HTMLCharNameCompare )))
619 cRet = ((HTML_CharEntry*)pFound)->cChar;
620 return cRet;
623 /*\f*/
625 // Flag: Optionen-Tabelle wurde schon sortiert
626 static int __FAR_DATA bSortOptionKeyWords = FALSE;
628 static HTML_TokenEntry __FAR_DATA aHTMLOptionTab[] = {
630 // Attribute ohne Wert
631 {{OOO_STRING_SVTOOLS_HTML_O_box}, HTML_O_BOX},
632 {{OOO_STRING_SVTOOLS_HTML_O_checked}, HTML_O_CHECKED},
633 {{OOO_STRING_SVTOOLS_HTML_O_compact}, HTML_O_COMPACT},
634 {{OOO_STRING_SVTOOLS_HTML_O_continue}, HTML_O_CONTINUE},
635 {{OOO_STRING_SVTOOLS_HTML_O_controls}, HTML_O_CONTROLS}, // IExplorer 2.0
636 {{OOO_STRING_SVTOOLS_HTML_O_declare}, HTML_O_DECLARE},
637 {{OOO_STRING_SVTOOLS_HTML_O_disabled}, HTML_O_DISABLED},
638 {{OOO_STRING_SVTOOLS_HTML_O_folded}, HTML_O_FOLDED}, // Netscape internal
639 {{OOO_STRING_SVTOOLS_HTML_O_ismap}, HTML_O_ISMAP},
640 {{OOO_STRING_SVTOOLS_HTML_O_mayscript}, HTML_O_MAYSCRIPT},
641 {{OOO_STRING_SVTOOLS_HTML_O_multiple}, HTML_O_MULTIPLE},
642 {{OOO_STRING_SVTOOLS_HTML_O_noflow}, HTML_O_NOFLOW},
643 {{OOO_STRING_SVTOOLS_HTML_O_nohref}, HTML_O_NOHREF}, // Netscape 2.0
644 {{OOO_STRING_SVTOOLS_HTML_O_noresize}, HTML_O_NORESIZE}, // Netscape 2.0
645 {{OOO_STRING_SVTOOLS_HTML_O_noshade}, HTML_O_NOSHADE}, // Netscape 2.0
646 {{OOO_STRING_SVTOOLS_HTML_O_nowrap}, HTML_O_NOWRAP},
647 {{OOO_STRING_SVTOOLS_HTML_O_plain}, HTML_O_PLAIN},
648 {{OOO_STRING_SVTOOLS_HTML_O_sdfixed}, HTML_O_SDFIXED},
649 {{OOO_STRING_SVTOOLS_HTML_O_selected}, HTML_O_SELECTED},
650 {{OOO_STRING_SVTOOLS_HTML_O_shapes}, HTML_O_SHAPES},
652 // Attribute mit einem String als Wert
653 {{OOO_STRING_SVTOOLS_HTML_O_above}, HTML_O_ABOVE},
654 {{OOO_STRING_SVTOOLS_HTML_O_accept}, HTML_O_ACCEPT},
655 {{OOO_STRING_SVTOOLS_HTML_O_accesskey}, HTML_O_ACCESSKEY},
656 {{OOO_STRING_SVTOOLS_HTML_O_add_date}, HTML_O_ADD_DATE}, // Netscape internal
657 {{OOO_STRING_SVTOOLS_HTML_O_alt}, HTML_O_ALT},
658 {{OOO_STRING_SVTOOLS_HTML_O_axes}, HTML_O_AXES},
659 {{OOO_STRING_SVTOOLS_HTML_O_axis}, HTML_O_AXIS},
660 {{OOO_STRING_SVTOOLS_HTML_O_below}, HTML_O_BELOW},
661 {{OOO_STRING_SVTOOLS_HTML_O_char}, HTML_O_CHAR}, // HTML 3 Table Model Draft
662 {{OOO_STRING_SVTOOLS_HTML_O_class}, HTML_O_CLASS},
663 {{OOO_STRING_SVTOOLS_HTML_O_clip}, HTML_O_CLIP},
664 {{OOO_STRING_SVTOOLS_HTML_O_code}, HTML_O_CODE}, // HotJava
665 {{OOO_STRING_SVTOOLS_HTML_O_codetype}, HTML_O_CODETYPE},
666 {{OOO_STRING_SVTOOLS_HTML_O_colspec}, HTML_O_COLSPEC},
667 {{OOO_STRING_SVTOOLS_HTML_O_content}, HTML_O_CONTENT},
668 {{OOO_STRING_SVTOOLS_HTML_O_coords}, HTML_O_COORDS}, // Netscape 2.0
669 {{OOO_STRING_SVTOOLS_HTML_O_dp}, HTML_O_DP},
670 {{OOO_STRING_SVTOOLS_HTML_O_enctype}, HTML_O_ENCTYPE},
671 {{OOO_STRING_SVTOOLS_HTML_O_error}, HTML_O_ERROR},
672 {{OOO_STRING_SVTOOLS_HTML_O_face}, HTML_O_FACE}, // IExplorer 2.0
673 {{OOO_STRING_SVTOOLS_HTML_O_frameborder}, HTML_O_FRAMEBORDER}, // IExplorer 3.0
674 {{OOO_STRING_SVTOOLS_HTML_O_httpequiv}, HTML_O_HTTPEQUIV},
675 {{OOO_STRING_SVTOOLS_HTML_O_language}, HTML_O_LANGUAGE}, // JavaScript
676 {{OOO_STRING_SVTOOLS_HTML_O_last_modified}, HTML_O_LAST_MODIFIED}, // Netscape internal
677 {{OOO_STRING_SVTOOLS_HTML_O_last_visit}, HTML_O_LAST_VISIT}, // Netscape internal
678 {{OOO_STRING_SVTOOLS_HTML_O_md}, HTML_O_MD},
679 {{OOO_STRING_SVTOOLS_HTML_O_n}, HTML_O_N},
680 {{OOO_STRING_SVTOOLS_HTML_O_name}, HTML_O_NAME},
681 {{OOO_STRING_SVTOOLS_HTML_O_notation}, HTML_O_NOTATION},
682 {{OOO_STRING_SVTOOLS_HTML_O_prompt}, HTML_O_PROMPT},
683 {{OOO_STRING_SVTOOLS_HTML_O_shape}, HTML_O_SHAPE},
684 {{OOO_STRING_SVTOOLS_HTML_O_standby}, HTML_O_STANDBY},
685 {{OOO_STRING_SVTOOLS_HTML_O_style}, HTML_O_STYLE},
686 {{OOO_STRING_SVTOOLS_HTML_O_title}, HTML_O_TITLE},
687 {{OOO_STRING_SVTOOLS_HTML_O_value}, HTML_O_VALUE},
688 {{OOO_STRING_SVTOOLS_HTML_O_SDval}, HTML_O_SDVAL}, // StarDiv NumberValue
689 {{OOO_STRING_SVTOOLS_HTML_O_SDnum}, HTML_O_SDNUM}, // StarDiv NumberFormat
690 {{OOO_STRING_SVTOOLS_HTML_O_sdlibrary}, HTML_O_SDLIBRARY},
691 {{OOO_STRING_SVTOOLS_HTML_O_sdmodule}, HTML_O_SDMODULE},
693 // Attribute mit einem SGML-Identifier als Wert
694 {{OOO_STRING_SVTOOLS_HTML_O_from}, HTML_O_FROM},
695 {{OOO_STRING_SVTOOLS_HTML_O_id}, HTML_O_ID},
696 {{OOO_STRING_SVTOOLS_HTML_O_target}, HTML_O_TARGET}, // Netscape 2.0
697 {{OOO_STRING_SVTOOLS_HTML_O_to}, HTML_O_TO},
698 {{OOO_STRING_SVTOOLS_HTML_O_until}, HTML_O_UNTIL},
700 // Attribute mit einem URI als Wert
701 {{OOO_STRING_SVTOOLS_HTML_O_action}, HTML_O_ACTION},
702 {{OOO_STRING_SVTOOLS_HTML_O_archive}, HTML_O_ARCHIVE},
703 {{OOO_STRING_SVTOOLS_HTML_O_background}, HTML_O_BACKGROUND},
704 {{OOO_STRING_SVTOOLS_HTML_O_classid}, HTML_O_CLASSID},
705 {{OOO_STRING_SVTOOLS_HTML_O_codebase}, HTML_O_CODEBASE}, // HotJava
706 {{OOO_STRING_SVTOOLS_HTML_O_data}, HTML_O_DATA},
707 {{OOO_STRING_SVTOOLS_HTML_O_dynsrc}, HTML_O_DYNSRC}, // IExplorer 3.0b1
708 {{OOO_STRING_SVTOOLS_HTML_O_dynsync}, HTML_O_DYNSYNC}, // IExplorer 2.0
709 {{OOO_STRING_SVTOOLS_HTML_O_imagemap}, HTML_O_IMAGEMAP},
710 {{OOO_STRING_SVTOOLS_HTML_O_href}, HTML_O_HREF},
711 {{OOO_STRING_SVTOOLS_HTML_O_lowsrc}, HTML_O_LOWSRC}, // Netscape 3.0
712 {{OOO_STRING_SVTOOLS_HTML_O_script}, HTML_O_SCRIPT},
713 {{OOO_STRING_SVTOOLS_HTML_O_src}, HTML_O_SRC},
714 {{OOO_STRING_SVTOOLS_HTML_O_usemap}, HTML_O_USEMAP}, // Netscape 2.0
716 // Attribute mit Entity-Namen als Wert
717 {{OOO_STRING_SVTOOLS_HTML_O_dingbat}, HTML_O_DINGBAT},
718 {{OOO_STRING_SVTOOLS_HTML_O_sym}, HTML_O_SYM},
720 // Attribute mit einer Farbe als Wert (alle Netscape)
721 {{OOO_STRING_SVTOOLS_HTML_O_alink}, HTML_O_ALINK},
722 {{OOO_STRING_SVTOOLS_HTML_O_bgcolor}, HTML_O_BGCOLOR},
723 {{OOO_STRING_SVTOOLS_HTML_O_bordercolor}, HTML_O_BORDERCOLOR}, // IExplorer 2.0
724 {{OOO_STRING_SVTOOLS_HTML_O_bordercolorlight}, HTML_O_BORDERCOLORLIGHT}, // IExplorer 2.0
725 {{OOO_STRING_SVTOOLS_HTML_O_bordercolordark}, HTML_O_BORDERCOLORDARK}, // IExplorer 2.0
726 {{OOO_STRING_SVTOOLS_HTML_O_color}, HTML_O_COLOR},
727 {{OOO_STRING_SVTOOLS_HTML_O_link}, HTML_O_LINK},
728 {{OOO_STRING_SVTOOLS_HTML_O_text}, HTML_O_TEXT},
729 {{OOO_STRING_SVTOOLS_HTML_O_vlink}, HTML_O_VLINK},
731 // Attribute mit einem numerischen Wert
732 {{OOO_STRING_SVTOOLS_HTML_O_border}, HTML_O_BORDER},
733 {{OOO_STRING_SVTOOLS_HTML_O_cellspacing},HTML_O_CELLSPACING}, // HTML 3 Table Model Draft
734 {{OOO_STRING_SVTOOLS_HTML_O_cellpadding},HTML_O_CELLPADDING}, // HTML 3 Table Model Draft
735 {{OOO_STRING_SVTOOLS_HTML_O_charoff}, HTML_O_CHAROFF}, // HTML 3 Table Model Draft
736 {{OOO_STRING_SVTOOLS_HTML_O_colspan}, HTML_O_COLSPAN},
737 {{OOO_STRING_SVTOOLS_HTML_O_framespacing}, HTML_O_FRAMESPACING}, // IExplorer 3.0
738 {{OOO_STRING_SVTOOLS_HTML_O_gutter}, HTML_O_GUTTER}, // Netscape 3.0b5
739 {{OOO_STRING_SVTOOLS_HTML_O_indent}, HTML_O_INDENT},
740 {{OOO_STRING_SVTOOLS_HTML_O_height}, HTML_O_HEIGHT},
741 {{OOO_STRING_SVTOOLS_HTML_O_hspace}, HTML_O_HSPACE}, // Netscape
742 {{OOO_STRING_SVTOOLS_HTML_O_left}, HTML_O_LEFT},
743 {{OOO_STRING_SVTOOLS_HTML_O_leftmargin}, HTML_O_LEFTMARGIN}, // IExplorer 2.0
744 {{OOO_STRING_SVTOOLS_HTML_O_loop}, HTML_O_LOOP}, // IExplorer 2.0
745 {{OOO_STRING_SVTOOLS_HTML_O_marginheight},HTML_O_MARGINHEIGHT}, // Netscape 2.0
746 {{OOO_STRING_SVTOOLS_HTML_O_marginwidth},HTML_O_MARGINWIDTH}, // Netscape 2.0
747 {{OOO_STRING_SVTOOLS_HTML_O_max}, HTML_O_MAX},
748 {{OOO_STRING_SVTOOLS_HTML_O_maxlength}, HTML_O_MAXLENGTH},
749 {{OOO_STRING_SVTOOLS_HTML_O_min}, HTML_O_MIN},
750 {{OOO_STRING_SVTOOLS_HTML_O_pagex}, HTML_O_PAGEX},
751 {{OOO_STRING_SVTOOLS_HTML_O_pagey}, HTML_O_PAGEY},
752 {{OOO_STRING_SVTOOLS_HTML_O_pointsize}, HTML_O_POINTSIZE},
753 {{OOO_STRING_SVTOOLS_HTML_O_rowspan}, HTML_O_ROWSPAN},
754 {{OOO_STRING_SVTOOLS_HTML_O_scrollamount}, HTML_O_SCROLLAMOUNT}, // IExplorer 2.0
755 {{OOO_STRING_SVTOOLS_HTML_O_scrolldelay}, HTML_O_SCROLLDELAY}, // IExplorer 2.0
756 {{OOO_STRING_SVTOOLS_HTML_O_seqnum}, HTML_O_SEQNUM},
757 {{OOO_STRING_SVTOOLS_HTML_O_skip}, HTML_O_SKIP},
758 {{OOO_STRING_SVTOOLS_HTML_O_span}, HTML_O_SPAN}, // HTML 3 Table Model Draft
759 {{OOO_STRING_SVTOOLS_HTML_O_tabindex}, HTML_O_TABINDEX},
760 {{OOO_STRING_SVTOOLS_HTML_O_top}, HTML_O_TOP},
761 {{OOO_STRING_SVTOOLS_HTML_O_topmargin}, HTML_O_TOPMARGIN}, // IExplorer 2.0
762 {{OOO_STRING_SVTOOLS_HTML_O_vspace}, HTML_O_VSPACE}, // Netscape
763 {{OOO_STRING_SVTOOLS_HTML_O_weight}, HTML_O_WEIGHT},
764 {{OOO_STRING_SVTOOLS_HTML_O_width}, HTML_O_WIDTH},
765 {{OOO_STRING_SVTOOLS_HTML_O_x}, HTML_O_X},
766 {{OOO_STRING_SVTOOLS_HTML_O_y}, HTML_O_Y},
767 {{OOO_STRING_SVTOOLS_HTML_O_zindex}, HTML_O_ZINDEX},
769 // Attribute mit Enum-Werten
770 {{OOO_STRING_SVTOOLS_HTML_O_bgproperties}, HTML_O_BGPROPERTIES}, // IExplorer 2.0
771 {{OOO_STRING_SVTOOLS_HTML_O_behavior}, HTML_O_BEHAVIOR}, // IExplorer 2.0
772 {{OOO_STRING_SVTOOLS_HTML_O_clear}, HTML_O_CLEAR},
773 {{OOO_STRING_SVTOOLS_HTML_O_dir}, HTML_O_DIR}, // HTML 3 Table Model Draft
774 {{OOO_STRING_SVTOOLS_HTML_O_direction}, HTML_O_DIRECTION}, // IExplorer 2.0
775 {{OOO_STRING_SVTOOLS_HTML_O_format}, HTML_O_FORMAT},
776 {{OOO_STRING_SVTOOLS_HTML_O_frame}, HTML_O_FRAME}, // HTML 3 Table Model Draft
777 {{OOO_STRING_SVTOOLS_HTML_O_lang}, HTML_O_LANG},
778 {{OOO_STRING_SVTOOLS_HTML_O_method}, HTML_O_METHOD},
779 {{OOO_STRING_SVTOOLS_HTML_O_palette}, HTML_O_PALETTE},
780 {{OOO_STRING_SVTOOLS_HTML_O_rel}, HTML_O_REL},
781 {{OOO_STRING_SVTOOLS_HTML_O_rev}, HTML_O_REV},
782 {{OOO_STRING_SVTOOLS_HTML_O_rules}, HTML_O_RULES}, // HTML 3 Table Model Draft
783 {{OOO_STRING_SVTOOLS_HTML_O_scrolling}, HTML_O_SCROLLING}, // Netscape 2.0
784 {{OOO_STRING_SVTOOLS_HTML_O_sdreadonly}, HTML_O_SDREADONLY},
785 {{OOO_STRING_SVTOOLS_HTML_O_subtype}, HTML_O_SUBTYPE},
786 {{OOO_STRING_SVTOOLS_HTML_O_type}, HTML_O_TYPE},
787 {{OOO_STRING_SVTOOLS_HTML_O_valign}, HTML_O_VALIGN},
788 {{OOO_STRING_SVTOOLS_HTML_O_valuetype}, HTML_O_VALUETYPE},
789 {{OOO_STRING_SVTOOLS_HTML_O_wrap}, HTML_O_WRAP},
790 {{OOO_STRING_SVTOOLS_HTML_O_visibility}, HTML_O_VISIBILITY},
792 // Attribute mit Script-Code als Wert
793 {{OOO_STRING_SVTOOLS_HTML_O_onblur}, HTML_O_ONBLUR}, // JavaScript
794 {{OOO_STRING_SVTOOLS_HTML_O_onchange}, HTML_O_ONCHANGE}, // JavaScript
795 {{OOO_STRING_SVTOOLS_HTML_O_onclick}, HTML_O_ONCLICK}, // JavaScript
796 {{OOO_STRING_SVTOOLS_HTML_O_onfocus}, HTML_O_ONFOCUS}, // JavaScript
797 {{OOO_STRING_SVTOOLS_HTML_O_onload}, HTML_O_ONLOAD}, // JavaScript
798 {{OOO_STRING_SVTOOLS_HTML_O_onmouseover}, HTML_O_ONMOUSEOVER}, // JavaScript
799 {{OOO_STRING_SVTOOLS_HTML_O_onreset}, HTML_O_ONRESET}, // JavaScript
800 {{OOO_STRING_SVTOOLS_HTML_O_onselect}, HTML_O_ONSELECT}, // JavaScript
801 {{OOO_STRING_SVTOOLS_HTML_O_onsubmit}, HTML_O_ONSUBMIT}, // JavaScript
802 {{OOO_STRING_SVTOOLS_HTML_O_onunload}, HTML_O_ONUNLOAD}, // JavaScript
803 {{OOO_STRING_SVTOOLS_HTML_O_onabort}, HTML_O_ONABORT}, // JavaScript
804 {{OOO_STRING_SVTOOLS_HTML_O_onerror}, HTML_O_ONERROR}, // JavaScript
805 {{OOO_STRING_SVTOOLS_HTML_O_onmouseout}, HTML_O_ONMOUSEOUT}, // JavaScript
807 {{OOO_STRING_SVTOOLS_HTML_O_SDonblur}, HTML_O_SDONBLUR}, // StarBasic
808 {{OOO_STRING_SVTOOLS_HTML_O_SDonchange}, HTML_O_SDONCHANGE}, // StarBasic
809 {{OOO_STRING_SVTOOLS_HTML_O_SDonclick}, HTML_O_SDONCLICK}, // StarBasic
810 {{OOO_STRING_SVTOOLS_HTML_O_SDonfocus}, HTML_O_SDONFOCUS}, // StarBasic
811 {{OOO_STRING_SVTOOLS_HTML_O_SDonload}, HTML_O_SDONLOAD}, // StarBasic
812 {{OOO_STRING_SVTOOLS_HTML_O_SDonmouseover}, HTML_O_SDONMOUSEOVER}, // StarBasic
813 {{OOO_STRING_SVTOOLS_HTML_O_SDonreset}, HTML_O_SDONRESET}, // StarBasic
814 {{OOO_STRING_SVTOOLS_HTML_O_SDonselect}, HTML_O_SDONSELECT}, // StarBasic
815 {{OOO_STRING_SVTOOLS_HTML_O_SDonsubmit}, HTML_O_SDONSUBMIT}, // StarBasic
816 {{OOO_STRING_SVTOOLS_HTML_O_SDonunload}, HTML_O_SDONUNLOAD}, // StarBasic
817 {{OOO_STRING_SVTOOLS_HTML_O_SDonabort}, HTML_O_SDONABORT}, // StarBasic
818 {{OOO_STRING_SVTOOLS_HTML_O_SDonerror}, HTML_O_SDONERROR}, // StarBasic
819 {{OOO_STRING_SVTOOLS_HTML_O_SDonmouseout}, HTML_O_SDONMOUSEOUT}, // StarBasic
821 // Attribute mit Kontext-abhaengigen Werten
822 {{OOO_STRING_SVTOOLS_HTML_O_align}, HTML_O_ALIGN},
823 {{OOO_STRING_SVTOOLS_HTML_O_cols}, HTML_O_COLS}, // Netscape 2.0 vs HTML 2.0
824 {{OOO_STRING_SVTOOLS_HTML_O_rows}, HTML_O_ROWS}, // Netscape 2.0 vs HTML 2.0
825 {{OOO_STRING_SVTOOLS_HTML_O_size}, HTML_O_SIZE},
826 {{OOO_STRING_SVTOOLS_HTML_O_start}, HTML_O_START}, // Netscape 2.0 vs IExplorer 2.0
827 {{OOO_STRING_SVTOOLS_HTML_O_units}, HTML_O_UNITS}
830 int GetHTMLOption( const String& rName )
832 if( !bSortOptionKeyWords )
834 qsort( (void*) aHTMLOptionTab,
835 sizeof( aHTMLOptionTab ) / sizeof( HTML_TokenEntry ),
836 sizeof( HTML_TokenEntry ),
837 HTMLKeyCompare );
838 bSortOptionKeyWords = TRUE;
841 int nRet = HTML_O_UNKNOWN;
842 void* pFound;
843 HTML_TokenEntry aSrch;
844 aSrch.pUToken = &rName;
845 aSrch.nToken = -1;
847 if( 0 != ( pFound = bsearch( (sal_Char *) &aSrch,
848 (void*) aHTMLOptionTab,
849 sizeof( aHTMLOptionTab ) / sizeof( HTML_TokenEntry ),
850 sizeof( HTML_TokenEntry ),
851 HTMLKeyCompare )))
852 nRet = ((HTML_TokenEntry*)pFound)->nToken;
853 return nRet;
856 /*\f*/
858 // Flag: Farb-Tabelle wurde schon sortiert
859 struct HTML_ColorEntry
861 union
863 const sal_Char* sName;
864 const String *pUName;
866 ULONG nColor;
869 static int __FAR_DATA bSortColorKeyWords = FALSE;
871 #define HTML_NO_COLOR 0xffffffffUL
873 // die Farbnamen werden nicht exportiert
874 // Sie stammen aus "http://www.uio.no/~mnbjerke/colors_w.html"
875 // und scheinen im Gegensatz zu denen aus
876 // "http://www.infi.net/wwwimages/colorindex.html"
877 // zu stimmen
878 static HTML_ColorEntry __FAR_DATA aHTMLColorNameTab[] = {
879 { { "ALICEBLUE" }, 0x00f0f8ffUL },
880 { { "ANTIQUEWHITE" }, 0x00faebd7UL },
881 { { "AQUA" }, 0x0000ffffUL },
882 { { "AQUAMARINE" }, 0x007fffd4UL },
883 { { "AZURE" }, 0x00f0ffffUL },
884 { { "BEIGE" }, 0x00f5f5dcUL },
885 { { "BISQUE" }, 0x00ffe4c4UL },
886 { { "BLACK" }, 0x00000000UL },
887 { { "BLANCHEDALMOND" }, 0x00ffebcdUL },
888 { { "BLUE" }, 0x000000ffUL },
889 { { "BLUEVIOLET" }, 0x008a2be2UL },
890 { { "BROWN" }, 0x00a52a2aUL },
891 { { "BURLYWOOD" }, 0x00deb887UL },
892 { { "CADETBLUE" }, 0x005f9ea0UL },
893 { { "CHARTREUSE" }, 0x007fff00UL },
894 { { "CHOCOLATE" }, 0x00d2691eUL },
895 { { "CORAL" }, 0x00ff7f50UL },
896 { { "CORNFLOWERBLUE" }, 0x006495edUL },
897 { { "CORNSILK" }, 0x00fff8dcUL },
898 { { "CRIMSON" }, 0x00dc143cUL },
899 { { "CYAN" }, 0x0000ffffUL },
900 { { "DARKBLUE" }, 0x0000008bUL },
901 { { "DARKCYAN" }, 0x00008b8bUL },
902 { { "DARKGOLDENROD" }, 0x00b8860bUL },
903 { { "DARKGRAY" }, 0x00a9a9a9UL },
904 { { "DARKGREEN" }, 0x00006400UL },
905 { { "DARKKHAKI" }, 0x00bdb76bUL },
906 { { "DARKMAGENTA" }, 0x008b008bUL },
907 { { "DARKOLIVEGREEN" }, 0x00556b2fUL },
908 { { "DARKORANGE" }, 0x00ff8c00UL },
909 { { "DARKORCHID" }, 0x009932ccUL },
910 { { "DARKRED" }, 0x008b0000UL },
911 { { "DARKSALMON" }, 0x00e9967aUL },
912 { { "DARKSEAGREEN" }, 0x008fbc8fUL },
913 { { "DARKSLATEBLUE" }, 0x00483d8bUL },
914 { { "DARKSLATEGRAY" }, 0x002f4f4fUL },
915 { { "DARKTURQUOISE" }, 0x0000ced1UL },
916 { { "DARKVIOLET" }, 0x009400d3UL },
917 { { "DEEPPINK" }, 0x00ff1493UL },
918 { { "DEEPSKYBLUE" }, 0x0000bfffUL },
919 { { "DIMGRAY" }, 0x00696969UL },
920 { { "DODGERBLUE" }, 0x001e90ffUL },
921 { { "FIREBRICK" }, 0x00b22222UL },
922 { { "FLORALWHITE" }, 0x00fffaf0UL },
923 { { "FORESTGREEN" }, 0x00228b22UL },
924 { { "FUCHSIA" }, 0x00ff00ffUL },
925 { { "GAINSBORO" }, 0x00dcdcdcUL },
926 { { "GHOSTWHITE" }, 0x00f8f8ffUL },
927 { { "GOLD" }, 0x00ffd700UL },
928 { { "GOLDENROD" }, 0x00daa520UL },
929 { { "GRAY" }, 0x00808080UL },
930 { { "GREEN" }, 0x00008000UL },
931 { { "GREENYELLOW" }, 0x00adff2fUL },
932 { { "HONEYDEW" }, 0x00f0fff0UL },
933 { { "HOTPINK" }, 0x00ff69b4UL },
934 { { "INDIANRED" }, 0x00cd5c5cUL },
935 { { "INDIGO" }, 0x004b0082UL },
936 { { "IVORY" }, 0x00fffff0UL },
937 { { "KHAKI" }, 0x00f0e68cUL },
938 { { "LAVENDER" }, 0x00e6e6faUL },
939 { { "LAVENDERBLUSH" }, 0x00fff0f5UL },
940 { { "LAWNGREEN" }, 0x007cfc00UL },
941 { { "LEMONCHIFFON" }, 0x00fffacdUL },
942 { { "LIGHTBLUE" }, 0x00add8e6UL },
943 { { "LIGHTCORAL" }, 0x00f08080UL },
944 { { "LIGHTCYAN" }, 0x00e0ffffUL },
945 { { "LIGHTGOLDENRODYELLOW" }, 0x00fafad2UL },
946 { { "LIGHTGREEN" }, 0x0090ee90UL },
947 { { "LIGHTGREY" }, 0x00d3d3d3UL },
948 { { "LIGHTPINK" }, 0x00ffb6c1UL },
949 { { "LIGHTSALMON" }, 0x00ffa07aUL },
950 { { "LIGHTSEAGREEN" }, 0x0020b2aaUL },
951 { { "LIGHTSKYBLUE" }, 0x0087cefaUL },
952 { { "LIGHTSLATEGRAY" }, 0x00778899UL },
953 { { "LIGHTSTEELBLUE" }, 0x00b0c4deUL },
954 { { "LIGHTYELLOW" }, 0x00ffffe0UL },
955 { { "LIME" }, 0x0000ff00UL },
956 { { "LIMEGREEN" }, 0x0032cd32UL },
957 { { "LINEN" }, 0x00faf0e6UL },
958 { { "MAGENTA" }, 0x00ff00ffUL },
959 { { "MAROON" }, 0x00800000UL },
960 { { "MEDIUMAQUAMARINE" }, 0x0066cdaaUL },
961 { { "MEDIUMBLUE" }, 0x000000cdUL },
962 { { "MEDIUMORCHID" }, 0x00ba55d3UL },
963 { { "MEDIUMPURPLE" }, 0x009370dbUL },
964 { { "MEDIUMSEAGREEN" }, 0x003cb371UL },
965 { { "MEDIUMSLATEBLUE" }, 0x007b68eeUL },
966 { { "MEDIUMSPRINGGREEN" }, 0x0000fa9aUL },
967 { { "MEDIUMTURQUOISE" }, 0x0048d1ccUL },
968 { { "MEDIUMVIOLETRED" }, 0x00c71585UL },
969 { { "MIDNIGHTBLUE" }, 0x00191970UL },
970 { { "MINTCREAM" }, 0x00f5fffaUL },
971 { { "MISTYROSE" }, 0x00ffe4e1UL },
972 { { "MOCCASIN" }, 0x00ffe4b5UL },
973 { { "NAVAJOWHITE" }, 0x00ffdeadUL },
974 { { "NAVY" }, 0x00000080UL },
975 { { "OLDLACE" }, 0x00fdf5e6UL },
976 { { "OLIVE" }, 0x00808000UL },
977 { { "OLIVEDRAB" }, 0x006b8e23UL },
978 { { "ORANGE" }, 0x00ffa500UL },
979 { { "ORANGERED" }, 0x00ff4500UL },
980 { { "ORCHID" }, 0x00da70d6UL },
981 { { "PALEGOLDENROD" }, 0x00eee8aaUL },
982 { { "PALEGREEN" }, 0x0098fb98UL },
983 { { "PALETURQUOISE" }, 0x00afeeeeUL },
984 { { "PALEVIOLETRED" }, 0x00db7093UL },
985 { { "PAPAYAWHIP" }, 0x00ffefd5UL },
986 { { "PEACHPUFF" }, 0x00ffdab9UL },
987 { { "PERU" }, 0x00cd853fUL },
988 { { "PINK" }, 0x00ffc0cbUL },
989 { { "PLUM" }, 0x00dda0ddUL },
990 { { "POWDERBLUE" }, 0x00b0e0e6UL },
991 { { "PURPLE" }, 0x00800080UL },
992 { { "RED" }, 0x00ff0000UL },
993 { { "ROSYBROWN" }, 0x00bc8f8fUL },
994 { { "ROYALBLUE" }, 0x004169e1UL },
995 { { "SADDLEBROWN" }, 0x008b4513UL },
996 { { "SALMON" }, 0x00fa8072UL },
997 { { "SANDYBROWN" }, 0x00f4a460UL },
998 { { "SEAGREEN" }, 0x002e8b57UL },
999 { { "SEASHELL" }, 0x00fff5eeUL },
1000 { { "SIENNA" }, 0x00a0522dUL },
1001 { { "SILVER" }, 0x00c0c0c0UL },
1002 { { "SKYBLUE" }, 0x0087ceebUL },
1003 { { "SLATEBLUE" }, 0x006a5acdUL },
1004 { { "SLATEGRAY" }, 0x00708090UL },
1005 { { "SNOW" }, 0x00fffafaUL },
1006 { { "SPRINGGREEN" }, 0x0000ff7fUL },
1007 { { "STEELBLUE" }, 0x004682b4UL },
1008 { { "TAN" }, 0x00d2b48cUL },
1009 { { "TEAL" }, 0x00008080UL },
1010 { { "THISTLE" }, 0x00d8bfd8UL },
1011 { { "TOMATO" }, 0x00ff6347UL },
1012 { { "TURQUOISE" }, 0x0040e0d0UL },
1013 { { "VIOLET" }, 0x00ee82eeUL },
1014 { { "WHEAT" }, 0x00f5deb3UL },
1015 { { "WHITE" }, 0x00ffffffUL },
1016 { { "WHITESMOKE" }, 0x00f5f5f5UL },
1017 { { "YELLOW" }, 0x00ffff00UL },
1018 { { "YELLOWGREEN" }, 0x009acd32UL }
1021 extern "C"
1024 static int
1025 #if defined( WNT )
1026 __cdecl
1027 #endif
1028 #if defined( ICC ) && defined( OS2 )
1029 _Optlink
1030 #endif
1031 HTMLColorNameCompare( const void *pFirst, const void *pSecond)
1033 int nRet = 0;
1034 if( HTML_NO_COLOR == ((HTML_ColorEntry*)pFirst)->nColor )
1036 if( HTML_NO_COLOR == ((HTML_ColorEntry*)pSecond)->nColor )
1037 nRet = ((HTML_ColorEntry*)pFirst)->pUName->CompareTo(
1038 *((HTML_ColorEntry*)pSecond)->pUName );
1039 else
1040 nRet = ((HTML_ColorEntry*)pFirst)->pUName->CompareToAscii(
1041 ((HTML_ColorEntry*)pSecond)->sName );
1043 else
1045 if( HTML_NO_COLOR == ((HTML_ColorEntry*)pSecond)->nColor )
1046 nRet = -1 * ((HTML_ColorEntry*)pSecond)->pUName->CompareToAscii(
1047 ((HTML_ColorEntry*)pFirst)->sName );
1048 else
1049 nRet = strcmp( ((HTML_ColorEntry*)pFirst)->sName,
1050 ((HTML_ColorEntry*)pSecond)->sName );
1053 return nRet;
1058 ULONG GetHTMLColor( const String& rName )
1060 if( !bSortColorKeyWords )
1062 qsort( (void*) aHTMLColorNameTab,
1063 sizeof( aHTMLColorNameTab ) / sizeof( HTML_ColorEntry ),
1064 sizeof( HTML_ColorEntry ),
1065 HTMLColorNameCompare );
1066 bSortColorKeyWords = TRUE;
1069 ULONG nRet = ULONG_MAX;
1070 void* pFound;
1071 HTML_ColorEntry aSrch;
1072 aSrch.pUName = &rName;
1073 aSrch.nColor = HTML_NO_COLOR;
1075 if( 0 != ( pFound = bsearch( (sal_Char *) &aSrch,
1076 (void*) aHTMLColorNameTab,
1077 sizeof( aHTMLColorNameTab) / sizeof( HTML_ColorEntry ),
1078 sizeof( HTML_ColorEntry ),
1079 HTMLColorNameCompare )))
1080 nRet = ((HTML_ColorEntry*)pFound)->nColor;
1082 return nRet;