]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathUnknown.cpp
92d6b416e1fe31ef2c894c5f74447bee6d970527
[lyx.git] / src / mathed / InsetMathUnknown.cpp
1 /**
2  * \file InsetMathUnknown.cpp
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
15 #include "MathSupport.h"
16 #include "MathAtom.h"
17 #include "MathStream.h"
18
19 #include "MetricsInfo.h"
20
21 #include "frontends/Painter.h"
22
23
24 namespace lyx {
25
26 InsetMathUnknown::InsetMathUnknown(docstring const & name,
27         docstring const & selection, bool final, bool black)
28         : name_(name), final_(final), black_(black), kerning_(0),
29           selection_(selection)
30 {}
31
32
33 docstring InsetMathUnknown::name() const
34 {
35         return name_;
36 }
37
38
39 void InsetMathUnknown::setName(docstring const & name)
40 {
41         name_ = name;
42 }
43
44
45 void InsetMathUnknown::normalize(NormalStream & os) const
46 {
47         os << "[unknown " << name_ << ']';
48 }
49
50
51 void InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
52 {
53         metricsStrRedBlack(mi, dim, name_);
54         docstring::const_reverse_iterator rit = name_.rbegin();
55         kerning_ = mathed_char_kerning(mi.base.font, *rit);
56 }
57
58
59 void InsetMathUnknown::draw(PainterInfo & pi, int x, int y) const
60 {
61         if (black_)
62                 drawStrBlack(pi, x, y, name_);
63         else
64                 drawStrRed(pi, x, y, name_);
65 }
66
67
68 void InsetMathUnknown::finalize()
69 {
70         final_ = true;
71 }
72
73
74 bool InsetMathUnknown::final() const
75 {
76         return final_;
77 }
78
79
80 void InsetMathUnknown::maple(MapleStream & os) const
81 {
82         os << name_;
83 }
84
85
86 void InsetMathUnknown::mathematica(MathematicaStream & os) const
87 {
88         os << name_;
89 }
90
91
92 void InsetMathUnknown::mathmlize(MathMLStream &) const
93 {
94         throw MathExportException();
95 }
96
97
98 void InsetMathUnknown::htmlize(HtmlStream &) const
99 {
100         throw MathExportException();
101 }
102
103
104 void InsetMathUnknown::octave(OctaveStream & os) const
105 {
106         os << name_;
107 }
108
109
110 } // namespace lyx