2 * \file InsetMathEnv.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "InsetMathEnv.h"
16 #include "MathStream.h"
17 #include "MathStream.h"
19 #include "MetricsInfo.h"
21 #include "support/gettext.h"
22 #include "support/lstrings.h"
26 using namespace lyx::support;
30 InsetMathEnv::InsetMathEnv(Buffer * buf, docstring const & name)
31 : InsetMathNest(buf, 1), name_(name)
35 Inset * InsetMathEnv::clone() const
37 return new InsetMathEnv(*this);
41 void InsetMathEnv::metrics(MetricsInfo & mi, Dimension & dim) const
43 Changer dummy = mi.base.changeEnsureMath();
44 cell(0).metrics(mi, dim);
48 void InsetMathEnv::draw(PainterInfo & pi, int x, int y) const
50 Changer dummy = pi.base.changeEnsureMath();
51 cell(0).draw(pi, x, y);
55 void InsetMathEnv::write(WriteStream & os) const
57 MathEnsurer ensurer(os);
58 os << "\\begin{" << name_ << '}' << cell(0) << "\\end{" << name_ << '}';
62 void InsetMathEnv::normalize(NormalStream & os) const
64 os << "[env " << name_ << ' ' << cell(0) << ']';
68 void InsetMathEnv::infoize(odocstream & os) const
70 os << bformat(_("Environment: %1$s"), name_);