LCOV - code coverage report
Current view: top level - libreoffice/svtools/source/svhtml - htmlkywd.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 19 72 26.4 %
Date: 2012-12-27 Functions: 2 7 28.6 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10