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"
21 MathStringInset::MathStringInset(string const & s)
26 auto_ptr<InsetBase> MathStringInset::clone() const
28 return auto_ptr<InsetBase>(new MathStringInset(*this));
32 void MathStringInset::metrics(MetricsInfo & mi, Dimension & dim) const
34 mathed_string_dim(mi.base.font, str_, dim);
38 void MathStringInset::draw(PainterInfo & pi, int x, int y) const
40 //lyxerr << "drawing '" << str_ << "' code: " << code_ << endl;
41 drawStr(pi, pi.base.font, x, y, str_);
45 void MathStringInset::normalize(NormalStream & os) const
47 os << "[string " << str_ << ' ' << "mathalpha" << ']';
51 void MathStringInset::maple(MapleStream & os) const
53 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
54 os << ' ' << str_ << ' ';
58 // insert '*' between adjacent chars if type is LM_TC_VAR
60 for (string::size_type i = 1; i < str_.size(); ++i)
65 void MathStringInset::mathematica(MathematicaStream & os) const
67 os << ' ' << str_ << ' ';
71 void MathStringInset::octave(OctaveStream & os) const
73 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
74 os << ' ' << str_ << ' ';
78 // insert '*' between adjacent chars if type is LM_TC_VAR
80 for (string::size_type i = 1; i < str_.size(); ++i)
85 void MathStringInset::mathmlize(MathMLStream & os) const
88 if (code_ == LM_TC_VAR)
89 os << "<mi> " << str_ << " </mi>";
90 else if (code_ == LM_TC_CONST)
91 os << "<mn> " << str_ << " </mn>";
92 else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM)
93 os << "<mtext> " << str_ << " </mtext>";
100 void MathStringInset::write(WriteStream & os) const