]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFoot.cpp
Fix Bug 3947: BibTeX allows parentheses in the key (even if the whole entry is delimi...
[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         setLabel(_("foot"));
36 }
37
38
39 InsetFoot::InsetFoot(InsetFoot const & in)
40         : InsetFootlike(in)
41 {
42         setLabel(_("foot"));
43 }
44
45
46 auto_ptr<Inset> InsetFoot::doClone() const
47 {
48         return auto_ptr<Inset>(new InsetFoot(*this));
49 }
50
51
52 docstring const InsetFoot::editMessage() const
53 {
54         return _("Opened Footnote Inset");
55 }
56
57
58 int InsetFoot::latex(Buffer const & buf, odocstream & os,
59                      OutputParams const & runparams_in) const
60 {
61         OutputParams runparams = runparams_in;
62         // footnotes in titling commands like \title have moving arguments
63         runparams.moving_arg |= runparams_in.intitle;
64
65         // in titling commands, \thanks should be used instead of \footnote.
66         // some classes (e.g. memoir) do not understand \footnote.
67         if (runparams_in.intitle)
68                 os << "%\n\\thanks{";
69         else
70                 os << "%\n\\footnote{";
71
72         int const i = InsetText::latex(buf, os, runparams);
73         os << "%\n}";
74         runparams_in.encoding = runparams.encoding;
75
76         return i + 2;
77 }
78
79
80 int InsetFoot::plaintext(Buffer const & buf, odocstream & os,
81                          OutputParams const & runparams) const
82 {
83         os << '[' << buf.B_("footnote") << ":\n";
84         InsetText::plaintext(buf, os, runparams);
85         os << "\n]";
86
87         return PLAINTEXT_NEWLINE + 1; // one char on a separate line
88 }
89
90
91 int InsetFoot::docbook(Buffer const & buf, odocstream & os,
92                        OutputParams const & runparams) const
93 {
94         os << "<footnote>";
95         int const i = InsetText::docbook(buf, os, runparams);
96         os << "</footnote>";
97
98         return i;
99 }
100
101
102 } // namespace lyx