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"
17 #include "OutputParams.h"
18 #include "output_latex.h"
25 InsetEnvironment::InsetEnvironment
26 (BufferParams const & bp, docstring const & name)
27 : InsetText(bp), layout_(bp.getTextClass()[name]), name_(name)
29 setAutoBreakRows(true);
34 InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
35 : InsetText(in), layout_(in.layout_)
39 Inset * InsetEnvironment::clone() const
41 return new InsetEnvironment(*this);
45 void InsetEnvironment::write(Buffer const & buf, std::ostream & os) const
47 os << "Environment " << to_utf8(name()) << "\n";
48 InsetText::write(buf, os);
52 void InsetEnvironment::read(Buffer const & buf, Lexer & lex)
54 InsetText::read(buf, lex);
58 docstring const InsetEnvironment::editMessage() const
60 return _("Opened Environment Inset: ") + name();
64 int InsetEnvironment::latex(Buffer const & buf, odocstream & os,
65 OutputParams const & runparams) const
68 os << from_utf8(layout_->latexheader);
70 latexParagraphs(buf, paragraphs(), os, texrow, runparams,
71 layout_->latexparagraph);
73 os << from_utf8(layout_->latexfooter);
78 int InsetEnvironment::plaintext(Buffer const & buf, odocstream & os,
79 OutputParams const & runparams) const
81 os << '[' << to_utf8(name()) << ":\n";
82 InsetText::plaintext(buf, os, runparams);
85 return PLAINTEXT_NEWLINE + 1; // one char on a separate line
89 LayoutPtr const & InsetEnvironment::layout() const