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