]> git.lyx.org Git - lyx.git/blob - src/insets/insetenv.C
Enable convertDefault.sh to run even if its executable bit is not set.
[lyx.git] / src / insets / insetenv.C
1 /**
2  * \file insetenv.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "insetenv.h"
14 #include "gettext.h"
15 #include "lyxtextclass.h"
16 #include "paragraph_funcs.h"
17 #include "lyxlayout.h"
18 #include "bufferparams.h"
19 #include "support/LOstream.h"
20 #include "debug.h"
21
22
23 using std::ostream;
24 using std::endl;
25 using std::auto_ptr;
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)
39         : InsetText(in), layout_(in.layout_)
40 {}
41
42
43 auto_ptr<InsetBase> InsetEnvironment::clone() const
44 {
45         return auto_ptr<InsetBase>(new InsetEnvironment(*this));
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 }