9 // This class is now mostly finished, except one thing, it is a global
10 // object. This will not do. The user (and layout files) are free to
11 // create floats and modify them to fit into a certain document. So it is
12 // pretty clear that each layout needs its own list, as do documents.
13 // However this is also not enough since we really want the user to be
14 // able to create "presistent" floats, in the sense that a user created
15 // float can be used across sessions and across documents. So we need a
16 // global¹ floatlist as well. The interaction between these are not quite
17 // clear, but it seems natural that the definition found in the document
19 // We also have the issue about what get stored _in_ the lyx file.
21 // ¹ not absolutely global but somewhere where documents,layouts and
22 // the bufferview can have access to it.
26 FloatList::FloatList()
28 // Insert the latex builtin float-types
29 // (these will later be read from a layout file)
32 Floating table("table", "htbp", "lot", "", "plain", "Table", true);
36 Floating figure("figure", "htbp", "lof", "", "plain", "Figure", true);
39 // And we add algorithm too since LyX has
40 // supported that for a long time,
41 // but support for this should probably be moved to a layout file.
42 Floating algorithm("algorithm", "htbp", "loa",
43 "", "ruled", "Algorithm");
48 FloatList::const_iterator FloatList::begin() const
54 FloatList::const_iterator FloatList::end() const
60 void FloatList::newFloat(Floating const & fl)
66 string const FloatList::defaultPlacement(string const & t) const
68 List::const_iterator cit = list.find(t);
69 if (cit != list.end())
70 return cit->second.placement();
75 bool FloatList::typeExist(string const & t) const
77 List::const_iterator cit = list.find(t);
78 return cit != list.end();
82 Floating const & FloatList::getType(string const & t) const
84 // I wish we could use exceptions
85 List::const_iterator cit = list.find(t);
86 if (cit != list.end())
88 #ifdef HAVE_EXCEPTIONS
89 throw UnknownFloatType(t);
91 static Floating empty_float;
97 FloatList::const_iterator FloatList::operator[](string const & t) const
103 // The global floatlist