3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
8 * Full author contact details are available in file CREDITS.
13 #include "FloatList.h"
17 // This class is now mostly finished, except one thing, it is a global
18 // object. This will not do. The user (and layout files) are free to
19 // create floats and modify them to fit into a certain document. So it is
20 // pretty clear that each layout needs its own list, as do documents.
21 // However this is also not enough since we really want the user to be
22 // able to create "presistent" floats, in the sense that a user created
23 // float can be used across sessions and across documents. So we need a
24 // global¹ floatlist as well. The interaction between these are not quite
25 // clear, but it seems natural that the definition found in the document
27 // We also have the issue about what get stored _in_ the lyx file.
29 // ¹ not absolutely global but somewhere where documents,layouts and
30 // the bufferview can have access to it.
34 FloatList::FloatList()
39 FloatList::const_iterator FloatList::begin() const
45 FloatList::const_iterator FloatList::end() const
51 void FloatList::newFloat(Floating const & fl)
57 string const FloatList::defaultPlacement(string const & t) const
59 List::const_iterator cit = list.find(t);
60 if (cit != list.end())
61 return cit->second.placement();
66 bool FloatList::typeExist(string const & t) const
68 List::const_iterator cit = list.find(t);
69 return cit != list.end();
73 Floating const & FloatList::getType(string const & t) const
75 // I wish we could use exceptions
76 List::const_iterator cit = list.find(t);
77 if (cit != list.end())
79 #ifdef HAVE_EXCEPTIONS
80 throw UnknownFloatType(t);
82 static Floating empty_float;
88 void FloatList::erase(string const & t)
94 FloatList::const_iterator FloatList::operator[](string const & t) const