1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
24 // Starmath color types
25 // In order to add them to starmath, edit the SmColorTokenTableEntry lists on
26 // /core/starmath/source/starmathdatabase.css .
29 // https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_Keywords
31 inline constexpr Color
COL_SM_BLACK(0x000000);
32 inline constexpr Color
COL_SM_SILVER(0xC0C0C0);
33 inline constexpr Color
COL_SM_GRAY(0x808080);
34 inline constexpr Color
COL_SM_WHITE(0xFFFFFF);
35 inline constexpr Color
COL_SM_MAROON(0x800000);
36 inline constexpr Color
COL_SM_RED(0xFF0000);
37 inline constexpr Color
COL_SM_PURPLE(0x800080);
38 inline constexpr Color
COL_SM_FUCHSIA(0xFF00FF);
39 inline constexpr Color
COL_SM_GREEN(0x008000);
40 inline constexpr Color
COL_SM_LIME(0x00FF00);
41 inline constexpr Color
COL_SM_OLIVE(0x808000);
42 inline constexpr Color
COL_SM_YELLOW(0xFFFF00);
43 inline constexpr Color
COL_SM_NAVY(0x000080);
44 inline constexpr Color
COL_SM_BLUE(0x0000FF);
45 inline constexpr Color
COL_SM_TEAL(0x008080);
46 inline constexpr Color
COL_SM_AQUA(0x00FFFF);
48 inline constexpr Color
COL_SM_ORANGE(0xFFA500);
50 inline constexpr Color
COL_SM_ALICEBLUE(0xF0F8FF);
51 inline constexpr Color
COL_SM_ANTIQUEWHITE(0xFAEBD7);
52 inline constexpr Color
COL_SM_AQUAMARINE(0x7FFFD4);
53 inline constexpr Color
COL_SM_AZURE(0xF0FFFF);
54 inline constexpr Color
COL_SM_BEIGE(0xF5F5DC);
55 inline constexpr Color
COL_SM_BISQUE(0xFFE4C4);
56 inline constexpr Color
COL_SM_BLANCHEDALMOND(0xFFEBCD);
57 inline constexpr Color
COL_SM_BLUEVIOLET(0x8A2BE2);
58 inline constexpr Color
COL_SM_BROWN(0xA52A2A);
59 inline constexpr Color
COL_SM_BURLYWOOD(0xDEB887);
60 inline constexpr Color
COL_SM_CADETBLUE(0x5F9EA0);
61 inline constexpr Color
COL_SM_CHARTREUSE(0x7FFF00);
62 inline constexpr Color
COL_SM_CHOCOLATE(0xD2691E);
63 inline constexpr Color
COL_SM_CORAL(0xFF7F50);
64 inline constexpr Color
COL_SM_CORNFLOWERBLUE(0x6495ED);
65 inline constexpr Color
COL_SM_CORNSILK(0xFFF8DC);
66 inline constexpr Color
COL_SM_CRIMSON(0xDC143C);
67 inline constexpr Color
COL_SM_CYAN(0x00FFFF);
68 inline constexpr Color
COL_SM_DARKBLUE(0x00008B);
69 inline constexpr Color
COL_SM_DARKCYAN(0x008B8B);
70 inline constexpr Color
COL_SM_DARKGOLDENROD(0xB8860B);
71 inline constexpr Color
COL_SM_DARKGRAY(0xA9A9A9);
72 inline constexpr Color
COL_SM_DARKGREEN(0x006400);
73 inline constexpr Color
COL_SM_DARKGREY(0xA9A9A9);
74 inline constexpr Color
COL_SM_DARKKHAKI(0xBDB76B);
75 inline constexpr Color
COL_SM_DARKMAGENTA(0x8B008B);
76 inline constexpr Color
COL_SM_DARKOLIVEGREEN(0x556B2F);
77 inline constexpr Color
COL_SM_DARKORANGE(0xFF8C00);
78 inline constexpr Color
COL_SM_DARKORCHID(0x9932CC);
79 inline constexpr Color
COL_SM_DARKRED(0x8B0000);
80 inline constexpr Color
COL_SM_DARKSALMON(0xE9967A);
81 inline constexpr Color
COL_SM_DARKSEAGREEN(0x8FBC8F);
82 inline constexpr Color
COL_SM_DARKSLATEBLUE(0x483D8B);
83 inline constexpr Color
COL_SM_DARKSLATEGRAY(0x2F4F4F);
84 inline constexpr Color
COL_SM_DARKSLATEGREY(0x2F4F4F);
85 inline constexpr Color
COL_SM_DARKTURQUOISE(0x00CED1);
86 inline constexpr Color
COL_SM_DARKVIOLET(0x9400D3);
87 inline constexpr Color
COL_SM_DEEPPINK(0xFF1493);
88 inline constexpr Color
COL_SM_DEEPSKYBLUE(0x00BFFF);
89 inline constexpr Color
COL_SM_DIMGRAY(0x696969);
90 inline constexpr Color
COL_SM_DIMGREY(0x696969);
91 inline constexpr Color
COL_SM_DODGERBLUE(0x1E90FF);
92 inline constexpr Color
COL_SM_FIREBRICK(0xB22222);
93 inline constexpr Color
COL_SM_FLORALWHITE(0xFFFAF0);
94 inline constexpr Color
COL_SM_FORESTGREEN(0x228B22);
95 inline constexpr Color
COL_SM_GAINSBORO(0xDCDCDC);
96 inline constexpr Color
COL_SM_GHOSTWHITE(0xF8F8FF);
97 inline constexpr Color
COL_SM_GOLD(0xFFD700);
98 inline constexpr Color
COL_SM_GOLDENROD(0xDAA520);
99 inline constexpr Color
COL_SM_GREENYELLOW(0xADFF2F);
100 inline constexpr Color
COL_SM_GREY(0x808080);
101 inline constexpr Color
COL_SM_HONEYDEW(0xF0FFF0);
102 inline constexpr Color
COL_SM_HOTPINK(0xFF69B4);
103 inline constexpr Color
COL_SM_INDIANRED(0xCD5C5C);
104 inline constexpr Color
COL_SM_INDIGO(0x4B0082);
105 inline constexpr Color
COL_SM_IVORY(0xFFFFF0);
106 inline constexpr Color
COL_SM_KHAKI(0xF0E68C);
107 inline constexpr Color
COL_SM_LAVENDER(0xE6E6FA);
108 inline constexpr Color
COL_SM_LAVENDERBLUSH(0xFFF0F5);
109 inline constexpr Color
COL_SM_LAWNGREEN(0x7CFC00);
110 inline constexpr Color
COL_SM_LEMONCHIFFON(0xFFFACD);
111 inline constexpr Color
COL_SM_LIGHTBLUE(0xADD8E6);
112 inline constexpr Color
COL_SM_LIGHTCORAL(0xF08080);
113 inline constexpr Color
COL_SM_LIGHTCYAN(0xE0FFFF);
114 inline constexpr Color
COL_SM_LIGHTGOLDENRODYELLOW(0xFAFAD2);
115 inline constexpr Color
COL_SM_LIGHTGRAY(0xD3D3D3);
116 inline constexpr Color
COL_SM_LIGHTGREEN(0x90EE90);
117 inline constexpr Color
COL_SM_LIGHTGREY(0xD3D3D3);
118 inline constexpr Color
COL_SM_LIGHTPINK(0xFFB6C1);
119 inline constexpr Color
COL_SM_LIGHTSALMON(0xFFA07A);
120 inline constexpr Color
COL_SM_LIGHTSEAGREEN(0x20B2AA);
121 inline constexpr Color
COL_SM_LIGHTSKYBLUE(0x87CEFA);
122 inline constexpr Color
COL_SM_LIGHTSLATEGRAY(0x778899);
123 inline constexpr Color
COL_SM_LIGHTSLATEGREY(0x778899);
124 inline constexpr Color
COL_SM_LIGHTSTEELBLUE(0xB0C4DE);
125 inline constexpr Color
COL_SM_LIGHTYELLOW(0xFFFFE0);
126 inline constexpr Color
COL_SM_LIMEGREEN(0x32CD32);
127 inline constexpr Color
COL_SM_LINEN(0xFAF0E6);
128 inline constexpr Color
COL_SM_MAGENTA(0xFF00FF);
129 inline constexpr Color
COL_SM_MEDIUMAQUAMARINE(0x66CDAA);
130 inline constexpr Color
COL_SM_MEDIUMBLUE(0x0000CD);
131 inline constexpr Color
COL_SM_MEDIUMORCHID(0xBA55D3);
132 inline constexpr Color
COL_SM_MEDIUMPURPLE(0x9370DB);
133 inline constexpr Color
COL_SM_MEDIUMSEAGREEN(0x3CB371);
134 inline constexpr Color
COL_SM_MEDIUMSLATEBLUE(0x7B68EE);
135 inline constexpr Color
COL_SM_MEDIUMSPRINGGREEN(0x00FA9A);
136 inline constexpr Color
COL_SM_MEDIUMTURQUOISE(0x48D1CC);
137 inline constexpr Color
COL_SM_MEDIUMVIOLETRED(0xC71585);
138 inline constexpr Color
COL_SM_MIDNIGHTBLUE(0x191970);
139 inline constexpr Color
COL_SM_MINTCREAM(0xF5FFFA);
140 inline constexpr Color
COL_SM_MISTYROSE(0xFFE4E1);
141 inline constexpr Color
COL_SM_MOCCASIN(0xFFE4B5);
142 inline constexpr Color
COL_SM_NAVAJOWHITE(0xFFDEAD);
143 inline constexpr Color
COL_SM_OLDLACE(0xFDF5E6);
144 inline constexpr Color
COL_SM_OLIVEDRAB(0x6B8E23);
145 inline constexpr Color
COL_SM_ORANGERED(0xFF4500);
146 inline constexpr Color
COL_SM_ORCHID(0xDA70D6);
147 inline constexpr Color
COL_SM_PALEGOLDENROD(0xEEE8AA);
148 inline constexpr Color
COL_SM_PALEGREEN(0x98FB98);
149 inline constexpr Color
COL_SM_PALETURQUOISE(0xAFEEEE);
150 inline constexpr Color
COL_SM_PALEVIOLETRED(0xDB7093);
151 inline constexpr Color
COL_SM_PAPAYAWHIP(0xFFEFD5);
152 inline constexpr Color
COL_SM_PEACHPUFF(0xFFDAB9);
153 inline constexpr Color
COL_SM_PERU(0xCD853F);
154 inline constexpr Color
COL_SM_PINK(0xFFC0CB);
155 inline constexpr Color
COL_SM_PLUM(0xDDA0DD);
156 inline constexpr Color
COL_SM_POWDERBLUE(0xB0E0E6);
157 inline constexpr Color
COL_SM_ROSYBROWN(0xBC8F8F);
158 inline constexpr Color
COL_SM_ROYALBLUE(0x4169E1);
159 inline constexpr Color
COL_SM_SADDLEBROWN(0x8B4513);
160 inline constexpr Color
COL_SM_SALMON(0xFA8072);
161 inline constexpr Color
COL_SM_SANDYBROWN(0xF4A460);
162 inline constexpr Color
COL_SM_SEAGREEN(0x2E8B57);
163 inline constexpr Color
COL_SM_SEASHELL(0xFFF5EE);
164 inline constexpr Color
COL_SM_SIENNA(0xA0522D);
165 inline constexpr Color
COL_SM_SKYBLUE(0x87CEEB);
166 inline constexpr Color
COL_SM_SLATEBLUE(0x6A5ACD);
167 inline constexpr Color
COL_SM_SLATEGRAY(0x708090);
168 inline constexpr Color
COL_SM_SLATEGREY(0x708090);
169 inline constexpr Color
COL_SM_SNOW(0xFFFAFA);
170 inline constexpr Color
COL_SM_SPRINGGREEN(0x00FF7F);
171 inline constexpr Color
COL_SM_STEELBLUE(0x4682B4);
172 inline constexpr Color
COL_SM_TAN(0xD2B48C);
173 inline constexpr Color
COL_SM_THISTLE(0xD8BFD8);
174 inline constexpr Color
COL_SM_TOMATO(0xFF6347);
175 inline constexpr Color
COL_SM_TURQUOISE(0x40E0D0);
176 inline constexpr Color
COL_SM_VIOLET(0xEE82EE);
177 inline constexpr Color
COL_SM_WHEAT(0xF5DEB3);
178 inline constexpr Color
COL_SM_WHITESMOKE(0xF5F5F5);
179 inline constexpr Color
COL_SM_YELLOWGREEN(0x9ACD32);
181 inline constexpr Color
COL_SM_REBECCAPURPLE(0x663399);
183 // For now only five colors.
184 // In a future all of them.
185 // https://www.overleaf.com/learn/latex/Using_colours_in_LaTeX
186 inline constexpr Color
COL_SM_DIV_APRICOT(0xFFB781);
187 inline constexpr Color
COL_SM_DIV_AQUAMARINE(0x1BBEC1);
188 inline constexpr Color
COL_SM_DIV_BITTERSWEET(0xCF4B16);
189 inline constexpr Color
COL_SM_DIV_BLACK(0xCF4B16);
190 inline constexpr Color
COL_SM_DIV_BLUE(0x102694);
192 // https://design.ubuntu.com/brand/colour-palette/
193 inline constexpr Color
COL_SM_UBUNTU_ORANGE(0xE95420);
194 // https://www.debian.org/logos/ Picked from SVG logo
195 inline constexpr Color
COL_SM_DEBIAN_MAGENTA(0xA80030);
196 // https://libreoffice.org/
197 inline constexpr Color
COL_SM_LO_GREEN(0x00A500);
199 namespace starmathdatabase
201 // Variables containing color information.
202 extern const SmColorTokenTableEntry aColorTokenTableParse
[159];
203 extern const SmColorTokenTableEntry aColorTokenTableHTML
[148];
204 extern const SmColorTokenTableEntry aColorTokenTableMATHML
[16];
205 extern const SmColorTokenTableEntry aColorTokenTableDVIPS
[5];
206 extern const SmColorTokenTableEntry aColorTokenTableERROR
[1];
209 * Identifies operator chars tokens for importing mathml.
210 * Identifies from rText
212 * While loading MO or MI elements might find an unicode16 symbol.
213 * This code allows to generate appropriate token for them.
216 * @return closing fences' token
218 SmToken
Identify_SmXMLOperatorContext_Impl(std::u16string_view rText
, bool bIsStretchy
= true,
219 sal_Int32 nIndex
= 0);
222 * Identifies opening / closing brace tokens for importing mathml.
223 * Identifies from rText
225 * While loading MO fenced elements might find braces symbols.
226 * This code allows to generate appropriate token for them.
229 * @return closing fences' token
231 SmToken
Identify_PrefixPostfix_SmXMLOperatorContext_Impl(std::u16string_view rText
,
232 sal_Int32 nIndex
= 0);
235 * Identifies opening brace tokens for importing mathml.
236 * Identifies from rText
238 * While loading MO elements ( with prefix value for form attribute ) might find braces symbols.
239 * This code allows to generate appropriate token for them.
242 * @return closing fences' token
244 SmToken
Identify_Prefix_SmXMLOperatorContext_Impl(std::u16string_view rText
, sal_Int32 nIndex
= 0);
247 * Identifies closing brace tokens for importing mathml.
248 * Identifies from rText
250 * While loading MO elements ( with postfix value for form attribute ) might find braces symbols.
251 * This code allows to generate appropriate token for them.
254 * @return closing fences' token
256 SmToken
Identify_Postfix_SmXMLOperatorContext_Impl(std::u16string_view rText
, sal_Int32 nIndex
= 0);
259 * Identifies color from color code cColor.
260 * It will be returned with the parser syntax.
262 * For a given color returns the way it would be in the parser.
263 * Used for nodes to text visitors.
266 * @param parser color
268 SmColorTokenTableEntry
Identify_Color_Parser(sal_uInt32 cColor
);
271 * Identifies color from color code cColor.
272 * It will be returned with the MATHML syntax.
274 * This is used to export mathml.
275 * Identifies the color and allows it to export it in proper mathml code.
278 * @param parser color
280 SmColorTokenTableEntry
Identify_Color_MATHML(sal_uInt32 cColor
);
283 * Identifies color from color code cColor.
284 * It will be returned with the dvipsnames syntax.
286 * @param parser color
288 SmColorTokenTableEntry
Identify_Color_DVIPSNAMES(sal_uInt32 cColor
);
291 * Identifies color from color name.
292 * It will be returned with the parser syntax.
294 * This finds color values for the color names loaded by the parser.
297 * @param parser color
299 const SmColorTokenTableEntry
* Identify_ColorName_Parser(std::u16string_view colorname
);
302 * Identifies color from color name.
303 * It will be returned with the HTML syntax.
305 * This finds color values for the color names loaded by mathmlimport.
306 * In theory mathml only supports HTML4 colors, but most browsers support all HTML5 colors.
307 * That's why there is an high risk of finding them inside mathml and have to give support.
310 * @param parser color
312 SmColorTokenTableEntry
Identify_ColorName_HTML(std::u16string_view colorname
);
315 * Identifies color from color name.
316 * It will be returned with the dvipsnames syntax.
318 * This code has been implemented to add a compatibility layer to import / export latex.
321 * @param parser color
323 const SmColorTokenTableEntry
* Identify_ColorName_DVIPSNAMES(std::u16string_view colorname
);
326 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */