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