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