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