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