]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathUnknown.C
302c913829a266906e87611b3a3f7d54781ffb17
[lyx.git] / src / mathed / InsetMathUnknown.C
1 /**
2  * \file InsetMathUnknown.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 "InsetMathUnknown.h"
14 #include "MathSupport.h"
15 #include "MathAtom.h"
16 #include "MathStream.h"
17 #include "MathStream.h"
18
19
20 namespace lyx {
21
22 using std::string;
23 using std::auto_ptr;
24 using std::vector;
25
26
27 InsetMathUnknown::InsetMathUnknown(docstring const & nm, bool final, bool black)
28         : name_(nm), final_(final), black_(black)
29 {}
30
31
32 auto_ptr<InsetBase> InsetMathUnknown::doClone() const
33 {
34         return auto_ptr<InsetBase>(new InsetMathUnknown(*this));
35 }
36
37
38 docstring InsetMathUnknown::name() const
39 {
40         return name_;
41 }
42
43
44 void InsetMathUnknown::setName(docstring const & name)
45 {
46         name_ = name;
47 }
48
49
50 void InsetMathUnknown::normalize(NormalStream & os) const
51 {
52         os << "[unknown " << name_ << ']';
53 }
54
55
56 bool InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
57 {
58         mathed_string_dim(mi.base.font, name_, dim);
59         if (dim_ == dim)
60                 return false;
61         dim_ = dim;
62         return true;
63 }
64
65
66 void InsetMathUnknown::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         setPosCache(pi, x, y);
73 }
74
75
76 void InsetMathUnknown::finalize()
77 {
78         final_ = true;
79 }
80
81
82 bool InsetMathUnknown::final() const
83 {
84         return final_;
85 }
86
87
88 void InsetMathUnknown::maple(MapleStream & os) const
89 {
90         os << name_;
91 }
92
93
94 void InsetMathUnknown::mathematica(MathematicaStream & os) const
95 {
96         os << name_;
97 }
98
99
100 void InsetMathUnknown::mathmlize(MathStream & os) const
101 {
102         os << MTag("mi") << name_ << ETag("mi");
103 }
104
105
106 void InsetMathUnknown::octave(OctaveStream & os) const
107 {
108         os << name_;
109 }
110
111
112 } // namespace lyx