]> git.lyx.org Git - lyx.git/blob - src/mathed/math_unknowninset.C
lyxfont.h no longer #includes LColor.h.
[lyx.git] / src / mathed / math_unknowninset.C
1 /**
2  * \file math_unknowninset.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "math_unknowninset.h"
14 #include "math_support.h"
15 #include "math_atom.h"
16 #include "math_mathmlstream.h"
17 #include "math_streamstr.h"
18
19 using std::auto_ptr;
20
21
22 MathUnknownInset::MathUnknownInset(string const & nm, bool final, bool black)
23         : name_(nm), final_(final), black_(black)
24 {}
25
26
27 auto_ptr<InsetBase> MathUnknownInset::clone() const
28 {
29         return auto_ptr<InsetBase>(new MathUnknownInset(*this));
30 }
31
32
33 string MathUnknownInset::name() const
34 {
35         return name_;
36 }
37
38
39 void MathUnknownInset::setName(string const & name)
40 {
41         name_ = name;
42 }
43
44
45 bool MathUnknownInset::match(MathAtom const & at) const
46 {
47         MathUnknownInset const * q = at->asUnknownInset();
48         return q && name_ == q->name_;
49 }
50
51
52 void MathUnknownInset::normalize(NormalStream & os) const
53 {
54         os << "[unknown " << name_ << ']';
55 }
56
57
58 void MathUnknownInset::metrics(MetricsInfo & mi, Dimension & dim) const
59 {
60         mathed_string_dim(mi.base.font, name_, dim);
61 }
62
63
64 void MathUnknownInset::draw(PainterInfo & pi, int x, int y) const
65 {
66         if (black_)
67                 drawStrBlack(pi, x, y, name_);
68         else
69                 drawStrRed(pi, x, y, name_);
70 }
71
72
73 void MathUnknownInset::finalize()
74 {
75         final_ = true;
76 }
77
78
79 bool MathUnknownInset::final() const
80 {
81         return final_;
82 }
83
84
85 void MathUnknownInset::maple(MapleStream & os) const
86 {
87         os << name_;
88 }
89
90 void MathUnknownInset::mathematica(MathematicaStream & os) const
91 {
92         os << name_;
93 }
94
95
96 void MathUnknownInset::mathmlize(MathMLStream & os) const
97 {
98         os << MTag("mi") << name_ << ETag("mi");
99 }
100
101
102 void MathUnknownInset::octave(OctaveStream & os) const
103 {
104         os << name_;
105 }