diff options
author | dante <dante19031999@gmail.com> | 2021-08-13 19:13:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-15 09:09:07 +0200 |
commit | 73b6462b81080c63e6668979f4a9cd00242925e9 (patch) | |
tree | 536e2408898c516db31092483eb3a422c9db3f15 /starmath | |
parent | 6c4ff1d23ef61e708f3450d1b0ae77cc78cac731 (diff) |
Add the Form attribute to mo
Change-Id: I4f64460e15c707fa8ecdcfdfbea460b2f1410947
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120469
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/mathml/attribute.hxx | 7 | ||||
-rw-r--r-- | starmath/inc/mathml/def.hxx | 13 | ||||
-rw-r--r-- | starmath/source/mathml/attribute.cxx | 19 | ||||
-rw-r--r-- | starmath/source/mathml/def.cxx | 38 |
4 files changed, 57 insertions, 20 deletions
diff --git a/starmath/inc/mathml/attribute.hxx b/starmath/inc/mathml/attribute.hxx index a6b1bdec639c..cbe042827d85 100644 --- a/starmath/inc/mathml/attribute.hxx +++ b/starmath/inc/mathml/attribute.hxx @@ -25,6 +25,7 @@ union SmMlAttributeValue { struct SmMlDir m_aDir; struct SmMlDisplaystyle m_aDisplaystyle; struct SmMlFence m_aFence; + struct SmMlForm m_aForm; struct SmMlHref m_aHref; struct SmMlLspace m_aLspace; struct SmMlMathbackground m_aMathbackground; @@ -126,6 +127,7 @@ public: const struct SmMlDir* getMlDir() const; const struct SmMlDisplaystyle* getMlDisplaystyle() const; const struct SmMlFence* getMlFence() const; + const struct SmMlForm* getMlForm() const; const struct SmMlHref* getMlHref() const; const struct SmMlLspace* getMlLspace() const; const struct SmMlMathbackground* getMlMathbackground() const; @@ -146,6 +148,7 @@ public: void setMlDir(const SmMlDir* aDir); void setMlDisplaystyle(const SmMlDisplaystyle* aDisplaystyle); void setMlFence(const SmMlFence* aFence); + void setMlForm(const SmMlForm* aForm); void setMlHref(const SmMlHref* aHref); void setMlLspace(const SmMlLspace* aLspace); void setMlMathbackground(const SmMlMathbackground* aMathbackground); @@ -171,10 +174,10 @@ extern SmMlAttributePos MlAttributeListMath[1]; extern SmMlAttributePos MlAttributeListMi[7]; extern SmMlAttributePos MlAttributeListMerror[4]; extern SmMlAttributePos MlAttributeListMn[7]; -extern SmMlAttributePos MlAttributeListMo[17]; +extern SmMlAttributePos MlAttributeListMo[18]; extern SmMlAttributePos MlAttributeListMrow[4]; extern SmMlAttributePos MlAttributeListMtext[7]; -extern SmMlAttributePos MlAttributeListMstyle[17]; +extern SmMlAttributePos MlAttributeListMstyle[18]; } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/starmath/inc/mathml/def.hxx b/starmath/inc/mathml/def.hxx index 52cf70206b2f..38073671189c 100644 --- a/starmath/inc/mathml/def.hxx +++ b/starmath/inc/mathml/def.hxx @@ -76,6 +76,7 @@ enum class SmMlAttributeValueType : uint_fast8_t MlDir, MlDisplaystyle, MlFence, + MlForm, MlHref, MlLspace, MlMathbackground, @@ -123,6 +124,13 @@ enum class SmMlAttributeValueFence : uint_fast8_t MlTrue = 0x01 }; +enum class SmMlAttributeValueForm : uint_fast8_t +{ + MlPrefix = 0x01, + MlInfix = 0x02, + MlPosfix = 0x04 +}; + enum class SmMlAttributeValueHref : uint_fast8_t { NMlEmpty = 0x00, @@ -236,6 +244,11 @@ struct SmMlFence SmMlAttributeValueFence m_aFence; }; +struct SmMlForm +{ + SmMlAttributeValueForm m_aForm; +}; + struct SmMlHref { SmMlAttributeValueHref m_aHref; diff --git a/starmath/source/mathml/attribute.cxx b/starmath/source/mathml/attribute.cxx index da7668417327..61c4df609452 100644 --- a/starmath/source/mathml/attribute.cxx +++ b/starmath/source/mathml/attribute.cxx @@ -63,6 +63,9 @@ void SmMlAttribute::setDefaultAttributeValue() case SmMlAttributeValueType::MlFence: m_aAttributeValue.m_aFence.m_aFence = SmMlAttributeValueFence::MlFalse; break; + case SmMlAttributeValueType::MlForm: + m_aAttributeValue.m_aForm.m_aForm = SmMlAttributeValueForm::MlInfix; + break; case SmMlAttributeValueType::MlHref: m_aAttributeValue.m_aHref.m_aHref = SmMlAttributeValueHref::NMlEmpty; m_aAttributeValue.m_aHref.m_aLnk = new OUString(u""); @@ -139,6 +142,9 @@ void SmMlAttribute::setAttributeValue(const SmMlAttribute* aAttribute) case SmMlAttributeValueType::MlFence: setMlFence(aAttribute->getMlFence()); break; + case SmMlAttributeValueType::MlForm: + setMlForm(aAttribute->getMlForm()); + break; case SmMlAttributeValueType::MlHref: setMlHref(aAttribute->getMlHref()); break; @@ -212,6 +218,13 @@ const struct SmMlFence* SmMlAttribute::getMlFence() const return nullptr; } +const struct SmMlForm* SmMlAttribute::getMlForm() const +{ + if (m_aSmMlAttributeValueType == SmMlAttributeValueType::MlForm) + return &m_aAttributeValue.m_aForm; + return nullptr; +} + const struct SmMlHref* SmMlAttribute::getMlHref() const { if (m_aSmMlAttributeValueType == SmMlAttributeValueType::MlHref) @@ -330,6 +343,12 @@ void SmMlAttribute::setMlFence(const SmMlFence* aFence) m_aAttributeValue.m_aFence.m_aFence = aFence->m_aFence; } +void SmMlAttribute::setMlForm(const SmMlForm* aForm) +{ + clearPreviousAttributeValue(); + m_aAttributeValue.m_aForm.m_aForm = aForm->m_aForm; +} + void SmMlAttribute::setMlHref(const SmMlHref* aHref) { clearPreviousAttributeValue(); diff --git a/starmath/source/mathml/def.cxx b/starmath/source/mathml/def.cxx index dfa383ccc450..484dcd665393 100644 --- a/starmath/source/mathml/def.cxx +++ b/starmath/source/mathml/def.cxx @@ -64,15 +64,16 @@ SmMlAttributePos starmathdatabase::MlAttributeListMo[] = { { SmMlAttributeValueType::MlMathsize, 5 }, { SmMlAttributeValueType::MlMathvariant, 6 }, { SmMlAttributeValueType::MlFence, 7 }, - { SmMlAttributeValueType::MlMaxsize, 8 }, - { SmMlAttributeValueType::MlMinsize, 9 }, - { SmMlAttributeValueType::MlMovablelimits, 10 }, - { SmMlAttributeValueType::MlLspace, 11 }, - { SmMlAttributeValueType::MlRspace, 12 }, - { SmMlAttributeValueType::MlAccent, 13 }, - { SmMlAttributeValueType::MlStretchy, 14 }, - { SmMlAttributeValueType::MlSeparator, 15 }, - { SmMlAttributeValueType::MlSymmetric, 16 } + { SmMlAttributeValueType::MlForm, 8 }, + { SmMlAttributeValueType::MlMaxsize, 9 }, + { SmMlAttributeValueType::MlMinsize, 10 }, + { SmMlAttributeValueType::MlMovablelimits, 11 }, + { SmMlAttributeValueType::MlLspace, 12 }, + { SmMlAttributeValueType::MlRspace, 13 }, + { SmMlAttributeValueType::MlAccent, 14 }, + { SmMlAttributeValueType::MlStretchy, 15 }, + { SmMlAttributeValueType::MlSeparator, 16 }, + { SmMlAttributeValueType::MlSymmetric, 17 } // clang-format on }; @@ -107,15 +108,16 @@ SmMlAttributePos starmathdatabase::MlAttributeListMstyle[] = { { SmMlAttributeValueType::MlMathsize, 5 }, { SmMlAttributeValueType::MlMathvariant, 6 }, { SmMlAttributeValueType::MlFence, 7 }, - { SmMlAttributeValueType::MlMaxsize, 8 }, - { SmMlAttributeValueType::MlMinsize, 9 }, - { SmMlAttributeValueType::MlMovablelimits, 10 }, - { SmMlAttributeValueType::MlLspace, 11 }, - { SmMlAttributeValueType::MlRspace, 12 }, - { SmMlAttributeValueType::MlAccent, 13 }, - { SmMlAttributeValueType::MlStretchy, 14 }, - { SmMlAttributeValueType::MlSeparator, 15 }, - { SmMlAttributeValueType::MlSymmetric, 16 } + { SmMlAttributeValueType::MlForm, 8 }, + { SmMlAttributeValueType::MlMaxsize, 9 }, + { SmMlAttributeValueType::MlMinsize, 10 }, + { SmMlAttributeValueType::MlMovablelimits, 11 }, + { SmMlAttributeValueType::MlLspace, 12 }, + { SmMlAttributeValueType::MlRspace, 13 }, + { SmMlAttributeValueType::MlAccent, 14 }, + { SmMlAttributeValueType::MlStretchy, 15 }, + { SmMlAttributeValueType::MlSeparator, 16 }, + { SmMlAttributeValueType::MlSymmetric, 17 } // clang-format on }; |