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"
29 InsetEnvironment::InsetEnvironment
30 (BufferParams
const & bp
, docstring
const & name
)
31 : InsetText(bp
), layout_(bp
.getTextClass()[name
]), name_(name
)
33 setAutoBreakRows(true);
38 InsetEnvironment::InsetEnvironment(InsetEnvironment
const & in
)
39 : InsetText(in
), layout_(in
.layout_
)
43 auto_ptr
<Inset
> InsetEnvironment::doClone() const
45 return auto_ptr
<Inset
>(new InsetEnvironment(*this));
49 void InsetEnvironment::write(Buffer
const & buf
, ostream
& os
) const
51 os
<< "Environment " << to_utf8(name()) << "\n";
52 InsetText::write(buf
, os
);
56 void InsetEnvironment::read(Buffer
const & buf
, Lexer
& lex
)
58 InsetText::read(buf
, lex
);
62 docstring
const InsetEnvironment::editMessage() const
64 return _("Opened Environment Inset: ") + name();
68 int InsetEnvironment::latex(Buffer
const & buf
, odocstream
& os
,
69 OutputParams
const & runparams
) const
72 os
<< from_utf8(layout_
->latexheader
);
74 latexParagraphs(buf
, paragraphs(), os
, texrow
, runparams
,
75 layout_
->latexparagraph
);
77 os
<< from_utf8(layout_
->latexfooter
);
82 int InsetEnvironment::plaintext(Buffer
const & buf
, odocstream
& os
,
83 OutputParams
const & runparams
) const
85 os
<< '[' << to_utf8(name()) << ":\n";
86 InsetText::plaintext(buf
, os
, runparams
);
89 return PLAINTEXT_NEWLINE
+ 1; // one char on a separate line
93 Layout_ptr
const & InsetEnvironment::layout() const