]> git.lyx.org Git - lyx.git/blob - src/mathed/math_unknowninset.C
several smallish changes/bugfixes/left overs from Porto
[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 "math_support.h"
9 #include "math_mathmlstream.h"
10 #include "math_streamstr.h"
11
12
13 MathUnknownInset::MathUnknownInset(string const & nm, bool final, bool black)
14         : name_(nm), final_(final), black_(black)
15 {}
16
17
18 MathInset * MathUnknownInset::clone() const
19 {
20         return new MathUnknownInset(*this);
21 }
22
23
24 string const & MathUnknownInset::name() const
25 {
26         return name_;
27 }
28
29
30 string & MathUnknownInset::name()
31 {
32         return name_;
33 }
34
35
36 bool MathUnknownInset::match(MathInset * p) const
37 {
38         MathUnknownInset const * q = p->asUnknownInset();
39         return q && name_ == q->name_;
40 }
41
42
43 void MathUnknownInset::write(WriteStream & os) const
44 {
45         os << "\\" << name_ << ' ';
46 }
47
48
49 void MathUnknownInset::normalize(NormalStream & os) const
50 {
51         os << "[unknown " << name_ << ']';
52 }
53
54
55 void MathUnknownInset::metrics(MathMetricsInfo & mi) const
56 {
57         mathed_string_dim(mi.base.font, name_, ascent_, descent_, width_);
58 }
59
60
61 void MathUnknownInset::draw(MathPainterInfo & pi, int x, int y) const
62 {
63         if (black_)
64                 drawStrBlack(pi, x, y, name_);
65         else
66                 drawStrRed(pi, x, y, name_);
67 }
68
69
70 void MathUnknownInset::finalize()
71 {
72         final_ = true;
73 }
74
75
76 bool MathUnknownInset::final() const
77 {
78         return final_;
79 }
80
81
82 void MathUnknownInset::maplize(MapleStream & os) const
83 {
84         os << name_;
85 }
86
87
88 void MathUnknownInset::mathmlize(MathMLStream & os) const
89 {
90         os << MTag("mi") << name_ << ETag("mi");
91 }
92
93
94 void MathUnknownInset::octavize(OctaveStream & os) const
95 {
96         os << name_;
97 }