]> git.lyx.org Git - lyx.git/blob - src/mathed/math_sizeinset.C
the convert patch
[lyx.git] / src / mathed / math_sizeinset.C
1 /**
2  * \file math_sizeinset.C
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 "math_sizeinset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_parser.h"
17 #include "math_streamstr.h"
18
19 #include "support/convert.h"
20 #include "support/std_ostream.h"
21
22 using std::auto_ptr;
23
24
25 MathSizeInset::MathSizeInset(latexkeys const * l)
26         : MathNestInset(1), key_(l), style_(Styles(convert<int>(l->extra)))
27 {}
28
29
30 auto_ptr<InsetBase> MathSizeInset::doClone() const
31 {
32         return auto_ptr<InsetBase>(new MathSizeInset(*this));
33 }
34
35
36 void MathSizeInset::metrics(MetricsInfo & mi, Dimension & dim) const
37 {
38         StyleChanger dummy(mi.base, style_);
39         cell(0).metrics(mi, dim);
40         metricsMarkers(dim);
41         dim_ = dim;
42 }
43
44
45 void MathSizeInset::draw(PainterInfo & pi, int x, int y) const
46 {
47         StyleChanger dummy(pi.base, style_);
48         cell(0).draw(pi, x + 1, y);
49         drawMarkers(pi, x, y);
50 }
51
52
53 void MathSizeInset::write(WriteStream & os) const
54 {
55         os << "{\\" << key_->name << ' ' << cell(0) << '}';
56 }
57
58
59 void MathSizeInset::normalize(NormalStream & os) const
60 {
61         os << '[' << key_->name << ' ' << cell(0) << ']';
62 }
63
64
65 void MathSizeInset::infoize(std::ostream & os) const
66 {
67         os << "Size: " << key_->name;
68 }