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