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