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