diff options
author | Regina Henschel <regina@apache.org> | 2014-10-30 18:41:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-10-31 13:04:17 +0000 |
commit | fe5840aab17e366749c373e4f8683e06e40b4b05 (patch) | |
tree | 0b31cc89dede495cfd1ce8b62e8c6a5290778313 /starmath | |
parent | fa277f5952d719f0dbc880301343e6653548bd03 (diff) |
Resolves: #i118191# Red is not red enough
Enable Math to use 16 basic HTML colors
Patch by: Regina Henschel <rb.henschel@t-online.de>
Found by: <lapsap7+ooo@gmail.com
(cherry picked from commit 529e59d90037748d0030191b93252e597935243e)
Conflicts:
starmath/inc/parse.hxx
starmath/source/mathmlimport.cxx
starmath/source/parse.cxx
Change-Id: I08de0ce33928ead3635a3a87c81671b4cc4112ac
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/parse.hxx | 5 | ||||
-rw-r--r-- | starmath/source/mathmlexport.cxx | 30 | ||||
-rw-r--r-- | starmath/source/mathmlimport.cxx | 19 | ||||
-rw-r--r-- | starmath/source/mathmlimport.hxx | 3 | ||||
-rw-r--r-- | starmath/source/node.cxx | 56 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 10 |
6 files changed, 103 insertions, 20 deletions
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx index d967be7a69c3..7f59def955a6 100644 --- a/starmath/inc/parse.hxx +++ b/starmath/inc/parse.hxx @@ -103,10 +103,11 @@ enum SmTokenType /*220*/ TWIDESLASH, TWIDEBACKSLASH, TLDBRACKET, TRDBRACKET, TNOSPACE, /*225*/ TUNKNOWN, TDEBUG, TPRECEDES, TSUCCEEDS, TPRECEDESEQUAL, /*230*/ TSUCCEEDSEQUAL, TPRECEDESEQUIV, TSUCCEEDSEQUIV, TNOTPRECEDES, TNOTSUCCEEDS, -/*235*/ TINTD +/*235*/ TSILVER, TGRAY, TMAROON, TPURPLE, TLIME, +/*240*/ TOLIVE, TNAVY, TTEAL, TAQUA, TFUCHSIA, +/*245*/ TINTD }; - struct SmToken { diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index c55190b31059..a39bc033d1b5 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -1341,6 +1341,36 @@ void SmXMLExport::ExportFont(const SmNode *pNode, int nLevel) case TYELLOW: AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_YELLOW); break; + case TSILVER: + AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_SILVER); + break; + case TGRAY: + AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_GRAY); + break; + case TMAROON: + AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_MAROON); + break; + case TOLIVE: + AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_OLIVE); + break; + case TLIME: + AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_LIME); + break; + case TAQUA: + AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_AQUA); + break; + case TTEAL: + AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_TEAL); + break; + case TNAVY: + AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_NAVY); + break; + case TFUCHSIA: + AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_FUCHSIA); + break; + case TPURPLE: + AddAttribute(XML_NAMESPACE_MATH, XML_COLOR, XML_PURPLE); + break; case TSIZE: { const SmFontNode *pFontNode = static_cast<const SmFontNode *>(pNode); diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 0ea7bc2ee384..0a5ddb912f0b 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -670,6 +670,9 @@ void SmXMLContext_Helper::RetrieveAttrs(const uno::Reference< case XML_TOK_COLOR: sColor = sValue; break; + case XML_TOK_MATHCOLOR: + sColor = sValue; + break; default: break; } @@ -1896,6 +1899,7 @@ static const SvXMLTokenMapEntry aPresLayoutAttrTokenMap[] = { XML_NAMESPACE_MATH, XML_FONTSIZE, XML_TOK_FONTSIZE }, { XML_NAMESPACE_MATH, XML_FONTFAMILY, XML_TOK_FONTFAMILY }, { XML_NAMESPACE_MATH, XML_COLOR, XML_TOK_COLOR }, + { XML_NAMESPACE_MATH, XML_MATHCOLOR, XML_TOK_MATHCOLOR }, XML_TOKEN_MAP_END }; @@ -1953,15 +1957,20 @@ static const SvXMLTokenMapEntry aColorTokenMap[] = { XML_NAMESPACE_MATH, XML_RED, TRED}, { XML_NAMESPACE_MATH, XML_GREEN, TGREEN}, { XML_NAMESPACE_MATH, XML_BLUE, TBLUE}, - { XML_NAMESPACE_MATH, XML_AQUA, TCYAN}, - { XML_NAMESPACE_MATH, XML_FUCHSIA, TMAGENTA}, + { XML_NAMESPACE_MATH, XML_AQUA, TAQUA}, + { XML_NAMESPACE_MATH, XML_FUCHSIA, TFUCHSIA}, { XML_NAMESPACE_MATH, XML_YELLOW, TYELLOW}, + { XML_NAMESPACE_MATH, XML_NAVY, TNAVY}, + { XML_NAMESPACE_MATH, XML_TEAL, TTEAL}, + { XML_NAMESPACE_MATH, XML_MAROON, TMAROON}, + { XML_NAMESPACE_MATH, XML_PURPLE, TPURPLE}, + { XML_NAMESPACE_MATH, XML_OLIVE, TOLIVE}, + { XML_NAMESPACE_MATH, XML_GRAY, TGRAY}, + { XML_NAMESPACE_MATH, XML_SILVER, TSILVER}, + { XML_NAMESPACE_MATH, XML_LIME, TLIME}, XML_TOKEN_MAP_END }; - - - const SvXMLTokenMap& SmXMLImport::GetPresLayoutElemTokenMap() { if (!pPresLayoutElemTokenMap) diff --git a/starmath/source/mathmlimport.hxx b/starmath/source/mathmlimport.hxx index 44e4ce1a2c34..f7326e75961a 100644 --- a/starmath/source/mathmlimport.hxx +++ b/starmath/source/mathmlimport.hxx @@ -297,7 +297,8 @@ enum SmXMLPresLayoutAttrTokenMap XML_TOK_FONTSTYLE, XML_TOK_FONTSIZE, XML_TOK_FONTFAMILY, - XML_TOK_COLOR + XML_TOK_COLOR, + XML_TOK_MATHCOLOR }; diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index 06fdbf753175..7c93b1463011 100644 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -2015,12 +2015,6 @@ void SmAttributNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) ExtendBy(*pAttr, RCP_THIS, true); } - -/**************************************************************************/ - - - - void SmFontNode::CreateTextFromNode(OUString &rText) { switch (GetToken().eType) @@ -2092,6 +2086,36 @@ void SmFontNode::CreateTextFromNode(OUString &rText) case TYELLOW: rText += "color yellow "; break; + case TTEAL: + rText += "color teal"; + break; + case TSILVER: + rText += "color silver"; + break; + case TGRAY: + rText += "color gray"; + break; + case TMAROON: + rText += "color maroon"; + break; + case TPURPLE: + rText += "color purple"; + break; + case TLIME: + rText += "color lime"; + break; + case TOLIVE: + rText += "color olive"; + break; + case TNAVY: + rText += "color navy"; + break; + case TAQUA: + rText += "color aqua"; + break; + case TFUCHSIA: + rText += "color fuchsia"; + break; case TSANS: rText += "font sans "; break; @@ -2107,7 +2131,6 @@ void SmFontNode::CreateTextFromNode(OUString &rText) GetSubNode(1)->CreateTextFromNode(rText); } - void SmFontNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell) { //! prepare subnodes first @@ -2132,7 +2155,6 @@ void SmFontNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell) Flags() |= FLG_FONT; } - void SmFontNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) { SmNode *pNode = GetSubNode(1); @@ -2157,12 +2179,22 @@ void SmFontNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) case TBLACK : SetColor(Color(COL_BLACK)); break; case TWHITE : SetColor(Color(COL_WHITE)); break; - case TRED : SetColor(Color(COL_RED)); break; + case TRED : SetColor(Color(COL_LIGHTRED)); break; case TGREEN : SetColor(Color(COL_GREEN)); break; - case TBLUE : SetColor(Color(COL_BLUE)); break; - case TCYAN : SetColor(Color(COL_CYAN)); break; - case TMAGENTA : SetColor(Color(COL_MAGENTA)); break; + case TBLUE : SetColor(Color(COL_LIGHTBLUE)); break; + case TCYAN : SetColor(Color(COL_LIGHTCYAN)); break; // as in Calc + case TMAGENTA : SetColor(Color(COL_LIGHTMAGENTA)); break; // as in Calc case TYELLOW : SetColor(Color(COL_YELLOW)); break; + case TTEAL : SetColor(Color(COL_CYAN)); break; + case TSILVER : SetColor(Color(COL_LIGHTGRAY)); break; + case TGRAY : SetColor(Color(COL_GRAY)); break; + case TMAROON : SetColor(Color(COL_RED)); break; + case TPURPLE : SetColor(Color(COL_MAGENTA)); break; + case TLIME : SetColor(Color(COL_LIGHTGREEN)); break; + case TOLIVE : SetColor(Color(COL_BROWN)); break; + case TNAVY : SetColor(Color(COL_BLUE)); break; + case TAQUA : SetColor(Color(COL_LIGHTCYAN)); break; + case TFUCHSIA : SetColor(Color(COL_LIGHTMAGENTA)); break; default: SAL_WARN("starmath", "unknown case"); diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx index b7373f122434..408612e0a185 100644 --- a/starmath/source/parse.cxx +++ b/starmath/source/parse.cxx @@ -92,6 +92,7 @@ static const SmTokenTableEntry aTokenTable[] = { "alignt", TALIGNC, '\0', TGALIGN | TGDISCARDED, 0}, { "and", TAND, MS_AND, TGPRODUCT, 0}, { "approx", TAPPROX, MS_APPROX, TGRELATION, 0}, + { "aqua", TAQUA, '\0', TGCOLOR, 0}, { "arccos", TACOS, '\0', TGFUNCTION, 5}, { "arccot", TACOT, '\0', TGFUNCTION, 5}, { "arcsin", TASIN, '\0', TGFUNCTION, 5}, @@ -146,11 +147,13 @@ static const SmTokenTableEntry aTokenTable[] = { "font", TFONT, '\0', TGFONTATTR, 5}, { "forall", TFORALL, MS_FORALL, TGSTANDALONE, 5}, { "from", TFROM, '\0', TGLIMIT, 0}, + { "fuchsia", TFUCHSIA, '\0', TGCOLOR, 0}, { "func", TFUNC, '\0', TGFUNCTION, 5}, { "ge", TGE, MS_GE, TGRELATION, 0}, { "geslant", TGESLANT, MS_GESLANT, TGRELATION, 0 }, { "gg", TGG, MS_GG, TGRELATION, 0}, { "grave", TGRAVE, MS_GRAVE, TGATTRIBUT, 5}, + { "gray", TGRAY, '\0', TGCOLOR, 0}, { "green", TGREEN, '\0', TGCOLOR, 0}, { "gt", TGT, MS_GT, TGRELATION, 0}, { "hat", THAT, MS_HAT, TGATTRIBUT, 5}, @@ -177,6 +180,7 @@ static const SmTokenTableEntry aTokenTable[] = { "leslant", TLESLANT, MS_LESLANT, TGRELATION, 0 }, { "lfloor", TLFLOOR, MS_LFLOOR, TGLBRACES, 5}, { "lim", TLIM, '\0', TGOPER, 5}, + { "lime", TLIME, '\0', TGCOLOR, 0}, { "liminf", TLIMINF, '\0', TGOPER, 5}, { "limsup", TLIMSUP, '\0', TGOPER, 5}, { "lint", TLINT, MS_LINT, TGOPER, 5}, @@ -190,10 +194,12 @@ static const SmTokenTableEntry aTokenTable[] = { "lsup", TLSUP, '\0', TGPOWER, 0}, { "lt", TLT, MS_LT, TGRELATION, 0}, { "magenta", TMAGENTA, '\0', TGCOLOR, 0}, + { "maroon", TMAROON, '\0', TGCOLOR, 0}, { "matrix", TMATRIX, '\0', 0, 5}, { "minusplus", TMINUSPLUS, MS_MINUSPLUS, TGUNOPER | TGSUM, 5}, { "mline", TMLINE, MS_VERTLINE, 0, 0}, //! not in TGRBRACES, Level 0 { "nabla", TNABLA, MS_NABLA, TGSTANDALONE, 5}, + { "navy", TNAVY, '\0', TGCOLOR, 0}, { "nbold", TNBOLD, '\0', TGFONTATTR, 5}, { "ndivides", TNDIVIDES, MS_NDIVIDES, TGRELATION, 0}, { "neg", TNEG, MS_NEG, TGUNOPER, 5 }, @@ -211,6 +217,7 @@ static const SmTokenTableEntry aTokenTable[] = { "nsupseteq", TNSUPSETEQ, MS_NSUPSETEQ, TGRELATION, 0 }, { "odivide", TODIVIDE, MS_ODIVIDE, TGPRODUCT, 0}, { "odot", TODOT, MS_ODOT, TGPRODUCT, 0}, + { "olive", TOLIVE, '\0', TGCOLOR, 0}, { "ominus", TOMINUS, MS_OMINUS, TGSUM, 0}, { "oper", TOPER, '\0', TGOPER, 5}, { "oplus", TOPLUS, MS_OPLUS, TGSUM, 0}, @@ -232,6 +239,7 @@ static const SmTokenTableEntry aTokenTable[] = { "nprec", TNOTPRECEDES, MS_NOTPRECEDES, TGRELATION, 0 }, { "prod", TPROD, MS_PROD, TGOPER, 5}, { "prop", TPROP, MS_PROP, TGRELATION, 0}, + { "purple", TPURPLE, '\0', TGCOLOR, 0}, { "rangle", TRANGLE, MS_RMATHANGLE, TGRBRACES, 0}, //! 0 to terminate expression { "rbrace", TRBRACE, MS_RBRACE, TGRBRACES, 0}, { "rceil", TRCEIL, MS_RCEIL, TGRBRACES, 0}, @@ -252,6 +260,7 @@ static const SmTokenTableEntry aTokenTable[] = { "setR" , TSETR, MS_SETR, TGSTANDALONE, 5}, { "setZ" , TSETZ, MS_SETZ, TGSTANDALONE, 5}, { "setminus", TBACKSLASH, MS_BACKSLASH, TGPRODUCT, 0 }, + { "silver", TSILVER, '\0', TGCOLOR, 0}, { "sim", TSIM, MS_SIM, TGRELATION, 0}, { "simeq", TSIMEQ, MS_SIMEQ, TGRELATION, 0}, { "sin", TSIN, '\0', TGFUNCTION, 5}, @@ -273,6 +282,7 @@ static const SmTokenTableEntry aTokenTable[] = { "supseteq", TSUPSETEQ, MS_SUPSETEQ, TGRELATION, 0}, { "tan", TTAN, '\0', TGFUNCTION, 5}, { "tanh", TTANH, '\0', TGFUNCTION, 5}, + { "teal", TTEAL, '\0', TGCOLOR, 0}, { "tilde", TTILDE, MS_TILDE, TGATTRIBUT, 5}, { "times", TTIMES, MS_TIMES, TGPRODUCT, 0}, { "to", TTO, '\0', TGLIMIT, 0}, |