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.
15 #include "bufferparams.h"
17 #include "paragraph.h"
18 #include "outputparams.h"
19 #include "output_latex.h"
30 InsetEnvironment::InsetEnvironment
31 (BufferParams const & bp, string const & name)
32 : InsetText(bp), layout_(bp.getLyXTextClass()[name])
34 setInsetName(from_utf8(name));
35 setAutoBreakRows(true);
40 InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
41 : InsetText(in), layout_(in.layout_)
45 auto_ptr<InsetBase> InsetEnvironment::doClone() const
47 return auto_ptr<InsetBase>(new InsetEnvironment(*this));
51 void InsetEnvironment::write(Buffer const & buf, ostream & os) const
53 os << "Environment " << to_utf8(getInsetName()) << "\n";
54 InsetText::write(buf, os);
58 void InsetEnvironment::read(Buffer const & buf, LyXLex & lex)
60 InsetText::read(buf, lex);
64 docstring const InsetEnvironment::editMessage() const
66 return _("Opened Environment Inset: ") + getInsetName();
70 int InsetEnvironment::latex(Buffer const & buf, odocstream & os,
71 OutputParams const & runparams) const
74 os << from_utf8(layout_->latexheader);
76 latexParagraphs(buf, paragraphs(), os, texrow, runparams,
77 layout_->latexparagraph);
79 os << from_utf8(layout_->latexfooter);
84 int InsetEnvironment::plaintext(Buffer const & buf, odocstream & os,
85 OutputParams const & runparams) const
87 os << '[' << to_utf8(getInsetName()) << ":\n";
88 InsetText::plaintext(buf, os, runparams);
91 return 1 + runparams.linelen; // one char on a separate line
95 LyXLayout_ptr const & InsetEnvironment::layout() const