2 * \file math_stringinset.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 "math_stringinset.h"
14 #include "math_mathmlstream.h"
15 #include "math_streamstr.h"
16 #include "math_support.h"
22 MathStringInset::MathStringInset(string const & s)
27 auto_ptr<InsetBase> MathStringInset::clone() const
29 return auto_ptr<InsetBase>(new MathStringInset(*this));
33 void MathStringInset::metrics(MetricsInfo & mi, Dimension & dim) const
35 mathed_string_dim(mi.base.font, str_, dim);
39 void MathStringInset::draw(PainterInfo & pi, int x, int y) const
41 //lyxerr << "drawing '" << str_ << "' code: " << code_ << endl;
42 drawStr(pi, pi.base.font, x, y, str_);
46 void MathStringInset::normalize(NormalStream & os) const
48 os << "[string " << str_ << ' ' << "mathalpha" << ']';
52 void MathStringInset::maple(MapleStream & os) const
54 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
55 os << ' ' << str_ << ' ';
59 // insert '*' between adjacent chars if type is LM_TC_VAR
61 for (string::size_type i = 1; i < str_.size(); ++i)
66 void MathStringInset::mathematica(MathematicaStream & os) const
68 os << ' ' << str_ << ' ';
72 void MathStringInset::octave(OctaveStream & os) const
74 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
75 os << ' ' << str_ << ' ';
79 // insert '*' between adjacent chars if type is LM_TC_VAR
81 for (string::size_type i = 1; i < str_.size(); ++i)
86 void MathStringInset::mathmlize(MathMLStream & os) const
89 if (code_ == LM_TC_VAR)
90 os << "<mi> " << str_ << " </mi>";
91 else if (code_ == LM_TC_CONST)
92 os << "<mn> " << str_ << " </mn>";
93 else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM)
94 os << "<mtext> " << str_ << " </mtext>";
101 void MathStringInset::write(WriteStream & os) const