LibreOffice Module starmath (master) 1
attribute.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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
10#pragma once
11
12#include "def.hxx"
13
14/* All possible data needed to do the job outside mathml limits */
15// Ml prefix means it is part of mathml standard
16// NMl means it is not part of mathml standard but needed info to work
17
18/* Union for storing the mathml attribute value */
19/*************************************************************************************************/
20
23
42};
43
44/* Class managing the attribute value */
45/*************************************************************************************************/
46
48{
49private:
52 bool m_bSet;
53
54private:
57 void setAttributeValue(const SmMlAttribute* aMlAttribute);
58
59public:
62 , m_bSet(false){};
63
65
68 , m_bSet(false)
69 {
71 };
72
73 SmMlAttribute(const SmMlAttribute& aMlAttribute)
75 , m_bSet(aMlAttribute.isSet())
76 {
77 setAttributeValue(&aMlAttribute);
78 }
79
80 SmMlAttribute(const SmMlAttribute* aMlAttribute)
82 , m_bSet(aMlAttribute->isSet())
83 {
84 setAttributeValue(aMlAttribute);
85 }
86
87public:
90 bool isSet() const { return m_bSet; }
91
94 void setSet(bool bSet) { m_bSet = bSet; }
95
96public:
102
107 bool isNullAttribute() const
108 {
110 };
111
116 bool isMlAttributeValueType(SmMlAttributeValueType aAttributeValueType) const
117 {
118 return m_aSmMlAttributeValueType == aAttributeValueType;
119 };
120
126 {
128 m_aSmMlAttributeValueType = aAttributeValueType;
130 }
131
132 void setMlAttributeValue(const SmMlAttribute& aMlAttribute)
133 {
134 m_bSet = true;
135 setAttributeValue(&aMlAttribute);
136 }
137
138 void setMlAttributeValue(const SmMlAttribute* aMlAttribute)
139 {
140 m_bSet = true;
141 setAttributeValue(aMlAttribute);
142 }
143
144public:
145 // Get values
146 const struct SmMlAccent* getMlAccent() const;
147 const struct SmMlDir* getMlDir() const;
148 const struct SmMlDisplaystyle* getMlDisplaystyle() const;
149 const struct SmMlFence* getMlFence() const;
150 const struct SmMlForm* getMlForm() const;
151 const struct SmMlHref* getMlHref() const;
152 const struct SmMlLspace* getMlLspace() const;
153 const struct SmMlMathbackground* getMlMathbackground() const;
154 const struct SmMlMathcolor* getMlMathcolor() const;
155 const struct SmMlMathsize* getMlMathsize() const;
156 const struct SmMlMathvariant* getMlMathvariant() const;
157 const struct SmMlMaxsize* getMlMaxsize() const;
158 const struct SmMlMinsize* getMlMinsize() const;
159 const struct SmMlMovablelimits* getMlMovablelimits() const;
160 const struct SmMlRspace* getMlRspace() const;
161 const struct SmMlSeparator* getMlSeparator() const;
162 const struct SmMlStretchy* getMlStretchy() const;
163 const struct SmMlSymmetric* getMlSymmetric() const;
164
165 // Set values
166 // Note that content is copied.
167 void setMlAccent(const SmMlAccent* aAccent);
168 void setMlDir(const SmMlDir* aDir);
169 void setMlDisplaystyle(const SmMlDisplaystyle* aDisplaystyle);
170 void setMlFence(const SmMlFence* aFence);
171 void setMlForm(const SmMlForm* aForm);
172 void setMlHref(const SmMlHref* aHref);
173 void setMlLspace(const SmMlLspace* aLspace);
174 void setMlMathbackground(const SmMlMathbackground* aMathbackground);
175 void setMlMathcolor(const SmMlMathcolor* aMathcolor);
176 void setMlMathsize(const SmMlMathsize* aMathsize);
177 void setMlMathvariant(const SmMlMathvariant* aMathvariant);
178 void setMlMaxsize(const SmMlMaxsize* aMaxsize);
179 void setMlMinsize(const SmMlMinsize* aMinSize);
180 void setMlMovablelimits(const SmMlMovablelimits* aMovablelimits);
181 void setMlRspace(const SmMlRspace* aRspace);
182 void setMlSeparator(const SmMlSeparator* aSeparator);
183 void setMlStretchy(const SmMlStretchy* aStretchy);
184 void setMlSymmetric(const SmMlSymmetric* aSymmetric);
185};
186
187/* element's attributes */
188/*************************************************************************************************/
189
191{
201}
202
203/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
const struct SmMlForm * getMlForm() const
Definition: attribute.cxx:221
bool isNullAttribute() const
Checks if the attribute contains information.
Definition: attribute.hxx:107
void clearPreviousAttributeValue()
Definition: attribute.cxx:12
const struct SmMlMathcolor * getMlMathcolor() const
Definition: attribute.cxx:249
const struct SmMlRspace * getMlRspace() const
Definition: attribute.cxx:291
void setMlStretchy(const SmMlStretchy *aStretchy)
Definition: attribute.cxx:461
SmMlAttributeValue m_aAttributeValue
Definition: attribute.hxx:51
bool isSet() const
Check if the attribute has been set.
Definition: attribute.hxx:90
void setSet(bool bSet)
Set if the attribute has been set.
Definition: attribute.hxx:94
void setMlAttributeValue(const SmMlAttribute &aMlAttribute)
Definition: attribute.hxx:132
const struct SmMlDisplaystyle * getMlDisplaystyle() const
Definition: attribute.cxx:207
void setMlMovablelimits(const SmMlMovablelimits *aMovablelimits)
Definition: attribute.cxx:435
const struct SmMlMovablelimits * getMlMovablelimits() const
Definition: attribute.cxx:284
void setDefaultAttributeValue()
Definition: attribute.cxx:47
void setMlMathvariant(const SmMlMathvariant *aMathvariant)
Definition: attribute.cxx:403
void setMlMathcolor(const SmMlMathcolor *aMathcolor)
Definition: attribute.cxx:384
SmMlAttributeValueType m_aSmMlAttributeValueType
Definition: attribute.hxx:50
void setMlRspace(const SmMlRspace *aRspace)
Definition: attribute.cxx:442
void setMlMathbackground(const SmMlMathbackground *aMathbackground)
Definition: attribute.cxx:377
const struct SmMlSeparator * getMlSeparator() const
Definition: attribute.cxx:298
const struct SmMlStretchy * getMlStretchy() const
Definition: attribute.cxx:305
void setMlAttributeValueType(SmMlAttributeValueType aAttributeValueType)
Set the type of attribute we are dealing with.
Definition: attribute.hxx:125
const struct SmMlLspace * getMlLspace() const
Definition: attribute.cxx:235
void setMlMathsize(const SmMlMathsize *aMathsize)
Definition: attribute.cxx:391
const struct SmMlFence * getMlFence() const
Definition: attribute.cxx:214
void setMlForm(const SmMlForm *aForm)
Definition: attribute.cxx:350
void setMlSymmetric(const SmMlSymmetric *aSymmetric)
Definition: attribute.cxx:468
void setMlHref(const SmMlHref *aHref)
Definition: attribute.cxx:357
const struct SmMlAccent * getMlAccent() const
Definition: attribute.cxx:193
const struct SmMlDir * getMlDir() const
Definition: attribute.cxx:200
const struct SmMlSymmetric * getMlSymmetric() const
Definition: attribute.cxx:312
SmMlAttributeValueType getMlAttributeValueType() const
Returns the type of attribute we are dealing with.
Definition: attribute.hxx:101
const struct SmMlMinsize * getMlMinsize() const
Definition: attribute.cxx:277
void setMlFence(const SmMlFence *aFence)
Definition: attribute.cxx:343
void setMlAttributeValue(const SmMlAttribute *aMlAttribute)
Definition: attribute.hxx:138
const struct SmMlMathbackground * getMlMathbackground() const
Definition: attribute.cxx:242
const struct SmMlMathvariant * getMlMathvariant() const
Definition: attribute.cxx:263
SmMlAttribute(const SmMlAttribute *aMlAttribute)
Definition: attribute.hxx:80
void setMlDisplaystyle(const SmMlDisplaystyle *aDisplaystyle)
Definition: attribute.cxx:336
void setMlAccent(const SmMlAccent *aAccent)
Definition: attribute.cxx:322
SmMlAttribute(const SmMlAttribute &aMlAttribute)
Definition: attribute.hxx:73
void setAttributeValue(const SmMlAttribute *aMlAttribute)
Definition: attribute.cxx:125
void setMlLspace(const SmMlLspace *aLspace)
Definition: attribute.cxx:365
void setMlDir(const SmMlDir *aDir)
Definition: attribute.cxx:329
const struct SmMlHref * getMlHref() const
Definition: attribute.cxx:228
void setMlMaxsize(const SmMlMaxsize *aMaxsize)
Definition: attribute.cxx:410
bool isMlAttributeValueType(SmMlAttributeValueType aAttributeValueType) const
Compares the type of attribute with a given one.
Definition: attribute.hxx:116
void setMlSeparator(const SmMlSeparator *aSeparator)
Definition: attribute.cxx:454
void setMlMinsize(const SmMlMinsize *aMinSize)
Definition: attribute.cxx:423
const struct SmMlMaxsize * getMlMaxsize() const
Definition: attribute.cxx:270
const struct SmMlMathsize * getMlMathsize() const
Definition: attribute.cxx:256
SmMlAttribute(SmMlAttributeValueType)
Definition: attribute.hxx:66
SmMlAttributeValueType
Definition: def.hxx:73
Parses the starmath code and creates the nodes.
Definition: attribute.hxx:191
SmMlAttributePos MlAttributeListMtext[7]
Definition: def.cxx:89
SmMlAttributePos MlAttributeListMath[1]
Definition: def.cxx:18
SmMlAttributePos MlAttributeListMerror[4]
Definition: def.cxx:36
SmMlAttributePos MlAttributeListEmpty[1]
Definition: def.cxx:12
SmMlAttributePos MlAttributeListMo[18]
Definition: def.cxx:57
SmMlAttributePos MlAttributeListMstyle[18]
Definition: def.cxx:101
SmMlAttributePos MlAttributeListMn[7]
Definition: def.cxx:45
SmMlAttributePos MlAttributeListMrow[4]
Definition: def.cxx:80
SmMlAttributePos MlAttributeListMi[7]
Definition: def.cxx:24
Definition: def.hxx:233
struct SmMlForm m_aForm
Definition: attribute.hxx:28
struct SmMlMovablelimits m_aMovablelimits
Definition: attribute.hxx:37
struct SmMlDir m_aDir
Definition: attribute.hxx:25
struct SmMlMathcolor m_aMathcolor
Definition: attribute.hxx:32
struct SmMlLspace m_aLspace
Definition: attribute.hxx:30
struct SmMlMathsize m_aMathsize
Definition: attribute.hxx:33
struct SmMlFence m_aFence
Definition: attribute.hxx:27
struct SmMlDisplaystyle m_aDisplaystyle
Definition: attribute.hxx:26
struct SmMlAccent m_aAccent
Definition: attribute.hxx:24
struct SmMlSeparator m_aSeparator
Definition: attribute.hxx:39
struct SmMlMathvariant m_aMathvariant
Definition: attribute.hxx:34
struct SmMlMinsize m_aMinsize
Definition: attribute.hxx:36
struct SmMlSymmetric m_aSymmetric
Definition: attribute.hxx:41
struct SmMlMaxsize m_aMaxsize
Definition: attribute.hxx:35
struct SmMlMathbackground m_aMathbackground
Definition: attribute.hxx:31
struct SmMlStretchy m_aStretchy
Definition: attribute.hxx:40
struct SmMlHref m_aHref
Definition: attribute.hxx:29
struct SmMlRspace m_aRspace
Definition: attribute.hxx:38