]> git.lyx.org Git - features.git/blob - src/insets/insetfoot.C
07c8335353ed9a3ccf279eb9d32eb0bb2f5aa869
[features.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 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "insetfoot.h"
17 #include "gettext.h"
18 #include "lyxfont.h"
19 #include "BufferView.h"
20 #include "Painter.h"
21 #include "support/LOstream.h"
22
23 using std::ostream;
24
25 InsetFoot::InsetFoot(Buffer * bf)
26                 : InsetCollapsable(bf)
27 {
28     setLabel(_("foot"));
29     LyXFont font(LyXFont::ALL_SANE);
30     font.decSize();
31     font.decSize();
32     font.setColor(LColor::footnote);
33     setLabelFont(font);
34     setAutoCollapse(false);
35     setInsetName("Foot");
36 }
37
38
39 Inset * InsetFoot::Clone() const
40 {
41     InsetFoot * result = new InsetFoot(buffer);
42     result->init(buffer, this);
43
44     result->collapsed = collapsed;
45     return result;
46 }
47
48
49 char const * InsetFoot::EditMessage() const
50 {
51     return _("Opened Footnote Inset");
52 }
53
54
55 int InsetFoot::Latex(ostream & os, bool fragile, bool fp) const
56 {
57     os << "\\footnote{%" << endl;
58     
59     int i = InsetText::Latex(os, fragile, fp);
60     os << "}%" << endl;
61     
62     return i + 2;
63 }
64
65
66 bool InsetFoot::InsertInset(BufferView * bv, Inset * inset)
67 {
68     if (!InsertInsetAllowed(inset))
69         return false;
70
71     return InsetText::InsertInset(bv, inset);
72 }
73
74 bool InsetFoot::InsertInsetAllowed(Inset * inset) const
75 {
76     if ((inset->LyxCode() == Inset::FOOT_CODE) ||
77         (inset->LyxCode() == Inset::MARGIN_CODE)) {
78         return false;
79     }
80     return true;
81 }
82
83 LyXFont InsetFoot::GetDrawFont(LyXParagraph * par, int pos) const
84 {
85     LyXFont fn = InsetCollapsable::GetDrawFont(par, pos);
86     fn.decSize();
87     fn.decSize();
88     return fn;
89 }