]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathSize.cpp
Fulfill promise to Andre: TextClass_ptr --> TextClassPtr.
[lyx.git] / src / mathed / InsetMathSize.cpp
1 /**
2  * \file InsetMathSize.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 "InsetMathSize.h"
14 #include "MathData.h"
15 #include "MathParser.h"
16 #include "MathStream.h"
17
18 #include "support/convert.h"
19 #include "support/std_ostream.h"
20
21
22 namespace lyx {
23
24 InsetMathSize::InsetMathSize(latexkeys const * l)
25         : InsetMathNest(1), key_(l), style_(Styles(convert<int>(l->extra)))
26 {}
27
28
29 Inset * InsetMathSize::clone() const
30 {
31         return new InsetMathSize(*this);
32 }
33
34
35 bool InsetMathSize::metrics(MetricsInfo & mi, Dimension & dim) const
36 {
37         StyleChanger dummy(mi.base, style_);
38         cell(0).metrics(mi, dim);
39         metricsMarkers(dim);
40         if (dim_ == dim)
41                 return false;
42         dim_ = dim;
43         return true;
44 }
45
46
47 void InsetMathSize::draw(PainterInfo & pi, int x, int y) const
48 {
49         StyleChanger dummy(pi.base, style_);
50         cell(0).draw(pi, x + 1, y);
51         drawMarkers(pi, x, y);
52 }
53
54
55 void InsetMathSize::write(WriteStream & os) const
56 {
57         os << "{\\" << key_->name << ' ' << cell(0) << '}';
58 }
59
60
61 void InsetMathSize::normalize(NormalStream & os) const
62 {
63         os << '[' << key_->name << ' ' << cell(0) << ']';
64 }
65
66
67 void InsetMathSize::infoize(odocstream & os) const
68 {
69         os << "Size: " << key_->name;
70 }
71
72
73 } // namespace lyx