diff options
Diffstat (limited to 'starmath/source/mathmlattr.cxx')
-rw-r--r-- | starmath/source/mathmlattr.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/starmath/source/mathmlattr.cxx b/starmath/source/mathmlattr.cxx index 262609f1875d..0c39c3e2862e 100644 --- a/starmath/source/mathmlattr.cxx +++ b/starmath/source/mathmlattr.cxx @@ -10,6 +10,7 @@ #include "mathmlattr.hxx" #include <cassert> +#include <unordered_map> namespace { @@ -144,4 +145,38 @@ sal_Int32 ParseMathMLAttributeLengthValue(const OUString &rStr, MathMLAttributeL return nIdx; } + +bool GetMathMLMathvariantValue(const OUString &rStr, MathMLMathvariantValue *pV) +{ + static const std::unordered_map<OUString, MathMLMathvariantValue, OUStringHash> aMap{ + {"normal", MathMLMathvariantValue::Normal}, + {"bold", MathMLMathvariantValue::Bold}, + {"italic", MathMLMathvariantValue::Italic}, + {"bold-italic", MathMLMathvariantValue::BoldItalic}, + {"double-struck", MathMLMathvariantValue::DoubleStruck}, + {"bold-fraktur", MathMLMathvariantValue::BoldFraktur}, + {"script", MathMLMathvariantValue::Script}, + {"bold-script", MathMLMathvariantValue::BoldScript}, + {"fraktur", MathMLMathvariantValue::Fraktur}, + {"sans-serif", MathMLMathvariantValue::SansSerif}, + {"bold-sans-serif", MathMLMathvariantValue::BoldSansSerif}, + {"sans-serif-italic", MathMLMathvariantValue::SansSerifItalic}, + {"sans-serif-bold-italic", MathMLMathvariantValue::SansSerifBoldItalic}, + {"monospace", MathMLMathvariantValue::Monospace}, + {"initial", MathMLMathvariantValue::Initial}, + {"tailed", MathMLMathvariantValue::Tailed}, + {"looped", MathMLMathvariantValue::Looped}, + {"stretched", MathMLMathvariantValue::Stretched} + }; + + assert(pV); + auto it = aMap.find(rStr); + if (it != aMap.end()) + { + *pV = it->second; + return true; + } + return false; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |