]> git.lyx.org Git - lyx.git/blob - src/insets/insetenv.C
Move a couple of InsetText member variables from protected to private.
[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
15 #include "bufferparams.h"
16 #include "gettext.h"
17 #include "paragraph.h"
18 #include "paragraph_funcs.h"
19 #include "texrow.h"
20
21 #include "support/std_ostream.h"
22
23 using std::auto_ptr;
24 using std::ostream;
25
26
27 InsetEnvironment::InsetEnvironment
28                 (BufferParams const & bp, string const & name)
29         : InsetText(bp), layout_(bp.getLyXTextClass()[name])
30 {
31         setInsetName(name);
32         setAutoBreakRows(true);
33         setDrawFrame(ALWAYS);
34 }
35
36
37 InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
38         : InsetText(in), layout_(in.layout_)
39 {}
40
41
42 auto_ptr<InsetBase> InsetEnvironment::clone() const
43 {
44         return auto_ptr<InsetBase>(new InsetEnvironment(*this));
45 }
46
47
48 void InsetEnvironment::write(Buffer const & buf, ostream & os) const
49 {
50         os << "Environment " << getInsetName() << "\n";
51         InsetText::write(buf, os);
52 }
53
54
55 void InsetEnvironment::read(Buffer const & buf, LyXLex & lex)
56 {
57         InsetText::read(buf, lex);
58 }
59
60
61 string const InsetEnvironment::editMessage() const
62 {
63         return _("Opened Environment Inset: ") + getInsetName();
64 }
65
66
67 int InsetEnvironment::latex(Buffer const & buf, ostream & os,
68                             LatexRunParams const & runparams) const
69 {
70         os << layout_->latexheader;
71         TexRow texrow;
72         latexParagraphs(buf, paragraphs, os, texrow, runparams,
73                         layout_->latexparagraph);
74         os << layout_->latexfooter;
75         return texrow.rows();
76 }
77
78
79 LyXLayout_ptr const & InsetEnvironment::layout() const
80 {
81         return layout_;
82 }