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"
18 #include "OutputParams.h"
19 #include "output_latex.h"
21 #include "TextClass.h"
27 InsetEnvironment::InsetEnvironment
28 (BufferParams const & bp, docstring const & name)
29 : InsetText(bp), layout_(bp.getTextClass()[name]), name_(name)
31 setAutoBreakRows(true);
36 InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
37 : InsetText(in), layout_(in.layout_)
41 Inset * InsetEnvironment::clone() const
43 return new InsetEnvironment(*this);
47 void InsetEnvironment::write(Buffer const & buf, std::ostream & os) const
49 os << "Environment " << to_utf8(name()) << "\n";
50 InsetText::write(buf, os);
54 void InsetEnvironment::read(Buffer const & buf, Lexer & lex)
56 InsetText::read(buf, lex);
60 docstring const InsetEnvironment::editMessage() const
62 return _("Opened Environment Inset: ") + name();
66 int InsetEnvironment::latex(Buffer const & buf, odocstream & os,
67 OutputParams const & runparams) const
70 os << from_utf8(layout_->latexheader);
72 latexParagraphs(buf, paragraphs(), os, texrow, runparams,
73 layout_->latexparagraph);
75 os << from_utf8(layout_->latexfooter);
80 int InsetEnvironment::plaintext(Buffer const & buf, odocstream & os,
81 OutputParams const & runparams) const
83 os << '[' << to_utf8(name()) << ":\n";
84 InsetText::plaintext(buf, os, runparams);
87 return PLAINTEXT_NEWLINE + 1; // one char on a separate line
91 LayoutPtr const & InsetEnvironment::layout() const