]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathFBox.C
do not create invalid .lyx files when importing \i{}, \j{}, \l{} or \L{}.
[lyx.git] / src / mathed / InsetMathFBox.C
1 /**
2  * \file InsetMathFBox.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 "InsetMathFBox.h"
14 #include "MathData.h"
15 #include "MathStream.h"
16 #include "MathParser.h"
17 #include "MathStream.h"
18 #include "LColor.h"
19
20 #include "support/std_ostream.h"
21 #include "frontends/Painter.h"
22
23
24 namespace lyx {
25
26 using std::auto_ptr;
27
28
29 InsetMathFBox::InsetMathFBox()
30         : InsetMathNest(1)
31 {}
32
33
34 auto_ptr<InsetBase> InsetMathFBox::doClone() const
35 {
36         return auto_ptr<InsetBase>(new InsetMathFBox(*this));
37 }
38
39
40 InsetMath::mode_type InsetMathFBox::currentMode() const
41 {
42         return TEXT_MODE;
43 }
44
45
46 bool InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const
47 {
48         FontSetChanger dummy(mi.base, "textnormal");
49         cell(0).metrics(mi, dim);
50         metricsMarkers(dim, 3); // 1 pixel space, 1 frame, 1 space
51         if (dim_ == dim)
52                 return false;
53         dim_ = dim;
54         return true;
55 }
56
57
58 void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const
59 {
60         pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
61                 dim_.width() - 2, dim_.height() - 2, LColor::foreground);
62         FontSetChanger dummy(pi.base, "textnormal");
63         cell(0).draw(pi, x + 3, y);
64         setPosCache(pi, x, y);
65 }
66
67
68 void InsetMathFBox::write(WriteStream & os) const
69 {
70         os << "\\fbox{" << cell(0) << '}';
71 }
72
73
74 void InsetMathFBox::normalize(NormalStream & os) const
75 {
76         os << "[fbox " << cell(0) << ']';
77 }
78
79
80 void InsetMathFBox::infoize(odocstream & os) const
81 {
82         os << "FBox: ";
83 }
84
85
86 } // namespace lyx