]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathUnknown.C
This commit fixes a crash when accessing a math inset. This was due to an invalid...
[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 "MathMLStream.h"
17 #include "MathStream.h"
18
19 using std::string;
20 using std::auto_ptr;
21
22
23 InsetMathUnknown::InsetMathUnknown(string const & nm, bool final, bool black)
24         : name_(nm), final_(final), black_(black)
25 {}
26
27
28 auto_ptr<InsetBase> InsetMathUnknown::doClone() const
29 {
30         return auto_ptr<InsetBase>(new InsetMathUnknown(*this));
31 }
32
33
34 string InsetMathUnknown::name() const
35 {
36         return name_;
37 }
38
39
40 void InsetMathUnknown::setName(string const & name)
41 {
42         name_ = name;
43 }
44
45
46 void InsetMathUnknown::normalize(NormalStream & os) const
47 {
48         os << "[unknown " << name_ << ']';
49 }
50
51
52 void InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
53 {
54         // FIXME UNICODE
55         mathed_string_dim(mi.base.font, lyx::from_utf8(name_), dim);
56         dim_ = dim;
57 }
58
59
60 void InsetMathUnknown::draw(PainterInfo & pi, int x, int y) const
61 {
62         // FIXME UNICODE
63         if (black_)
64                 drawStrBlack(pi, x, y, lyx::from_utf8(name_));
65         else
66                 drawStrRed(pi, x, y, lyx::from_utf8(name_));
67         setPosCache(pi, x, y);
68 }
69
70
71 void InsetMathUnknown::finalize()
72 {
73         final_ = true;
74 }
75
76
77 bool InsetMathUnknown::final() const
78 {
79         return final_;
80 }
81
82
83 void InsetMathUnknown::maple(MapleStream & os) const
84 {
85         os << name_;
86 }
87
88
89 void InsetMathUnknown::mathematica(MathematicaStream & os) const
90 {
91         os << name_;
92 }
93
94
95 void InsetMathUnknown::mathmlize(MathMLStream & os) const
96 {
97         os << MTag("mi") << name_ << ETag("mi");
98 }
99
100
101 void InsetMathUnknown::octave(OctaveStream & os) const
102 {
103         os << name_;
104 }