+#include <config.h>
+
#ifdef __GNUG__
#pragma implementation
#endif
#include "math_funcinset.h"
#include "font.h"
#include "Painter.h"
-#include "mathed/support.h"
-#include "support/LOstream.h"
-
+#include "math_support.h"
+#include "math_mathmlstream.h"
+#include "math_streamstr.h"
-using std::ostream;
extern LyXFont WhichFont(short type, int size);
MathFuncInset::MathFuncInset(string const & nm)
- : MathInset(0, nm)
+ : name_(nm)
{}
}
-void MathFuncInset::write(std::ostream & os, bool /* fragile */) const
+string const & MathFuncInset::name() const
{
- os << "\\" << name_ << ' ';
+ return name_;
}
-void MathFuncInset::writeNormal(std::ostream & os) const
+void MathFuncInset::setName(string const & n)
{
- os << "[" << name_ << "] ";
+ name_ = n;
}
-void MathFuncInset::metrics(MathStyles st)
+void MathFuncInset::metrics(MathMetricsInfo const & mi) const
{
- size_ = st;
- if (name_.empty())
- mathed_char_dim(LM_TC_TEXTRM, size_, 'I', ascent_, descent_, width_);
- else
- mathed_string_dim(LM_TC_TEXTRM, size_, name_, ascent_, descent_, width_);
+ mi_ = mi;
+ mathed_string_dim(LM_TC_TEXTRM, mi_, name_, ascent_, descent_, width_);
}
-void MathFuncInset::draw(Painter & pain, int x, int y)
+void MathFuncInset::draw(Painter & pain, int x, int y) const
{
- xo(x);
- yo(y);
- if (name_.empty())
- drawChar(pain, LM_TC_TEXTRM, size_, x, y, ' ');
- else
- drawStr(pain, LM_TC_TEXTRM, size_, x, y, name_);
+ drawStr(pain, LM_TC_TEXTRM, mi_, x, y, name_);
+}
+
+
+bool MathFuncInset::match(MathInset * p) const
+{
+ MathFuncInset const * q = p->asFuncInset();
+ return q && name_ == q->name_;
+}
+
+
+void MathFuncInset::maplize(MapleStream & os) const
+{
+ os << ' ' << name_;
+}
+
+
+void MathFuncInset::mathmlize(MathMLStream & os) const
+{
+ os << MTag("mi") << name_ << ETag("mi");
+}
+
+
+void MathFuncInset::octavize(OctaveStream & os) const
+{
+ os << ' ' << name_;
+}
+
+
+void MathFuncInset::normalize(NormalStream & os) const
+{
+ os << "[func " << name_ << ']';
+}
+
+
+void MathFuncInset::write(WriteStream & os) const
+{
+ os << "\\" << name_ << ' ';
}