7 #include "math_stringinset.h"
8 #include "math_mathmlstream.h"
12 #include "math_parser.h"
16 MathStringInset::MathStringInset(string const & s, MathTextCodes t)
21 MathInset * MathStringInset::clone() const
23 return new MathStringInset(*this);
27 int MathStringInset::ascent() const
29 return mathed_string_ascent(code_, mi_, str_);
33 int MathStringInset::descent() const
35 return mathed_string_descent(code_, mi_, str_);
39 int MathStringInset::width() const
41 return mathed_string_width(code_, mi_, str_);
45 void MathStringInset::metrics(MathMetricsInfo const & mi) const
51 void MathStringInset::draw(Painter & pain, int x, int y) const
53 //lyxerr << "drawing '" << str_ << "' code: " << code_ << endl;
54 drawStr(pain, code_, mi_, x, y, str_);
58 void MathStringInset::write(MathWriteInfo & os) const
60 if (math_font_name(code_))
61 os << '\\' << math_font_name(code_) << '{' << str_.c_str() << '}';
67 void MathStringInset::writeNormal(NormalStream & os) const
69 os << "[string " << str_.c_str() << ' ' << "mathalpha" << "]";
73 void MathStringInset::maplize(MapleStream & os) const
75 if (code_ != LM_TC_VAR || str_.size() <= 1) {
80 // insert '*' between adjacent chars if type is LM_TC_VAR
82 for (string::size_type i = 1; i < str_.size(); ++i)
87 void MathStringInset::octavize(OctaveStream & os) const
89 if (code_ != LM_TC_VAR || str_.size() <= 1) {
94 // insert '*' between adjacent chars if type is LM_TC_VAR
96 for (string::size_type i = 1; i < str_.size(); ++i)
101 void MathStringInset::mathmlize(MathMLStream & os) const
103 if (code_ == LM_TC_VAR)
104 os << "<mi>" << str_.c_str() << "</mi>";
105 else if (code_ == LM_TC_CONST)
106 os << "<mn>" << str_.c_str() << "</mn>";
107 else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM)
108 os << "<mtext>" << str_.c_str() << "</mtext>";