]> git.lyx.org Git - lyx.git/blob - src/mathed/math_exfuncinset.C
make 'det' partially work for math-extern
[lyx.git] / src / mathed / math_exfuncinset.C
1 #include <config.h>
2
3 #include "math_exfuncinset.h"
4 #include "math_support.h"
5 #include "math_mathmlstream.h"
6 #include "math_streamstr.h"
7
8
9 MathExFuncInset::MathExFuncInset(string const & name)
10         : MathNestInset(1), name_(name)
11 {}
12
13
14 MathExFuncInset::MathExFuncInset(string const & name, MathArray const & ar)
15         : MathNestInset(1), name_(name)
16 {
17         cell(0) = ar;
18 }
19
20
21 MathInset * MathExFuncInset::clone() const
22 {
23         return new MathExFuncInset(*this);
24 }
25
26
27 void MathExFuncInset::metrics(MathMetricsInfo & mi) const
28 {
29         mathed_string_dim(mi.base.font, name_, ascent_, descent_, width_);
30 }
31
32
33 void MathExFuncInset::draw(MathPainterInfo & pi, int x, int y) const
34 {
35         drawStrBlack(pi, x, y, name_);
36 }
37
38
39 void MathExFuncInset::normalize(NormalStream & os) const
40 {
41         os << '[' << name_ << ' ' << cell(0) << ']';
42 }
43
44
45 void MathExFuncInset::maplize(MapleStream & os) const
46 {
47         if (name_ == "det")
48                 os << "linalg[det](" << cell(0) << ')';
49         else
50                 os << name_ << '(' << cell(0) << ')';
51 }
52
53
54 void MathExFuncInset::mathmlize(MathMLStream & os) const
55 {
56         os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str());
57 }
58
59
60 void MathExFuncInset::octavize(OctaveStream & os) const
61 {
62         os << name_ << '(' << cell(0) << ')';
63 }
64
65
66 void MathExFuncInset::write(WriteStream & os) const
67 {
68         os << '\\' << name_ << '{' << cell(0) << '}';
69 }