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