]> git.lyx.org Git - lyx.git/blob - src/insets/insetlist.C
reformatting and remove using delc
[lyx.git] / src / insets / insetlist.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 "insetlist.h"
17 #include "gettext.h"
18 #include "lyxfont.h"
19 #include "BufferView.h"
20 #include "lyxtext.h"
21 #include "insets/insettext.h"
22 #include "support/LOstream.h"
23 #include "debug.h"
24
25 using std::ostream;
26 using std::endl;
27
28 // This class is _far_ from finished. I hope that we can have a inset to
29 // handle the different lists that we have. It should also be possible
30 // to create new lists on the fly.
31 // Currently LyX only supports: itemize, enumerate, description and
32 // lyxlist. All support for these should be moved to this class and other
33 // helper classes.
34 // It is also possible that we will need a baseclass and subclasses for
35 // different types of lists. (and should they be collapsable?)
36 //
37 // Lgb
38
39 InsetList::InsetList()
40         : InsetCollapsable()
41 {
42         setLabel(_("list"));
43         LyXFont font(LyXFont::ALL_SANE);
44         font.decSize();
45         font.decSize();
46         font.setColor(LColor::footnote);
47         setLabelFont(font);
48         setAutoCollapse(false);
49         setInsetName("List");
50 }
51
52
53 void InsetList::Write(Buffer const * buf, ostream & os) const
54 {
55         os << getInsetName() << "\n";
56         InsetCollapsable::Write(buf, os);
57 }
58
59
60 Inset * InsetList::Clone(Buffer const &) const
61 {
62         InsetList * result = new InsetList;
63         result->inset.init(&inset);
64         
65         result->collapsed = collapsed;
66         return result;
67 }
68
69
70 string const InsetList::EditMessage() const
71 {
72         return _("Opened List Inset");
73 }
74
75
76 int InsetList::Latex(Buffer const * buf,
77                      ostream & os, bool fragile, bool fp) const
78 {
79         os << "\\footnote{%\n";
80         
81         int i = inset.Latex(buf, os, fragile, fp);
82         os << "}%\n";
83         
84         return i + 2;
85 }
86
87
88 bool InsetList::InsertInsetAllowed(Inset * in) const
89 {
90         if ((in->LyxCode() == Inset::FOOT_CODE) ||
91             (in->LyxCode() == Inset::MARGIN_CODE)) {
92                 return false;
93         }
94         return true;
95 }