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