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 #include <starmathdatabase.hxx>
21 
Identify_SmXMLOperatorContext_Impl(sal_Unicode cChar,bool bIsStretchy)22 SmToken starmathdatabase::Identify_SmXMLOperatorContext_Impl(sal_Unicode cChar, bool bIsStretchy)
23 {
24     switch (cChar)
25     {
26         case MS_COPROD:
27             return SmToken(TCOPROD, MS_COPROD, "coprod", TG::Oper, 5);
28         case MS_IIINT:
29             return SmToken(TIIINT, MS_IIINT, "iiint", TG::Oper, 5);
30         case MS_IINT:
31             return SmToken(TIINT, MS_IINT, "iint", TG::Oper, 5);
32         case MS_INT:
33             if (bIsStretchy)
34                 return SmToken(TINTD, MS_INT, "intd", TG::Oper, 5);
35             else
36                 return SmToken(TINT, MS_INT, "int", TG::Oper, 5);
37         case MS_LINT:
38             return SmToken(TLINT, MS_LINT, "lint", TG::Oper, 5);
39         case MS_LLINT:
40             return SmToken(TLLINT, MS_LLINT, "llint", TG::Oper, 5);
41         case MS_LLLINT:
42             return SmToken(TLLLINT, MS_LLLINT, "lllint", TG::Oper, 5);
43         case MS_PROD:
44             return SmToken(TPROD, MS_PROD, "prod", TG::Oper, 5);
45         case MS_SUM:
46             return SmToken(TSUM, MS_SUM, "sum", TG::Oper, 5);
47         case MS_FACT:
48             return SmToken(TFACT, MS_FACT, "!", TG::UnOper, 5);
49         case MS_NEG:
50             return SmToken(TNEG, MS_NEG, "neg", TG::UnOper, 5);
51         case MS_OMINUS:
52             return SmToken(TOMINUS, MS_OMINUS, "ominus", TG::Sum, 0);
53         case MS_OPLUS:
54             return SmToken(TOPLUS, MS_OPLUS, "oplus", TG::Sum, 0);
55         case MS_UNION:
56             return SmToken(TUNION, MS_UNION, "union", TG::Sum, 0);
57         case MS_OR:
58             return SmToken(TOR, MS_OR, "|", TG::Sum, 5);
59         case MS_PLUSMINUS:
60             return SmToken(TPLUSMINUS, MS_PLUSMINUS, "+-", TG::Sum | TG::UnOper, 5);
61         case MS_MINUSPLUS:
62             return SmToken(TMINUSPLUS, MS_MINUSPLUS, "-+", TG::Sum | TG::UnOper, 5);
63         case 0xe083:
64         case MS_PLUS:
65             return SmToken(TPLUS, MS_PLUS, "+", TG::Sum | TG::UnOper, 5);
66         case MS_MINUS:
67             return SmToken(TMINUS, MS_MINUS, "-", TG::Sum | TG::UnOper, 5);
68         case 0x2022:
69         case MS_CDOT:
70             return SmToken(TCDOT, MS_CDOT, "cdot", TG::Product, 0);
71         case MS_DIV:
72             return SmToken(TDIV, MS_DIV, "div", TG::Product, 0);
73         case MS_TIMES:
74             return SmToken(TTIMES, MS_TIMES, "times", TG::Product, 0);
75         case MS_INTERSECT:
76             return SmToken(TINTERSECT, MS_INTERSECT, "intersection", TG::Product, 0);
77         case MS_ODIVIDE:
78             return SmToken(TODIVIDE, MS_ODIVIDE, "odivide", TG::Product, 0);
79         case MS_ODOT:
80             return SmToken(TODOT, MS_ODOT, "odot", TG::Product, 0);
81         case MS_OTIMES:
82             return SmToken(TOTIMES, MS_OTIMES, "otimes", TG::Product, 0);
83         case MS_AND:
84             return SmToken(TAND, MS_AND, "&", TG::Product, 0);
85         case MS_MULTIPLY:
86             return SmToken(TMULTIPLY, MS_MULTIPLY, "*", TG::Product, 0);
87         case MS_SLASH:
88             if (bIsStretchy)
89                 return SmToken(TWIDESLASH, MS_SLASH, "wideslash", TG::Product, 0);
90             else
91                 return SmToken(TSLASH, MS_SLASH, "slash", TG::Product, 0);
92         case MS_BACKSLASH:
93             if (bIsStretchy)
94                 return SmToken(TWIDEBACKSLASH, MS_BACKSLASH, "widebslash", TG::Product, 0);
95             else
96                 return SmToken(TBACKSLASH, MS_BACKSLASH, "bslash", TG::Product, 0);
97         case MS_DEF:
98             return SmToken(TDEF, MS_DEF, "def", TG::Relation, 0);
99         case MS_LINE:
100             return SmToken(TDIVIDES, MS_LINE, "divides", TG::Relation, 0);
101         case MS_EQUIV:
102             return SmToken(TEQUIV, MS_EQUIV, "equiv", TG::Relation, 0);
103         case MS_GE:
104             return SmToken(TGE, MS_GE, ">=", TG::Relation, 0);
105         case MS_GESLANT:
106             return SmToken(TGESLANT, MS_GESLANT, "geslant", TG::Relation, 0);
107         case MS_GG:
108             return SmToken(TGG, MS_GG, ">>", TG::Relation, 0);
109         case MS_GT:
110             return SmToken(TGT, MS_GT, ">", TG::Relation, 0);
111         case MS_IN:
112             return SmToken(TIN, MS_IN, "in", TG::Relation, 0);
113         case MS_LE:
114             return SmToken(TLE, MS_LE, "<=", TG::Relation, 0);
115         case MS_LESLANT:
116             return SmToken(TLESLANT, MS_LESLANT, "leslant", TG::Relation, 0);
117         case MS_LL:
118             return SmToken(TLL, MS_LL, "<<", TG::Relation, 0);
119         case MS_LT:
120             return SmToken(TLT, MS_LT, "<", TG::Relation, 0);
121         case MS_NDIVIDES:
122             return SmToken(TNDIVIDES, MS_NDIVIDES, "ndivides", TG::Relation, 0);
123         case MS_NEQ:
124             return SmToken(TNEQ, MS_NEQ, "<>", TG::Relation, 0);
125         case MS_NOTIN:
126             return SmToken(TNOTIN, MS_NOTIN, "notin", TG::Relation, 0);
127         case MS_NOTPRECEDES:
128             return SmToken(TNOTPRECEDES, MS_NOTPRECEDES, "nprec", TG::Relation, 0);
129         case MS_NSUBSET:
130             return SmToken(TNSUBSET, MS_NSUBSET, "nsubset", TG::Relation, 0);
131         case MS_NSUBSETEQ:
132             return SmToken(TNSUBSETEQ, MS_NSUBSETEQ, "nsubseteq", TG::Relation, 0);
133         case MS_NOTSUCCEEDS:
134             return SmToken(TNOTSUCCEEDS, MS_NOTSUCCEEDS, "nsucc", TG::Relation, 0);
135         case MS_NSUPSET:
136             return SmToken(TNSUPSET, MS_NSUPSET, "nsupset", TG::Relation, 0);
137         case MS_NSUPSETEQ:
138             return SmToken(TNSUPSETEQ, MS_NSUPSETEQ, "nsupseteq", TG::Relation, 0);
139         case MS_ORTHO:
140             return SmToken(TORTHO, MS_ORTHO, "ortho", TG::Relation, 0);
141         case MS_NI:
142             return SmToken(TNI, MS_NI, "owns", TG::Relation, 0);
143         case MS_DLINE:
144             return SmToken(TPARALLEL, MS_DLINE, "parallel", TG::Relation, 0);
145         case MS_PRECEDES:
146             return SmToken(TPRECEDES, MS_PRECEDES, "prec", TG::Relation, 0);
147         case MS_PRECEDESEQUAL:
148             return SmToken(TPRECEDESEQUAL, MS_PRECEDESEQUAL, "preccurlyeq", TG::Relation, 0);
149         case MS_PRECEDESEQUIV:
150             return SmToken(TPRECEDESEQUIV, MS_PRECEDESEQUIV, "precsim", TG::Relation, 0);
151         case MS_PROP:
152             return SmToken(TPROP, MS_PROP, "prop", TG::Relation, 0);
153         case MS_SIM:
154             return SmToken(TSIM, MS_SIM, "sim", TG::Relation, 0);
155         case 0x2245:
156         case MS_SIMEQ:
157             return SmToken(TSIMEQ, MS_SIMEQ, "simeq", TG::Relation, 0);
158         case MS_SUBSET:
159             return SmToken(TSUBSET, MS_SUBSET, "subset", TG::Relation, 0);
160         case MS_SUBSETEQ:
161             return SmToken(TSUBSETEQ, MS_SUBSETEQ, "subseteq", TG::Relation, 0);
162         case MS_SUCCEEDS:
163             return SmToken(TSUCCEEDS, MS_SUCCEEDS, "succ", TG::Relation, 0);
164         case MS_SUCCEEDSEQUAL:
165             return SmToken(TSUCCEEDSEQUAL, MS_SUCCEEDSEQUAL, "succcurlyeq", TG::Relation, 0);
166         case MS_SUCCEEDSEQUIV:
167             return SmToken(TSUCCEEDSEQUIV, MS_SUCCEEDSEQUIV, "succsim", TG::Relation, 0);
168         case MS_SUPSET:
169             return SmToken(TSUPSET, MS_SUPSET, "supset", TG::Relation, 0);
170         case MS_SUPSETEQ:
171             return SmToken(TSUPSETEQ, MS_SUPSETEQ, "supseteq", TG::Relation, 0);
172         case MS_RIGHTARROW:
173             return SmToken(TTOWARD, MS_RIGHTARROW, "toward", TG::Relation, 0);
174         case MS_TRANSL:
175             return SmToken(TTRANSL, MS_TRANSL, "transl", TG::Relation, 0);
176         case MS_TRANSR:
177             return SmToken(TTRANSR, MS_TRANSR, "transr", TG::Relation, 0);
178         case MS_ASSIGN:
179             return SmToken(TASSIGN, MS_ASSIGN, "=", TG::Relation, 0);
180         case MS_LANGLE:
181             return SmToken(TLANGLE, MS_LMATHANGLE, "langle", TG::LBrace, 5);
182         case MS_LMATHANGLE:
183             return SmToken(TLANGLE, MS_LMATHANGLE, "langle", TG::LBrace, 5);
184         case MS_LBRACE:
185             return SmToken(TLBRACE, MS_LBRACE, "lbrace", TG::LBrace, 5);
186         case MS_LCEIL:
187             return SmToken(TLCEIL, MS_LCEIL, "lceil", TG::LBrace, 5);
188         case MS_LFLOOR:
189             return SmToken(TLFLOOR, MS_LFLOOR, "lfloor", TG::LBrace, 5);
190         case MS_LDBRACKET:
191             return SmToken(TLDBRACKET, MS_LDBRACKET, "ldbracket", TG::LBrace, 5);
192         case MS_LBRACKET:
193             return SmToken(TLBRACKET, MS_LBRACKET, "[", TG::LBrace, 5);
194         case MS_LPARENT:
195             return SmToken(TLPARENT, MS_LPARENT, "(", TG::LBrace, 5);
196         case MS_RANGLE:
197             return SmToken(TRANGLE, MS_RMATHANGLE, "rangle", TG::RBrace, 5);
198         case MS_RMATHANGLE:
199             return SmToken(TRANGLE, MS_RMATHANGLE, "rangle", TG::RBrace, 5);
200         case MS_RBRACE:
201             return SmToken(TRBRACE, MS_RBRACE, "rbrace", TG::RBrace, 5);
202         case MS_RCEIL:
203             return SmToken(TRCEIL, MS_RCEIL, "rceil", TG::RBrace, 5);
204         case MS_RFLOOR:
205             return SmToken(TRFLOOR, MS_RFLOOR, "rfloor", TG::RBrace, 5);
206         case MS_RDBRACKET:
207             return SmToken(TRDBRACKET, MS_RDBRACKET, "rdbracket", TG::RBrace, 5);
208         case MS_RBRACKET:
209             return SmToken(TRBRACKET, MS_RBRACKET, "]", TG::RBrace, 5);
210         case MS_RPARENT:
211             return SmToken(TRPARENT, MS_RPARENT, ")", TG::RBrace, 5);
212         case MS_NONE:
213             return SmToken(TNONE, MS_NONE, "none", TG::RBrace | TG::LBrace, 5);
214         default:
215             return SmToken(TERROR, MS_NONE, "", TG::NONE, SAL_MAX_UINT16);
216     }
217 }
218 
Identify_Prefix_SmXMLOperatorContext_Impl(sal_Unicode cChar)219 SmToken starmathdatabase::Identify_Prefix_SmXMLOperatorContext_Impl(sal_Unicode cChar)
220 {
221     switch (cChar)
222     {
223         case MS_VERTLINE:
224             return SmToken(TLLINE, MS_VERTLINE, "lline", TG::LBrace, 5);
225         case MS_DVERTLINE:
226             return SmToken(TLDLINE, MS_DVERTLINE, "ldline", TG::LBrace, 5);
227         case MS_LANGLE:
228             return SmToken(TLANGLE, MS_LMATHANGLE, "langle", TG::LBrace, 5);
229         case MS_LMATHANGLE:
230             return SmToken(TLANGLE, MS_LMATHANGLE, "langle", TG::LBrace, 5);
231         case MS_LBRACE:
232             return SmToken(TLBRACE, MS_LBRACE, "lbrace", TG::LBrace, 5);
233         case MS_LCEIL:
234             return SmToken(TLCEIL, MS_LCEIL, "lceil", TG::LBrace, 5);
235         case MS_LFLOOR:
236             return SmToken(TLFLOOR, MS_LFLOOR, "lfloor", TG::LBrace, 5);
237         case MS_LDBRACKET:
238             return SmToken(TLDBRACKET, MS_LDBRACKET, "ldbracket", TG::LBrace, 5);
239         case MS_LBRACKET:
240             return SmToken(TLBRACKET, MS_LBRACKET, "[", TG::LBrace, 5);
241         case MS_LPARENT:
242             return SmToken(TLPARENT, MS_LPARENT, "(", TG::LBrace, 5);
243         case MS_RANGLE:
244             return SmToken(TRANGLE, MS_RMATHANGLE, "rangle", TG::RBrace, 5);
245         case MS_RMATHANGLE:
246             return SmToken(TRANGLE, MS_RMATHANGLE, "rangle", TG::RBrace, 5);
247         case MS_RBRACE:
248             return SmToken(TRBRACE, MS_RBRACE, "rbrace", TG::RBrace, 5);
249         case MS_RCEIL:
250             return SmToken(TRCEIL, MS_RCEIL, "rceil", TG::RBrace, 5);
251         case MS_RFLOOR:
252             return SmToken(TRFLOOR, MS_RFLOOR, "rfloor", TG::RBrace, 5);
253         case MS_RDBRACKET:
254             return SmToken(TRDBRACKET, MS_RDBRACKET, "rdbracket", TG::RBrace, 5);
255         case MS_RBRACKET:
256             return SmToken(TRBRACKET, MS_RBRACKET, "]", TG::RBrace, 5);
257         case MS_RPARENT:
258             return SmToken(TRPARENT, MS_RPARENT, ")", TG::RBrace, 5);
259         case MS_NONE:
260             return SmToken(TNONE, MS_NONE, "none", TG::LBrace | TG::RBrace, 5);
261         default:
262             return SmToken(TERROR, MS_NONE, "", TG::NONE, SAL_MAX_UINT16);
263     }
264 }
265 
Identify_Postfix_SmXMLOperatorContext_Impl(sal_Unicode cChar)266 SmToken starmathdatabase::Identify_Postfix_SmXMLOperatorContext_Impl(sal_Unicode cChar)
267 {
268     switch (cChar)
269     {
270         case MS_VERTLINE:
271             return SmToken(TRLINE, MS_VERTLINE, "rline", TG::RBrace, 5);
272         case MS_DVERTLINE:
273             return SmToken(TRDLINE, MS_DVERTLINE, "rdline", TG::RBrace, 5);
274         case MS_LANGLE:
275             return SmToken(TLANGLE, MS_LMATHANGLE, "langle", TG::LBrace, 5);
276         case MS_LMATHANGLE:
277             return SmToken(TLANGLE, MS_LMATHANGLE, "langle", TG::LBrace, 5);
278         case MS_LBRACE:
279             return SmToken(TLBRACE, MS_LBRACE, "lbrace", TG::LBrace, 5);
280         case MS_LCEIL:
281             return SmToken(TLCEIL, MS_LCEIL, "lceil", TG::LBrace, 5);
282         case MS_LFLOOR:
283             return SmToken(TLFLOOR, MS_LFLOOR, "lfloor", TG::LBrace, 5);
284         case MS_LDBRACKET:
285             return SmToken(TLDBRACKET, MS_LDBRACKET, "ldbracket", TG::LBrace, 5);
286         case MS_LBRACKET:
287             return SmToken(TLBRACKET, MS_LBRACKET, "[", TG::LBrace, 5);
288         case MS_LPARENT:
289             return SmToken(TLPARENT, MS_LPARENT, "(", TG::LBrace, 5);
290         case MS_RANGLE:
291             return SmToken(TRANGLE, MS_RMATHANGLE, "rangle", TG::RBrace, 5);
292         case MS_RMATHANGLE:
293             return SmToken(TRANGLE, MS_RMATHANGLE, "rangle", TG::RBrace, 5);
294         case MS_RBRACE:
295             return SmToken(TRBRACE, MS_RBRACE, "rbrace", TG::RBrace, 5);
296         case MS_RCEIL:
297             return SmToken(TRCEIL, MS_RCEIL, "rceil", TG::RBrace, 5);
298         case MS_RFLOOR:
299             return SmToken(TRFLOOR, MS_RFLOOR, "rfloor", TG::RBrace, 5);
300         case MS_RDBRACKET:
301             return SmToken(TRDBRACKET, MS_RDBRACKET, "rdbracket", TG::RBrace, 5);
302         case MS_RBRACKET:
303             return SmToken(TRBRACKET, MS_RBRACKET, "]", TG::RBrace, 5);
304         case MS_RPARENT:
305             return SmToken(TRPARENT, MS_RPARENT, ")", TG::RBrace, 5);
306         case MS_NONE:
307             return SmToken(TNONE, MS_NONE, "none", TG::LBrace | TG::RBrace, 5);
308         default:
309             return SmToken(TERROR, MS_NONE, "", TG::NONE, SAL_MAX_UINT16);
310     }
311 }
312 
Identify_PrefixPostfix_SmXMLOperatorContext_Impl(sal_Unicode cChar)313 SmToken starmathdatabase::Identify_PrefixPostfix_SmXMLOperatorContext_Impl(sal_Unicode cChar)
314 {
315     switch (cChar)
316     {
317         case MS_VERTLINE:
318             return SmToken(TLRLINE, MS_VERTLINE, "lrline", TG::LBrace | TG::RBrace, 5);
319         case MS_DVERTLINE:
320             return SmToken(TLRDLINE, MS_DVERTLINE, "lrdline", TG::LBrace | TG::RBrace, 5);
321         case MS_LANGLE:
322             return SmToken(TLANGLE, MS_LMATHANGLE, "langle", TG::LBrace, 5);
323         case MS_LMATHANGLE:
324             return SmToken(TLANGLE, MS_LMATHANGLE, "langle", TG::LBrace, 5);
325         case MS_LBRACE:
326             return SmToken(TLBRACE, MS_LBRACE, "lbrace", TG::LBrace, 5);
327         case MS_LCEIL:
328             return SmToken(TLCEIL, MS_LCEIL, "lceil", TG::LBrace, 5);
329         case MS_LFLOOR:
330             return SmToken(TLFLOOR, MS_LFLOOR, "lfloor", TG::LBrace, 5);
331         case MS_LDBRACKET:
332             return SmToken(TLDBRACKET, MS_LDBRACKET, "ldbracket", TG::LBrace, 5);
333         case MS_LBRACKET:
334             return SmToken(TLBRACKET, MS_LBRACKET, "[", TG::LBrace, 5);
335         case MS_LPARENT:
336             return SmToken(TLPARENT, MS_LPARENT, "(", TG::LBrace, 5);
337         case MS_RANGLE:
338             return SmToken(TRANGLE, MS_RMATHANGLE, "rangle", TG::RBrace, 5);
339         case MS_RMATHANGLE:
340             return SmToken(TRANGLE, MS_RMATHANGLE, "rangle", TG::RBrace, 5);
341         case MS_RBRACE:
342             return SmToken(TRBRACE, MS_RBRACE, "rbrace", TG::RBrace, 5);
343         case MS_RCEIL:
344             return SmToken(TRCEIL, MS_RCEIL, "rceil", TG::RBrace, 5);
345         case MS_RFLOOR:
346             return SmToken(TRFLOOR, MS_RFLOOR, "rfloor", TG::RBrace, 5);
347         case MS_RDBRACKET:
348             return SmToken(TRDBRACKET, MS_RDBRACKET, "rdbracket", TG::RBrace, 5);
349         case MS_RBRACKET:
350             return SmToken(TRBRACKET, MS_RBRACKET, "]", TG::RBrace, 5);
351         case MS_RPARENT:
352             return SmToken(TRPARENT, MS_RPARENT, ")", TG::RBrace, 5);
353         case MS_NONE:
354             return SmToken(TNONE, MS_NONE, "none", TG::LBrace | TG::RBrace, 5);
355         default:
356             return SmToken(TERROR, MS_NONE, "", TG::NONE, SAL_MAX_UINT16);
357     }
358 }
359 
360 const SmColorTokenTableEntry starmathdatabase::aColorTokenTableParse[]
361     = { { "aliceblue", THTMLCOL, COL_SM_ALICEBLUE },
362         { "antiquewhite", THTMLCOL, COL_SM_ANTIQUEWHITE },
363         { "aqua", TMATHMLCOL, COL_SM_AQUA },
364         { "aquamarine", THTMLCOL, COL_SM_AQUAMARINE },
365         { "azure", THTMLCOL, COL_SM_AZURE },
366         { "beige", THTMLCOL, COL_SM_BEIGE },
367         { "bisque", THTMLCOL, COL_SM_BISQUE },
368         { "black", TMATHMLCOL, COL_SM_BLACK },
369         { "blanchedalmond", THTMLCOL, COL_SM_BLANCHEDALMOND },
370         { "blue", TMATHMLCOL, COL_SM_BLUE },
371         { "blueviolet", THTMLCOL, COL_SM_BLUEVIOLET },
372         { "brown", THTMLCOL, COL_SM_BROWN },
373         { "burlywood", THTMLCOL, COL_SM_BURLYWOOD },
374         { "cadetblue", THTMLCOL, COL_SM_CADETBLUE },
375         { "chartreuse", THTMLCOL, COL_SM_CHARTREUSE },
376         { "chocolate", THTMLCOL, COL_SM_CHOCOLATE },
377         { "coral", THTMLCOL, COL_SM_CORAL },
378         { "cornflowerblue", THTMLCOL, COL_SM_CORNFLOWERBLUE },
379         { "cornsilk", THTMLCOL, COL_SM_CORNSILK },
380         { "crimson", THTMLCOL, COL_SM_CRIMSON },
381         { "cyan", TMATHMLCOL, COL_SM_CYAN },
382         { "darkblue", THTMLCOL, COL_SM_DARKBLUE },
383         { "darkcyan", THTMLCOL, COL_SM_DARKCYAN },
384         { "darkgoldenrod", THTMLCOL, COL_SM_DARKGOLDENROD },
385         { "darkgray", THTMLCOL, COL_SM_DARKGRAY },
386         { "darkgreen", THTMLCOL, COL_SM_DARKGREEN },
387         { "darkgrey", THTMLCOL, COL_SM_DARKGREY },
388         { "darkkhaki", THTMLCOL, COL_SM_DARKKHAKI },
389         { "darkmagenta", THTMLCOL, COL_SM_DARKMAGENTA },
390         { "darkolivegreen", THTMLCOL, COL_SM_DARKOLIVEGREEN },
391         { "darkorange", THTMLCOL, COL_SM_DARKORANGE },
392         { "darkorchid", THTMLCOL, COL_SM_DARKORCHID },
393         { "darkred", THTMLCOL, COL_SM_DARKRED },
394         { "darksalmon", THTMLCOL, COL_SM_DARKSALMON },
395         { "darkseagreen", THTMLCOL, COL_SM_DARKSEAGREEN },
396         { "darkslateblue", THTMLCOL, COL_SM_DARKSLATEBLUE },
397         { "darkslategray", THTMLCOL, COL_SM_DARKSLATEGRAY },
398         { "darkslategrey", THTMLCOL, COL_SM_DARKSLATEGREY },
399         { "darkturquoise", THTMLCOL, COL_SM_DARKTURQUOISE },
400         { "darkviolet", THTMLCOL, COL_SM_DARKVIOLET },
401         { "debian", TICONICCOL, COL_SM_DEBIAN_MAGENTA },
402         { "deeppink", THTMLCOL, COL_SM_DEEPPINK },
403         { "deepskyblue", THTMLCOL, COL_SM_DEEPSKYBLUE },
404         { "dimgray", THTMLCOL, COL_SM_DIMGRAY },
405         { "dimgrey", THTMLCOL, COL_SM_DIMGREY },
406         { "dodgerblue", THTMLCOL, COL_SM_DODGERBLUE },
407         { "dvip", TDVIPSNAMESCOL, COL_SM_BLACK },
408         { "firebrick", THTMLCOL, COL_SM_FIREBRICK },
409         { "floralwhite", THTMLCOL, COL_SM_FLORALWHITE },
410         { "forestgreen", THTMLCOL, COL_SM_FORESTGREEN },
411         { "fuchsia", TMATHMLCOL, COL_SM_FUCHSIA },
412         { "gainsboro", THTMLCOL, COL_SM_GAINSBORO },
413         { "ghostwhite", THTMLCOL, COL_SM_GHOSTWHITE },
414         { "gold", THTMLCOL, COL_SM_GOLD },
415         { "goldenrod", THTMLCOL, COL_SM_GOLDENROD },
416         { "gray", TMATHMLCOL, COL_SM_GRAY },
417         { "green", TMATHMLCOL, COL_SM_GREEN },
418         { "greenyellow", THTMLCOL, COL_SM_GREENYELLOW },
419         { "grey", THTMLCOL, COL_SM_GREY },
420         { "hex", THEX, COL_SM_BLACK },
421         { "honeydew", THTMLCOL, COL_SM_HONEYDEW },
422         { "hotpink", THTMLCOL, COL_SM_HOTPINK },
423         { "indianred", THTMLCOL, COL_SM_INDIANRED },
424         { "indigo", THTMLCOL, COL_SM_INDIGO },
425         { "ivory", THTMLCOL, COL_SM_IVORY },
426         { "khaki", THTMLCOL, COL_SM_KHAKI },
427         { "lavender", THTMLCOL, COL_SM_LAVENDER },
428         { "lavenderblush", THTMLCOL, COL_SM_LAVENDERBLUSH },
429         { "lawngreen", THTMLCOL, COL_SM_LAWNGREEN },
430         { "lemonchiffon", THTMLCOL, COL_SM_LEMONCHIFFON },
431         { "lightblue", THTMLCOL, COL_SM_LIGHTBLUE },
432         { "lightcoral", THTMLCOL, COL_SM_LIGHTCORAL },
433         { "lightcyan", THTMLCOL, COL_SM_LIGHTCYAN },
434         { "lightgoldenrodyellow", THTMLCOL, COL_SM_LIGHTGOLDENRODYELLOW },
435         { "lightgray", THTMLCOL, COL_SM_LIGHTGRAY },
436         { "lightgreen", THTMLCOL, COL_SM_LIGHTGREEN },
437         { "lightgrey", THTMLCOL, COL_SM_LIGHTGREY },
438         { "lightpink", THTMLCOL, COL_SM_LIGHTPINK },
439         { "lightsalmon", THTMLCOL, COL_SM_LIGHTSALMON },
440         { "lightseagreen", THTMLCOL, COL_SM_LIGHTSEAGREEN },
441         { "lightskyblue", THTMLCOL, COL_SM_LIGHTSKYBLUE },
442         { "lightslategray", THTMLCOL, COL_SM_LIGHTSLATEGRAY },
443         { "lightslategrey", THTMLCOL, COL_SM_LIGHTSLATEGREY },
444         { "lightsteelblue", THTMLCOL, COL_SM_LIGHTSTEELBLUE },
445         { "lightyellow", THTMLCOL, COL_SM_LIGHTYELLOW },
446         { "lime", TMATHMLCOL, COL_SM_LIME },
447         { "limegreen", THTMLCOL, COL_SM_LIMEGREEN },
448         { "linen", THTMLCOL, COL_SM_LINEN },
449         { "lo", TICONICCOL, COL_SM_LO_GREEN },
450         { "magenta", TMATHMLCOL, COL_SM_MAGENTA },
451         { "maroon", TMATHMLCOL, COL_SM_MAROON },
452         { "mediumaquamarine", THTMLCOL, COL_SM_MEDIUMAQUAMARINE },
453         { "mediumblue", THTMLCOL, COL_SM_MEDIUMBLUE },
454         { "mediumorchid", THTMLCOL, COL_SM_MEDIUMORCHID },
455         { "mediumpurple", THTMLCOL, COL_SM_MEDIUMPURPLE },
456         { "mediumseagreen", THTMLCOL, COL_SM_MEDIUMSEAGREEN },
457         { "mediumslateblue", THTMLCOL, COL_SM_MEDIUMSLATEBLUE },
458         { "mediumspringgreen", THTMLCOL, COL_SM_MEDIUMSPRINGGREEN },
459         { "mediumturquoise", THTMLCOL, COL_SM_MEDIUMTURQUOISE },
460         { "mediumvioletred", THTMLCOL, COL_SM_MEDIUMVIOLETRED },
461         { "midnightblue", THTMLCOL, COL_SM_MIDNIGHTBLUE },
462         { "mintcream", THTMLCOL, COL_SM_MINTCREAM },
463         { "mistyrose", THTMLCOL, COL_SM_MISTYROSE },
464         { "moccasin", THTMLCOL, COL_SM_MOCCASIN },
465         { "navajowhite", THTMLCOL, COL_SM_NAVAJOWHITE },
466         { "navy", TMATHMLCOL, COL_SM_NAVY },
467         { "oldlace", THTMLCOL, COL_SM_OLDLACE },
468         { "olive", TMATHMLCOL, COL_SM_OLIVE },
469         { "olivedrab", THTMLCOL, COL_SM_OLIVEDRAB },
470         { "orange", THTMLCOL, COL_SM_ORANGE },
471         { "orangered", THTMLCOL, COL_SM_ORANGERED },
472         { "orchid", THTMLCOL, COL_SM_ORCHID },
473         { "palegoldenrod", THTMLCOL, COL_SM_PALEGOLDENROD },
474         { "palegreen", THTMLCOL, COL_SM_PALEGREEN },
475         { "paleturquoise", THTMLCOL, COL_SM_PALETURQUOISE },
476         { "palevioletred", THTMLCOL, COL_SM_PALEVIOLETRED },
477         { "papayawhip", THTMLCOL, COL_SM_PAPAYAWHIP },
478         { "peachpuff", THTMLCOL, COL_SM_PEACHPUFF },
479         { "peru", THTMLCOL, COL_SM_PERU },
480         { "pink", THTMLCOL, COL_SM_PINK },
481         { "plum", THTMLCOL, COL_SM_PLUM },
482         { "powderblue", THTMLCOL, COL_SM_POWDERBLUE },
483         { "purple", TMATHMLCOL, COL_SM_PURPLE },
484         { "rebeccapurple", THTMLCOL, COL_SM_REBECCAPURPLE },
485         { "red", TMATHMLCOL, COL_SM_RED },
486         { "rgb", TRGB, COL_AUTO },
487         { "rgba", TRGBA, COL_AUTO },
488         { "rosybrown", THTMLCOL, COL_SM_ROSYBROWN },
489         { "royalblue", THTMLCOL, COL_SM_ROYALBLUE },
490         { "saddlebrown", THTMLCOL, COL_SM_SADDLEBROWN },
491         { "salmon", THTMLCOL, COL_SM_SALMON },
492         { "sandybrown", THTMLCOL, COL_SM_SANDYBROWN },
493         { "seagreen", THTMLCOL, COL_SM_SEAGREEN },
494         { "seashell", THTMLCOL, COL_SM_SEASHELL },
495         { "sienna", THTMLCOL, COL_SM_SIENNA },
496         { "silver", TMATHMLCOL, COL_SM_SILVER },
497         { "skyblue", THTMLCOL, COL_SM_SKYBLUE },
498         { "slateblue", THTMLCOL, COL_SM_SLATEBLUE },
499         { "slategray", THTMLCOL, COL_SM_SLATEGRAY },
500         { "slategrey", THTMLCOL, COL_SM_SLATEGREY },
501         { "snow", THTMLCOL, COL_SM_SNOW },
502         { "springgreen", THTMLCOL, COL_SM_SPRINGGREEN },
503         { "steelblue", THTMLCOL, COL_SM_STEELBLUE },
504         { "tan", THTMLCOL, COL_SM_TAN },
505         { "teal", TMATHMLCOL, COL_SM_TEAL },
506         { "thistle", THTMLCOL, COL_SM_THISTLE },
507         { "tomato", THTMLCOL, COL_SM_TOMATO },
508         { "turquoise", THTMLCOL, COL_SM_TURQUOISE },
509         { "ubuntu", TICONICCOL, COL_SM_UBUNTU_ORANGE },
510         { "violet", THTMLCOL, COL_SM_VIOLET },
511         { "wheat", THTMLCOL, COL_SM_WHEAT },
512         { "white", TMATHMLCOL, COL_SM_WHITE },
513         { "whitesmoke", THTMLCOL, COL_SM_WHITESMOKE },
514         { "yellow", TMATHMLCOL, COL_SM_YELLOW },
515         { "yellowgreen", THTMLCOL, COL_SM_YELLOWGREEN } };
516 
517 const SmColorTokenTableEntry starmathdatabase::aColorTokenTableHTML[]
518     = { { "aliceblue", THTMLCOL, COL_SM_ALICEBLUE },
519         { "antiquewhite", THTMLCOL, COL_SM_ANTIQUEWHITE },
520         { "aqua", TMATHMLCOL, COL_SM_AQUA },
521         { "aquamarine", THTMLCOL, COL_SM_AQUAMARINE },
522         { "azure", THTMLCOL, COL_SM_AZURE },
523         { "beige", THTMLCOL, COL_SM_BEIGE },
524         { "bisque", THTMLCOL, COL_SM_BISQUE },
525         { "black", TMATHMLCOL, COL_SM_BLACK },
526         { "blanchedalmond", THTMLCOL, COL_SM_BLANCHEDALMOND },
527         { "blue", TMATHMLCOL, COL_SM_BLUE },
528         { "blueviolet", THTMLCOL, COL_SM_BLUEVIOLET },
529         { "brown", THTMLCOL, COL_SM_BROWN },
530         { "burlywood", THTMLCOL, COL_SM_BURLYWOOD },
531         { "cadetblue", THTMLCOL, COL_SM_CADETBLUE },
532         { "chartreuse", THTMLCOL, COL_SM_CHARTREUSE },
533         { "chocolate", THTMLCOL, COL_SM_CHOCOLATE },
534         { "coral", THTMLCOL, COL_SM_CORAL },
535         { "cornflowerblue", THTMLCOL, COL_SM_CORNFLOWERBLUE },
536         { "cornsilk", THTMLCOL, COL_SM_CORNSILK },
537         { "crimson", THTMLCOL, COL_SM_CRIMSON },
538         { "cyan", TMATHMLCOL, COL_SM_CYAN },
539         { "darkblue", THTMLCOL, COL_SM_DARKBLUE },
540         { "darkcyan", THTMLCOL, COL_SM_DARKCYAN },
541         { "darkgoldenrod", THTMLCOL, COL_SM_DARKGOLDENROD },
542         { "darkgray", THTMLCOL, COL_SM_DARKGRAY },
543         { "darkgreen", THTMLCOL, COL_SM_DARKGREEN },
544         { "darkgrey", THTMLCOL, COL_SM_DARKGREY },
545         { "darkkhaki", THTMLCOL, COL_SM_DARKKHAKI },
546         { "darkmagenta", THTMLCOL, COL_SM_DARKMAGENTA },
547         { "darkolivegreen", THTMLCOL, COL_SM_DARKOLIVEGREEN },
548         { "darkorange", THTMLCOL, COL_SM_DARKORANGE },
549         { "darkorchid", THTMLCOL, COL_SM_DARKORCHID },
550         { "darkred", THTMLCOL, COL_SM_DARKRED },
551         { "darksalmon", THTMLCOL, COL_SM_DARKSALMON },
552         { "darkseagreen", THTMLCOL, COL_SM_DARKSEAGREEN },
553         { "darkslateblue", THTMLCOL, COL_SM_DARKSLATEBLUE },
554         { "darkslategray", THTMLCOL, COL_SM_DARKSLATEGRAY },
555         { "darkslategrey", THTMLCOL, COL_SM_DARKSLATEGREY },
556         { "darkturquoise", THTMLCOL, COL_SM_DARKTURQUOISE },
557         { "darkviolet", THTMLCOL, COL_SM_DARKVIOLET },
558         { "deeppink", THTMLCOL, COL_SM_DEEPPINK },
559         { "deepskyblue", THTMLCOL, COL_SM_DEEPSKYBLUE },
560         { "dimgray", THTMLCOL, COL_SM_DIMGRAY },
561         { "dimgrey", THTMLCOL, COL_SM_DIMGREY },
562         { "dodgerblue", THTMLCOL, COL_SM_DODGERBLUE },
563         { "firebrick", THTMLCOL, COL_SM_FIREBRICK },
564         { "floralwhite", THTMLCOL, COL_SM_FLORALWHITE },
565         { "forestgreen", THTMLCOL, COL_SM_FORESTGREEN },
566         { "fuchsia", TMATHMLCOL, COL_SM_FUCHSIA },
567         { "gainsboro", THTMLCOL, COL_SM_GAINSBORO },
568         { "ghostwhite", THTMLCOL, COL_SM_GHOSTWHITE },
569         { "gold", THTMLCOL, COL_SM_GOLD },
570         { "goldenrod", THTMLCOL, COL_SM_GOLDENROD },
571         { "gray", TMATHMLCOL, COL_SM_GRAY },
572         { "green", TMATHMLCOL, COL_SM_GREEN },
573         { "greenyellow", THTMLCOL, COL_SM_GREENYELLOW },
574         { "grey", THTMLCOL, COL_SM_GREY },
575         { "honeydew", THTMLCOL, COL_SM_HONEYDEW },
576         { "hotpink", THTMLCOL, COL_SM_HOTPINK },
577         { "indianred", THTMLCOL, COL_SM_INDIANRED },
578         { "indigo", THTMLCOL, COL_SM_INDIGO },
579         { "ivory", THTMLCOL, COL_SM_IVORY },
580         { "khaki", THTMLCOL, COL_SM_KHAKI },
581         { "lavender", THTMLCOL, COL_SM_LAVENDER },
582         { "lavenderblush", THTMLCOL, COL_SM_LAVENDERBLUSH },
583         { "lawngreen", THTMLCOL, COL_SM_LAWNGREEN },
584         { "lemonchiffon", THTMLCOL, COL_SM_LEMONCHIFFON },
585         { "lightblue", THTMLCOL, COL_SM_LIGHTBLUE },
586         { "lightcoral", THTMLCOL, COL_SM_LIGHTCORAL },
587         { "lightcyan", THTMLCOL, COL_SM_LIGHTCYAN },
588         { "lightgoldenrodyellow", THTMLCOL, COL_SM_LIGHTGOLDENRODYELLOW },
589         { "lightgray", THTMLCOL, COL_SM_LIGHTGRAY },
590         { "lightgreen", THTMLCOL, COL_SM_LIGHTGREEN },
591         { "lightgrey", THTMLCOL, COL_SM_LIGHTGREY },
592         { "lightpink", THTMLCOL, COL_SM_LIGHTPINK },
593         { "lightsalmon", THTMLCOL, COL_SM_LIGHTSALMON },
594         { "lightseagreen", THTMLCOL, COL_SM_LIGHTSEAGREEN },
595         { "lightskyblue", THTMLCOL, COL_SM_LIGHTSKYBLUE },
596         { "lightslategray", THTMLCOL, COL_SM_LIGHTSLATEGRAY },
597         { "lightslategrey", THTMLCOL, COL_SM_LIGHTSLATEGREY },
598         { "lightsteelblue", THTMLCOL, COL_SM_LIGHTSTEELBLUE },
599         { "lightyellow", THTMLCOL, COL_SM_LIGHTYELLOW },
600         { "lime", TMATHMLCOL, COL_SM_LIME },
601         { "limegreen", THTMLCOL, COL_SM_LIMEGREEN },
602         { "linen", THTMLCOL, COL_SM_LINEN },
603         { "magenta", TMATHMLCOL, COL_SM_MAGENTA },
604         { "maroon", TMATHMLCOL, COL_SM_MAROON },
605         { "mediumaquamarine", THTMLCOL, COL_SM_MEDIUMAQUAMARINE },
606         { "mediumblue", THTMLCOL, COL_SM_MEDIUMBLUE },
607         { "mediumorchid", THTMLCOL, COL_SM_MEDIUMORCHID },
608         { "mediumpurple", THTMLCOL, COL_SM_MEDIUMPURPLE },
609         { "mediumseagreen", THTMLCOL, COL_SM_MEDIUMSEAGREEN },
610         { "mediumslateblue", THTMLCOL, COL_SM_MEDIUMSLATEBLUE },
611         { "mediumspringgreen", THTMLCOL, COL_SM_MEDIUMSPRINGGREEN },
612         { "mediumturquoise", THTMLCOL, COL_SM_MEDIUMTURQUOISE },
613         { "mediumvioletred", THTMLCOL, COL_SM_MEDIUMVIOLETRED },
614         { "midnightblue", THTMLCOL, COL_SM_MIDNIGHTBLUE },
615         { "mintcream", THTMLCOL, COL_SM_MINTCREAM },
616         { "mistyrose", THTMLCOL, COL_SM_MISTYROSE },
617         { "moccasin", THTMLCOL, COL_SM_MOCCASIN },
618         { "navajowhite", THTMLCOL, COL_SM_NAVAJOWHITE },
619         { "navy", TMATHMLCOL, COL_SM_NAVY },
620         { "oldlace", THTMLCOL, COL_SM_OLDLACE },
621         { "olive", TMATHMLCOL, COL_SM_OLIVE },
622         { "olivedrab", THTMLCOL, COL_SM_OLIVEDRAB },
623         { "orange", THTMLCOL, COL_SM_ORANGE },
624         { "orangered", THTMLCOL, COL_SM_ORANGERED },
625         { "orchid", THTMLCOL, COL_SM_ORCHID },
626         { "palegoldenrod", THTMLCOL, COL_SM_PALEGOLDENROD },
627         { "palegreen", THTMLCOL, COL_SM_PALEGREEN },
628         { "paleturquoise", THTMLCOL, COL_SM_PALETURQUOISE },
629         { "palevioletred", THTMLCOL, COL_SM_PALEVIOLETRED },
630         { "papayawhip", THTMLCOL, COL_SM_PAPAYAWHIP },
631         { "peachpuff", THTMLCOL, COL_SM_PEACHPUFF },
632         { "peru", THTMLCOL, COL_SM_PERU },
633         { "pink", THTMLCOL, COL_SM_PINK },
634         { "plum", THTMLCOL, COL_SM_PLUM },
635         { "powderblue", THTMLCOL, COL_SM_POWDERBLUE },
636         { "purple", TMATHMLCOL, COL_SM_PURPLE },
637         { "rebeccapurple", THTMLCOL, COL_SM_REBECCAPURPLE },
638         { "red", TMATHMLCOL, COL_SM_RED },
639         { "rosybrown", THTMLCOL, COL_SM_ROSYBROWN },
640         { "royalblue", THTMLCOL, COL_SM_ROYALBLUE },
641         { "saddlebrown", THTMLCOL, COL_SM_SADDLEBROWN },
642         { "salmon", THTMLCOL, COL_SM_SALMON },
643         { "sandybrown", THTMLCOL, COL_SM_SANDYBROWN },
644         { "seagreen", THTMLCOL, COL_SM_SEAGREEN },
645         { "seashell", THTMLCOL, COL_SM_SEASHELL },
646         { "sienna", THTMLCOL, COL_SM_SIENNA },
647         { "silver", TMATHMLCOL, COL_SM_SILVER },
648         { "skyblue", THTMLCOL, COL_SM_SKYBLUE },
649         { "slateblue", THTMLCOL, COL_SM_SLATEBLUE },
650         { "slategray", THTMLCOL, COL_SM_SLATEGRAY },
651         { "slategrey", THTMLCOL, COL_SM_SLATEGREY },
652         { "snow", THTMLCOL, COL_SM_SNOW },
653         { "springgreen", THTMLCOL, COL_SM_SPRINGGREEN },
654         { "steelblue", THTMLCOL, COL_SM_STEELBLUE },
655         { "tan", THTMLCOL, COL_SM_TAN },
656         { "teal", TMATHMLCOL, COL_SM_TEAL },
657         { "thistle", THTMLCOL, COL_SM_THISTLE },
658         { "tomato", THTMLCOL, COL_SM_TOMATO },
659         { "turquoise", THTMLCOL, COL_SM_TURQUOISE },
660         { "violet", THTMLCOL, COL_SM_VIOLET },
661         { "wheat", THTMLCOL, COL_SM_WHEAT },
662         { "white", TMATHMLCOL, COL_SM_WHITE },
663         { "whitesmoke", THTMLCOL, COL_SM_WHITESMOKE },
664         { "yellow", TMATHMLCOL, COL_SM_YELLOW },
665         { "yellowgreen", THTMLCOL, COL_SM_YELLOWGREEN } };
666 
667 const SmColorTokenTableEntry starmathdatabase::aColorTokenTableDVIPS[]
668     = { { "apricot", TDVIPSNAMESCOL, COL_SM_DIV_APRICOT },
669         { "aquamarine", TDVIPSNAMESCOL, COL_SM_DIV_AQUAMARINE },
670         { "bittersweet", TDVIPSNAMESCOL, COL_SM_DIV_BITTERSWEET },
671         { "black", TDVIPSNAMESCOL, COL_SM_BLACK },
672         { "blue", TDVIPSNAMESCOL, COL_SM_BLACK } };
673 
674 const SmColorTokenTableEntry starmathdatabase::aColorTokenTableMATHML[] = {
675     // clang-format off
676         { "aqua", TMATHMLCOL, COL_SM_AQUA },
677         { "black", TMATHMLCOL, COL_SM_BLACK },
678         { "blue", TMATHMLCOL, COL_SM_BLUE },
679         { "fuchsia", TMATHMLCOL, COL_SM_FUCHSIA },
680         { "gray", TMATHMLCOL, COL_SM_GRAY },
681         { "green", TMATHMLCOL, COL_SM_GREEN },
682         { "lime", TMATHMLCOL, COL_SM_LIME },
683         { "maroon", TMATHMLCOL, COL_SM_MAROON },
684         { "navy", TMATHMLCOL, COL_SM_NAVY },
685         { "olive", TMATHMLCOL, COL_SM_OLIVE },
686         { "purple", TMATHMLCOL, COL_SM_PURPLE },
687         { "red", TMATHMLCOL, COL_SM_RED },
688         { "silver", TMATHMLCOL, COL_SM_SILVER },
689         { "teal", TMATHMLCOL, COL_SM_TEAL },
690         { "white", TMATHMLCOL, COL_SM_WHITE },
691         { "yellow", TMATHMLCOL, COL_SM_YELLOW }
692     // clang-format on
693 };
694 
695 const SmColorTokenTableEntry starmathdatabase::aColorTokenTableERROR[]
696     = { { "", TERROR, COL_SM_BLACK } };
697 
Identify_Color_Parser(sal_uInt32 cColor)698 SmColorTokenTableEntry starmathdatabase::Identify_Color_Parser(sal_uInt32 cColor)
699 {
700     for (auto i = std::begin(aColorTokenTableParse); i < std::end(aColorTokenTableParse); ++i)
701         if (i->equals(cColor))
702             return i;
703     for (auto i = std::begin(aColorTokenTableDVIPS); i < std::end(aColorTokenTableDVIPS); ++i)
704         if (i->equals(cColor))
705             return i;
706     if ((cColor & 0x00FFFFFF) == cColor)
707         return SmColorTokenTableEntry("", TRGB, cColor);
708     else
709         return SmColorTokenTableEntry("", TRGBA, cColor);
710 }
711 
Identify_Color_HTML(sal_uInt32 cColor)712 SmColorTokenTableEntry starmathdatabase::Identify_Color_HTML(sal_uInt32 cColor)
713 {
714     for (auto i = std::begin(aColorTokenTableHTML); i < std::end(aColorTokenTableHTML); ++i)
715         if (i->equals(cColor))
716             return i;
717     if ((cColor & 0x00FFFFFF) == cColor)
718         return SmColorTokenTableEntry("", TRGB, cColor);
719     else
720         return SmColorTokenTableEntry("", TRGBA, cColor);
721 }
722 
Identify_Color_MATHML(sal_uInt32 cColor)723 SmColorTokenTableEntry starmathdatabase::Identify_Color_MATHML(sal_uInt32 cColor)
724 {
725     for (auto i = std::begin(aColorTokenTableMATHML); i < std::end(aColorTokenTableMATHML); ++i)
726         if (i->equals(cColor))
727             return i;
728     if ((cColor & 0x00FFFFFF) == cColor)
729         return SmColorTokenTableEntry("", TRGB, cColor);
730     else
731         return SmColorTokenTableEntry("", TRGBA, cColor);
732 }
733 
Identify_Color_DVIPSNAMES(sal_uInt32 cColor)734 SmColorTokenTableEntry starmathdatabase::Identify_Color_DVIPSNAMES(sal_uInt32 cColor)
735 {
736     for (auto i = std::begin(aColorTokenTableDVIPS); i < std::end(aColorTokenTableDVIPS); ++i)
737         if (i->equals(cColor))
738             return i;
739     if ((cColor & 0x00FFFFFF) == cColor)
740         return SmColorTokenTableEntry("", TRGB, cColor);
741     else
742         return SmColorTokenTableEntry("", TRGBA, cColor);
743 }
744 
Identify_ColorName_Parser(const OUString & colorname)745 const SmColorTokenTableEntry* starmathdatabase::Identify_ColorName_Parser(const OUString& colorname)
746 {
747     if (colorname.isEmpty())
748         return &aColorTokenTableERROR[0];
749     for (auto i = std::begin(aColorTokenTableParse); i < std::end(aColorTokenTableParse); ++i)
750     {
751         sal_Int32 matches = colorname.compareToIgnoreAsciiCaseAscii(i->pIdent);
752         if (matches == 0)
753             return i;
754         if (matches < 0)
755             break;
756     }
757     return &aColorTokenTableERROR[0];
758 }
Identify_ColorName_HTML(const OUString & colorname)759 SmColorTokenTableEntry starmathdatabase::Identify_ColorName_HTML(const OUString& colorname)
760 {
761     if (colorname.isEmpty())
762         return SmColorTokenTableEntry("", TERROR, COL_SM_BLACK);
763     if (colorname[0] == '#')
764     {
765         Color col = Color::STRtoRGB(colorname);
766         return SmColorTokenTableEntry("", TRGB, col);
767     }
768     for (auto i = std::begin(aColorTokenTableHTML); i < std::end(aColorTokenTableHTML); ++i)
769     {
770         sal_Int32 matches = colorname.compareToIgnoreAsciiCaseAscii(i->pIdent);
771         if (matches == 0)
772             return i;
773         if (matches < 0)
774             break;
775     }
776     return SmColorTokenTableEntry("", TERROR, COL_SM_BLACK);
777 }
778 const SmColorTokenTableEntry*
Identify_ColorName_DVIPSNAMES(const OUString & colorname)779 starmathdatabase::Identify_ColorName_DVIPSNAMES(const OUString& colorname)
780 {
781     if (colorname.isEmpty())
782         return &aColorTokenTableERROR[0];
783     for (auto i = std::begin(aColorTokenTableDVIPS); i < std::end(aColorTokenTableDVIPS); ++i)
784     {
785         sal_Int32 matches = colorname.compareToIgnoreAsciiCaseAscii(i->pIdent);
786         if (matches == 0)
787             return i;
788         if (matches < 0)
789             break;
790     }
791     return &aColorTokenTableERROR[0];
792 }
793