]> git.lyx.org Git - lyx.git/blob - src/insets/insetenv.C
read them back...
[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 "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
26
27 InsetEnvironment::InsetEnvironment
28                 (BufferParams const & bp, string const & name)
29         : InsetCollapsable(bp)
30 {
31         setLabel(name);
32         setInsetName(name);
33         // needs more stuff in lyxlayout. coming in later patches.
34         //LyXTextClass const & tc = bp.getLyXTextClass();
35         //LyXLayout_ptr const & layout = tc.getEnv(name);
36         //header_ = layout->latexheader;
37         //footer_ = layout->latexfooter;
38         header_ = "\\begin{" + name + "}";
39         footer_ = "\\end{" + name + "}";
40 }
41
42
43 InsetEnvironment::InsetEnvironment(InsetEnvironment const & in, bool same_id)
44         : InsetCollapsable(in, same_id), header_(in.header_), footer_(in.footer_)
45 {}
46
47
48 Inset * InsetEnvironment::clone(Buffer const &, bool same_id) const
49 {
50         return new InsetEnvironment(*this, same_id);
51 }
52
53
54 void InsetEnvironment::write(Buffer const * buf, ostream & os) const
55 {
56         os << "Environment " << getInsetName() << "\n";
57         InsetCollapsable::write(buf, os);
58 }
59
60
61 void InsetEnvironment::read(Buffer const * buf, LyXLex & lex)
62 {
63         InsetCollapsable::read(buf, lex);
64 }
65
66
67 string const InsetEnvironment::editMessage() const
68 {
69         return _("Opened Environment Inset: ") + getInsetName();
70 }
71
72
73 int InsetEnvironment::latex(Buffer const * buf,
74                          ostream & os, bool fragile, bool fp) const
75 {
76         os << header_;
77         int i = inset.latex(buf, os, fragile, fp);
78         os << footer_;
79         return i;
80 }