summaryrefslogtreecommitdiffstats
path: root/starmath/inc/mathml/def.hxx
blob: 38073671189c27c0ed13dd631209422c47aedcaf (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
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
 * 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/.
 */

#pragma once

#include <tools/color.hxx>

/* All possible data needed to do the job outside mathml limits */
// Ml prefix means it is part of mathml standard
// NMl means it is not part of mathml standard but needed info to work

/* For now empty, don't know yet what's needed besides default font size. */
struct SmGlobalData
{
};

/* Mhtml length tools */
/*************************************************************************************************/

enum class SmLengthUnit : uint_fast8_t
{
    MlEm,
    MlEx,
    MlPx,
    MlIn,
    MlCm,
    MlMm,
    MlPt,
    MlPc,
    MlP, // Percent
    MlM // Multiplier
};

struct SmLengthValue
{
    SmLengthUnit m_aLengthUnit;
    double m_aLengthValue;
    // Keeps original text value to avoid numerical error data loss
    OUString* m_aOriginalText;
};

/* Possible mathml elements */
/*************************************************************************************************/

enum class SmMlElementType : uint_fast8_t
{
    // Used for base element. Means no information contained.
    NMlEmpty,
    // Used for structural dependencies. Means no information contained.
    NMlStructural,
    NMlSmNode,
    // Mathml real elements
    MlMath,
    MlMi,
    MlMerror,
    MlMn,
    MlMo,
    MlMrow,
    MlMtext,
    MlMstyle
};

/* Possible mathml attributes */
/*************************************************************************************************/

enum class SmMlAttributeValueType : uint_fast8_t
{
    NMlEmpty,
    MlAccent,
    MlDir,
    MlDisplaystyle,
    MlFence,
    MlForm,
    MlHref,
    MlLspace,
    MlMathbackground,
    MlMathcolor,
    MlMathsize,
    MlMathvariant,
    MlMaxsize,
    MlMinsize,
    MlMovablelimits,
    MlRspace,
    MlSeparator,
    MlStretchy,
    MlSymmetric
};

/* Possible values of mathml attributes */
/*************************************************************************************************/

enum class SmMlAttributeValueEmpty : uint_fast8_t
{
    MlEmpty = 0x00
};

enum class SmMlAttributeValueAccent : uint_fast8_t
{
    MlFalse = 0x00,
    MlTrue = 0x01
};

enum class SmMlAttributeValueDir : uint_fast8_t
{
    MlLtr = 0x00,
    MlRtl = 0x01
};

enum class SmMlAttributeValueDisplaystyle : uint_fast8_t
{
    MlFalse = 0x00,
    MlTrue = 0x01
};

enum class SmMlAttributeValueFence : uint_fast8_t
{
    MlFalse = 0x00,
    MlTrue = 0x01
};

enum class SmMlAttributeValueForm : uint_fast8_t
{
    MlPrefix = 0x01,
    MlInfix = 0x02,
    MlPosfix = 0x04
};

enum class SmMlAttributeValueHref : uint_fast8_t
{
    NMlEmpty = 0x00,
    NMlValid = 0x01
};

enum class SmMlAttributeValueLspace : uint_fast8_t
{
    NMlEmpty = 0x00
};

enum class SmMlAttributeValueMathbackground : uint_fast32_t
{
    MlTransparent = 0x00,
    MlRgb = 0x01
};

enum class SmMlAttributeValueMathcolor : uint_fast8_t
{
    MlDefault = 0x00,
    MlRgb = 0x01
};

enum class SmMlAttributeValueMathsize : uint_fast8_t
{
    NMlEmpty = 0x00,
};

enum class SmMlAttributeValueMathvariant : uint_fast16_t
{
    normal = 0x000,
    bold = 0x001,
    italic = 0x002,
    double_struck = 0x004,
    script = 0x008,
    fraktur = 0x010,
    sans_serif = 0x020,
    monospace = 0x040,
    bold_italic = 0x001 | 0x002,
    bold_fraktur = 0x001 | 0x010,
    bold_script = 0x001 | 0x008,
    bold_sans_serif = 0x001 | 0x020,
    sans_serif_italic = 0x002 | 0x20,
    sans_serif_bold_italic = 0x001 | 0x002 | 0x020,
    // Non english
    initial = 0x080,
    tailed = 0x100,
    looped = 0x200,
    stretched = 0x400
};

enum class SmMlAttributeValueMaxsize : uint_fast8_t
{
    MlInfinity = 0x00,
    MlFinite = 0x01
};

/*
 * Specifies whether attached under- and overscripts move to sub- and superscript positions when displaystyle is false.
 * Source: https://developer.mozilla.org/en-US/docs/Web/MathML/Element/mo
 */
enum class SmMlAttributeValueMovablelimits : uint_fast8_t
{
    MlFalse = 0x00,
    MlTrue = 0x01
};

enum class SmMlAttributeValueRspace : uint_fast8_t
{
    NMlEmpty = 0x00
};

enum class SmMlAttributeValueSeparator : uint_fast8_t
{
    MlFalse = 0x00,
    MlTrue = 0x01
};

enum class SmMlAttributeValueStretchy : uint_fast8_t
{
    MlFalse = 0x00,
    MlTrue = 0x01
};

enum class SmMlAttributeValueSymmetric : uint_fast8_t
{
    MlFalse = 0x00,
    MlTrue = 0x01
};

/* Structures for all possible attributes */
/*************************************************************************************************/

struct SmMlAccent
{
    SmMlAttributeValueAccent m_aAccent;
};

struct SmMlDir
{
    SmMlAttributeValueDir m_aDir;
};

struct SmMlDisplaystyle
{
    SmMlAttributeValueDisplaystyle m_aDisplaystyle;
};

struct SmMlFence
{
    SmMlAttributeValueFence m_aFence;
};

struct SmMlForm
{
    SmMlAttributeValueForm m_aForm;
};

struct SmMlHref
{
    SmMlAttributeValueHref m_aHref;
    OUString* m_aLnk;
};

struct SmMlLspace
{
    SmLengthValue m_aLengthValue;
};

struct SmMlMathbackground
{
    SmMlAttributeValueMathbackground m_aMathbackground;
    Color m_aCol;
};

struct SmMlMathcolor
{
    SmMlAttributeValueMathcolor m_aMathcolor;
    Color m_aCol;
};

struct SmMlMathsize
{
    SmLengthValue m_aLengthValue;
};

struct SmMlMathvariant
{
    SmMlAttributeValueMathvariant m_aMathvariant;
};

struct SmMlMaxsize
{
    SmMlAttributeValueMaxsize m_aMaxsize;
    SmLengthValue m_aLengthValue;
};

struct SmMlMinsize
{
    SmLengthValue m_aLengthValue;
};

struct SmMlMovablelimits
{
    SmMlAttributeValueMovablelimits m_aMovablelimits;
};

struct SmMlRspace
{
    SmLengthValue m_aLengthValue;
};

struct SmMlSeparator
{
    SmMlAttributeValueSeparator m_aSeparator;
};

struct SmMlStretchy
{
    SmMlAttributeValueStretchy m_aStretchy;
};

struct SmMlSymmetric
{
    SmMlAttributeValueSymmetric m_aSymmetric;
};

/* order attributes */
/*************************************************************************************************/

struct SmMlAttributePos
{
    SmMlAttributeValueType m_aAttributeValueType;
    uint_fast8_t m_nPos;
};

/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */