]> git.lyx.org Git - lyx.git/blob - src/insets/insetenv.C
Rename LatexRunParams::fragile as moving_arg.
[lyx.git] / src / insets / insetenv.C
1 // -*- C++ -*-
2 /**
3  * \file insetenv.C
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #include <config.h>
13
14 #include "insetenv.h"
15 #include "gettext.h"
16 #include "lyxtextclass.h"
17 #include "paragraph_funcs.h"
18 #include "lyxlayout.h"
19 #include "bufferparams.h"
20 #include "support/LOstream.h"
21 #include "debug.h"
22
23
24 using std::ostream;
25 using std::endl;
26
27
28 InsetEnvironment::InsetEnvironment
29                 (BufferParams const & bp, string const & name)
30         : InsetText(bp), layout_(bp.getLyXTextClass()[name])
31 {
32         setInsetName(name);
33         autoBreakRows = true;
34         drawFrame_ = ALWAYS;
35 }
36
37
38 InsetEnvironment::InsetEnvironment(InsetEnvironment const & in, bool same_id)
39         : InsetText(in, same_id), layout_(in.layout_)
40 {}
41
42
43 Inset * InsetEnvironment::clone(Buffer const &, bool same_id) const
44 {
45         return new InsetEnvironment(*this, same_id);
46 }
47
48
49 void InsetEnvironment::write(Buffer const * buf, ostream & os) const
50 {
51         os << "Environment " << getInsetName() << "\n";
52         InsetText::write(buf, os);
53 }
54
55
56 void InsetEnvironment::read(Buffer const * buf, LyXLex & lex)
57 {
58         InsetText::read(buf, lex);
59 }
60
61
62 string const InsetEnvironment::editMessage() const
63 {
64         return _("Opened Environment Inset: ") + getInsetName();
65 }
66
67
68 int InsetEnvironment::latex(Buffer const * buf, ostream & os,
69                             LatexRunParams const & runparams) const
70 {
71         os << layout_->latexheader;
72         TexRow texrow;
73         latexParagraphs(buf, paragraphs, os, texrow, runparams,
74                         layout_->latexparagraph);
75         os << layout_->latexfooter;
76         return texrow.rows();
77 }
78
79
80 LyXLayout_ptr const & InsetEnvironment::layout() const
81 {
82         return layout_;
83 }