]> git.lyx.org Git - lyx.git/blob - src/insets/insetfoot.C
static_cast-based key/mouse-state. Kill insetKeyPress.
[lyx.git] / src / insets / insetfoot.C
1 /* This file is part of
2  * ======================================================
3  *
4  *           LyX, The Document Processor
5  *
6  *          Copyright 1998 The LyX Team.
7  *
8  * ======================================================
9  */
10
11 #include <config.h>
12
13 #ifdef __GNUG__
14 #pragma implementation
15 #endif
16
17 #include "insetfoot.h"
18 #include "gettext.h"
19 #include "lyxfont.h"
20 #include "BufferView.h"
21 #include "lyxtext.h"
22 #include "insets/insettext.h"
23 #include "support/LOstream.h"
24 #include "debug.h"
25 // the following are needed just to get the layout of the enclosing
26 // paragraph. This seems a bit too much to me (JMarc)
27 #include "lyxlayout.h"
28 #include "lyxtextclasslist.h"
29 #include "buffer.h"
30 #include "paragraph.h"
31
32
33 using std::ostream;
34
35
36 InsetFoot::InsetFoot(BufferParams const & bp)
37         : InsetFootlike(bp)
38 {
39         setLabel(_("foot"));
40         setInsetName("Foot");
41 }
42
43
44 InsetFoot::InsetFoot(InsetFoot const & in, bool same_id)
45         : InsetFootlike(in, same_id)
46 {
47         setLabel(_("foot"));
48         setInsetName("Foot");
49 }
50
51
52 Inset * InsetFoot::clone(Buffer const &, bool same_id) const
53 {
54         return new InsetFoot(*const_cast<InsetFoot *>(this), same_id);
55 }
56
57
58 string const InsetFoot::editMessage() const
59 {
60         return _("Opened Footnote Inset");
61 }
62
63
64 int InsetFoot::latex(Buffer const * buf,
65                      ostream & os, bool fragile, bool fp) const
66 {
67         if (buf && parOwner()) {
68                 LyXLayout const & layout =
69                         textclasslist[buf->params.textclass][parOwner()->layout()];
70                 fragile |= layout.intitle;
71         }
72
73         os << "%\n\\footnote{";
74
75         int const i = inset.latex(buf, os, fragile, fp);
76         os << "%\n}";
77
78         return i + 2;
79 }
80
81
82 int InsetFoot::docbook(Buffer const * buf, ostream & os) const
83 {
84         os << "<footnote>";
85         int const i = inset.docbook(buf, os);
86         os << "</footnote>";
87
88         return i;
89 }