10 // This class is now mostly finished, except one thing, it is a global
11 // object. This will not do. The user (and layout files) are free to
12 // create floats and modify them to fit into a certain document. So it is
13 // pretty clear that each layout needs its own list, as do documents.
14 // However this is also not enough since we really want the user to be
15 // able to create "presistent" floats, in the sense that a user created
16 // float can be used across sessions and across documents. So we need a
17 // global¹ floatlist as well. The interaction between these are not quite
18 // clear, but it seems natural that the definition found in the document
20 // We also have the issue about what get stored _in_ the lyx file.
22 // ¹ not absolutely global but somewhere where documents,layouts and
23 // the bufferview can have access to it.
27 FloatList::FloatList()
29 // Insert the latex builtin float-types
30 // (these will later be read from a layout file)
33 Floating table("table", "htbp", "lot", "", "plain", N_("Table"),
34 N_("List of Tables"), true);
38 Floating figure("figure", "htbp", "lof",
39 "", "plain", N_("Figure"),
40 N_("List of Figures"), true);
43 // And we add algorithm too since LyX has
44 // supported that for a long time,
45 // but support for this should probably be moved to a layout file.
46 Floating algorithm("algorithm", "htbp", "loa",
47 "", "ruled", N_("Algorithm"),
48 N_("List of Algorithms"));
53 FloatList::const_iterator FloatList::begin() const
59 FloatList::const_iterator FloatList::end() const
65 void FloatList::newFloat(Floating const & fl)
71 string const FloatList::defaultPlacement(string const & t) const
73 List::const_iterator cit = list.find(t);
74 if (cit != list.end())
75 return cit->second.placement();
80 bool FloatList::typeExist(string const & t) const
82 List::const_iterator cit = list.find(t);
83 return cit != list.end();
87 Floating const & FloatList::getType(string const & t) const
89 // I wish we could use exceptions
90 List::const_iterator cit = list.find(t);
91 if (cit != list.end())
93 #ifdef HAVE_EXCEPTIONS
94 throw UnknownFloatType(t);
96 static Floating empty_float;
102 FloatList::const_iterator FloatList::operator[](string const & t) const
108 // The global floatlist