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