]> git.lyx.org Git - lyx.git/blob - src/insets/insetfoot.C
the clone auto_ptr patch
[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 #include "gettext.h"
16 #include "lyxfont.h"
17 #include "BufferView.h"
18 #include "latexrunparams.h"
19 #include "lyxtext.h"
20 #include "insets/insettext.h"
21 #include "support/LOstream.h"
22 #include "debug.h"
23 // the following are needed just to get the layout of the enclosing
24 // paragraph. This seems a bit too much to me (JMarc)
25 #include "lyxlayout.h"
26 #include "buffer.h"
27 #include "paragraph.h"
28
29
30 using std::ostream;
31 using std::auto_ptr;
32
33
34 InsetFoot::InsetFoot(BufferParams const & bp)
35         : InsetFootlike(bp)
36 {
37         setLabel(_("foot"));
38         setInsetName("Foot");
39 }
40
41
42 InsetFoot::InsetFoot(InsetFoot const & in)
43         : InsetFootlike(in)
44 {
45         setLabel(_("foot"));
46         setInsetName("Foot");
47 }
48
49
50 auto_ptr<InsetBase> InsetFoot::clone() const
51 {
52         return auto_ptr<InsetBase>(new InsetFoot(*this));
53 }
54
55
56 string const InsetFoot::editMessage() const
57 {
58         return _("Opened Footnote Inset");
59 }
60
61
62 int InsetFoot::latex(Buffer const * buf, ostream & os,
63                      LatexRunParams const & runparams_in) const
64 {
65         LatexRunParams runparams = runparams_in;
66         if (buf && parOwner()) {
67                 LyXLayout_ptr const & layout = parOwner()->layout();
68                 runparams.moving_arg |= layout->intitle;
69         }
70
71         os << "%\n\\footnote{";
72
73         int const i = inset.latex(buf, os, runparams);
74         os << "%\n}";
75
76         return i + 2;
77 }
78
79
80 int InsetFoot::docbook(Buffer const * buf, ostream & os, bool mixcont) const
81 {
82         os << "<footnote>";
83         int const i = inset.docbook(buf, os, mixcont);
84         os << "</footnote>";
85
86         return i;
87 }