]> git.lyx.org Git - lyx.git/blob - src/mathed/math_unknowninset.C
Jean-Marc's fix for wrong descent
[lyx.git] / src / mathed / math_unknowninset.C
1 #include <config.h>
2
3
4 #include "math_unknowninset.h"
5 #include "math_support.h"
6 #include "math_mathmlstream.h"
7 #include "math_streamstr.h"
8
9
10 MathUnknownInset::MathUnknownInset(string const & nm, bool final, bool black)
11         : name_(nm), final_(final), black_(black)
12 {}
13
14
15 MathInset * MathUnknownInset::clone() const
16 {
17         return new MathUnknownInset(*this);
18 }
19
20
21 string MathUnknownInset::name() const
22 {
23         return name_;
24 }
25
26
27 void MathUnknownInset::setName(string const & name)
28 {
29         name_ = name;
30 }
31
32
33 bool MathUnknownInset::match(MathAtom const & at) const
34 {
35         MathUnknownInset const * q = at->asUnknownInset();
36         return q && name_ == q->name_;
37 }
38
39
40 void MathUnknownInset::normalize(NormalStream & os) const
41 {
42         os << "[unknown " << name_ << ']';
43 }
44
45
46 void MathUnknownInset::metrics(MathMetricsInfo & mi) const
47 {
48         mathed_string_dim(mi.base.font, name_, dim_);
49 }
50
51
52 void MathUnknownInset::draw(MathPainterInfo & pi, int x, int y) const
53 {
54         if (black_)
55                 drawStrBlack(pi, x, y, name_);
56         else
57                 drawStrRed(pi, x, y, name_);
58 }
59
60
61 void MathUnknownInset::finalize()
62 {
63         final_ = true;
64 }
65
66
67 bool MathUnknownInset::final() const
68 {
69         return final_;
70 }
71
72
73 void MathUnknownInset::maple(MapleStream & os) const
74 {
75         os << name_;
76 }
77
78 void MathUnknownInset::mathematica(MathematicaStream & os) const
79 {
80         os << name_;
81 }
82
83
84 void MathUnknownInset::mathmlize(MathMLStream & os) const
85 {
86         os << MTag("mi") << name_ << ETag("mi");
87 }
88
89
90 void MathUnknownInset::octave(OctaveStream & os) const
91 {
92         os << name_;
93 }