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