Starmath has now full support of HTML colors.

Some of them have been added to the UI ( from Css3 ).
There was not a criteria for color picking so I chose those whose name told me something, those I liked and some to have a more complete palette.
It would be nice to be able to ask our users whose colors from https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_Keywords they want in the UI.
The color names have been left in alphabetical order.
Starmathdatabse has clang format.

Change-Id: I6ac1bdbc9e3ed10bff75a99b90bf92d3dcdcabcb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105892
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
dante
2020-11-15 10:11:16 +01:00
committed by Noel Grandin
parent 0094423237
commit 0643dab681
11 changed files with 779 additions and 328 deletions

View File

@@ -89,7 +89,7 @@ class SmParser
// Moves between tokens inside starmath code. // Moves between tokens inside starmath code.
void NextToken(); void NextToken();
void NextTokenColor(); void NextTokenColor(bool dvipload);
void NextTokenFontSize(); void NextTokenFontSize();
sal_Int32 GetTokenIndex() const { return m_nTokenIndex; } sal_Int32 GetTokenIndex() const { return m_nTokenIndex; }
void Replace( sal_Int32 nPos, sal_Int32 nLen, const OUString &rText ); void Replace( sal_Int32 nPos, sal_Int32 nLen, const OUString &rText );

View File

@@ -43,9 +43,138 @@ constexpr Color COL_SM_BLUE(0x0000FF);
constexpr Color COL_SM_TEAL(0x008080); constexpr Color COL_SM_TEAL(0x008080);
constexpr Color COL_SM_AQUA(0x00FFFF); constexpr Color COL_SM_AQUA(0x00FFFF);
/* CSS Level 2 */ /* CSS Level 2 */
// TODO constexpr Color COL_SM_ORANGE(0xFFA500);
/* CSS Level 3 */ /* CSS Level 3 */
// TODO constexpr Color COL_SM_ALICEBLUE(0xF0F8FF);
constexpr Color COL_SM_ANTIQUEWHITE(0xFAEBD7);
constexpr Color COL_SM_AQUAMARINE(0x7FFFD4);
constexpr Color COL_SM_AZURE(0xF0FFFF);
constexpr Color COL_SM_BEIGE(0xF5F5DC);
constexpr Color COL_SM_BISQUE(0xFFE4C4);
constexpr Color COL_SM_BLANCHEDALMOND(0xFFEBCD);
constexpr Color COL_SM_BLUEVIOLET(0x8A2BE2);
constexpr Color COL_SM_BROWN(0xA52A2A);
constexpr Color COL_SM_BURLYWOOD(0xDEB887);
constexpr Color COL_SM_CADETBLUE(0x5F9EA0);
constexpr Color COL_SM_CHARTREUSE(0x7FFF00);
constexpr Color COL_SM_CHOCOLATE(0xD2691E);
constexpr Color COL_SM_CORAL(0xFF7F50);
constexpr Color COL_SM_CORNFLOWERBLUE(0x6495ED);
constexpr Color COL_SM_CORNSILK(0xFFF8DC);
constexpr Color COL_SM_CRIMSON(0xDC143C);
constexpr Color COL_SM_CYAN(0x00FFFF);
constexpr Color COL_SM_DARKBLUE(0x00008B);
constexpr Color COL_SM_DARKCYAN(0x008B8B);
constexpr Color COL_SM_DARKGOLDENROD(0xB8860B);
constexpr Color COL_SM_DARKGRAY(0xA9A9A9);
constexpr Color COL_SM_DARKGREEN(0x006400);
constexpr Color COL_SM_DARKGREY(0xA9A9A9);
constexpr Color COL_SM_DARKKHAKI(0xBDB76B);
constexpr Color COL_SM_DARKMAGENTA(0x8B008B);
constexpr Color COL_SM_DARKOLIVEGREEN(0x556B2F);
constexpr Color COL_SM_DARKORANGE(0xFF8C00);
constexpr Color COL_SM_DARKORCHID(0x9932CC);
constexpr Color COL_SM_DARKRED(0x8B0000);
constexpr Color COL_SM_DARKSALMON(0xE9967A);
constexpr Color COL_SM_DARKSEAGREEN(0x8FBC8F);
constexpr Color COL_SM_DARKSLATEBLUE(0x483D8B);
constexpr Color COL_SM_DARKSLATEGRAY(0x2F4F4F);
constexpr Color COL_SM_DARKSLATEGREY(0x2F4F4F);
constexpr Color COL_SM_DARKTURQUOISE(0x00CED1);
constexpr Color COL_SM_DARKVIOLET(0x9400D3);
constexpr Color COL_SM_DEEPPINK(0xFF1493);
constexpr Color COL_SM_DEEPSKYBLUE(0x00BFFF);
constexpr Color COL_SM_DIMGRAY(0x696969);
constexpr Color COL_SM_DIMGREY(0x696969);
constexpr Color COL_SM_DODGERBLUE(0x1E90FF);
constexpr Color COL_SM_FIREBRICK(0xB22222);
constexpr Color COL_SM_FLORALWHITE(0xFFFAF0);
constexpr Color COL_SM_FORESTGREEN(0x228B22);
constexpr Color COL_SM_GAINSBORO(0xDCDCDC);
constexpr Color COL_SM_GHOSTWHITE(0xF8F8FF);
constexpr Color COL_SM_GOLD(0xFFD700);
constexpr Color COL_SM_GOLDENROD(0xDAA520);
constexpr Color COL_SM_GREENYELLOW(0xADFF2F);
constexpr Color COL_SM_GREY(0x808080);
constexpr Color COL_SM_HONEYDEW(0xF0FFF0);
constexpr Color COL_SM_HOTPINK(0xFF69B4);
constexpr Color COL_SM_INDIANRED(0xCD5C5C);
constexpr Color COL_SM_INDIGO(0x4B0082);
constexpr Color COL_SM_IVORY(0xFFFFF0);
constexpr Color COL_SM_KHAKI(0xF0E68C);
constexpr Color COL_SM_LAVENDER(0xE6E6FA);
constexpr Color COL_SM_LAVENDERBLUSH(0xFFF0F5);
constexpr Color COL_SM_LAWNGREEN(0x7CFC00);
constexpr Color COL_SM_LEMONCHIFFON(0xFFFACD);
constexpr Color COL_SM_LIGHTBLUE(0xADD8E6);
constexpr Color COL_SM_LIGHTCORAL(0xF08080);
constexpr Color COL_SM_LIGHTCYAN(0xE0FFFF);
constexpr Color COL_SM_LIGHTGOLDENRODYELLOW(0xFAFAD2);
constexpr Color COL_SM_LIGHTGRAY(0xD3D3D3);
constexpr Color COL_SM_LIGHTGREEN(0x90EE90);
constexpr Color COL_SM_LIGHTGREY(0xD3D3D3);
constexpr Color COL_SM_LIGHTPINK(0xFFB6C1);
constexpr Color COL_SM_LIGHTSALMON(0xFFA07A);
constexpr Color COL_SM_LIGHTSEAGREEN(0x20B2AA);
constexpr Color COL_SM_LIGHTSKYBLUE(0x87CEFA);
constexpr Color COL_SM_LIGHTSLATEGRAY(0x778899);
constexpr Color COL_SM_LIGHTSLATEGREY(0x778899);
constexpr Color COL_SM_LIGHTSTEELBLUE(0xB0C4DE);
constexpr Color COL_SM_LIGHTYELLOW(0xFFFFE0);
constexpr Color COL_SM_LIMEGREEN(0x32CD32);
constexpr Color COL_SM_LINEN(0xFAF0E6);
constexpr Color COL_SM_MAGENTA(0xFF00FF);
constexpr Color COL_SM_MEDIUMAQUAMARINE(0x66CDAA);
constexpr Color COL_SM_MEDIUMBLUE(0x0000CD);
constexpr Color COL_SM_MEDIUMORCHID(0xBA55D3);
constexpr Color COL_SM_MEDIUMPURPLE(0x9370DB);
constexpr Color COL_SM_MEDIUMSEAGREEN(0x3CB371);
constexpr Color COL_SM_MEDIUMSLATEBLUE(0x7B68EE);
constexpr Color COL_SM_MEDIUMSPRINGGREEN(0x00FA9A);
constexpr Color COL_SM_MEDIUMTURQUOISE(0x48D1CC);
constexpr Color COL_SM_MEDIUMVIOLETRED(0xC71585);
constexpr Color COL_SM_MIDNIGHTBLUE(0x191970);
constexpr Color COL_SM_MINTCREAM(0xF5FFFA);
constexpr Color COL_SM_MISTYROSE(0xFFE4E1);
constexpr Color COL_SM_MOCCASIN(0xFFE4B5);
constexpr Color COL_SM_NAVAJOWHITE(0xFFDEAD);
constexpr Color COL_SM_OLDLACE(0xFDF5E6);
constexpr Color COL_SM_OLIVEDRAB(0x6B8E23);
constexpr Color COL_SM_ORANGERED(0xFF4500);
constexpr Color COL_SM_ORCHID(0xDA70D6);
constexpr Color COL_SM_PALEGOLDENROD(0xEEE8AA);
constexpr Color COL_SM_PALEGREEN(0x98FB98);
constexpr Color COL_SM_PALETURQUOISE(0xAFEEEE);
constexpr Color COL_SM_PALEVIOLETRED(0xDB7093);
constexpr Color COL_SM_PAPAYAWHIP(0xFFEFD5);
constexpr Color COL_SM_PEACHPUFF(0xFFDAB9);
constexpr Color COL_SM_PERU(0xCD853F);
constexpr Color COL_SM_PINK(0xFFC0CB);
constexpr Color COL_SM_PLUM(0xDDA0DD);
constexpr Color COL_SM_POWDERBLUE(0xB0E0E6);
constexpr Color COL_SM_ROSYBROWN(0xBC8F8F);
constexpr Color COL_SM_ROYALBLUE(0x4169E1);
constexpr Color COL_SM_SADDLEBROWN(0x8B4513);
constexpr Color COL_SM_SALMON(0xFA8072);
constexpr Color COL_SM_SANDYBROWN(0xF4A460);
constexpr Color COL_SM_SEAGREEN(0x2E8B57);
constexpr Color COL_SM_SEASHELL(0xFFF5EE);
constexpr Color COL_SM_SIENNA(0xA0522D);
constexpr Color COL_SM_SKYBLUE(0x87CEEB);
constexpr Color COL_SM_SLATEBLUE(0x6A5ACD);
constexpr Color COL_SM_SLATEGRAY(0x708090);
constexpr Color COL_SM_SLATEGREY(0x708090);
constexpr Color COL_SM_SNOW(0xFFFAFA);
constexpr Color COL_SM_SPRINGGREEN(0x00FF7F);
constexpr Color COL_SM_STEELBLUE(0x4682B4);
constexpr Color COL_SM_TAN(0xD2B48C);
constexpr Color COL_SM_THISTLE(0xD8BFD8);
constexpr Color COL_SM_TOMATO(0xFF6347);
constexpr Color COL_SM_TURQUOISE(0x40E0D0);
constexpr Color COL_SM_VIOLET(0xEE82EE);
constexpr Color COL_SM_WHEAT(0xF5DEB3);
constexpr Color COL_SM_WHITESMOKE(0xF5F5F5);
constexpr Color COL_SM_YELLOWGREEN(0x9ACD32);
/* CSS Level 4 */ /* CSS Level 4 */
constexpr Color COL_SM_REBECCAPURPLE(0x663399); constexpr Color COL_SM_REBECCAPURPLE(0x663399);
/* dvipsnames */ /* dvipsnames */
@@ -68,8 +197,8 @@ constexpr Color COL_SM_LO_GREEN(0x00A500);
namespace starmathdatabase namespace starmathdatabase
{ {
// Variables containing color information. // Variables containing color information.
extern const SmColorTokenTableEntry aColorTokenTableParse[31]; extern const SmColorTokenTableEntry aColorTokenTableParse[159];
extern const SmColorTokenTableEntry aColorTokenTableHTML[20]; extern const SmColorTokenTableEntry aColorTokenTableHTML[148];
extern const SmColorTokenTableEntry aColorTokenTableDVIPSNAMES[5]; extern const SmColorTokenTableEntry aColorTokenTableDVIPSNAMES[5];
/** /**

View File

@@ -205,6 +205,17 @@
#define RID_COLORX_RGB_HELP NC_("RID_COLORX_RGB_HELP", "Color RGB" ) #define RID_COLORX_RGB_HELP NC_("RID_COLORX_RGB_HELP", "Color RGB" )
#define RID_COLORX_RGBA_HELP NC_("RID_COLORX_RGBA_HELP", "Color RGBA" ) #define RID_COLORX_RGBA_HELP NC_("RID_COLORX_RGBA_HELP", "Color RGBA" )
#define RID_COLORX_HEX_HELP NC_("RID_COLORX_HEX_HELP", "Color hexadecimal" ) #define RID_COLORX_HEX_HELP NC_("RID_COLORX_HEX_HELP", "Color hexadecimal" )
#define RID_COLORX_CORAL_HELP NC_("RID_COLORX_CORAL_HELP", "Color Coral" )
#define RID_COLORX_CRIMSON_HELP NC_("RID_COLORX_CRIMSON_HELP", "Color Crimson" )
#define RID_COLORX_MIDNIGHT_HELP NC_("RID_COLORX_MIDNIGHT_HELP", "Color Midnight blue" )
#define RID_COLORX_VIOLET_HELP NC_("RID_COLORX_VIOLET_HELP", "Color Violet" )
#define RID_COLORX_ORANGE_HELP NC_("RID_COLORX_ORANGE_HELP", "Color Orange" )
#define RID_COLORX_ORANGERED_HELP NC_("RID_COLORX_ORANGERED_HELP", "Color Orangered" )
#define RID_COLORX_SEAGREEN_HELP NC_("RID_COLORX_SEAGREEN_HELP", "Color Seagreen" )
#define RID_COLORX_INDIGO_HELP NC_("RID_COLORX_INDIGO_HELP", "Color Indigo" )
#define RID_COLORX_HOTPINK_HELP NC_("RID_COLORX_HOTPINK_HELP", "Color Hot pink" )
#define RID_COLORX_LAVENDER_HELP NC_("RID_COLORX_LAVENDER_HELP", "Color Lavender" )
#define RID_COLORX_SNOW_HELP NC_("RID_COLORX_SNOW_HELP", "Color Snow" )
#define RID_LRGROUPX_HELP NC_("RID_LRGROUPX_HELP", "Group Brackets" ) #define RID_LRGROUPX_HELP NC_("RID_LRGROUPX_HELP", "Group Brackets" )
#define RID_LRPARENTX_HELP NC_("RID_LRPARENTX_HELP", "Round Brackets" ) #define RID_LRPARENTX_HELP NC_("RID_LRPARENTX_HELP", "Round Brackets" )
#define RID_LRBRACKETX_HELP NC_("RID_LRBRACKETX_HELP", "Square Brackets" ) #define RID_LRBRACKETX_HELP NC_("RID_LRBRACKETX_HELP", "Square Brackets" )
@@ -337,6 +348,17 @@
#define STR_SILVER NC_("STR_SILVER", "silver" ) #define STR_SILVER NC_("STR_SILVER", "silver" )
#define STR_TEAL NC_("STR_TEAL", "teal" ) #define STR_TEAL NC_("STR_TEAL", "teal" )
#define STR_YELLOW NC_("STR_YELLOW", "yellow" ) #define STR_YELLOW NC_("STR_YELLOW", "yellow" )
#define STR_CORAL NC_("STR_CORAL", "coral" )
#define STR_CRIMSON NC_("STR_CRIMSON", "crimson" )
#define STR_MIDNIGHT NC_("STR_MIDNIGHT", "midnight" )
#define STR_VIOLET NC_("STR_VIOLET", "violet" )
#define STR_ORANGE NC_("STR_ORANGE", "orange" )
#define STR_ORANGERED NC_("STR_ORANGERED", "orangered" )
#define STR_LAVENDER NC_("STR_LAVENDER", "lavender" )
#define STR_SNOW NC_("STR_SNOW", "snow" )
#define STR_SEAGREEN NC_("STR_SEAGREEN", "seagreen" )
#define STR_INDIGO NC_("STR_INDIGO", "indigo" )
#define STR_HOTPINK NC_("STR_HOTPINK", "hotpink" )
#define STR_RGB NC_("STR_RGB", "rgb" ) #define STR_RGB NC_("STR_RGB", "rgb" )
#define STR_RGBA NC_("STR_RGBA", "rgba" ) #define STR_RGBA NC_("STR_RGBA", "rgba" )
#define STR_HEX NC_("STR_HEX", "hex" ) #define STR_HEX NC_("STR_HEX", "hex" )

View File

@@ -197,6 +197,17 @@
#define RID_COLORX_RGB "color rgb 0 0 0 {<?>} " #define RID_COLORX_RGB "color rgb 0 0 0 {<?>} "
#define RID_COLORX_RGBA "color rgba 0 0 0 0 {<?>} " #define RID_COLORX_RGBA "color rgba 0 0 0 0 {<?>} "
#define RID_COLORX_HEX "color hex 000000 {<?>} " #define RID_COLORX_HEX "color hex 000000 {<?>} "
#define RID_COLORX_CORAL "color coral {<?>} "
#define RID_COLORX_CRIMSON "color crimson {<?>} "
#define RID_COLORX_MIDNIGHT "color mignightblue {<?>} "
#define RID_COLORX_VIOLET "color violet {<?>} "
#define RID_COLORX_ORANGE "color orange {<?>} "
#define RID_COLORX_ORANGERED "color orangered {<?>} "
#define RID_COLORX_SEAGREEN "color seagreen {<?>} "
#define RID_COLORX_INDIGO "color indigo {<?>} "
#define RID_COLORX_HOTPINK "color hotpink {<?>} "
#define RID_COLORX_LAVENDER "color lavender {<?>} "
#define RID_COLORX_SNOW "color snow {<?>} "
#define RID_LRGROUPX "{<?>} " #define RID_LRGROUPX "{<?>} "
#define RID_LRPARENTX "(<?>) " #define RID_LRPARENTX "(<?>) "
#define RID_LRBRACKETX "[<?>] " #define RID_LRBRACKETX "[<?>] "
@@ -225,14 +236,14 @@
#define RID_EVAL_FROMX "evaluate {<?>} from{<?>} " #define RID_EVAL_FROMX "evaluate {<?>} from{<?>} "
#define RID_EVAL_TOX "evaluate {<?>} to{<?>} " #define RID_EVAL_TOX "evaluate {<?>} to{<?>} "
#define RID_EVAL_FROMTOX "evaluate {<?>} from{<?>} to{<?>} " #define RID_EVAL_FROMTOX "evaluate {<?>} from{<?>} to{<?>} "
#define RID_RSUBX "<?>_{<?>}" #define RID_RSUBX "<?>_{<?>} "
#define RID_RSUPX "<?>^{<?>}" #define RID_RSUPX "<?>^{<?>} "
#define RID_LSUBX "<?> lsub{<?>} " #define RID_LSUBX "<?> lsub{<?>} "
#define RID_LSUPX "<?> lsup{<?>} " #define RID_LSUPX "<?> lsup{<?>} "
#define RID_CSUBX "<?> csub{<?>} " #define RID_CSUBX "<?> csub{<?>} "
#define RID_CSUPX "<?> csup{<?>} " #define RID_CSUPX "<?> csup{<?>} "
#define RID_SBLANK "`" #define RID_SBLANK "` "
#define RID_BLANK "~" #define RID_BLANK "~ "
#define RID_NEWLINE "newline " #define RID_NEWLINE "newline "
#define RID_BINOMXY "binom{<?>}{<?>} " #define RID_BINOMXY "binom{<?>}{<?>} "
#define RID_STACK "stack{<?> # <?> # <?>} " #define RID_STACK "stack{<?> # <?> # <?>} "

View File

@@ -64,6 +64,7 @@ namespace o3tl {
// Tokens identifiers. Allow to know what kind of information the node contains. // Tokens identifiers. Allow to know what kind of information the node contains.
enum SmTokenType enum SmTokenType
{ {
// clang-format off
// Uncategorized // Uncategorized
TEND, TSPECIAL, TNONE, TESCAPE, TUNKNOWN, TEND, TSPECIAL, TNONE, TESCAPE, TUNKNOWN,
TBLANK, TSBLANK, TPLACE, TNOSPACE, TDOTSDOWN, TBLANK, TSBLANK, TPLACE, TNOSPACE, TDOTSDOWN,
@@ -139,6 +140,7 @@ enum SmTokenType
// Color // Color
TRGB, TRGBA, THEX, THTMLCOL, TDVIPSNAMESCOL, TRGB, TRGBA, THEX, THTMLCOL, TDVIPSNAMESCOL,
TICONICCOL TICONICCOL
// clang-format on
}; };
struct SmTokenTableEntry struct SmTokenTableEntry

View File

@@ -148,7 +148,7 @@ void Test::testtdf99556()
void Test::testTdf103430() void Test::testTdf103430()
{ {
loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/tdf103430.mml")); loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/tdf103430.mml"));
CPPUNIT_ASSERT_EQUAL(OUString("frac { { nitalic d ^ 2 nitalic color blue y } } { { color apricot nitalic d font sans bold italic color red x } }"), CPPUNIT_ASSERT_EQUAL(OUString("frac { { nitalic d ^ 2 nitalic color blue y } } { { color dvip apricot nitalic d font sans bold italic color red x } }"),
mxDocShell->GetText()); mxDocShell->GetText());
} }

View File

@@ -191,7 +191,14 @@ const SmElementDescr SmElementsControl::m_aAttributesList[] =
{RID_COLORX_NAVY, RID_COLORX_NAVY_HELP}, {RID_COLORX_OLIVE, RID_COLORX_OLIVE_HELP}, {RID_COLORX_NAVY, RID_COLORX_NAVY_HELP}, {RID_COLORX_OLIVE, RID_COLORX_OLIVE_HELP},
{RID_COLORX_PURPLE, RID_COLORX_PURPLE_HELP}, {RID_COLORX_SILVER, RID_COLORX_SILVER_HELP}, {RID_COLORX_PURPLE, RID_COLORX_PURPLE_HELP}, {RID_COLORX_SILVER, RID_COLORX_SILVER_HELP},
{RID_COLORX_TEAL, RID_COLORX_TEAL_HELP},{RID_COLORX_RGB, RID_COLORX_RGB_HELP}, {RID_COLORX_TEAL, RID_COLORX_TEAL_HELP},{RID_COLORX_RGB, RID_COLORX_RGB_HELP},
{RID_COLORX_HEX, RID_COLORX_HEX_HELP} {RID_COLORX_HEX, RID_COLORX_HEX_HELP},
{nullptr, nullptr},
{RID_COLORX_CORAL, RID_COLORX_CORAL_HELP}, {RID_COLORX_MIDNIGHT, RID_COLORX_MIDNIGHT_HELP},
{RID_COLORX_CRIMSON, RID_COLORX_CRIMSON_HELP}, {RID_COLORX_VIOLET, RID_COLORX_VIOLET_HELP},
{RID_COLORX_ORANGE, RID_COLORX_ORANGE_HELP}, {RID_COLORX_ORANGERED, RID_COLORX_ORANGERED_HELP},
{RID_COLORX_SEAGREEN, RID_COLORX_SEAGREEN_HELP}, {RID_COLORX_INDIGO, RID_COLORX_INDIGO_HELP},
{RID_COLORX_HOTPINK, RID_COLORX_HOTPINK_HELP}, {RID_COLORX_LAVENDER, RID_COLORX_LAVENDER_HELP},
{RID_COLORX_SNOW, RID_COLORX_SNOW_HELP},
}; };
const SmElementDescr SmElementsControl::m_aBracketsList[] = const SmElementDescr SmElementsControl::m_aBracketsList[] =
@@ -933,6 +940,28 @@ void SmElementsControl::addElements(const SmElementDescr aElementsArray[], sal_u
addElement(aParser, "color silver { \"" + SmResId(STR_SILVER) + "\" }", aElement, SmResId(pElementHelp)); addElement(aParser, "color silver { \"" + SmResId(STR_SILVER) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_TEAL) else if (aElement == RID_COLORX_TEAL)
addElement(aParser, "color teal { \"" + SmResId(STR_TEAL) + "\" }", aElement, SmResId(pElementHelp)); addElement(aParser, "color teal { \"" + SmResId(STR_TEAL) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_CORAL)
addElement(aParser, "color coral { \"" + SmResId(STR_CORAL) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_CRIMSON)
addElement(aParser, "color crimson { \"" + SmResId(STR_CRIMSON) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_MIDNIGHT)
addElement(aParser, "color midnightblue { \"" + SmResId(STR_MIDNIGHT) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_VIOLET)
addElement(aParser, "color violet { \"" + SmResId(STR_VIOLET) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_ORANGE)
addElement(aParser, "color orange { \"" + SmResId(STR_ORANGE) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_ORANGERED)
addElement(aParser, "color orangered { \"" + SmResId(STR_ORANGERED) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_SEAGREEN)
addElement(aParser, "color seagreen { \"" + SmResId(STR_SEAGREEN) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_INDIGO)
addElement(aParser, "color indigo { \"" + SmResId(STR_INDIGO) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_HOTPINK)
addElement(aParser, "color hotpink { \"" + SmResId(STR_HOTPINK) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_SNOW)
addElement(aParser, "color snow { \"" + SmResId(STR_SNOW) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_LAVENDER)
addElement(aParser, "color lavender { \"" + SmResId(STR_LAVENDER) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_RGB) else if (aElement == RID_COLORX_RGB)
addElement(aParser, "color rgb 0 0 0 { \"" + SmResId(STR_RGB) + "\" }", aElement, SmResId(pElementHelp)); addElement(aParser, "color rgb 0 0 0 { \"" + SmResId(STR_RGB) + "\" }", aElement, SmResId(pElementHelp));
else if (aElement == RID_COLORX_RGBA) else if (aElement == RID_COLORX_RGBA)

View File

@@ -698,7 +698,9 @@ void SmXMLContext_Helper::ApplyAttrs()
{ {
std::unique_ptr<SmColorTokenTableEntry> aSmColorTokenTableEntry; std::unique_ptr<SmColorTokenTableEntry> aSmColorTokenTableEntry;
aSmColorTokenTableEntry = starmathdatabase::Identify_ColorName_HTML( sColor ); aSmColorTokenTableEntry = starmathdatabase::Identify_ColorName_HTML( sColor );
if( aSmColorTokenTableEntry ) if( aSmColorTokenTableEntry->eType == TRGB )
aSmColorTokenTableEntry = starmathdatabase::Identify_Color_Parser( sal_uInt32(aSmColorTokenTableEntry->cColor) );
if( aSmColorTokenTableEntry->eType != TERROR )
{ {
aToken = aSmColorTokenTableEntry; aToken = aSmColorTokenTableEntry;
std::unique_ptr<SmFontNode> pFontNode(new SmFontNode(aToken)); std::unique_ptr<SmFontNode> pFontNode(new SmFontNode(aToken));

View File

@@ -954,7 +954,7 @@ void SmParser::NextToken() //Central part of the parser
m_nBufferIndex = aRes.EndPos; m_nBufferIndex = aRes.EndPos;
} }
void SmParser::NextTokenColor() void SmParser::NextTokenColor(bool dvipload)
{ {
sal_Int32 nBufLen = m_aBufferString.getLength(); sal_Int32 nBufLen = m_aBufferString.getLength();
@@ -1008,9 +1008,9 @@ void SmParser::NextTokenColor()
assert(n >= 0); assert(n >= 0);
OUString aName( m_aBufferString.copy( nRealStart, n ) ); OUString aName( m_aBufferString.copy( nRealStart, n ) );
std::unique_ptr<SmColorTokenTableEntry> aSmColorTokenTableEntry; std::unique_ptr<SmColorTokenTableEntry> aSmColorTokenTableEntry;
aSmColorTokenTableEntry = starmathdatabase::Identify_ColorName_Parser( aName ); if(dvipload) aSmColorTokenTableEntry = starmathdatabase::Identify_ColorName_DVIPSNAMES( aName );
if ( aSmColorTokenTableEntry ) m_aCurToken = aSmColorTokenTableEntry; else aSmColorTokenTableEntry = starmathdatabase::Identify_ColorName_Parser( aName );
else m_aCurToken.eType = TNONE; m_aCurToken = aSmColorTokenTableEntry;
} }
else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR) else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR)
{ {
@@ -2085,9 +2085,11 @@ std::unique_ptr<SmStructureNode> SmParser::DoColor()
if (aDepthGuard.TooDeep()) throw std::range_error("parser depth limit"); if (aDepthGuard.TooDeep()) throw std::range_error("parser depth limit");
assert(m_aCurToken.eType == TCOLOR); assert(m_aCurToken.eType == TCOLOR);
NextTokenColor(); NextTokenColor(false);
SmToken aToken; SmToken aToken;
if( m_aCurToken.eType == TDVIPSNAMESCOL ) NextTokenColor(true);
if( m_aCurToken.eType == TERROR ) return DoError(SmParseError::ColorExpected);
if (TokenInGroup(TG::Color)) if (TokenInGroup(TG::Color))
{ {
aToken = m_aCurToken; aToken = m_aCurToken;

View File

@@ -358,72 +358,328 @@ SmToken starmathdatabase::Identify_PrefixPostfix_SmXMLOperatorContext_Impl(sal_U
} }
const SmColorTokenTableEntry starmathdatabase::aColorTokenTableParse[] const SmColorTokenTableEntry starmathdatabase::aColorTokenTableParse[]
= { { "apricot", "Apricot", TDVIPSNAMESCOL, COL_SM_DIV_APRICOT }, = { { "aliceblue", "aliceblue", THTMLCOL, COL_SM_ALICEBLUE },
{ "antiquewhite", "antiquewhite", THTMLCOL, COL_SM_ANTIQUEWHITE },
{ "aqua", "aqua", THTMLCOL, COL_SM_AQUA }, { "aqua", "aqua", THTMLCOL, COL_SM_AQUA },
{ "aquamarine", "Aquamarine", TDVIPSNAMESCOL, COL_SM_DIV_AQUAMARINE }, { "aquamarine", "aquamarine", THTMLCOL, COL_SM_AQUAMARINE },
{ "bittersweet", "Bittersweet", TDVIPSNAMESCOL, COL_SM_DIV_BITTERSWEET }, { "azure", "azure", THTMLCOL, COL_SM_AZURE },
{ "beige", "beige", THTMLCOL, COL_SM_BEIGE },
{ "bisque", "bisque", THTMLCOL, COL_SM_BISQUE },
{ "black", "black", THTMLCOL, COL_SM_BLACK }, { "black", "black", THTMLCOL, COL_SM_BLACK },
{ "blanchedalmond", "blanchedalmond", THTMLCOL, COL_SM_BLANCHEDALMOND },
{ "blue", "blue", THTMLCOL, COL_SM_BLUE }, { "blue", "blue", THTMLCOL, COL_SM_BLUE },
{ "cyan", "cyan", THTMLCOL, COL_SM_BLACK }, { "blueviolet", "blueviolet", THTMLCOL, COL_SM_BLUEVIOLET },
{ "brown", "brown", THTMLCOL, COL_SM_BROWN },
{ "burlywood", "burlywood", THTMLCOL, COL_SM_BURLYWOOD },
{ "cadetblue", "cadetblue", THTMLCOL, COL_SM_CADETBLUE },
{ "chartreuse", "chartreuse", THTMLCOL, COL_SM_CHARTREUSE },
{ "chocolate", "chocolate", THTMLCOL, COL_SM_CHOCOLATE },
{ "coral", "coral", THTMLCOL, COL_SM_CORAL },
{ "cornflowerblue", "cornflowerblue", THTMLCOL, COL_SM_CORNFLOWERBLUE },
{ "cornsilk", "cornsilk", THTMLCOL, COL_SM_CORNSILK },
{ "crimson", "crimson", THTMLCOL, COL_SM_CRIMSON },
{ "cyan", "cyan", THTMLCOL, COL_SM_CYAN },
{ "darkblue", "darkblue", THTMLCOL, COL_SM_DARKBLUE },
{ "darkcyan", "darkcyan", THTMLCOL, COL_SM_DARKCYAN },
{ "darkgoldenrod", "darkgoldenrod", THTMLCOL, COL_SM_DARKGOLDENROD },
{ "darkgray", "darkgray", THTMLCOL, COL_SM_DARKGRAY },
{ "darkgreen", "darkgreen", THTMLCOL, COL_SM_DARKGREEN },
{ "darkgrey", "darkgrey", THTMLCOL, COL_SM_DARKGREY },
{ "darkkhaki", "darkkhaki", THTMLCOL, COL_SM_DARKKHAKI },
{ "darkmagenta", "darkmagenta", THTMLCOL, COL_SM_DARKMAGENTA },
{ "darkolivegreen", "darkolivegreen", THTMLCOL, COL_SM_DARKOLIVEGREEN },
{ "darkorange", "darkorange", THTMLCOL, COL_SM_DARKORANGE },
{ "darkorchid", "darkorchid", THTMLCOL, COL_SM_DARKORCHID },
{ "darkred", "darkred", THTMLCOL, COL_SM_DARKRED },
{ "darksalmon", "darksalmon", THTMLCOL, COL_SM_DARKSALMON },
{ "darkseagreen", "darkseagreen", THTMLCOL, COL_SM_DARKSEAGREEN },
{ "darkslateblue", "darkslateblue", THTMLCOL, COL_SM_DARKSLATEBLUE },
{ "darkslategray", "darkslategray", THTMLCOL, COL_SM_DARKSLATEGRAY },
{ "darkslategrey", "darkslategrey", THTMLCOL, COL_SM_DARKSLATEGREY },
{ "darkturquoise", "darkturquoise", THTMLCOL, COL_SM_DARKTURQUOISE },
{ "darkviolet", "darkviolet", THTMLCOL, COL_SM_DARKVIOLET },
{ "debian", "", TICONICCOL, COL_SM_DEBIAN_MAGENTA }, { "debian", "", TICONICCOL, COL_SM_DEBIAN_MAGENTA },
{ "dblack", "Black", TDVIPSNAMESCOL, COL_SM_BLACK }, { "deeppink", "deeppink", THTMLCOL, COL_SM_DEEPPINK },
{ "dblue", "Blue", TDVIPSNAMESCOL, COL_SM_BLACK }, { "deepskyblue", "deepskyblue", THTMLCOL, COL_SM_DEEPSKYBLUE },
{ "dimgray", "dimgray", THTMLCOL, COL_SM_DIMGRAY },
{ "dimgrey", "dimgrey", THTMLCOL, COL_SM_DIMGREY },
{ "dodgerblue", "dodgerblue", THTMLCOL, COL_SM_DODGERBLUE },
{ "dvip", "dvip", TDVIPSNAMESCOL, COL_SM_BLACK },
{ "firebrick", "firebrick", THTMLCOL, COL_SM_FIREBRICK },
{ "floralwhite", "floralwhite", THTMLCOL, COL_SM_FLORALWHITE },
{ "forestgreen", "forestgreen", THTMLCOL, COL_SM_FORESTGREEN },
{ "fuchsia", "fuchsia", THTMLCOL, COL_SM_FUCHSIA }, { "fuchsia", "fuchsia", THTMLCOL, COL_SM_FUCHSIA },
{ "gainsboro", "gainsboro", THTMLCOL, COL_SM_GAINSBORO },
{ "ghostwhite", "ghostwhite", THTMLCOL, COL_SM_GHOSTWHITE },
{ "gold", "gold", THTMLCOL, COL_SM_GOLD },
{ "goldenrod", "goldenrod", THTMLCOL, COL_SM_GOLDENROD },
{ "gray", "gray", THTMLCOL, COL_SM_GRAY }, { "gray", "gray", THTMLCOL, COL_SM_GRAY },
{ "green", "green", THTMLCOL, COL_SM_GREEN }, { "green", "green", THTMLCOL, COL_SM_GREEN },
{ "greenyellow", "greenyellow", THTMLCOL, COL_SM_GREENYELLOW },
{ "grey", "grey", THTMLCOL, COL_SM_GREY },
{ "hex", "hex", THEX, COL_SM_BLACK }, { "hex", "hex", THEX, COL_SM_BLACK },
{ "honeydew", "honeydew", THTMLCOL, COL_SM_HONEYDEW },
{ "hotpink", "hotpink", THTMLCOL, COL_SM_HOTPINK },
{ "indianred", "indianred", THTMLCOL, COL_SM_INDIANRED },
{ "indigo", "indigo", THTMLCOL, COL_SM_INDIGO },
{ "ivory", "ivory", THTMLCOL, COL_SM_IVORY },
{ "khaki", "khaki", THTMLCOL, COL_SM_KHAKI },
{ "lavender", "lavender", THTMLCOL, COL_SM_LAVENDER },
{ "lavenderblush", "lavenderblush", THTMLCOL, COL_SM_LAVENDERBLUSH },
{ "lawngreen", "lawngreen", THTMLCOL, COL_SM_LAWNGREEN },
{ "lemonchiffon", "lemonchiffon", THTMLCOL, COL_SM_LEMONCHIFFON },
{ "lightblue", "lightblue", THTMLCOL, COL_SM_LIGHTBLUE },
{ "lightcoral", "lightcoral", THTMLCOL, COL_SM_LIGHTCORAL },
{ "lightcyan", "lightcyan", THTMLCOL, COL_SM_LIGHTCYAN },
{ "lightgoldenrodyellow", "lightgoldenrodyellow", THTMLCOL, COL_SM_LIGHTGOLDENRODYELLOW },
{ "lightgray", "lightgray", THTMLCOL, COL_SM_LIGHTGRAY },
{ "lightgreen", "lightgreen", THTMLCOL, COL_SM_LIGHTGREEN },
{ "lightgrey", "lightgrey", THTMLCOL, COL_SM_LIGHTGREY },
{ "lightpink", "lightpink", THTMLCOL, COL_SM_LIGHTPINK },
{ "lightsalmon", "lightsalmon", THTMLCOL, COL_SM_LIGHTSALMON },
{ "lightseagreen", "lightseagreen", THTMLCOL, COL_SM_LIGHTSEAGREEN },
{ "lightskyblue", "lightskyblue", THTMLCOL, COL_SM_LIGHTSKYBLUE },
{ "lightslategray", "lightslategray", THTMLCOL, COL_SM_LIGHTSLATEGRAY },
{ "lightslategrey", "lightslategrey", THTMLCOL, COL_SM_LIGHTSLATEGREY },
{ "lightsteelblue", "lightsteelblue", THTMLCOL, COL_SM_LIGHTSTEELBLUE },
{ "lightyellow", "lightyellow", THTMLCOL, COL_SM_LIGHTYELLOW },
{ "lime", "lime", THTMLCOL, COL_SM_LIME }, { "lime", "lime", THTMLCOL, COL_SM_LIME },
{ "limegreen", "limegreen", THTMLCOL, COL_SM_LIMEGREEN },
{ "linen", "linen", THTMLCOL, COL_SM_LINEN },
{ "lo", "", TICONICCOL, COL_SM_LO_GREEN }, { "lo", "", TICONICCOL, COL_SM_LO_GREEN },
{ "magenta", "magenta", THTMLCOL, COL_SM_FUCHSIA }, { "magenta", "magenta", THTMLCOL, COL_SM_MAGENTA },
{ "maroon", "maroon", THTMLCOL, COL_SM_MAROON }, { "maroon", "maroon", THTMLCOL, COL_SM_MAROON },
{ "mediumaquamarine", "mediumaquamarine", THTMLCOL, COL_SM_MEDIUMAQUAMARINE },
{ "mediumblue", "mediumblue", THTMLCOL, COL_SM_MEDIUMBLUE },
{ "mediumorchid", "mediumorchid", THTMLCOL, COL_SM_MEDIUMORCHID },
{ "mediumpurple", "mediumpurple", THTMLCOL, COL_SM_MEDIUMPURPLE },
{ "mediumseagreen", "mediumseagreen", THTMLCOL, COL_SM_MEDIUMSEAGREEN },
{ "mediumslateblue", "mediumslateblue", THTMLCOL, COL_SM_MEDIUMSLATEBLUE },
{ "mediumspringgreen", "mediumspringgreen", THTMLCOL, COL_SM_MEDIUMSPRINGGREEN },
{ "mediumturquoise", "mediumturquoise", THTMLCOL, COL_SM_MEDIUMTURQUOISE },
{ "mediumvioletred", "mediumvioletred", THTMLCOL, COL_SM_MEDIUMVIOLETRED },
{ "midnightblue", "midnightblue", THTMLCOL, COL_SM_MIDNIGHTBLUE },
{ "mintcream", "mintcream", THTMLCOL, COL_SM_MINTCREAM },
{ "mistyrose", "mistyrose", THTMLCOL, COL_SM_MISTYROSE },
{ "moccasin", "moccasin", THTMLCOL, COL_SM_MOCCASIN },
{ "navajowhite", "navajowhite", THTMLCOL, COL_SM_NAVAJOWHITE },
{ "navy", "navy", THTMLCOL, COL_SM_NAVY }, { "navy", "navy", THTMLCOL, COL_SM_NAVY },
{ "oldlace", "oldlace", THTMLCOL, COL_SM_OLDLACE },
{ "olive", "olive", THTMLCOL, COL_SM_OLIVE }, { "olive", "olive", THTMLCOL, COL_SM_OLIVE },
{ "olivedrab", "olivedrab", THTMLCOL, COL_SM_OLIVEDRAB },
{ "orange", "orange", THTMLCOL, COL_SM_ORANGE },
{ "orangered", "orangered", THTMLCOL, COL_SM_ORANGERED },
{ "orchid", "orchid", THTMLCOL, COL_SM_ORCHID },
{ "palegoldenrod", "palegoldenrod", THTMLCOL, COL_SM_PALEGOLDENROD },
{ "palegreen", "palegreen", THTMLCOL, COL_SM_PALEGREEN },
{ "paleturquoise", "paleturquoise", THTMLCOL, COL_SM_PALETURQUOISE },
{ "palevioletred", "palevioletred", THTMLCOL, COL_SM_PALEVIOLETRED },
{ "papayawhip", "papayawhip", THTMLCOL, COL_SM_PAPAYAWHIP },
{ "peachpuff", "peachpuff", THTMLCOL, COL_SM_PEACHPUFF },
{ "peru", "peru", THTMLCOL, COL_SM_PERU },
{ "pink", "pink", THTMLCOL, COL_SM_PINK },
{ "plum", "plum", THTMLCOL, COL_SM_PLUM },
{ "powderblue", "powderblue", THTMLCOL, COL_SM_POWDERBLUE },
{ "purple", "purple", THTMLCOL, COL_SM_PURPLE }, { "purple", "purple", THTMLCOL, COL_SM_PURPLE },
{ "rebeccapurple", "rebeccapurple", THTMLCOL, COL_SM_REBECCAPURPLE }, { "rebeccapurple", "rebeccapurple", THTMLCOL, COL_SM_REBECCAPURPLE },
{ "red", "red", THTMLCOL, COL_SM_RED }, { "red", "red", THTMLCOL, COL_SM_RED },
{ "rgb", "rgb", TRGB, COL_AUTO }, { "rgb", "rgb", TRGB, COL_AUTO },
{ "rgba", "rgba", TRGBA, COL_AUTO }, { "rgba", "rgba", TRGBA, COL_AUTO },
{ "rosybrown", "rosybrown", THTMLCOL, COL_SM_ROSYBROWN },
{ "royalblue", "royalblue", THTMLCOL, COL_SM_ROYALBLUE },
{ "saddlebrown", "saddlebrown", THTMLCOL, COL_SM_SADDLEBROWN },
{ "salmon", "salmon", THTMLCOL, COL_SM_SALMON },
{ "sandybrown", "sandybrown", THTMLCOL, COL_SM_SANDYBROWN },
{ "seagreen", "seagreen", THTMLCOL, COL_SM_SEAGREEN },
{ "seashell", "seashell", THTMLCOL, COL_SM_SEASHELL },
{ "sienna", "sienna", THTMLCOL, COL_SM_SIENNA },
{ "silver", "silver", THTMLCOL, COL_SM_SILVER }, { "silver", "silver", THTMLCOL, COL_SM_SILVER },
{ "skyblue", "skyblue", THTMLCOL, COL_SM_SKYBLUE },
{ "slateblue", "slateblue", THTMLCOL, COL_SM_SLATEBLUE },
{ "slategray", "slategray", THTMLCOL, COL_SM_SLATEGRAY },
{ "slategrey", "slategrey", THTMLCOL, COL_SM_SLATEGREY },
{ "snow", "snow", THTMLCOL, COL_SM_SNOW },
{ "springgreen", "springgreen", THTMLCOL, COL_SM_SPRINGGREEN },
{ "steelblue", "steelblue", THTMLCOL, COL_SM_STEELBLUE },
{ "tan", "tan", THTMLCOL, COL_SM_TAN },
{ "teal", "teal", THTMLCOL, COL_SM_TEAL }, { "teal", "teal", THTMLCOL, COL_SM_TEAL },
{ "thistle", "thistle", THTMLCOL, COL_SM_THISTLE },
{ "tomato", "tomato", THTMLCOL, COL_SM_TOMATO },
{ "turquoise", "turquoise", THTMLCOL, COL_SM_TURQUOISE },
{ "ubuntu", "", TICONICCOL, COL_SM_UBUNTU_ORANGE }, { "ubuntu", "", TICONICCOL, COL_SM_UBUNTU_ORANGE },
{ "violet", "COL_SM_VIOLET", THTMLCOL, COL_SM_VIOLET },
{ "wheat", "wheat", THTMLCOL, COL_SM_WHEAT },
{ "white", "white", THTMLCOL, COL_SM_WHITE }, { "white", "white", THTMLCOL, COL_SM_WHITE },
{ "yellow", "yellow", THTMLCOL, COL_SM_YELLOW } }; { "whitesmoke", "whitesmoke", THTMLCOL, COL_SM_WHITESMOKE },
{ "yellow", "yellow", THTMLCOL, COL_SM_YELLOW },
{ "yellowgreen", "yellowgreen", THTMLCOL, COL_SM_YELLOWGREEN } };
const SmColorTokenTableEntry starmathdatabase::aColorTokenTableHTML[] const SmColorTokenTableEntry starmathdatabase::aColorTokenTableHTML[]
= { { "aqua", "aqua", THTMLCOL, COL_SM_AQUA }, = { { "aliceblue", "aliceblue", THTMLCOL, COL_SM_ALICEBLUE },
{ "antiquewhite", "antiquewhite", THTMLCOL, COL_SM_ANTIQUEWHITE },
{ "aqua", "aqua", THTMLCOL, COL_SM_AQUA },
{ "aquamarine", "aquamarine", THTMLCOL, COL_SM_AQUAMARINE },
{ "azure", "azure", THTMLCOL, COL_SM_AZURE },
{ "beige", "beige", THTMLCOL, COL_SM_BEIGE },
{ "bisque", "bisque", THTMLCOL, COL_SM_BISQUE },
{ "black", "black", THTMLCOL, COL_SM_BLACK }, { "black", "black", THTMLCOL, COL_SM_BLACK },
{ "blanchedalmond", "blanchedalmond", THTMLCOL, COL_SM_BLANCHEDALMOND },
{ "blue", "blue", THTMLCOL, COL_SM_BLUE }, { "blue", "blue", THTMLCOL, COL_SM_BLUE },
{ "cyan", "cyan", THTMLCOL, COL_SM_BLACK }, { "blueviolet", "blueviolet", THTMLCOL, COL_SM_BLUEVIOLET },
{ "brown", "brown", THTMLCOL, COL_SM_BROWN },
{ "burlywood", "burlywood", THTMLCOL, COL_SM_BURLYWOOD },
{ "cadetblue", "cadetblue", THTMLCOL, COL_SM_CADETBLUE },
{ "chartreuse", "chartreuse", THTMLCOL, COL_SM_CHARTREUSE },
{ "chocolate", "chocolate", THTMLCOL, COL_SM_CHOCOLATE },
{ "coral", "coral", THTMLCOL, COL_SM_CORAL },
{ "cornflowerblue", "cornflowerblue", THTMLCOL, COL_SM_CORNFLOWERBLUE },
{ "cornsilk", "cornsilk", THTMLCOL, COL_SM_CORNSILK },
{ "crimson", "crimson", THTMLCOL, COL_SM_CRIMSON },
{ "cyan", "cyan", THTMLCOL, COL_SM_CYAN },
{ "darkblue", "darkblue", THTMLCOL, COL_SM_DARKBLUE },
{ "darkcyan", "darkcyan", THTMLCOL, COL_SM_DARKCYAN },
{ "darkgoldenrod", "darkgoldenrod", THTMLCOL, COL_SM_DARKGOLDENROD },
{ "darkgray", "darkgray", THTMLCOL, COL_SM_DARKGRAY },
{ "darkgreen", "darkgreen", THTMLCOL, COL_SM_DARKGREEN },
{ "darkgrey", "darkgrey", THTMLCOL, COL_SM_DARKGREY },
{ "darkkhaki", "darkkhaki", THTMLCOL, COL_SM_DARKKHAKI },
{ "darkmagenta", "darkmagenta", THTMLCOL, COL_SM_DARKMAGENTA },
{ "darkolivegreen", "darkolivegreen", THTMLCOL, COL_SM_DARKOLIVEGREEN },
{ "darkorange", "darkorange", THTMLCOL, COL_SM_DARKORANGE },
{ "darkorchid", "darkorchid", THTMLCOL, COL_SM_DARKORCHID },
{ "darkred", "darkred", THTMLCOL, COL_SM_DARKRED },
{ "darksalmon", "darksalmon", THTMLCOL, COL_SM_DARKSALMON },
{ "darkseagreen", "darkseagreen", THTMLCOL, COL_SM_DARKSEAGREEN },
{ "darkslateblue", "darkslateblue", THTMLCOL, COL_SM_DARKSLATEBLUE },
{ "darkslategray", "darkslategray", THTMLCOL, COL_SM_DARKSLATEGRAY },
{ "darkslategrey", "darkslategrey", THTMLCOL, COL_SM_DARKSLATEGREY },
{ "darkturquoise", "darkturquoise", THTMLCOL, COL_SM_DARKTURQUOISE },
{ "darkviolet", "darkviolet", THTMLCOL, COL_SM_DARKVIOLET },
{ "deeppink", "deeppink", THTMLCOL, COL_SM_DEEPPINK },
{ "deepskyblue", "deepskyblue", THTMLCOL, COL_SM_DEEPSKYBLUE },
{ "dimgray", "dimgray", THTMLCOL, COL_SM_DIMGRAY },
{ "dimgrey", "dimgrey", THTMLCOL, COL_SM_DIMGREY },
{ "dodgerblue", "dodgerblue", THTMLCOL, COL_SM_DODGERBLUE },
{ "firebrick", "firebrick", THTMLCOL, COL_SM_FIREBRICK },
{ "floralwhite", "floralwhite", THTMLCOL, COL_SM_FLORALWHITE },
{ "forestgreen", "forestgreen", THTMLCOL, COL_SM_FORESTGREEN },
{ "fuchsia", "fuchsia", THTMLCOL, COL_SM_FUCHSIA }, { "fuchsia", "fuchsia", THTMLCOL, COL_SM_FUCHSIA },
{ "gainsboro", "gainsboro", THTMLCOL, COL_SM_GAINSBORO },
{ "ghostwhite", "ghostwhite", THTMLCOL, COL_SM_GHOSTWHITE },
{ "gold", "gold", THTMLCOL, COL_SM_GOLD },
{ "goldenrod", "goldenrod", THTMLCOL, COL_SM_GOLDENROD },
{ "gray", "gray", THTMLCOL, COL_SM_GRAY }, { "gray", "gray", THTMLCOL, COL_SM_GRAY },
{ "green", "green", THTMLCOL, COL_SM_GREEN }, { "green", "green", THTMLCOL, COL_SM_GREEN },
{ "hex", "hex", THEX, COL_SM_BLACK }, { "greenyellow", "greenyellow", THTMLCOL, COL_SM_GREENYELLOW },
{ "grey", "grey", THTMLCOL, COL_SM_GREY },
{ "honeydew", "honeydew", THTMLCOL, COL_SM_HONEYDEW },
{ "hotpink", "hotpink", THTMLCOL, COL_SM_HOTPINK },
{ "indianred", "indianred", THTMLCOL, COL_SM_INDIANRED },
{ "indigo", "indigo", THTMLCOL, COL_SM_INDIGO },
{ "ivory", "ivory", THTMLCOL, COL_SM_IVORY },
{ "khaki", "khaki", THTMLCOL, COL_SM_KHAKI },
{ "lavender", "lavender", THTMLCOL, COL_SM_LAVENDER },
{ "lavenderblush", "lavenderblush", THTMLCOL, COL_SM_LAVENDERBLUSH },
{ "lawngreen", "lawngreen", THTMLCOL, COL_SM_LAWNGREEN },
{ "lemonchiffon", "lemonchiffon", THTMLCOL, COL_SM_LEMONCHIFFON },
{ "lightblue", "lightblue", THTMLCOL, COL_SM_LIGHTBLUE },
{ "lightcoral", "lightcoral", THTMLCOL, COL_SM_LIGHTCORAL },
{ "lightcyan", "lightcyan", THTMLCOL, COL_SM_LIGHTCYAN },
{ "lightgoldenrodyellow", "lightgoldenrodyellow", THTMLCOL, COL_SM_LIGHTGOLDENRODYELLOW },
{ "lightgray", "lightgray", THTMLCOL, COL_SM_LIGHTGRAY },
{ "lightgreen", "lightgreen", THTMLCOL, COL_SM_LIGHTGREEN },
{ "lightgrey", "lightgrey", THTMLCOL, COL_SM_LIGHTGREY },
{ "lightpink", "lightpink", THTMLCOL, COL_SM_LIGHTPINK },
{ "lightsalmon", "lightsalmon", THTMLCOL, COL_SM_LIGHTSALMON },
{ "lightseagreen", "lightseagreen", THTMLCOL, COL_SM_LIGHTSEAGREEN },
{ "lightskyblue", "lightskyblue", THTMLCOL, COL_SM_LIGHTSKYBLUE },
{ "lightslategray", "lightslategray", THTMLCOL, COL_SM_LIGHTSLATEGRAY },
{ "lightslategrey", "lightslategrey", THTMLCOL, COL_SM_LIGHTSLATEGREY },
{ "lightsteelblue", "lightsteelblue", THTMLCOL, COL_SM_LIGHTSTEELBLUE },
{ "lightyellow", "lightyellow", THTMLCOL, COL_SM_LIGHTYELLOW },
{ "lime", "lime", THTMLCOL, COL_SM_LIME }, { "lime", "lime", THTMLCOL, COL_SM_LIME },
{ "magenta", "magenta", THTMLCOL, COL_SM_FUCHSIA }, { "limegreen", "limegreen", THTMLCOL, COL_SM_LIMEGREEN },
{ "linen", "linen", THTMLCOL, COL_SM_LINEN },
{ "magenta", "magenta", THTMLCOL, COL_SM_MAGENTA },
{ "maroon", "maroon", THTMLCOL, COL_SM_MAROON }, { "maroon", "maroon", THTMLCOL, COL_SM_MAROON },
{ "mediumaquamarine", "mediumaquamarine", THTMLCOL, COL_SM_MEDIUMAQUAMARINE },
{ "mediumblue", "mediumblue", THTMLCOL, COL_SM_MEDIUMBLUE },
{ "mediumorchid", "mediumorchid", THTMLCOL, COL_SM_MEDIUMORCHID },
{ "mediumpurple", "mediumpurple", THTMLCOL, COL_SM_MEDIUMPURPLE },
{ "mediumseagreen", "mediumseagreen", THTMLCOL, COL_SM_MEDIUMSEAGREEN },
{ "mediumslateblue", "mediumslateblue", THTMLCOL, COL_SM_MEDIUMSLATEBLUE },
{ "mediumspringgreen", "mediumspringgreen", THTMLCOL, COL_SM_MEDIUMSPRINGGREEN },
{ "mediumturquoise", "mediumturquoise", THTMLCOL, COL_SM_MEDIUMTURQUOISE },
{ "mediumvioletred", "mediumvioletred", THTMLCOL, COL_SM_MEDIUMVIOLETRED },
{ "midnightblue", "midnightblue", THTMLCOL, COL_SM_MIDNIGHTBLUE },
{ "mintcream", "mintcream", THTMLCOL, COL_SM_MINTCREAM },
{ "mistyrose", "mistyrose", THTMLCOL, COL_SM_MISTYROSE },
{ "moccasin", "moccasin", THTMLCOL, COL_SM_MOCCASIN },
{ "navajowhite", "navajowhite", THTMLCOL, COL_SM_NAVAJOWHITE },
{ "navy", "navy", THTMLCOL, COL_SM_NAVY }, { "navy", "navy", THTMLCOL, COL_SM_NAVY },
{ "oldlace", "oldlace", THTMLCOL, COL_SM_OLDLACE },
{ "olive", "olive", THTMLCOL, COL_SM_OLIVE }, { "olive", "olive", THTMLCOL, COL_SM_OLIVE },
{ "olivedrab", "olivedrab", THTMLCOL, COL_SM_OLIVEDRAB },
{ "orange", "orange", THTMLCOL, COL_SM_ORANGE },
{ "orangered", "orangered", THTMLCOL, COL_SM_ORANGERED },
{ "orchid", "orchid", THTMLCOL, COL_SM_ORCHID },
{ "palegoldenrod", "palegoldenrod", THTMLCOL, COL_SM_PALEGOLDENROD },
{ "palegreen", "palegreen", THTMLCOL, COL_SM_PALEGREEN },
{ "paleturquoise", "paleturquoise", THTMLCOL, COL_SM_PALETURQUOISE },
{ "palevioletred", "palevioletred", THTMLCOL, COL_SM_PALEVIOLETRED },
{ "papayawhip", "papayawhip", THTMLCOL, COL_SM_PAPAYAWHIP },
{ "peachpuff", "peachpuff", THTMLCOL, COL_SM_PEACHPUFF },
{ "peru", "peru", THTMLCOL, COL_SM_PERU },
{ "pink", "pink", THTMLCOL, COL_SM_PINK },
{ "plum", "plum", THTMLCOL, COL_SM_PLUM },
{ "powderblue", "powderblue", THTMLCOL, COL_SM_POWDERBLUE },
{ "purple", "purple", THTMLCOL, COL_SM_PURPLE }, { "purple", "purple", THTMLCOL, COL_SM_PURPLE },
{ "rebeccapurple", "rebeccapurple", THTMLCOL, COL_SM_REBECCAPURPLE }, { "rebeccapurple", "rebeccapurple", THTMLCOL, COL_SM_REBECCAPURPLE },
{ "red", "red", THTMLCOL, COL_SM_RED }, { "red", "red", THTMLCOL, COL_SM_RED },
{ "rosybrown", "rosybrown", THTMLCOL, COL_SM_ROSYBROWN },
{ "royalblue", "royalblue", THTMLCOL, COL_SM_ROYALBLUE },
{ "saddlebrown", "saddlebrown", THTMLCOL, COL_SM_SADDLEBROWN },
{ "salmon", "salmon", THTMLCOL, COL_SM_SALMON },
{ "sandybrown", "sandybrown", THTMLCOL, COL_SM_SANDYBROWN },
{ "seagreen", "seagreen", THTMLCOL, COL_SM_SEAGREEN },
{ "seashell", "seashell", THTMLCOL, COL_SM_SEASHELL },
{ "sienna", "sienna", THTMLCOL, COL_SM_SIENNA },
{ "silver", "silver", THTMLCOL, COL_SM_SILVER }, { "silver", "silver", THTMLCOL, COL_SM_SILVER },
{ "skyblue", "skyblue", THTMLCOL, COL_SM_SKYBLUE },
{ "slateblue", "slateblue", THTMLCOL, COL_SM_SLATEBLUE },
{ "slategray", "slategray", THTMLCOL, COL_SM_SLATEGRAY },
{ "slategrey", "slategrey", THTMLCOL, COL_SM_SLATEGREY },
{ "snow", "snow", THTMLCOL, COL_SM_SNOW },
{ "springgreen", "springgreen", THTMLCOL, COL_SM_SPRINGGREEN },
{ "steelblue", "steelblue", THTMLCOL, COL_SM_STEELBLUE },
{ "tan", "tan", THTMLCOL, COL_SM_TAN },
{ "teal", "teal", THTMLCOL, COL_SM_TEAL }, { "teal", "teal", THTMLCOL, COL_SM_TEAL },
{ "thistle", "thistle", THTMLCOL, COL_SM_THISTLE },
{ "tomato", "tomato", THTMLCOL, COL_SM_TOMATO },
{ "turquoise", "turquoise", THTMLCOL, COL_SM_TURQUOISE },
{ "violet", "COL_SM_VIOLET", THTMLCOL, COL_SM_VIOLET },
{ "wheat", "wheat", THTMLCOL, COL_SM_WHEAT },
{ "white", "white", THTMLCOL, COL_SM_WHITE }, { "white", "white", THTMLCOL, COL_SM_WHITE },
{ "yellow", "yellow", THTMLCOL, COL_SM_YELLOW } }; { "whitesmoke", "whitesmoke", THTMLCOL, COL_SM_WHITESMOKE },
{ "yellow", "yellow", THTMLCOL, COL_SM_YELLOW },
{ "yellowgreen", "yellowgreen", THTMLCOL, COL_SM_YELLOWGREEN } };
const SmColorTokenTableEntry starmathdatabase::aColorTokenTableDVIPSNAMES[] = { const SmColorTokenTableEntry starmathdatabase::aColorTokenTableDVIPSNAMES[]
{ "apricot", "Apricot", TDVIPSNAMESCOL, COL_SM_DIV_APRICOT }, = { { "apricot", "Apricot", TDVIPSNAMESCOL, COL_SM_DIV_APRICOT },
{ "aquamarine", "Aquamarine", TDVIPSNAMESCOL, COL_SM_DIV_AQUAMARINE }, { "aquamarine", "Aquamarine", TDVIPSNAMESCOL, COL_SM_DIV_AQUAMARINE },
{ "bittersweet", "Bittersweet", TDVIPSNAMESCOL, COL_SM_DIV_BITTERSWEET }, { "bittersweet", "Bittersweet", TDVIPSNAMESCOL, COL_SM_DIV_BITTERSWEET },
{ "dblack", "Black", TDVIPSNAMESCOL, COL_SM_BLACK }, { "black", "Black", TDVIPSNAMESCOL, COL_SM_BLACK },
{ "dblue", "Blue", TDVIPSNAMESCOL, COL_SM_BLACK }, { "blue", "Blue", TDVIPSNAMESCOL, COL_SM_BLACK } };
};
std::unique_ptr<SmColorTokenTableEntry> starmathdatabase::Identify_Color_Parser(sal_uInt32 cColor) std::unique_ptr<SmColorTokenTableEntry> starmathdatabase::Identify_Color_Parser(sal_uInt32 cColor)
{ {
for (auto i = std::begin(aColorTokenTableParse); i < std::end(aColorTokenTableParse); ++i) for (auto i = std::begin(aColorTokenTableParse); i < std::end(aColorTokenTableParse); ++i)
if (i->equals(cColor)) if (i->equals(cColor))
return std::unique_ptr<SmColorTokenTableEntry>(new SmColorTokenTableEntry(i)); return std::unique_ptr<SmColorTokenTableEntry>(new SmColorTokenTableEntry(i));
for (auto i = std::begin(aColorTokenTableDVIPSNAMES); i < std::end(aColorTokenTableDVIPSNAMES);
++i)
if (i->equals(cColor))
return std::unique_ptr<SmColorTokenTableEntry>(new SmColorTokenTableEntry(i));
if ((cColor & 0x00FFFFFF) == cColor) if ((cColor & 0x00FFFFFF) == cColor)
return std::unique_ptr<SmColorTokenTableEntry>( return std::unique_ptr<SmColorTokenTableEntry>(
new SmColorTokenTableEntry("", "", TRGB, cColor)); new SmColorTokenTableEntry("", "", TRGB, cColor));
@@ -464,34 +720,41 @@ std::unique_ptr<SmColorTokenTableEntry>
starmathdatabase::Identify_ColorName_Parser(const OUString& colorname) starmathdatabase::Identify_ColorName_Parser(const OUString& colorname)
{ {
if (colorname.isEmpty()) if (colorname.isEmpty())
return nullptr; return std::unique_ptr<SmColorTokenTableEntry>(
new SmColorTokenTableEntry("", "", TERROR, COL_SM_BLACK));
for (auto i = std::begin(aColorTokenTableParse); i < std::end(aColorTokenTableParse); ++i) for (auto i = std::begin(aColorTokenTableParse); i < std::end(aColorTokenTableParse); ++i)
if (i->equals(colorname)) if (i->equals(colorname))
return std::unique_ptr<SmColorTokenTableEntry>(new SmColorTokenTableEntry(i)); return std::unique_ptr<SmColorTokenTableEntry>(new SmColorTokenTableEntry(i));
return nullptr; return std::unique_ptr<SmColorTokenTableEntry>(
new SmColorTokenTableEntry("", "", TERROR, COL_SM_BLACK));
} }
std::unique_ptr<SmColorTokenTableEntry> std::unique_ptr<SmColorTokenTableEntry>
starmathdatabase::Identify_ColorName_HTML(const OUString& colorname) starmathdatabase::Identify_ColorName_HTML(const OUString& colorname)
{ {
if (colorname.isEmpty()) if (colorname.isEmpty())
return nullptr; return std::unique_ptr<SmColorTokenTableEntry>(
for (auto i = std::begin(aColorTokenTableParse); i < std::end(aColorTokenTableParse); ++i) new SmColorTokenTableEntry("", "", TERROR, COL_SM_BLACK));
for (auto i = std::begin(aColorTokenTableHTML); i < std::end(aColorTokenTableHTML); ++i)
if (i->equals(colorname)) if (i->equals(colorname))
return std::unique_ptr<SmColorTokenTableEntry>(new SmColorTokenTableEntry(i)); return std::unique_ptr<SmColorTokenTableEntry>(new SmColorTokenTableEntry(i));
if (colorname[0] == '#' && colorname.getLength() == 7) if (colorname[0] == '#' && colorname.getLength() == 7)
return std::unique_ptr<SmColorTokenTableEntry>( return std::unique_ptr<SmColorTokenTableEntry>(
new SmColorTokenTableEntry("", "", TRGB, colorname.copy(1, 6).toUInt32(16))); new SmColorTokenTableEntry("", "", TRGB, colorname.copy(1, 6).toUInt32(16)));
return nullptr; return std::unique_ptr<SmColorTokenTableEntry>(
new SmColorTokenTableEntry("", "", TERROR, COL_SM_BLACK));
} }
std::unique_ptr<SmColorTokenTableEntry> std::unique_ptr<SmColorTokenTableEntry>
starmathdatabase::Identify_ColorName_DVIPSNAMES(const OUString& colorname) starmathdatabase::Identify_ColorName_DVIPSNAMES(const OUString& colorname)
{ {
if (colorname.isEmpty()) if (colorname.isEmpty())
return nullptr; return std::unique_ptr<SmColorTokenTableEntry>(
for (auto i = std::begin(aColorTokenTableParse); i < std::end(aColorTokenTableParse); ++i) new SmColorTokenTableEntry("", "", TERROR, COL_SM_BLACK));
for (auto i = std::begin(aColorTokenTableDVIPSNAMES); i < std::end(aColorTokenTableDVIPSNAMES);
++i)
if (i->equals(colorname)) if (i->equals(colorname))
return std::unique_ptr<SmColorTokenTableEntry>(new SmColorTokenTableEntry(i)); return std::unique_ptr<SmColorTokenTableEntry>(new SmColorTokenTableEntry(i));
return nullptr; return std::unique_ptr<SmColorTokenTableEntry>(
new SmColorTokenTableEntry("", "", TERROR, COL_SM_BLACK));
} }

View File

@@ -2135,22 +2135,23 @@ void SmNodeToTextVisitor::Visit( SmFontNode* pNode )
Separate( ); Separate( );
} }
break; break;
case THTMLCOL:
case TDVIPSNAMESCOL: case TDVIPSNAMESCOL:
case TICONICCOL: Append( "color dvip " );
nc = pNode->GetToken().aText.toUInt32(16); nc = pNode->GetToken().aText.toUInt32(16);
aSmColorTokenTableEntry = starmathdatabase::Identify_Color_Parser( nc );
Append( aSmColorTokenTableEntry->pIdent );
break;
case THTMLCOL:
case TICONICCOL:
Append( "color " ); Append( "color " );
nc = pNode->GetToken().aText.toUInt32(16);
aSmColorTokenTableEntry = starmathdatabase::Identify_Color_Parser( nc ); aSmColorTokenTableEntry = starmathdatabase::Identify_Color_Parser( nc );
Append( aSmColorTokenTableEntry->pIdent ); Append( aSmColorTokenTableEntry->pIdent );
break; break;
case TRGB: case TRGB:
nc = pNode->GetToken().aText.toUInt32(16); nc = pNode->GetToken().aText.toUInt32(16);
aSmColorTokenTableEntry = starmathdatabase::Identify_Color_Parser( nc ); aSmColorTokenTableEntry = starmathdatabase::Identify_Color_Parser( nc );
if ( aSmColorTokenTableEntry ) {
Append( "color " );
Append( aSmColorTokenTableEntry->pIdent );
break;
}
Append( "color rgb " ); Append( "color rgb " );
nb = nc % 256; nb = nc % 256;
nc /= 256; nc /= 256;
@@ -2167,11 +2168,6 @@ void SmNodeToTextVisitor::Visit( SmFontNode* pNode )
case TRGBA: case TRGBA:
nc = pNode->GetToken().aText.toUInt32(16); nc = pNode->GetToken().aText.toUInt32(16);
aSmColorTokenTableEntry = starmathdatabase::Identify_Color_Parser( nc ); aSmColorTokenTableEntry = starmathdatabase::Identify_Color_Parser( nc );
if ( aSmColorTokenTableEntry ) {
Append( "color " );
Append( aSmColorTokenTableEntry->pIdent );
break;
}
Append( "color rgba " ); Append( "color rgba " );
nc = pNode->GetToken().aText.toUInt32(16); nc = pNode->GetToken().aText.toUInt32(16);
nb = nc % 256; nb = nc % 256;
@@ -2192,11 +2188,6 @@ void SmNodeToTextVisitor::Visit( SmFontNode* pNode )
case THEX: case THEX:
nc = pNode->GetToken().aText.toUInt32(16); nc = pNode->GetToken().aText.toUInt32(16);
aSmColorTokenTableEntry = starmathdatabase::Identify_Color_Parser( nc ); aSmColorTokenTableEntry = starmathdatabase::Identify_Color_Parser( nc );
if ( aSmColorTokenTableEntry ) {
Append( "color " );
Append( aSmColorTokenTableEntry->pIdent );
break;
}
Append( "color hex " ); Append( "color hex " );
nc = pNode->GetToken().aText.toUInt32(16); nc = pNode->GetToken().aText.toUInt32(16);
Append(OUString::number(nc,16)); Append(OUString::number(nc,16));