]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathEnv.cpp
Rename WriteStream to TeXMathStream.
[lyx.git] / src / mathed / InsetMathEnv.cpp
1 /**
2  * \file InsetMathEnv.cpp
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 "InsetMathEnv.h"
14
15 #include "MathData.h"
16 #include "MathStream.h"
17
18 #include "MetricsInfo.h"
19
20 #include "support/gettext.h"
21 #include "support/lstrings.h"
22
23 #include <ostream>
24
25 using namespace lyx::support;
26
27 namespace lyx {
28
29 InsetMathEnv::InsetMathEnv(Buffer * buf, docstring const & name)
30         : InsetMathNest(buf, 1), name_(name)
31 {}
32
33
34 Inset * InsetMathEnv::clone() const
35 {
36         return new InsetMathEnv(*this);
37 }
38
39
40 void InsetMathEnv::metrics(MetricsInfo & mi, Dimension & dim) const
41 {
42         Changer dummy = mi.base.changeEnsureMath();
43         cell(0).metrics(mi, dim);
44 }
45
46
47 void InsetMathEnv::draw(PainterInfo & pi, int x, int y) const
48 {
49         Changer dummy = pi.base.changeEnsureMath();
50         cell(0).draw(pi, x, y);
51 }
52
53
54 void InsetMathEnv::write(TeXMathStream & os) const
55 {
56         MathEnsurer ensurer(os);
57         os << "\\begin{" << name_ << '}' << cell(0) << "\\end{" << name_ << '}';
58 }
59
60
61 void InsetMathEnv::normalize(NormalStream & os) const
62 {
63         os << "[env " << name_ << ' ' << cell(0) << ']';
64 }
65
66
67 void InsetMathEnv::infoize(odocstream & os) const
68 {
69         os << bformat(_("Environment: %1$s"), name_);
70 }
71
72
73 } // namespace lyx