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"
20 #include "support/docstream.h"
21 #include "support/lstrings.h"
22 #include "support/textutils.h"
24 #include <boost/current_function.hpp>
25 #include <boost/assert.hpp>
33 MathData & InsetMath::cell(idx_type)
35 static MathData dummyCell;
36 lyxerr << BOOST_CURRENT_FUNCTION << ": I don't have any cell" << endl;
41 MathData const & InsetMath::cell(idx_type) const
43 static MathData dummyCell;
44 lyxerr << BOOST_CURRENT_FUNCTION << ": I don't have any cell" << endl;
49 void InsetMath::dump() const
51 lyxerr << "---------------------------------------------" << endl;
53 WriteStream wi(os, false, true);
55 lyxerr << to_utf8(os.str());
56 lyxerr << "\n---------------------------------------------" << endl;
60 void InsetMath::metricsT(TextMetricsInfo const &, Dimension &) const
62 lyxerr << "InsetMath::metricsT(Text) called directly!" << endl;
66 void InsetMath::drawT(TextPainter &, int, int) const
68 lyxerr << "InsetMath::drawT(Text) called directly!" << endl;
72 void InsetMath::write(WriteStream & os) const
74 docstring const s = name();
76 // We need an extra ' ' unless this is a single-char-non-ASCII name
77 // or anything non-ASCII follows
78 if (s.size() != 1 || isAlphaASCII(s[0]))
79 os.pendingSpace(true);
83 int InsetMath::plaintext(Buffer const &, odocstream &,
84 OutputParams const &) const
86 // all math plain text output shall take place in InsetMathHull
92 void InsetMath::normalize(NormalStream & os) const
94 os << '[' << name() << "] ";
98 void InsetMath::octave(OctaveStream & os) const
100 NormalStream ns(os.os());
105 void InsetMath::maple(MapleStream & os) const
107 NormalStream ns(os.os());
112 void InsetMath::maxima(MaximaStream & os) const
114 MapleStream ns(os.os());
119 void InsetMath::mathematica(MathematicaStream & os) const
121 NormalStream ns(os.os());
126 void InsetMath::mathmlize(MathStream & os) const
128 NormalStream ns(os.os());
133 HullType InsetMath::getType() const
139 std::ostream & operator<<(std::ostream & os, MathAtom const & at)
141 odocstringstream oss;
142 WriteStream wi(oss, false, false);
144 return os << to_utf8(oss.str());
148 odocstream & operator<<(odocstream & os, MathAtom const & at)
150 WriteStream wi(os, false, false);