summaryrefslogtreecommitdiffstats
path: root/starmath/inc/mathml/starmathdatabase.hxx
blob: b4d3d6d3f8b54d6b7553659dcf4b9c7fb0bfd84b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#pragma once

#include <token.hxx>

// Starmath color types
// In order to add them to starmath, edit the SmColorTokenTableEntry lists on
// /core/starmath/source/starmathdatabase.css .

// HTML
// https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_Keywords
/* CSS Level 1 */
constexpr Color COL_SM_BLACK(0x000000);
constexpr Color COL_SM_SILVER(0xC0C0C0);
constexpr Color COL_SM_GRAY(0x808080);
constexpr Color COL_SM_WHITE(0xFFFFFF);
constexpr Color COL_SM_MAROON(0x800000);
constexpr Color COL_SM_RED(0xFF0000);
constexpr Color COL_SM_PURPLE(0x800080);
constexpr Color COL_SM_FUCHSIA(0xFF00FF);
constexpr Color COL_SM_GREEN(0x008000);
constexpr Color COL_SM_LIME(0x00FF00);
constexpr Color COL_SM_OLIVE(0x808000);
constexpr Color COL_SM_YELLOW(0xFFFF00);
constexpr Color COL_SM_NAVY(0x000080);
constexpr Color COL_SM_BLUE(0x0000FF);
constexpr Color COL_SM_TEAL(0x008080);
constexpr Color COL_SM_AQUA(0x00FFFF);
/* CSS Level 2 */
constexpr Color COL_SM_ORANGE(0xFFA500);
/* CSS Level 3 */
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 */
constexpr Color COL_SM_REBECCAPURPLE(0x663399);
/* dvipsnames */
// For now only five colors.
// In a future all of them.
// https://www.overleaf.com/learn/latex/Using_colours_in_LaTeX
constexpr Color COL_SM_DIV_APRICOT(0xFFB781);
constexpr Color COL_SM_DIV_AQUAMARINE(0x1BBEC1);
constexpr Color COL_SM_DIV_BITTERSWEET(0xCF4B16);
constexpr Color COL_SM_DIV_BLACK(0xCF4B16);
constexpr Color COL_SM_DIV_BLUE(0x102694);
/* Iconic colors */
// https://design.ubuntu.com/brand/colour-palette/
constexpr Color COL_SM_UBUNTU_ORANGE(0xE95420);
// https://www.debian.org/logos/   Picked from SVG logo
constexpr Color COL_SM_DEBIAN_MAGENTA(0xA80030);
// https://libreoffice.org/
constexpr Color COL_SM_LO_GREEN(0x00A500);

namespace starmathdatabase
{
// Variables containing color information.
extern const SmColorTokenTableEntry aColorTokenTableParse[159];
extern const SmColorTokenTableEntry aColorTokenTableHTML[148];
extern const SmColorTokenTableEntry aColorTokenTableMATHML[16];
extern const SmColorTokenTableEntry aColorTokenTableDVIPS[5];
extern const SmColorTokenTableEntry aColorTokenTableERROR[1];

/**
  * Identifies operator chars tokens for importing mathml.
  * Identifies from char cChar
  *
  * While loading MO or MI elements might find an unicode16 symbol.
  * This code allows to generate appropriate token for them.
  *
  * @param cChar
  * @return closing fences' token
  */
SmToken Identify_SmXMLOperatorContext_Impl(sal_Unicode cChar, bool bIsStretchy = true);

/**
  * Identifies opening / closing brace tokens for importing mathml.
  * Identifies from char cChar
  *
  * While loading MO fenced elements might find braces symbols.
  * This code allows to generate appropriate token for them.
  *
  * @param cChar
  * @return closing fences' token
  */
SmToken Identify_PrefixPostfix_SmXMLOperatorContext_Impl(sal_Unicode cChar);

/**
  * Identifies opening brace tokens for importing mathml.
  * Identifies from char cChar
  *
  * While loading MO elements ( with prefix value for form attribute ) might find braces symbols.
  * This code allows to generate appropriate token for them.
  *
  * @param cChar
  * @return closing fences' token
  */
SmToken Identify_Prefix_SmXMLOperatorContext_Impl(sal_Unicode cChar);

/**
  * Identifies closing brace tokens for importing mathml.
  * Identifies from char cChar
  *
  * While loading MO elements ( with postfix value for form attribute ) might find braces symbols.
  * This code allows to generate appropriate token for them.
  *
  * @param cChar
  * @return closing fences' token
  */
SmToken Identify_Postfix_SmXMLOperatorContext_Impl(sal_Unicode cChar);

/**
  * Identifies color from color code cColor.
  * It will be returned with the parser syntax.
  *
  * For a given color returns the way it would be in the parser.
  * Used for nodes to text visitors.
  *
  * @param cColor
  * @param parser color
  */
SmColorTokenTableEntry Identify_Color_Parser(sal_uInt32 cColor);

/**
  * Identifies color from color code cColor.
  * It will be returned with the HTML syntax.
  * @param cColor
  * @param parser color
  */
SmColorTokenTableEntry Identify_Color_HTML(sal_uInt32 cColor);

/**
  * Identifies color from color code cColor.
  * It will be returned with the MATHML syntax.
  *
  * This is used to export mathml.
  * Identifies the color and allows it to export it in proper mathml code.
  *
  * @param cColor
  * @param parser color
  */
SmColorTokenTableEntry Identify_Color_MATHML(sal_uInt32 cColor);

/**
  * Identifies color from color code cColor.
  * It will be returned with the dvipsnames syntax.
  * @param cColor
  * @param parser color
  */
SmColorTokenTableEntry Identify_Color_DVIPSNAMES(sal_uInt32 cColor);

/**
  * Identifies color from color name.
  * It will be returned with the parser syntax.
  *
  * This finds color values for the color names loaded by the parser.
  *
  * @param cColor
  * @param parser color
  */
const SmColorTokenTableEntry* Identify_ColorName_Parser(std::u16string_view colorname);

/**
  * Identifies color from color name.
  * It will be returned with the HTML syntax.
  *
  * This finds color values for the color names loaded by mathmlimport.
  * In theory mathml only supports HTML4 colors, but most browsers support all HTML5 colors.
  * That's why there is an high risk of finding them inside mathml and have to give support.
  *
  * @param cColor
  * @param parser color
  */
SmColorTokenTableEntry Identify_ColorName_HTML(std::u16string_view colorname);

/**
  * Identifies color from color name.
  * It will be returned with the dvipsnames syntax.
  *
  * This code has been implemented to add a compatibility layer to import / export latex.
  *
  * @param cColor
  * @param parser color
  */
const SmColorTokenTableEntry* Identify_ColorName_DVIPSNAMES(std::u16string_view colorname);
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */