2 * \file InsetEnvironment.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 "InsetEnvironment.h"
15 #include "BufferParams.h"
16 #include "support/gettext.h"
18 #include "OutputParams.h"
19 #include "output_latex.h"
21 #include "TextClass.h"
28 InsetEnvironment::InsetEnvironment
29 (BufferParams const & bp, docstring const & name)
30 : InsetText(bp), layout_(bp.textClass()[name]), name_(name)
32 setAutoBreakRows(true);
37 InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
38 : InsetText(in), layout_(in.layout_)
42 Inset * InsetEnvironment::clone() const
44 return new InsetEnvironment(*this);
48 void InsetEnvironment::write(Buffer const & buf, ostream & os) const
50 os << "Environment " << to_utf8(name()) << "\n";
51 InsetText::write(buf, os);
55 void InsetEnvironment::read(Buffer const & buf, Lexer & lex)
57 InsetText::read(buf, lex);
61 docstring const InsetEnvironment::editMessage() const
63 return _("Opened Environment Inset: ") + name();
67 int InsetEnvironment::latex(Buffer const & buf, odocstream & os,
68 OutputParams const & runparams) const
71 os << from_utf8(layout_->latexheader);
73 latexParagraphs(buf, text_, os, texrow, runparams,
74 layout_->latexparagraph);
76 os << from_utf8(layout_->latexfooter);
81 int InsetEnvironment::plaintext(Buffer const & buf, odocstream & os,
82 OutputParams const & runparams) const
84 os << '[' << to_utf8(name()) << ":\n";
85 InsetText::plaintext(buf, os, runparams);
88 return PLAINTEXT_NEWLINE + 1; // one char on a separate line
92 LayoutPtr const & InsetEnvironment::layout() const