diff options
author | dante <dante19031999@gmail.com> | 2021-08-13 19:51:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-15 09:10:13 +0200 |
commit | ffaaec23ad94f9bec5fd0fcb02603270eb660b81 (patch) | |
tree | b0ddcff0d02ae0ddddd04888674cf1c00fae4525 /starmath/inc | |
parent | 73b6462b81080c63e6668979f4a9cd00242925e9 (diff) |
Add the possibility to check if a mathml attribute is manually set
Change-Id: I9c5eaee8e2cce47d9286306031e807ca2c0eed57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120473
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath/inc')
-rw-r--r-- | starmath/inc/mathml/attribute.hxx | 30 | ||||
-rw-r--r-- | starmath/inc/mathml/element.hxx | 7 |
2 files changed, 31 insertions, 6 deletions
diff --git a/starmath/inc/mathml/attribute.hxx b/starmath/inc/mathml/attribute.hxx index cbe042827d85..946e9f463e9c 100644 --- a/starmath/inc/mathml/attribute.hxx +++ b/starmath/inc/mathml/attribute.hxx @@ -49,6 +49,7 @@ class SmMlAttribute private: SmMlAttributeValueType m_aSmMlAttributeValueType; SmMlAttributeValue m_aAttributeValue; + bool m_bSet; private: void clearPreviousAttributeValue(); @@ -56,29 +57,43 @@ private: void setAttributeValue(const SmMlAttribute* aMlAttribute); public: - SmMlAttribute() { m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; }; + SmMlAttribute() + : m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty) + , m_bSet(false){}; ~SmMlAttribute() { clearPreviousAttributeValue(); }; SmMlAttribute(SmMlAttributeValueType) + : m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty) + , m_bSet(false) { - m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; setDefaultAttributeValue(); }; SmMlAttribute(const SmMlAttribute& aMlAttribute) + : m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty) + , m_bSet(aMlAttribute.isSet()) { - m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; setAttributeValue(&aMlAttribute); } SmMlAttribute(const SmMlAttribute* aMlAttribute) + : m_aSmMlAttributeValueType(SmMlAttributeValueType::NMlEmpty) + , m_bSet(aMlAttribute->isSet()) { - m_aSmMlAttributeValueType = SmMlAttributeValueType::NMlEmpty; setAttributeValue(aMlAttribute); } public: + /** Check if the attribute has been set + */ + bool isSet() const { return m_bSet; } + + /** Set if the attribute has been set + */ + void setSet(bool bSet) { m_bSet = bSet; } + +public: /** * Returns the type of attribute we are dealing with. * Attribute Value Type @@ -116,10 +131,15 @@ public: void setMlAttributeValue(const SmMlAttribute& aMlAttribute) { + m_bSet = true; setAttributeValue(&aMlAttribute); } - void setMlAttributeValue(const SmMlAttribute* aMlAttribute) { setAttributeValue(aMlAttribute); } + void setMlAttributeValue(const SmMlAttribute* aMlAttribute) + { + m_bSet = true; + setAttributeValue(aMlAttribute); + } public: // Get values diff --git a/starmath/inc/mathml/element.hxx b/starmath/inc/mathml/element.hxx index 2c5ec40ab019..513b5d84b7ea 100644 --- a/starmath/inc/mathml/element.hxx +++ b/starmath/inc/mathml/element.hxx @@ -164,7 +164,7 @@ public: // attributes * @param nAttributePos * @return given attribute. */ - SmMlAttribute getAttribute(SmMlAttributeValueType aElementType) const; + SmMlAttribute getAttribute(SmMlAttributeValueType aAttributeType) const; /** * Set's a given attribute. @@ -174,6 +174,11 @@ public: // attributes */ void setAttribute(const SmMlAttribute* aAttribute); + /** Checks if an attribute has been manually set + * @param aElementType + */ + bool isAttributeSet(SmMlAttributeValueType aAttributeType) const; + protected: // attributes /** * Get's a given attribute. |