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"
23 MathStringInset::MathStringInset(string const & s)
28 auto_ptr<InsetBase> MathStringInset::doClone() const
30 return auto_ptr<InsetBase>(new MathStringInset(*this));
34 void MathStringInset::metrics(MetricsInfo & mi, Dimension & dim) const
36 mathed_string_dim(mi.base.font, str_, dim);
40 void MathStringInset::draw(PainterInfo & pi, int x, int y) const
42 //lyxerr << "drawing '" << str_ << "' code: " << code_ << endl;
47 void MathStringInset::normalize(NormalStream & os) const
49 os << "[string " << str_ << ' ' << "mathalpha" << ']';
53 void MathStringInset::maple(MapleStream & os) const
55 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
56 os << ' ' << str_ << ' ';
60 // insert '*' between adjacent chars if type is LM_TC_VAR
62 for (string::size_type i = 1; i < str_.size(); ++i)
67 void MathStringInset::mathematica(MathematicaStream & os) const
69 os << ' ' << str_ << ' ';
73 void MathStringInset::octave(OctaveStream & os) const
75 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
76 os << ' ' << str_ << ' ';
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::mathmlize(MathMLStream & os) const
90 if (code_ == LM_TC_VAR)
91 os << "<mi> " << str_ << " </mi>";
92 else if (code_ == LM_TC_CONST)
93 os << "<mn> " << str_ << " </mn>";
94 else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM)
95 os << "<mtext> " << str_ << " </mtext>";
102 void MathStringInset::write(WriteStream & os) const