]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFoot.cpp
5bd2a9d044b9b3646b90028dce776f41d46418f5
[lyx.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 "Buffer.h"
17 #include "gettext.h"
18 // the following is needed just to get the layout of the enclosing
19 // paragraph. This seems a bit too much to me (JMarc)
20 #include "OutputParams.h"
21
22 #include "support/std_ostream.h"
23
24
25 namespace lyx {
26
27 using std::string;
28 using std::auto_ptr;
29 using std::ostream;
30
31
32 InsetFoot::InsetFoot(BufferParams const & bp)
33         : InsetFootlike(bp)
34 {
35         setLayout(bp);
36 }
37
38
39 InsetFoot::InsetFoot(InsetFoot const & in)
40         : InsetFootlike(in)
41 {}
42
43
44 auto_ptr<Inset> InsetFoot::doClone() const
45 {
46         return auto_ptr<Inset>(new InsetFoot(*this));
47 }
48
49
50 docstring const InsetFoot::editMessage() const
51 {
52         return _("Opened Footnote Inset");
53 }
54
55
56 int InsetFoot::latex(Buffer const & buf, odocstream & os,
57                      OutputParams const & runparams_in) const
58 {
59         OutputParams runparams = runparams_in;
60         // footnotes in titling commands like \title have moving arguments
61         runparams.moving_arg |= runparams_in.intitle;
62
63         // in titling commands, \thanks should be used instead of \footnote.
64         // some classes (e.g. memoir) do not understand \footnote.
65         if (runparams_in.intitle)
66                 os << "%\n\\thanks{";
67         else
68                 os << "%\n\\footnote{";
69
70         int const i = InsetText::latex(buf, os, runparams);
71         os << "%\n}";
72         runparams_in.encoding = runparams.encoding;
73
74         return i + 2;
75 }
76
77
78 int InsetFoot::plaintext(Buffer const & buf, odocstream & os,
79                          OutputParams const & runparams) const
80 {
81         os << '[' << buf.B_("footnote") << ":\n";
82         InsetText::plaintext(buf, os, runparams);
83         os << "\n]";
84
85         return PLAINTEXT_NEWLINE + 1; // one char on a separate line
86 }
87
88
89 int InsetFoot::docbook(Buffer const & buf, odocstream & os,
90                        OutputParams const & runparams) const
91 {
92         os << "<footnote>";
93         int const i = InsetText::docbook(buf, os, runparams);
94         os << "</footnote>";
95
96         return i;
97 }
98
99
100 } // namespace lyx