4 #include "math_stringinset.h"
5 #include "math_mathmlstream.h"
6 #include "math_streamstr.h"
7 #include "math_support.h"
13 MathStringInset::MathStringInset(string const & s)
18 auto_ptr<InsetBase> MathStringInset::clone() const
20 return auto_ptr<InsetBase>(new MathStringInset(*this));
24 void MathStringInset::metrics(MetricsInfo & mi, Dimension & dim) const
26 mathed_string_dim(mi.base.font, str_, dim);
30 void MathStringInset::draw(PainterInfo & pi, int x, int y) const
32 //lyxerr << "drawing '" << str_ << "' code: " << code_ << endl;
33 drawStr(pi, pi.base.font, x, y, str_);
37 void MathStringInset::normalize(NormalStream & os) const
39 os << "[string " << str_ << ' ' << "mathalpha" << ']';
43 void MathStringInset::maple(MapleStream & os) const
45 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
46 os << ' ' << str_ << ' ';
50 // insert '*' between adjacent chars if type is LM_TC_VAR
52 for (string::size_type i = 1; i < str_.size(); ++i)
57 void MathStringInset::mathematica(MathematicaStream & os) const
59 os << ' ' << str_ << ' ';
63 void MathStringInset::octave(OctaveStream & os) const
65 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
66 os << ' ' << str_ << ' ';
70 // insert '*' between adjacent chars if type is LM_TC_VAR
72 for (string::size_type i = 1; i < str_.size(); ++i)
77 void MathStringInset::mathmlize(MathMLStream & os) const
80 if (code_ == LM_TC_VAR)
81 os << "<mi> " << str_ << " </mi>";
82 else if (code_ == LM_TC_CONST)
83 os << "<mn> " << str_ << " </mn>";
84 else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM)
85 os << "<mtext> " << str_ << " </mtext>";
92 void MathStringInset::write(WriteStream & os) const