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