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"
20 // This class is now mostly finished, except one thing, it is a global
21 // object. This will not do. The user (and layout files) are free to
22 // create floats and modify them to fit into a certain document. So it is
23 // pretty clear that each layout needs its own list, as do documents.
24 // However this is also not enough since we really want the user to be
25 // able to create "presistent" floats, in the sense that a user created
26 // float can be used across sessions and across documents. So we need a
27 // global¹ floatlist as well. The interaction between these are not quite
28 // clear, but it seems natural that the definition found in the document
30 // We also have the issue about what get stored _in_ the lyx file.
32 // ¹ not absolutely global but somewhere where documents,layouts and
33 // the bufferview can have access to it.
37 FloatList::FloatList()
42 FloatList::const_iterator FloatList::begin() const
48 FloatList::const_iterator FloatList::end() const
54 void FloatList::newFloat(Floating const & fl)
60 string const FloatList::defaultPlacement(string const & t) const
62 List::const_iterator cit = list.find(t);
63 if (cit != list.end())
64 return cit->second.placement();
69 bool FloatList::typeExist(string const & t) const
71 List::const_iterator cit = list.find(t);
72 return cit != list.end();
76 Floating const & FloatList::getType(string const & t) const
78 // I wish we could use exceptions
79 List::const_iterator cit = list.find(t);
80 if (cit != list.end())
82 #ifdef HAVE_EXCEPTIONS
83 throw UnknownFloatType(t);
85 static Floating empty_float;
91 void FloatList::erase(string const & t)
97 FloatList::const_iterator FloatList::operator[](string const & t) const