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