]> git.lyx.org Git - lyx.git/blob - src/mathed/math_funcinset.C
6f24b2f475aa71d1f854af46be3ea6951d19ca5e
[lyx.git] / src / mathed / math_funcinset.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "math_funcinset.h"
8 #include "font.h"
9 #include "Painter.h"
10 #include "math_support.h"
11 #include "math_mathmlstream.h"
12 #include "math_streamstr.h"
13
14
15 extern LyXFont WhichFont(short type, int size);
16
17
18 MathFuncInset::MathFuncInset(string const & nm)
19         : name_(nm)
20 {}
21
22
23 MathInset * MathFuncInset::clone() const
24 {
25         return new MathFuncInset(*this);
26 }
27
28
29 string const & MathFuncInset::name() const
30 {
31         return name_;
32 }
33
34
35 void MathFuncInset::setName(string const & n)
36 {
37         name_ = n;
38 }
39
40
41 void MathFuncInset::metrics(MathMetricsInfo const & mi) const
42 {
43         whichFont(font_, LM_TC_TEXTRM, mi);
44         mathed_string_dim(font_, name_, ascent_, descent_, width_);
45 }
46
47
48 void MathFuncInset::draw(Painter & pain, int x, int y) const
49 {
50         drawStr(pain, font_, x, y, name_);
51 }
52
53
54 bool MathFuncInset::match(MathInset * p) const
55 {
56         MathFuncInset const * q = p->asFuncInset();
57         return q && name_ == q->name_;
58 }
59
60
61 void MathFuncInset::maplize(MapleStream & os) const
62 {
63         os << ' ' << name_;
64 }
65
66
67 void MathFuncInset::mathmlize(MathMLStream & os) const
68 {
69         os << MTag("mi") << name_ << ETag("mi");
70 }
71
72
73 void MathFuncInset::octavize(OctaveStream & os) const
74 {
75         os << ' ' << name_;
76 }
77
78
79 void MathFuncInset::normalize(NormalStream & os) const
80 {
81         os << "[func " << name_ << ']';
82 }
83
84
85 void MathFuncInset::write(WriteStream & os) const
86 {
87         os << "\\" << name_ << ' ';
88 }