summaryrefslogtreecommitdiff
path: root/starmath/source/mathmlattr.cxx
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2016-11-27 02:55:15 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2016-11-29 01:04:08 +0000
commit2bad9f1cd8da0cd3d8ff33e875eaf10c1fd9d0bf (patch)
tree2183236d12fdf71d43cc98dfee404450c06289c9 /starmath/source/mathmlattr.cxx
parent9abc547ef28f3f6891030597fd304ca757b102da (diff)
tdf#103430 Apply mathvariant attribute to <mi> and <mo>
by emulating it with SmFontNode. In case of <mo>, current implementation supports only the one named with an alphabet. Change-Id: I827a7e80f5aa94e243098a6e50eb758cf915c282 Reviewed-on: https://gerrit.libreoffice.org/31240 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
Diffstat (limited to 'starmath/source/mathmlattr.cxx')
-rw-r--r--starmath/source/mathmlattr.cxx35
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: */