3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alejandro Aguilar Sierra
9 * Full author contact details are available in file CREDITS.
14 #include "InsetMath.h"
16 #include "MathStream.h"
18 #include "support/debug.h"
19 #include "support/docstream.h"
20 #include "support/gettext.h"
21 #include "support/lstrings.h"
22 #include "support/textutils.h"
24 #include "support/assert.h"
30 MathData & InsetMath::cell(idx_type)
32 static MathData dummyCell;
33 LYXERR0("I don't have any cell");
38 MathData const & InsetMath::cell(idx_type) const
40 static MathData dummyCell;
41 LYXERR0("I don't have any cell");
46 void InsetMath::dump() const
48 lyxerr << "---------------------------------------------" << endl;
50 WriteStream wi(os, false, true);
52 lyxerr << to_utf8(os.str());
53 lyxerr << "\n---------------------------------------------" << endl;
57 void InsetMath::metricsT(TextMetricsInfo const &, Dimension &) const
59 LYXERR0("InsetMath::metricsT(Text) called directly!");
63 void InsetMath::drawT(TextPainter &, int, int) const
65 LYXERR0("InsetMath::drawT(Text) called directly!");
69 void InsetMath::write(WriteStream & os) const
71 docstring const s = name();
73 // We need an extra ' ' unless this is a single-char-non-ASCII name
74 // or anything non-ASCII follows
75 if (s.size() != 1 || isAlphaASCII(s[0]))
76 os.pendingSpace(true);
80 int InsetMath::plaintext(odocstream &, OutputParams const &) const
82 // all math plain text output shall take place in InsetMathHull
88 void InsetMath::normalize(NormalStream & os) const
90 os << '[' << name() << "] ";
94 void InsetMath::octave(OctaveStream & os) const
96 NormalStream ns(os.os());
101 void InsetMath::maple(MapleStream & os) const
103 NormalStream ns(os.os());
108 void InsetMath::maxima(MaximaStream & os) const
110 MapleStream ns(os.os());
115 void InsetMath::mathematica(MathematicaStream & os) const
117 NormalStream ns(os.os());
122 void InsetMath::mathmlize(MathStream & os) const
124 NormalStream ns(os.os());
129 HullType InsetMath::getType() const
135 ostream & operator<<(ostream & os, MathAtom const & at)
137 odocstringstream oss;
138 WriteStream wi(oss, false, false);
140 return os << to_utf8(oss.str());
144 odocstream & operator<<(odocstream & os, MathAtom const & at)
146 WriteStream wi(os, false, false);