* the GNU General Public Licence version 2 or later.
*/
-#include <config.h>
-
#ifdef __GNUG__
#pragma implementation
#endif
-#include "math_iter.h"
+#include <config.h>
+
+#include "Lsstream.h"
#include "math_inset.h"
-#include "symbol_def.h"
-#include "lyxfont.h"
-#include "mathed/support.h"
-#include "Painter.h"
+#include "math_scriptinset.h"
+#include "math_mathmlstream.h"
+#include "debug.h"
-// Initialize some static class variables.
-int MathedInset::df_asc;
-int MathedInset::df_des;
-int MathedInset::df_width;
-int MathedInset::workWidth;
+int MathInset::height() const
+{
+ return ascent() + descent();
+}
+
+std::ostream & operator<<(std::ostream & os, MathInset const & inset)
+{
+ WriteStream wi(os, false);
+ inset.write(wi);
+ return os;
+}
-MathedInset::MathedInset(string const & nm, short ot, short st)
- : name(nm), objtype(ot), width(0), ascent(0), descent(0), size_(st)
+
+MathInset::size_type MathInset::nargs() const
+{
+ return 0;
+}
+
+
+MathXArray dummyCell;
+
+MathXArray & MathInset::xcell(idx_type)
+{
+ lyxerr << "I don't have a cell 1\n";
+ return dummyCell;
+}
+
+
+MathXArray const & MathInset::xcell(idx_type) const
+{
+ lyxerr << "I don't have a cell 2\n";
+ return dummyCell;
+}
+
+
+MathArray & MathInset::cell(idx_type)
+{
+ lyxerr << "I don't have a cell 3\n";
+ return dummyCell.data_;
+}
+
+
+MathArray const & MathInset::cell(idx_type) const
+{
+ lyxerr << "I don't have a cell 4\n";
+ return dummyCell.data_;
+}
+
+
+MathInset::idx_type MathInset::index(row_type row, col_type col) const
+{
+ if (row != 0)
+ lyxerr << "illegal row: " << row << "\n";
+ if (col != 0)
+ lyxerr << "illegal col: " << col << "\n";
+ return 0;
+}
+
+void MathInset::substitute(MathMacro const &)
{}
-// In a near future maybe we use a better fonts renderer
-void MathedInset::drawStr(Painter & pain, short type, int siz,
- int x, int y, string const & s)
+bool MathInset::idxNext(idx_type &, pos_type &) const
+{
+ return false;
+}
+
+
+bool MathInset::idxRight(idx_type &, pos_type &) const
+{
+ return false;
+}
+
+
+bool MathInset::idxPrev(idx_type &, pos_type &) const
{
- string st;
- if (MathIsBinary(type))
- for (string::const_iterator it = s.begin();
- it != s.end(); ++it) {
- st += ' ';
- st += *it;
- st += ' ';
- }
- else
- st = s;
-
- LyXFont const mf = mathed_get_font(type, siz);
- pain.text(x, y, st, mf);
+ return false;
}
-int MathedInset::Ascent() const
+bool MathInset::idxLeft(idx_type &, pos_type &) const
{
- return ascent;
+ return false;
}
-int MathedInset::Descent() const
+bool MathInset::idxUp(idx_type &) const
{
- return descent;
+ return false;
}
-int MathedInset::Width() const
+bool MathInset::idxDown(idx_type &) const
{
- return width;
+ return false;
}
-int MathedInset::Height() const
+bool MathInset::idxFirst(idx_type &, pos_type &) const
{
- return ascent + descent;
+ return false;
}
-bool MathedInset::GetLimits() const
+bool MathInset::idxLast(idx_type &, pos_type &) const
{
return false;
}
-void MathedInset::SetLimits(bool) {}
+bool MathInset::idxHome(idx_type &, pos_type &) const
+{
+ return false;
+}
-string const & MathedInset::GetName() const
+bool MathInset::idxEnd(idx_type &, pos_type &) const
{
- return name;
+ return false;
}
-short MathedInset::GetType() const
+void MathInset::idxDelete(idx_type &, bool & popit, bool & deleteit)
{
- return objtype;
+ popit = false;
+ deleteit = false;
}
-short MathedInset::GetStyle() const
+void MathInset::idxDeleteRange(idx_type, idx_type)
+{}
+
+
+void MathInset::normalize(NormalStream & os) const
{
- return size_;
+ os << "[unknown ";
+ WriteStream wi(os.os(), false);
+ write(wi);
+ os << "] ";
}
-void MathedInset::SetType(short t)
+void MathInset::dump() const
{
- objtype = t;
+ lyxerr << "---------------------------------------------\n";
+ WriteStream wi(lyxerr, false);
+ write(wi);
+ lyxerr << "\n---------------------------------------------\n";
}
-void MathedInset::SetStyle(short st)
+void MathInset::validate(LaTeXFeatures &) const
+{}
+
+
+std::vector<MathInset::idx_type>
+ MathInset::idxBetween(idx_type from, idx_type to) const
{
- size_ = st;
+ std::vector<idx_type> res;
+ for (idx_type i = from; i <= to; ++i)
+ res.push_back(i);
+ return res;
}
-void MathedInset::SetName(string const & n)
+void MathInset::metrics(MathMetricsInfo const &) const
{
- name = n;
+ lyxerr << "MathInset::metrics() called directly!\n";
}
-void MathedInset::defaultAscent(int da)
+void MathInset::draw(Painter &, int, int) const
{
- df_asc = da;
+ lyxerr << "MathInset::draw() called directly!\n";
}
+void MathInset::write(WriteStream &) const
+{
+ lyxerr << "MathInset::write() called directly!\n";
+}
+
-void MathedInset::defaultDescent(int dd)
+void MathInset::octavize(OctaveStream & os) const
{
- df_des = dd;
+ NormalStream ns(os.os());
+ normalize(ns);
}
-void MathedInset::defaultWidth(int dw)
+void MathInset::maplize(MapleStream & os) const
{
- df_width = dw;
+ NormalStream ns(os.os());
+ normalize(ns);
}
+
+void MathInset::mathmlize(MathMLStream & os) const
+{
+ NormalStream ns(os.os());
+ normalize(ns);
+}