]> git.lyx.org Git - lyx.git/blob - src/mathed/math_fboxinset.C
Strip out redundant #includes
[lyx.git] / src / mathed / math_fboxinset.C
1 /**
2  * \file math_fboxinset.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_fboxinset.h"
14 #include "math_mathmlstream.h"
15 #include "math_streamstr.h"
16 #include "math_parser.h"
17 #include "frontends/Painter.h"
18
19 using std::auto_ptr;
20
21
22 MathFboxInset::MathFboxInset(latexkeys const * key)
23         : MathNestInset(1), key_(key)
24 {}
25
26
27 auto_ptr<InsetBase> MathFboxInset::clone() const
28 {
29         return auto_ptr<InsetBase>(new MathFboxInset(*this));
30 }
31
32
33 MathInset::mode_type MathFboxInset::currentMode() const
34 {
35         if (key_->name == "fbox")
36                 return TEXT_MODE;
37         return MATH_MODE;
38 }
39
40
41 void MathFboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
42 {
43         if (key_->name == "fbox") {
44                 FontSetChanger dummy(mi.base, "textnormal");
45                 cell(0).metrics(mi, dim_);
46         } else {
47                 cell(0).metrics(mi, dim_);
48         }
49         metricsMarkers(5); // 5 pixels margin
50         dim = dim_;
51 }
52
53
54 void MathFboxInset::draw(PainterInfo & pi, int x, int y) const
55 {
56         pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
57                 dim_.width() - 2, dim_.height() - 2, LColor::foreground);
58         if (key_->name == "fbox") {
59                 FontSetChanger dummy(pi.base, "textnormal");
60                 cell(0).draw(pi, x + 5, y);
61         } else {
62                 cell(0).draw(pi, x + 5, y);
63         }
64 }
65
66
67 void MathFboxInset::write(WriteStream & os) const
68 {
69         os << '\\' << key_->name << '{' << cell(0) << '}';
70 }
71
72
73 void MathFboxInset::normalize(NormalStream & os) const
74 {
75         os << '[' << key_->name << ' ' << cell(0) << ']';
76 }