]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathBox.C
Fix bug 2789 (as discussed)
[lyx.git] / src / mathed / InsetMathBox.C
1 /**
2  * \file InsetMathBox.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 "InsetMathBox.h"
14 #include "MathData.h"
15 #include "MathMLStream.h"
16 #include "MathStream.h"
17 #include "support/std_ostream.h"
18
19 using std::string;
20 using std::auto_ptr;
21
22
23 InsetMathBox::InsetMathBox(string const & name)
24         : InsetMathNest(1), name_(name)
25 {}
26
27
28 auto_ptr<InsetBase> InsetMathBox::doClone() const
29 {
30         return auto_ptr<InsetBase>(new InsetMathBox(*this));
31 }
32
33
34 void InsetMathBox::write(WriteStream & os) const
35 {
36         os << '\\' << name_ << '{' << cell(0) << '}';
37 }
38
39
40 void InsetMathBox::normalize(NormalStream & os) const
41 {
42         os << '[' << name_ << ' ';
43         //text_->write(buffer(), os);
44         os << "] ";
45 }
46
47
48 void InsetMathBox::metrics(MetricsInfo & mi, Dimension & dim) const
49 {
50         FontSetChanger dummy(mi.base, "textnormal");
51         cell(0).metrics(mi, dim);
52         metricsMarkers(dim);
53         dim_ = dim;
54 }
55
56
57 void InsetMathBox::draw(PainterInfo & pi, int x, int y) const
58 {
59         FontSetChanger dummy(pi.base, "textnormal");
60         cell(0).draw(pi, x, y);
61         drawMarkers(pi, x, y);
62 }
63
64
65 void InsetMathBox::infoize(std::ostream & os) const
66 {
67         os << "Box: " << name_;
68 }