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