3 * Purpose: Implementation of insets for mathed
4 * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
5 * Created: January 1996
8 * Dependencies: Xlib, XForms
10 * Copyright: 1996, 1997 Alejandro Aguilar Sierra
14 * You are free to use and modify this code under the terms of
15 * the GNU General Public Licence version 2 or later.
19 #pragma implementation
25 #include "math_inset.h"
26 #include "math_scriptinset.h"
27 #include "math_charinset.h"
28 #include "math_mathmlstream.h"
29 #include "math_cursor.h"
32 #include "frontends/LyXView.h"
33 #include "frontends/Dialogs.h"
34 #include "BufferView.h"
35 #include "formulabase.h"
42 int MathInset::height() const
44 return ascent() + descent();
48 ostream & operator<<(ostream & os, MathAtom const & at)
51 os << *(at.nucleus());
58 ostream & operator<<(ostream & os, MathInset const & inset)
60 WriteStream wi(os, false, false);
65 MathInset::size_type MathInset::nargs() const
73 MathXArray & MathInset::xcell(idx_type)
75 lyxerr << "I don't have a cell 1\n";
80 MathXArray const & MathInset::xcell(idx_type) const
82 lyxerr << "I don't have a cell 2\n";
87 MathArray & MathInset::cell(idx_type)
89 lyxerr << "I don't have a cell 3\n";
90 return dummyCell.data();
94 MathArray const & MathInset::cell(idx_type) const
96 lyxerr << "I don't have a cell 4\n";
97 return dummyCell.data();
101 MathInset::idx_type MathInset::index(row_type row, col_type col) const
104 lyxerr << "illegal row: " << row << "\n";
106 lyxerr << "illegal col: " << col << "\n";
110 void MathInset::substitute(MathMacro const &)
114 bool MathInset::idxNext(idx_type &, pos_type &) const
120 bool MathInset::idxRight(idx_type &, pos_type &) const
126 bool MathInset::idxPrev(idx_type &, pos_type &) const
132 bool MathInset::idxLeft(idx_type &, pos_type &) const
138 bool MathInset::idxUpDown(idx_type &, bool) const
144 bool MathInset::idxFirst(idx_type &, pos_type &) const
150 bool MathInset::idxLast(idx_type &, pos_type &) const
156 bool MathInset::idxHome(idx_type &, pos_type &) const
162 bool MathInset::idxEnd(idx_type &, pos_type &) const
168 void MathInset::normalize(NormalStream & os) const
171 WriteStream wi(os.os(), false, true);
177 void MathInset::dump() const
179 lyxerr << "---------------------------------------------\n";
180 WriteStream wi(lyxerr, false, true);
182 lyxerr << "\n---------------------------------------------\n";
186 void MathInset::validate(LaTeXFeatures &) const
190 vector<MathInset::idx_type>
191 MathInset::idxBetween(idx_type from, idx_type to) const
193 vector<idx_type> res;
194 for (idx_type i = from; i <= to; ++i)
200 void MathInset::metrics(MathMetricsInfo &) const
202 lyxerr << "MathInset::metrics() called directly!\n";
206 void MathInset::draw(MathPainterInfo &, int, int) const
208 lyxerr << "MathInset::draw() called directly!\n";
212 void MathInset::metricsT(TextMetricsInfo const &) const
215 lyxerr << "MathInset::metricsT(Text) called directly!\n";
220 void MathInset::drawT(TextPainter &, int, int) const
223 lyxerr << "MathInset::drawT(Text) called directly!\n";
229 void MathInset::write(WriteStream &) const
231 lyxerr << "MathInset::write() called directly!\n";
235 void MathInset::octavize(OctaveStream & os) const
237 NormalStream ns(os.os());
242 void MathInset::maplize(MapleStream & os) const
244 NormalStream ns(os.os());
249 void MathInset::mathematicize(MathematicaStream & os) const
251 NormalStream ns(os.os());
256 void MathInset::mathmlize(MathMLStream & os) const
258 NormalStream ns(os.os());
263 int MathInset::ascii(std::ostream &, int) const
269 int MathInset::linuxdoc(std::ostream &) const
275 int MathInset::docbook(std::ostream &, bool) const
281 int MathInset::dispatch(string const &, idx_type, pos_type)
283 return 0; // undispatched
287 std::vector<string> MathInset::getLabelList() const
289 return std::vector<string>();
293 string const & MathInset::getType() const
295 static string t("none");
300 string asString(MathArray const & ar)
303 for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
304 if ((*it)->getChar())
305 res += (*it)->getChar();
310 MathArray asArray(string const & str)
313 for (string::const_iterator it = str.begin(); it != str.end(); ++it)
314 ar.push_back(MathAtom(new MathCharInset(*it)));
319 Dialogs * getDialogs()
321 return mathcursor->formula()->view()->owner()->getDialogs();
325 LyXFunc * getLyXFunc()
327 return mathcursor->formula()->view()->owner()->getLyXFunc();