]> git.lyx.org Git - lyx.git/blob - src/insets/insetenv.C
the environment insets. not active yet.
[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 }
39
40
41 InsetEnvironment::InsetEnvironment(InsetEnvironment const & in, bool same_id)
42         : InsetCollapsable(in, same_id), header_(in.header_), footer_(in.footer_)
43 {}
44
45
46 Inset * InsetEnvironment::clone(Buffer const &, bool same_id) const
47 {
48         return new InsetEnvironment(*this, same_id);
49 }
50
51
52 void InsetEnvironment::write(Buffer const * buf, ostream & os) const
53 {
54         os << "Environment" << getInsetName() << "\"\n";
55         InsetCollapsable::write(buf, os);
56 }
57
58
59 void InsetEnvironment::read(Buffer const * buf, LyXLex & lex)
60 {
61         InsetCollapsable::read(buf, lex);
62 }
63
64
65 string const InsetEnvironment::editMessage() const
66 {
67         return _("Opened Environment Inset: ") + getInsetName();
68 }
69
70
71 int InsetEnvironment::latex(Buffer const * buf,
72                          ostream & os, bool fragile, bool fp) const
73 {
74         os << header_;
75         int i = inset.latex(buf, os, fragile, fp);
76         os << footer_;
77         return i;
78 }