]> git.lyx.org Git - lyx.git/blob - src/insets/insetfoot.C
37a294aef845e3598eefa747c4e00199ef0297be
[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 "lyxscreen.h"
21 #include "Painter.h"
22
23
24 InsetFoot::InsetFoot(Buffer * bf)
25                 : InsetCollapsable(bf)
26 {
27     setLabel(_("foot"));
28     LyXFont font(LyXFont::ALL_SANE);
29     font.decSize();
30     font.decSize();
31     font.setColor(LColor::footnote);
32     setLabelFont(font);
33     setAutoCollapse(false);
34 }
35
36
37 Inset * InsetFoot::Clone() const
38 {
39     InsetFoot * result = new InsetFoot(buffer);
40     result->init(buffer, par);
41
42     result->collapsed = collapsed;
43     return result;
44 }
45
46
47 char const * InsetFoot::EditMessage() const
48 {
49     return _("Opened Footnote Inset");
50 }
51
52
53 int InsetFoot::Latex(ostream & os, signed char fragile, bool fp) const
54 {
55         if (fragile) 
56                 os << "\\footnotetext{";
57         else 
58                 os << "\\footnote{";
59         
60         int i = InsetText::Latex(os, fragile, fp);
61         os << "}";
62         
63         return i;
64 }
65
66
67 void InsetFoot::Write(ostream & os) const
68 {
69         os << "Foot\n"
70            << "\ncollapsed ";
71         if (display())
72                 os << "false\n";
73         else
74                 os << "true\n";
75         WriteParagraphData(os);
76 }
77
78
79 void InsetFoot::Read(LyXLex & lex)
80 {
81     if (lex.IsOK()) {
82         lex.next();
83         string token = lex.GetString();
84         if (token == "collapsed") {
85             lex.next();
86             collapsed = lex.GetBool();
87         }
88     }
89     InsetText::Read(lex);
90 }
91
92
93 bool InsetFoot::InsertInset(BufferView * bv, Inset * inset)
94 {
95     if ((inset->LyxCode() == Inset::FOOT_CODE) ||
96         (inset->LyxCode() == Inset::MARGIN_CODE)) {
97         return false;
98     }
99     return InsetText::InsertInset(bv, inset);
100 }