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_mathmlstream.h"
28 #include "math_cursor.h"
29 #include "math_parser.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);
66 MathInset::size_type MathInset::nargs() const
72 Dimension MathInset::dimensions() const
74 lyxerr << "call MathInset::dimensions()\n";
75 return Dimension(width(), ascent(), descent());
81 MathXArray & MathInset::xcell(idx_type)
83 lyxerr << "I don't have a cell 1\n";
88 MathXArray const & MathInset::xcell(idx_type) const
90 lyxerr << "I don't have a cell 2\n";
95 MathArray & MathInset::cell(idx_type)
97 lyxerr << "I don't have a cell 3\n";
98 return dummyCell.data();
102 MathArray const & MathInset::cell(idx_type) const
104 lyxerr << "I don't have a cell 4\n";
105 return dummyCell.data();
109 MathInset::idx_type MathInset::index(row_type row, col_type col) const
112 lyxerr << "illegal row: " << row << "\n";
114 lyxerr << "illegal col: " << col << "\n";
118 void MathInset::substitute(MathMacro const &)
122 bool MathInset::idxNext(idx_type &, pos_type &) const
128 bool MathInset::idxRight(idx_type &, pos_type &) const
134 bool MathInset::idxPrev(idx_type &, pos_type &) const
140 bool MathInset::idxLeft(idx_type &, pos_type &) const
146 bool MathInset::idxUpDown(idx_type &, pos_type &, bool, int) const
152 bool MathInset::idxFirst(idx_type &, pos_type &) const
158 bool MathInset::idxLast(idx_type &, pos_type &) const
164 bool MathInset::idxHome(idx_type &, pos_type &) const
170 bool MathInset::idxEnd(idx_type &, pos_type &) const
176 void MathInset::getPos(idx_type, pos_type, int & x, int & y) const
178 lyxerr << "MathInset::getPos() called directly!\n";
183 void MathInset::normalize(NormalStream & os) const
186 WriteStream wi(os.os(), false, true);
192 void MathInset::dump() const
194 lyxerr << "---------------------------------------------\n";
195 WriteStream wi(lyxerr, false, true);
197 lyxerr << "\n---------------------------------------------\n";
201 void MathInset::validate(LaTeXFeatures &) const
205 vector<MathInset::idx_type>
206 MathInset::idxBetween(idx_type from, idx_type to) const
208 vector<idx_type> res;
209 for (idx_type i = from; i <= to; ++i)
215 void MathInset::metrics(MathMetricsInfo &) const
217 lyxerr << "MathInset::metrics() called directly!\n";
221 void MathInset::draw(MathPainterInfo &, int, int) const
223 lyxerr << "MathInset::draw() called directly!\n";
227 void MathInset::drawSelection(MathPainterInfo &,
228 idx_type, pos_type, idx_type, pos_type) const
230 lyxerr << "MathInset::drawSelection() called directly!\n";
234 void MathInset::metricsT(TextMetricsInfo const &) const
237 lyxerr << "MathInset::metricsT(Text) called directly!\n";
242 void MathInset::drawT(TextPainter &, int, int) const
245 lyxerr << "MathInset::drawT(Text) called directly!\n";
251 void MathInset::write(WriteStream &) const
253 lyxerr << "MathInset::write() called directly!\n";
257 void MathInset::octavize(OctaveStream & os) const
259 NormalStream ns(os.os());
264 void MathInset::maplize(MapleStream & os) const
266 NormalStream ns(os.os());
271 void MathInset::mathematicize(MathematicaStream & os) const
273 NormalStream ns(os.os());
278 void MathInset::mathmlize(MathMLStream & os) const
280 NormalStream ns(os.os());
285 int MathInset::ascii(std::ostream &, int) const
291 int MathInset::linuxdoc(std::ostream &) const
297 int MathInset::docbook(std::ostream &, bool) const
303 int MathInset::dispatch(string const &, idx_type, pos_type)
305 return 0; // undispatched
309 std::vector<string> MathInset::getLabelList() const
311 return std::vector<string>();
315 string const & MathInset::getType() const
317 static string t("none");
322 string MathInset::name() const
328 string asString(MathArray const & ar)
330 std::ostringstream os;
337 MathArray asArray(string const & str)
340 mathed_parse_cell(ar, str);
345 Dialogs * getDialogs()
347 return mathcursor->formula()->view()->owner()->getDialogs();
351 LyXFunc * getLyXFunc()
353 return mathcursor->formula()->view()->owner()->getLyXFunc();