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