1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
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
18 /* Union for storing the mathml attribute value */
19 /*************************************************************************************************/
21 union SmMlAttributeValue
{
22 SmMlAttributeValue(){};
24 struct SmMlAccent m_aAccent
;
25 struct SmMlDir m_aDir
;
26 struct SmMlDisplaystyle m_aDisplaystyle
;
27 struct SmMlFence m_aFence
;
28 struct SmMlForm m_aForm
;
29 struct SmMlHref m_aHref
;
30 struct SmMlLspace m_aLspace
;
31 struct SmMlMathbackground m_aMathbackground
;
32 struct SmMlMathcolor m_aMathcolor
;
33 struct SmMlMathsize m_aMathsize
;
34 struct SmMlMathvariant m_aMathvariant
;
35 struct SmMlMaxsize m_aMaxsize
;
36 struct SmMlMinsize m_aMinsize
;
37 struct SmMlMovablelimits m_aMovablelimits
;
38 struct SmMlRspace m_aRspace
;
39 struct SmMlSeparator m_aSeparator
;
40 struct SmMlStretchy m_aStretchy
;
41 struct SmMlSymmetric m_aSymmetric
;
44 /* Class managing the attribute value */
45 /*************************************************************************************************/
50 SmMlAttributeValueType m_aSmMlAttributeValueType
;
51 SmMlAttributeValue m_aAttributeValue
;
55 void clearPreviousAttributeValue();
56 void setDefaultAttributeValue();
57 void setAttributeValue(const SmMlAttribute
* aMlAttribute
);
61 : m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty
)
64 ~SmMlAttribute() { clearPreviousAttributeValue(); };
66 explicit SmMlAttribute(SmMlAttributeValueType
)
67 : m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty
)
70 setDefaultAttributeValue();
73 SmMlAttribute(const SmMlAttribute
& aMlAttribute
)
74 : m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty
)
75 , m_bSet(aMlAttribute
.isSet())
77 setAttributeValue(&aMlAttribute
);
80 explicit SmMlAttribute(const SmMlAttribute
* aMlAttribute
)
81 : m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty
)
82 , m_bSet(aMlAttribute
->isSet())
84 setAttributeValue(aMlAttribute
);
88 /** Check if the attribute has been set
90 bool isSet() const { return m_bSet
; }
92 /** Set if the attribute has been set
94 void setSet(bool bSet
) { m_bSet
= bSet
; }
98 * Returns the type of attribute we are dealing with.
99 * Attribute Value Type
101 SmMlAttributeValueType
getMlAttributeValueType() const { return m_aSmMlAttributeValueType
; };
104 * Checks if the attribute contains information.
105 * Attribute Value Type
107 bool isNullAttribute() const
109 return m_aSmMlAttributeValueType
== SmMlAttributeValueType::NMlEmpty
;
113 * Compares the type of attribute with a given one.
114 * Attribute Value Type
116 bool isMlAttributeValueType(SmMlAttributeValueType aAttributeValueType
) const
118 return m_aSmMlAttributeValueType
== aAttributeValueType
;
122 * Set the type of attribute we are dealing with.
123 * @param Attribute Value Type
125 void setMlAttributeValueType(SmMlAttributeValueType aAttributeValueType
)
127 clearPreviousAttributeValue();
128 m_aSmMlAttributeValueType
= aAttributeValueType
;
129 setDefaultAttributeValue();
132 void setMlAttributeValue(const SmMlAttribute
& aMlAttribute
)
135 setAttributeValue(&aMlAttribute
);
138 void setMlAttributeValue(const SmMlAttribute
* aMlAttribute
)
141 setAttributeValue(aMlAttribute
);
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;
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
);
187 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */