2 * \file InsetMathString.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "InsetMathString.h"
14 #include "MathMLStream.h"
15 #include "MathStream.h"
16 #include "MathSupport.h"
24 InsetMathString::InsetMathString(string const & s)
29 auto_ptr<InsetBase> InsetMathString::doClone() const
31 return auto_ptr<InsetBase>(new InsetMathString(*this));
35 void InsetMathString::metrics(MetricsInfo & mi, Dimension & dim) const
38 mathed_string_dim(mi.base.font, lyx::from_utf8(str_), dim);
42 void InsetMathString::draw(PainterInfo & pi, int x, int y) const
44 //lyxerr << "drawing '" << str_ << "' code: " << code_ << endl;
46 docstring dstr = lyx::from_utf8(str_);
51 void InsetMathString::normalize(NormalStream & os) const
53 os << "[string " << str_ << ' ' << "mathalpha" << ']';
57 void InsetMathString::maple(MapleStream & os) const
59 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
60 os << ' ' << str_ << ' ';
64 // insert '*' between adjacent chars if type is LM_TC_VAR
66 for (string::size_type i = 1; i < str_.size(); ++i)
71 void InsetMathString::mathematica(MathematicaStream & os) const
73 os << ' ' << str_ << ' ';
77 void InsetMathString::octave(OctaveStream & os) const
79 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
80 os << ' ' << str_ << ' ';
84 // insert '*' between adjacent chars if type is LM_TC_VAR
86 for (string::size_type i = 1; i < str_.size(); ++i)
91 void InsetMathString::mathmlize(MathMLStream & os) const
94 if (code_ == LM_TC_VAR)
95 os << "<mi> " << str_ << " </mi>";
96 else if (code_ == LM_TC_CONST)
97 os << "<mn> " << str_ << " </mn>";
98 else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM)
99 os << "<mtext> " << str_ << " </mtext>";
106 void InsetMathString::write(WriteStream & os) const