]> git.lyx.org Git - features.git/blob - src/insets/InsetFoot.cpp
rename InsetBase to Inset
[features.git] / src / insets / InsetFoot.cpp
1 /**
2  * \file InsetFoot.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Jürgen Vigna
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "InsetFoot.h"
15
16 #include "gettext.h"
17 // the following are needed just to get the layout of the enclosing
18 // paragraph. This seems a bit too much to me (JMarc)
19 #include "LyXLayout.h"
20 #include "OutputParams.h"
21 #include "Paragraph.h"
22 #include "paragraph_funcs.h"
23
24 #include "support/std_ostream.h"
25
26
27 namespace lyx {
28
29 using std::string;
30 using std::auto_ptr;
31 using std::ostream;
32
33
34 InsetFoot::InsetFoot(BufferParams const & bp)
35         : InsetFootlike(bp)
36 {
37         setLabel(_("foot"));
38 }
39
40
41 InsetFoot::InsetFoot(InsetFoot const & in)
42         : InsetFootlike(in)
43 {
44         setLabel(_("foot"));
45 }
46
47
48 auto_ptr<Inset> InsetFoot::doClone() const
49 {
50         return auto_ptr<Inset>(new InsetFoot(*this));
51 }
52
53
54 docstring const InsetFoot::editMessage() const
55 {
56         return _("Opened Footnote Inset");
57 }
58
59
60 int InsetFoot::latex(Buffer const & buf, odocstream & os,
61                      OutputParams const & runparams_in) const
62 {
63         OutputParams runparams = runparams_in;
64         // footnotes in titling commands like \title have moving arguments
65         runparams.moving_arg |= runparams_in.intitle;
66
67         // in titling commands, \thanks should be used instead of \footnote.
68         // some classes (e.g. memoir) do not understand \footnote.
69         if (runparams_in.intitle)
70                 os << "%\n\\thanks{";
71         else
72                 os << "%\n\\footnote{";
73
74         int const i = InsetText::latex(buf, os, runparams);
75         os << "%\n}";
76         runparams_in.encoding = runparams.encoding;
77
78         return i + 2;
79 }
80
81
82 int InsetFoot::plaintext(Buffer const & buf, odocstream & os,
83                          OutputParams const & runparams) const
84 {
85         os << '[' << _("footnote") << ":\n";
86         InsetText::plaintext(buf, os, runparams);
87         os << "\n]";
88
89         return PLAINTEXT_NEWLINE + 1; // one char on a separate line
90 }
91
92
93 int InsetFoot::docbook(Buffer const & buf, odocstream & os,
94                        OutputParams const & runparams) const
95 {
96         os << "<footnote>";
97         int const i = InsetText::docbook(buf, os, runparams);
98         os << "</footnote>";
99
100         return i;
101 }
102
103
104 } // namespace lyx