1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1998 The LyX Team.
8 * ====================================================== */
13 #pragma implementation
16 #include "insetlist.h"
19 #include "BufferView.h"
22 #include "support/LOstream.h"
27 // This class is _far_ from finished. I hope that we can have a inset to
28 // handle the different lists that we have. It should also be possible
29 // to create new lists on the fly.
30 // Currently LyX only supports: itemize, enumerate, description and
31 // lyxlist. All support for these should be moved to this class and other
33 // It is also possible that we will need a baseclass and subclasses for
34 // different types of lists. (and should they be collapsable?)
38 InsetList::InsetList()
42 LyXFont font(LyXFont::ALL_SANE);
45 font.setColor(LColor::footnote);
47 setAutoCollapse(false);
52 void InsetList::Write(Buffer const * buf, ostream & os) const
54 os << getInsetName() << "\n";
55 InsetCollapsable::Write(buf, os);
59 Inset * InsetList::Clone() const
61 InsetList * result = new InsetList;
64 result->collapsed = collapsed;
69 char const * InsetList::EditMessage() const
71 return _("Opened List Inset");
75 int InsetList::Latex(Buffer const * buf,
76 ostream & os, bool fragile, bool fp) const
78 os << "\\footnote{%\n";
80 int i = InsetText::Latex(buf, os, fragile, fp);
87 bool InsetList::InsertInset(BufferView * bv, Inset * inset)
89 if (!InsertInsetAllowed(inset))
92 return InsetText::InsertInset(bv, inset);
96 bool InsetList::InsertInsetAllowed(Inset * inset) const
98 if ((inset->LyxCode() == Inset::FOOT_CODE) ||
99 (inset->LyxCode() == Inset::MARGIN_CODE)) {
106 LyXFont InsetList::GetDrawFont(BufferView * bv,LyXParagraph * p, int pos) const
108 LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
109 fn.decSize().decSize();