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.
21 #include "math_inset.h"
23 #include "math_scriptinset.h"
24 #include "math_mathmlstream.h"
25 #include "math_cursor.h"
26 #include "math_parser.h"
29 #include "frontends/LyXView.h"
30 #include "frontends/Dialogs.h"
31 #include "BufferView.h"
32 #include "formulabase.h"
37 int MathInset::height() const
39 return ascent() + descent();
43 MathInset::size_type MathInset::nargs() const
49 Dimension MathInset::dimensions() const
51 lyxerr << "call MathInset::dimensions()\n";
52 return Dimension(width(), ascent(), descent());
58 MathArray & MathInset::cell(idx_type)
60 lyxerr << "I don't have a cell 1\n";
65 MathArray const & MathInset::cell(idx_type) const
67 lyxerr << "I don't have a cell 2\n";
72 MathInset::idx_type MathInset::index(row_type row, col_type col) const
75 lyxerr << "illegal row: " << row << "\n";
77 lyxerr << "illegal col: " << col << "\n";
81 void MathInset::substitute(MathMacro const &)
85 bool MathInset::idxNext(idx_type &, pos_type &) const
91 bool MathInset::idxRight(idx_type &, pos_type &) const
97 bool MathInset::idxPrev(idx_type &, pos_type &) const
103 bool MathInset::idxLeft(idx_type &, pos_type &) const
109 bool MathInset::idxUpDown(idx_type &, pos_type &, bool, int) const
115 bool MathInset::idxFirst(idx_type &, pos_type &) const
121 bool MathInset::idxLast(idx_type &, pos_type &) const
127 bool MathInset::idxHome(idx_type &, pos_type &) const
133 bool MathInset::idxEnd(idx_type &, pos_type &) const
139 void MathInset::getPos(idx_type, pos_type, int & x, int & y) const
141 lyxerr << "MathInset::getPos() called directly!\n";
146 void MathInset::dump() const
148 lyxerr << "---------------------------------------------\n";
149 WriteStream wi(lyxerr, false, true);
151 lyxerr << "\n---------------------------------------------\n";
155 bool MathInset::idxBetween(idx_type idx, idx_type from, idx_type to) const
157 return from <= idx && idx <= to;
161 void MathInset::metrics(MathMetricsInfo &) const
163 lyxerr << "MathInset::metrics() called directly!\n";
167 void MathInset::draw(MathPainterInfo &, int, int) const
169 lyxerr << "MathInset::draw() called directly!\n";
173 void MathInset::drawSelection(MathPainterInfo &,
174 idx_type, pos_type, idx_type, pos_type) const
176 lyxerr << "MathInset::drawSelection() called directly!\n";
180 void MathInset::metricsT(TextMetricsInfo const &) const
183 lyxerr << "MathInset::metricsT(Text) called directly!\n";
188 void MathInset::drawT(TextPainter &, int, int) const
191 lyxerr << "MathInset::drawT(Text) called directly!\n";
197 void MathInset::write(WriteStream & os) const
199 os << '\\' << name().c_str();
200 os.pendingSpace(true);
204 void MathInset::normalize(NormalStream & os) const
206 os << '[' << name().c_str() << "] ";
210 void MathInset::octavize(OctaveStream & os) const
212 NormalStream ns(os.os());
217 void MathInset::maplize(MapleStream & os) const
219 NormalStream ns(os.os());
224 void MathInset::maximize(MaximaStream & os) const
226 MapleStream ns(os.os());
231 void MathInset::mathematicize(MathematicaStream & os) const
233 NormalStream ns(os.os());
238 void MathInset::mathmlize(MathMLStream & os) const
240 NormalStream ns(os.os());
245 int MathInset::ascii(std::ostream &, int) const
251 int MathInset::linuxdoc(std::ostream &) const
257 int MathInset::docbook(std::ostream &, bool) const
263 MathInset::result_type
264 MathInset::dispatch(FuncRequest const &, idx_type &, pos_type &)
270 string const & MathInset::getType() const
272 static string t("none");
277 string MathInset::name() const
283 string asString(MathArray const & ar)
285 std::ostringstream os;
288 return STRCONV(os.str());
292 MathArray asArray(string const & str)
295 mathed_parse_cell(ar, str);
300 ostream & operator<<(ostream & os, MathAtom const & at)
302 WriteStream wi(os, false, false);
308 Dialogs & getDialogs()
310 return mathcursor->formula()->view()->owner()->getDialogs();