]> git.lyx.org Git - lyx.git/blob - src/insets/insetfoot.C
Change editMessage to return a docstring, change functions to not use to_utf8.
[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 using lyx::docstring;
27
28 using std::string;
29 using std::auto_ptr;
30 using std::ostream;
31
32
33 InsetFoot::InsetFoot(BufferParams const & bp)
34         : InsetFootlike(bp)
35 {
36         // FIXME UNICODE
37         setLabel(lyx::to_utf8(_("foot")));
38         setInsetName("Foot");
39 }
40
41
42 InsetFoot::InsetFoot(InsetFoot const & in)
43         : InsetFootlike(in)
44 {
45         // FIXME UNICODE
46         setLabel(lyx::to_utf8(_("foot")));
47         setInsetName("Foot");
48 }
49
50
51 auto_ptr<InsetBase> InsetFoot::doClone() const
52 {
53         return auto_ptr<InsetBase>(new InsetFoot(*this));
54 }
55
56
57 docstring const InsetFoot::editMessage() const
58 {
59         return _("Opened Footnote Inset");
60 }
61
62
63 int InsetFoot::latex(Buffer const & buf, ostream & os,
64                      OutputParams const & runparams_in) const
65 {
66         OutputParams runparams = runparams_in;
67         // footnotes in titling commands like \title have moving arguments
68         runparams.moving_arg |= runparams_in.intitle;
69
70         // in titling commands, \thanks should be used instead of \footnote.
71         // some classes (e.g. memoir) do not understand \footnote.
72         if (runparams_in.intitle)
73                 os << "%\n\\thanks{";
74         else
75                 os << "%\n\\footnote{";
76
77         int const i = InsetText::latex(buf, os, runparams);
78         os << "%\n}";
79
80         return i + 2;
81 }
82
83
84 int InsetFoot::docbook(Buffer const & buf, ostream & os,
85                        OutputParams const & runparams) const
86 {
87         os << "<footnote>";
88         int const i = InsetText::docbook(buf, os, runparams);
89         os << "</footnote>";
90
91         return i;
92 }