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