]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathSize.cpp
rename MathArray into MathData
[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 using std::auto_ptr;
25
26
27 InsetMathSize::InsetMathSize(latexkeys const * l)
28         : InsetMathNest(1), key_(l), style_(Styles(convert<int>(l->extra)))
29 {}
30
31
32 auto_ptr<InsetBase> InsetMathSize::doClone() const
33 {
34         return auto_ptr<InsetBase>(new InsetMathSize(*this));
35 }
36
37
38 bool InsetMathSize::metrics(MetricsInfo & mi, Dimension & dim) const
39 {
40         StyleChanger dummy(mi.base, style_);
41         cell(0).metrics(mi, dim);
42         metricsMarkers(dim);
43         if (dim_ == dim)
44                 return false;
45         dim_ = dim;
46         return true;
47 }
48
49
50 void InsetMathSize::draw(PainterInfo & pi, int x, int y) const
51 {
52         StyleChanger dummy(pi.base, style_);
53         cell(0).draw(pi, x + 1, y);
54         drawMarkers(pi, x, y);
55 }
56
57
58 void InsetMathSize::write(WriteStream & os) const
59 {
60         os << "{\\" << key_->name << ' ' << cell(0) << '}';
61 }
62
63
64 void InsetMathSize::normalize(NormalStream & os) const
65 {
66         os << '[' << key_->name << ' ' << cell(0) << ']';
67 }
68
69
70 void InsetMathSize::infoize(odocstream & os) const
71 {
72         os << "Size: " << key_->name;
73 }
74
75
76 } // namespace lyx