[Libreoffice-commits] core.git: 2 commits - svtools/source
Jan Holesovsky
kendy at collabora.com
Fri Feb 21 03:05:01 PST 2014
svtools/source/svhtml/htmlkywd.cxx | 284 ++++++++++++++++++-------------------
svtools/source/svhtml/parhtml.cxx | 9 -
2 files changed, 147 insertions(+), 146 deletions(-)
New commits:
commit 8a467da032954f4591ed30c0ca3a9bc05b343e06
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Feb 21 11:16:59 2014 +0100
html: Make GetColor() working in lower case.
To be consistent with the rest that works in lower case now.
Change-Id: I6fe40e71393230bbde8e283b1f98479bf644c610
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 6517e5c..5d49ab5 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -229,8 +229,7 @@ void HTMLOption::GetColor( Color& rColor ) const
DBG_ASSERT( (nToken>=HTML_OPTION_COLOR_START && nToken<HTML_OPTION_COLOR_END) || nToken==HTML_O_SIZE,
"GetColor: Option is not a color." );
- OUString aTmp( aValue );
- aTmp = aTmp.toAsciiUpperCase();
+ OUString aTmp(aValue.toAsciiLowerCase());
sal_uInt32 nColor = SAL_MAX_UINT32;
if( '#' != aTmp[0] )
nColor = GetHTMLColor( aTmp );
@@ -252,9 +251,9 @@ void HTMLOption::GetColor( Color& rColor ) const
}
nColor *= 16;
if( c >= '0' && c <= '9' )
- nColor += (c - 48);
- else if( c >= 'A' && c <= 'F' )
- nColor += (c - 55);
+ nColor += (c - '0');
+ else if( c >= 'a' && c <= 'f' )
+ nColor += (c + 0xa - 'a');
}
}
commit 0f1b3df7a35251e077404c4534bc14a35fd0501a
Author: Jan Holesovsky <kendy at collabora.com>
Date: Fri Feb 21 10:54:16 2014 +0100
html: Lowercase the html colors, and make the comparison more robust.
Change-Id: I5fb3b1c8ea3692864707489ff9a82b78c5647d4a
diff --git a/svtools/source/svhtml/htmlkywd.cxx b/svtools/source/svhtml/htmlkywd.cxx
index c0b7915..4c0fde7 100644
--- a/svtools/source/svhtml/htmlkywd.cxx
+++ b/svtools/source/svhtml/htmlkywd.cxx
@@ -753,146 +753,146 @@ static bool bSortColorKeyWords = false;
// "http://www.uio.no/~mnbjerke/colors_w.html")
// "http://www.infi.net/wwwimages/colorindex.html" seem to be buggy.
static HTML_ColorEntry aHTMLColorNameTab[] = {
- { { "ALICEBLUE" }, 0x00f0f8ffUL },
- { { "ANTIQUEWHITE" }, 0x00faebd7UL },
- { { "AQUA" }, 0x0000ffffUL },
- { { "AQUAMARINE" }, 0x007fffd4UL },
- { { "AZURE" }, 0x00f0ffffUL },
- { { "BEIGE" }, 0x00f5f5dcUL },
- { { "BISQUE" }, 0x00ffe4c4UL },
- { { "BLACK" }, 0x00000000UL },
- { { "BLANCHEDALMOND" }, 0x00ffebcdUL },
- { { "BLUE" }, 0x000000ffUL },
- { { "BLUEVIOLET" }, 0x008a2be2UL },
- { { "BROWN" }, 0x00a52a2aUL },
- { { "BURLYWOOD" }, 0x00deb887UL },
- { { "CADETBLUE" }, 0x005f9ea0UL },
- { { "CHARTREUSE" }, 0x007fff00UL },
- { { "CHOCOLATE" }, 0x00d2691eUL },
- { { "CORAL" }, 0x00ff7f50UL },
- { { "CORNFLOWERBLUE" }, 0x006495edUL },
- { { "CORNSILK" }, 0x00fff8dcUL },
- { { "CRIMSON" }, 0x00dc143cUL },
- { { "CYAN" }, 0x0000ffffUL },
- { { "DARKBLUE" }, 0x0000008bUL },
- { { "DARKCYAN" }, 0x00008b8bUL },
- { { "DARKGOLDENROD" }, 0x00b8860bUL },
- { { "DARKGRAY" }, 0x00a9a9a9UL },
- { { "DARKGREEN" }, 0x00006400UL },
- { { "DARKKHAKI" }, 0x00bdb76bUL },
- { { "DARKMAGENTA" }, 0x008b008bUL },
- { { "DARKOLIVEGREEN" }, 0x00556b2fUL },
- { { "DARKORANGE" }, 0x00ff8c00UL },
- { { "DARKORCHID" }, 0x009932ccUL },
- { { "DARKRED" }, 0x008b0000UL },
- { { "DARKSALMON" }, 0x00e9967aUL },
- { { "DARKSEAGREEN" }, 0x008fbc8fUL },
- { { "DARKSLATEBLUE" }, 0x00483d8bUL },
- { { "DARKSLATEGRAY" }, 0x002f4f4fUL },
- { { "DARKTURQUOISE" }, 0x0000ced1UL },
- { { "DARKVIOLET" }, 0x009400d3UL },
- { { "DEEPPINK" }, 0x00ff1493UL },
- { { "DEEPSKYBLUE" }, 0x0000bfffUL },
- { { "DIMGRAY" }, 0x00696969UL },
- { { "DODGERBLUE" }, 0x001e90ffUL },
- { { "FIREBRICK" }, 0x00b22222UL },
- { { "FLORALWHITE" }, 0x00fffaf0UL },
- { { "FORESTGREEN" }, 0x00228b22UL },
- { { "FUCHSIA" }, 0x00ff00ffUL },
- { { "GAINSBORO" }, 0x00dcdcdcUL },
- { { "GHOSTWHITE" }, 0x00f8f8ffUL },
- { { "GOLD" }, 0x00ffd700UL },
- { { "GOLDENROD" }, 0x00daa520UL },
- { { "GRAY" }, 0x00808080UL },
- { { "GREEN" }, 0x00008000UL },
- { { "GREENYELLOW" }, 0x00adff2fUL },
- { { "HONEYDEW" }, 0x00f0fff0UL },
- { { "HOTPINK" }, 0x00ff69b4UL },
- { { "INDIANRED" }, 0x00cd5c5cUL },
- { { "INDIGO" }, 0x004b0082UL },
- { { "IVORY" }, 0x00fffff0UL },
- { { "KHAKI" }, 0x00f0e68cUL },
- { { "LAVENDER" }, 0x00e6e6faUL },
- { { "LAVENDERBLUSH" }, 0x00fff0f5UL },
- { { "LAWNGREEN" }, 0x007cfc00UL },
- { { "LEMONCHIFFON" }, 0x00fffacdUL },
- { { "LIGHTBLUE" }, 0x00add8e6UL },
- { { "LIGHTCORAL" }, 0x00f08080UL },
- { { "LIGHTCYAN" }, 0x00e0ffffUL },
- { { "LIGHTGOLDENRODYELLOW" }, 0x00fafad2UL },
- { { "LIGHTGREEN" }, 0x0090ee90UL },
- { { "LIGHTGREY" }, 0x00d3d3d3UL },
- { { "LIGHTPINK" }, 0x00ffb6c1UL },
- { { "LIGHTSALMON" }, 0x00ffa07aUL },
- { { "LIGHTSEAGREEN" }, 0x0020b2aaUL },
- { { "LIGHTSKYBLUE" }, 0x0087cefaUL },
- { { "LIGHTSLATEGRAY" }, 0x00778899UL },
- { { "LIGHTSTEELBLUE" }, 0x00b0c4deUL },
- { { "LIGHTYELLOW" }, 0x00ffffe0UL },
- { { "LIME" }, 0x0000ff00UL },
- { { "LIMEGREEN" }, 0x0032cd32UL },
- { { "LINEN" }, 0x00faf0e6UL },
- { { "MAGENTA" }, 0x00ff00ffUL },
- { { "MAROON" }, 0x00800000UL },
- { { "MEDIUMAQUAMARINE" }, 0x0066cdaaUL },
- { { "MEDIUMBLUE" }, 0x000000cdUL },
- { { "MEDIUMORCHID" }, 0x00ba55d3UL },
- { { "MEDIUMPURPLE" }, 0x009370dbUL },
- { { "MEDIUMSEAGREEN" }, 0x003cb371UL },
- { { "MEDIUMSLATEBLUE" }, 0x007b68eeUL },
- { { "MEDIUMSPRINGGREEN" }, 0x0000fa9aUL },
- { { "MEDIUMTURQUOISE" }, 0x0048d1ccUL },
- { { "MEDIUMVIOLETRED" }, 0x00c71585UL },
- { { "MIDNIGHTBLUE" }, 0x00191970UL },
- { { "MINTCREAM" }, 0x00f5fffaUL },
- { { "MISTYROSE" }, 0x00ffe4e1UL },
- { { "MOCCASIN" }, 0x00ffe4b5UL },
- { { "NAVAJOWHITE" }, 0x00ffdeadUL },
- { { "NAVY" }, 0x00000080UL },
- { { "OLDLACE" }, 0x00fdf5e6UL },
- { { "OLIVE" }, 0x00808000UL },
- { { "OLIVEDRAB" }, 0x006b8e23UL },
- { { "ORANGE" }, 0x00ffa500UL },
- { { "ORANGERED" }, 0x00ff4500UL },
- { { "ORCHID" }, 0x00da70d6UL },
- { { "PALEGOLDENROD" }, 0x00eee8aaUL },
- { { "PALEGREEN" }, 0x0098fb98UL },
- { { "PALETURQUOISE" }, 0x00afeeeeUL },
- { { "PALEVIOLETRED" }, 0x00db7093UL },
- { { "PAPAYAWHIP" }, 0x00ffefd5UL },
- { { "PEACHPUFF" }, 0x00ffdab9UL },
- { { "PERU" }, 0x00cd853fUL },
- { { "PINK" }, 0x00ffc0cbUL },
- { { "PLUM" }, 0x00dda0ddUL },
- { { "POWDERBLUE" }, 0x00b0e0e6UL },
- { { "PURPLE" }, 0x00800080UL },
- { { "RED" }, 0x00ff0000UL },
- { { "ROSYBROWN" }, 0x00bc8f8fUL },
- { { "ROYALBLUE" }, 0x004169e1UL },
- { { "SADDLEBROWN" }, 0x008b4513UL },
- { { "SALMON" }, 0x00fa8072UL },
- { { "SANDYBROWN" }, 0x00f4a460UL },
- { { "SEAGREEN" }, 0x002e8b57UL },
- { { "SEASHELL" }, 0x00fff5eeUL },
- { { "SIENNA" }, 0x00a0522dUL },
- { { "SILVER" }, 0x00c0c0c0UL },
- { { "SKYBLUE" }, 0x0087ceebUL },
- { { "SLATEBLUE" }, 0x006a5acdUL },
- { { "SLATEGRAY" }, 0x00708090UL },
- { { "SNOW" }, 0x00fffafaUL },
- { { "SPRINGGREEN" }, 0x0000ff7fUL },
- { { "STEELBLUE" }, 0x004682b4UL },
- { { "TAN" }, 0x00d2b48cUL },
- { { "TEAL" }, 0x00008080UL },
- { { "THISTLE" }, 0x00d8bfd8UL },
- { { "TOMATO" }, 0x00ff6347UL },
- { { "TURQUOISE" }, 0x0040e0d0UL },
- { { "VIOLET" }, 0x00ee82eeUL },
- { { "WHEAT" }, 0x00f5deb3UL },
- { { "WHITE" }, 0x00ffffffUL },
- { { "WHITESMOKE" }, 0x00f5f5f5UL },
- { { "YELLOW" }, 0x00ffff00UL },
- { { "YELLOWGREEN" }, 0x009acd32UL }
+ { { "aliceblue" }, 0x00f0f8ffUL },
+ { { "antiquewhite" }, 0x00faebd7UL },
+ { { "aqua" }, 0x0000ffffUL },
+ { { "aquamarine" }, 0x007fffd4UL },
+ { { "azure" }, 0x00f0ffffUL },
+ { { "beige" }, 0x00f5f5dcUL },
+ { { "bisque" }, 0x00ffe4c4UL },
+ { { "black" }, 0x00000000UL },
+ { { "blanchedalmond" }, 0x00ffebcdUL },
+ { { "blue" }, 0x000000ffUL },
+ { { "blueviolet" }, 0x008a2be2UL },
+ { { "brown" }, 0x00a52a2aUL },
+ { { "burlywood" }, 0x00deb887UL },
+ { { "cadetblue" }, 0x005f9ea0UL },
+ { { "chartreuse" }, 0x007fff00UL },
+ { { "chocolate" }, 0x00d2691eUL },
+ { { "coral" }, 0x00ff7f50UL },
+ { { "cornflowerblue" }, 0x006495edUL },
+ { { "cornsilk" }, 0x00fff8dcUL },
+ { { "crimson" }, 0x00dc143cUL },
+ { { "cyan" }, 0x0000ffffUL },
+ { { "darkblue" }, 0x0000008bUL },
+ { { "darkcyan" }, 0x00008b8bUL },
+ { { "darkgoldenrod" }, 0x00b8860bUL },
+ { { "darkgray" }, 0x00a9a9a9UL },
+ { { "darkgreen" }, 0x00006400UL },
+ { { "darkkhaki" }, 0x00bdb76bUL },
+ { { "darkmagenta" }, 0x008b008bUL },
+ { { "darkolivegreen" }, 0x00556b2fUL },
+ { { "darkorange" }, 0x00ff8c00UL },
+ { { "darkorchid" }, 0x009932ccUL },
+ { { "darkred" }, 0x008b0000UL },
+ { { "darksalmon" }, 0x00e9967aUL },
+ { { "darkseagreen" }, 0x008fbc8fUL },
+ { { "darkslateblue" }, 0x00483d8bUL },
+ { { "darkslategray" }, 0x002f4f4fUL },
+ { { "darkturquoise" }, 0x0000ced1UL },
+ { { "darkviolet" }, 0x009400d3UL },
+ { { "deeppink" }, 0x00ff1493UL },
+ { { "deepskyblue" }, 0x0000bfffUL },
+ { { "dimgray" }, 0x00696969UL },
+ { { "dodgerblue" }, 0x001e90ffUL },
+ { { "firebrick" }, 0x00b22222UL },
+ { { "floralwhite" }, 0x00fffaf0UL },
+ { { "forestgreen" }, 0x00228b22UL },
+ { { "fuchsia" }, 0x00ff00ffUL },
+ { { "gainsboro" }, 0x00dcdcdcUL },
+ { { "ghostwhite" }, 0x00f8f8ffUL },
+ { { "gold" }, 0x00ffd700UL },
+ { { "goldenrod" }, 0x00daa520UL },
+ { { "gray" }, 0x00808080UL },
+ { { "green" }, 0x00008000UL },
+ { { "greenyellow" }, 0x00adff2fUL },
+ { { "honeydew" }, 0x00f0fff0UL },
+ { { "hotpink" }, 0x00ff69b4UL },
+ { { "indianred" }, 0x00cd5c5cUL },
+ { { "indigo" }, 0x004b0082UL },
+ { { "ivory" }, 0x00fffff0UL },
+ { { "khaki" }, 0x00f0e68cUL },
+ { { "lavender" }, 0x00e6e6faUL },
+ { { "lavenderblush" }, 0x00fff0f5UL },
+ { { "lawngreen" }, 0x007cfc00UL },
+ { { "lemonchiffon" }, 0x00fffacdUL },
+ { { "lightblue" }, 0x00add8e6UL },
+ { { "lightcoral" }, 0x00f08080UL },
+ { { "lightcyan" }, 0x00e0ffffUL },
+ { { "lightgoldenrodyellow" }, 0x00fafad2UL },
+ { { "lightgreen" }, 0x0090ee90UL },
+ { { "lightgrey" }, 0x00d3d3d3UL },
+ { { "lightpink" }, 0x00ffb6c1UL },
+ { { "lightsalmon" }, 0x00ffa07aUL },
+ { { "lightseagreen" }, 0x0020b2aaUL },
+ { { "lightskyblue" }, 0x0087cefaUL },
+ { { "lightslategray" }, 0x00778899UL },
+ { { "lightsteelblue" }, 0x00b0c4deUL },
+ { { "lightyellow" }, 0x00ffffe0UL },
+ { { "lime" }, 0x0000ff00UL },
+ { { "limegreen" }, 0x0032cd32UL },
+ { { "linen" }, 0x00faf0e6UL },
+ { { "magenta" }, 0x00ff00ffUL },
+ { { "maroon" }, 0x00800000UL },
+ { { "mediumaquamarine" }, 0x0066cdaaUL },
+ { { "mediumblue" }, 0x000000cdUL },
+ { { "mediumorchid" }, 0x00ba55d3UL },
+ { { "mediumpurple" }, 0x009370dbUL },
+ { { "mediumseagreen" }, 0x003cb371UL },
+ { { "mediumslateblue" }, 0x007b68eeUL },
+ { { "mediumspringgreen" }, 0x0000fa9aUL },
+ { { "mediumturquoise" }, 0x0048d1ccUL },
+ { { "mediumvioletred" }, 0x00c71585UL },
+ { { "midnightblue" }, 0x00191970UL },
+ { { "mintcream" }, 0x00f5fffaUL },
+ { { "mistyrose" }, 0x00ffe4e1UL },
+ { { "moccasin" }, 0x00ffe4b5UL },
+ { { "navajowhite" }, 0x00ffdeadUL },
+ { { "navy" }, 0x00000080UL },
+ { { "oldlace" }, 0x00fdf5e6UL },
+ { { "olive" }, 0x00808000UL },
+ { { "olivedrab" }, 0x006b8e23UL },
+ { { "orange" }, 0x00ffa500UL },
+ { { "orangered" }, 0x00ff4500UL },
+ { { "orchid" }, 0x00da70d6UL },
+ { { "palegoldenrod" }, 0x00eee8aaUL },
+ { { "palegreen" }, 0x0098fb98UL },
+ { { "paleturquoise" }, 0x00afeeeeUL },
+ { { "palevioletred" }, 0x00db7093UL },
+ { { "papayawhip" }, 0x00ffefd5UL },
+ { { "peachpuff" }, 0x00ffdab9UL },
+ { { "peru" }, 0x00cd853fUL },
+ { { "pink" }, 0x00ffc0cbUL },
+ { { "plum" }, 0x00dda0ddUL },
+ { { "powderblue" }, 0x00b0e0e6UL },
+ { { "purple" }, 0x00800080UL },
+ { { "red" }, 0x00ff0000UL },
+ { { "rosybrown" }, 0x00bc8f8fUL },
+ { { "royalblue" }, 0x004169e1UL },
+ { { "saddlebrown" }, 0x008b4513UL },
+ { { "salmon" }, 0x00fa8072UL },
+ { { "sandybrown" }, 0x00f4a460UL },
+ { { "seagreen" }, 0x002e8b57UL },
+ { { "seashell" }, 0x00fff5eeUL },
+ { { "sienna" }, 0x00a0522dUL },
+ { { "silver" }, 0x00c0c0c0UL },
+ { { "skyblue" }, 0x0087ceebUL },
+ { { "slateblue" }, 0x006a5acdUL },
+ { { "slategray" }, 0x00708090UL },
+ { { "snow" }, 0x00fffafaUL },
+ { { "springgreen" }, 0x0000ff7fUL },
+ { { "steelblue" }, 0x004682b4UL },
+ { { "tan" }, 0x00d2b48cUL },
+ { { "teal" }, 0x00008080UL },
+ { { "thistle" }, 0x00d8bfd8UL },
+ { { "tomato" }, 0x00ff6347UL },
+ { { "turquoise" }, 0x0040e0d0UL },
+ { { "violet" }, 0x00ee82eeUL },
+ { { "wheat" }, 0x00f5deb3UL },
+ { { "white" }, 0x00ffffffUL },
+ { { "whitesmoke" }, 0x00f5f5f5UL },
+ { { "yellow" }, 0x00ffff00UL },
+ { { "yellowgreen" }, 0x009acd32UL }
};
extern "C"
@@ -937,7 +937,9 @@ sal_uInt32 GetHTMLColor( const OUString& rName )
sal_uInt32 nRet = HTML_NO_COLOR;
void* pFound;
HTML_ColorEntry aSrch;
- aSrch.pUName = &rName;
+ OUString aLowerCase(rName.toAsciiLowerCase());
+
+ aSrch.pUName = &aLowerCase;
aSrch.nColor = HTML_NO_COLOR;
if( 0 != ( pFound = bsearch( (sal_Char *) &aSrch,
More information about the Libreoffice-commits
mailing list