2 * \file InsetMathString.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 "InsetMathString.h"
14 #include "MathMLStream.h"
15 #include "MathStream.h"
16 #include "MathSupport.h"
26 InsetMathString::InsetMathString(string const & s)
31 auto_ptr<InsetBase> InsetMathString::doClone() const
33 return auto_ptr<InsetBase>(new InsetMathString(*this));
37 void InsetMathString::metrics(MetricsInfo & mi, Dimension & dim) const
40 vector<char_type> n(str_.begin(), str_.end());
41 mathed_string_dim(mi.base.font, n, dim);
45 void InsetMathString::draw(PainterInfo & pi, int x, int y) const
47 //lyxerr << "drawing '" << str_ << "' code: " << code_ << endl;
49 docstring dstr = from_utf8(str_);
54 void InsetMathString::normalize(NormalStream & os) const
56 os << "[string " << str_ << ' ' << "mathalpha" << ']';
60 void InsetMathString::maple(MapleStream & os) const
62 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
63 os << ' ' << str_ << ' ';
67 // insert '*' between adjacent chars if type is LM_TC_VAR
69 for (string::size_type i = 1; i < str_.size(); ++i)
74 void InsetMathString::mathematica(MathematicaStream & os) const
76 os << ' ' << str_ << ' ';
80 void InsetMathString::octave(OctaveStream & os) const
82 if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
83 os << ' ' << str_ << ' ';
87 // insert '*' between adjacent chars if type is LM_TC_VAR
89 for (string::size_type i = 1; i < str_.size(); ++i)
94 void InsetMathString::mathmlize(MathMLStream & os) const
97 if (code_ == LM_TC_VAR)
98 os << "<mi> " << str_ << " </mi>";
99 else if (code_ == LM_TC_CONST)
100 os << "<mn> " << str_ << " </mn>";
101 else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM)
102 os << "<mtext> " << str_ << " </mtext>";
109 void InsetMathString::write(WriteStream & os) const