bump product version to 7.2.5.1
[LibreOffice.git] / starmath / inc / mathml / attribute.hxx
bloba6b1bdec639ca92921b6e7f33f6f48ab4e06189d
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.
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 */
10 #pragma once
12 #include "def.hxx"
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 SmMlHref m_aHref;
29 struct SmMlLspace m_aLspace;
30 struct SmMlMathbackground m_aMathbackground;
31 struct SmMlMathcolor m_aMathcolor;
32 struct SmMlMathsize m_aMathsize;
33 struct SmMlMathvariant m_aMathvariant;
34 struct SmMlMaxsize m_aMaxsize;
35 struct SmMlMinsize m_aMinsize;
36 struct SmMlMovablelimits m_aMovablelimits;
37 struct SmMlRspace m_aRspace;
38 struct SmMlSeparator m_aSeparator;
39 struct SmMlStretchy m_aStretchy;
40 struct SmMlSymmetric m_aSymmetric;
43 /* Class managing the attribute value */
44 /*************************************************************************************************/
46 class SmMlAttribute
48 private:
49 SmMlAttributeValueType m_aSmMlAttributeValueType;
50 SmMlAttributeValue m_aAttributeValue;
52 private:
53 void clearPreviousAttributeValue();
54 void setDefaultAttributeValue();
55 void setAttributeValue(const SmMlAttribute* aMlAttribute);
57 public:
58 SmMlAttribute() { m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; };
60 ~SmMlAttribute() { clearPreviousAttributeValue(); };
62 SmMlAttribute(SmMlAttributeValueType)
64 m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty;
65 setDefaultAttributeValue();
68 SmMlAttribute(const SmMlAttribute& aMlAttribute)
70 m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty;
71 setAttributeValue(&aMlAttribute);
74 SmMlAttribute(const SmMlAttribute* aMlAttribute)
76 m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty;
77 setAttributeValue(aMlAttribute);
80 public:
81 /**
82 * Returns the type of attribute we are dealing with.
83 * Attribute Value Type
85 SmMlAttributeValueType getMlAttributeValueType() const { return m_aSmMlAttributeValueType; };
87 /**
88 * Checks if the attribute contains information.
89 * Attribute Value Type
91 bool isNullAttribute() const
93 return m_aSmMlAttributeValueType == SmMlAttributeValueType::NMlEmpty;
96 /**
97 * Compares the type of attribute with a given one.
98 * Attribute Value Type
100 bool isMlAttributeValueType(SmMlAttributeValueType aAttributeValueType) const
102 return m_aSmMlAttributeValueType == aAttributeValueType;
106 * Set the type of attribute we are dealing with.
107 * @param Attribute Value Type
109 void setMlAttributeValueType(SmMlAttributeValueType aAttributeValueType)
111 clearPreviousAttributeValue();
112 m_aSmMlAttributeValueType = aAttributeValueType;
113 setDefaultAttributeValue();
116 void setMlAttributeValue(const SmMlAttribute& aMlAttribute)
118 setAttributeValue(&aMlAttribute);
121 void setMlAttributeValue(const SmMlAttribute* aMlAttribute) { setAttributeValue(aMlAttribute); }
123 public:
124 // Get values
125 const struct SmMlAccent* getMlAccent() const;
126 const struct SmMlDir* getMlDir() const;
127 const struct SmMlDisplaystyle* getMlDisplaystyle() const;
128 const struct SmMlFence* getMlFence() const;
129 const struct SmMlHref* getMlHref() const;
130 const struct SmMlLspace* getMlLspace() const;
131 const struct SmMlMathbackground* getMlMathbackground() const;
132 const struct SmMlMathcolor* getMlMathcolor() const;
133 const struct SmMlMathsize* getMlMathsize() const;
134 const struct SmMlMathvariant* getMlMathvariant() const;
135 const struct SmMlMaxsize* getMlMaxsize() const;
136 const struct SmMlMinsize* getMlMinsize() const;
137 const struct SmMlMovablelimits* getMlMovablelimits() const;
138 const struct SmMlRspace* getMlRspace() const;
139 const struct SmMlSeparator* getMlSeparator() const;
140 const struct SmMlStretchy* getMlStretchy() const;
141 const struct SmMlSymmetric* getMlSymmetric() const;
143 // Set values
144 // Note that content is copied.
145 void setMlAccent(const SmMlAccent* aAccent);
146 void setMlDir(const SmMlDir* aDir);
147 void setMlDisplaystyle(const SmMlDisplaystyle* aDisplaystyle);
148 void setMlFence(const SmMlFence* aFence);
149 void setMlHref(const SmMlHref* aHref);
150 void setMlLspace(const SmMlLspace* aLspace);
151 void setMlMathbackground(const SmMlMathbackground* aMathbackground);
152 void setMlMathcolor(const SmMlMathcolor* aMathcolor);
153 void setMlMathsize(const SmMlMathsize* aMathsize);
154 void setMlMathvariant(const SmMlMathvariant* aMathvariant);
155 void setMlMaxsize(const SmMlMaxsize* aMaxsize);
156 void setMlMinsize(const SmMlMinsize* aMinSize);
157 void setMlMovablelimits(const SmMlMovablelimits* aMovablelimits);
158 void setMlRspace(const SmMlRspace* aRspace);
159 void setMlSeparator(const SmMlSeparator* aSeparator);
160 void setMlStretchy(const SmMlStretchy* aStretchy);
161 void setMlSymmetric(const SmMlSymmetric* aSymmetric);
164 /* element's attributes */
165 /*************************************************************************************************/
167 namespace starmathdatabase
169 extern SmMlAttributePos MlAttributeListEmpty[1];
170 extern SmMlAttributePos MlAttributeListMath[1];
171 extern SmMlAttributePos MlAttributeListMi[7];
172 extern SmMlAttributePos MlAttributeListMerror[4];
173 extern SmMlAttributePos MlAttributeListMn[7];
174 extern SmMlAttributePos MlAttributeListMo[17];
175 extern SmMlAttributePos MlAttributeListMrow[4];
176 extern SmMlAttributePos MlAttributeListMtext[7];
177 extern SmMlAttributePos MlAttributeListMstyle[17];
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */