7 #include "insetfloatlist.h"
15 string const InsetFloatList::getScreenLabel() const
17 string const guiName = floatList[float_type]->second.name();
18 if (!guiName.empty()) {
19 string const res = _("List of ") + guiName;
22 return _("ERROR nonexistant float type!");
26 Inset::Code InsetFloatList::lyxCode() const
28 return Inset::FLOAT_LIST_CODE;
32 void InsetFloatList::write(Buffer const *, std::ostream & os) const
34 os << "FloatList " << float_type << "\n";
38 void InsetFloatList::read(Buffer const *, LyXLex & lex)
43 float_type = lex.GetString();
44 lyxerr << "FloatList::float_type: " << float_type << endl;
46 lex.printError("InsetFloatList: Parse error: `$$Token'");
49 token = lex.GetString();
50 if (token == "\\end_inset")
53 if (token != "\\end_inset") {
54 lex.printError("Missing \\end_inset at this point. "
60 void InsetFloatList::edit(BufferView *, int, int, unsigned int)
63 #warning Implement me please.
66 bv->owner()->getDialogs()->showFloatList(this);
71 void InsetFloatList::edit(BufferView * bv, bool)
77 int InsetFloatList::latex(Buffer const *, std::ostream & os, bool, bool) const
79 FloatList::const_iterator cit = floatList[float_type];
82 if (cit != floatList.end()) {
83 if (cit->second.builtin()) {
84 // Only two different types allowed here:
85 string const type = cit->second.type();
86 if (type == "table") {
87 os << "\\listoftables\n";
88 } else if (type == "figure") {
89 os << "\\listoffigures\n";
91 os << "%% unknown builtin float\n";
94 os << "\\listof{" << float_type << "}{"
95 << _("List of ") << cit->second.name() << "}\n";
98 os << "%%\\listof{" << float_type << "}{"
99 << _("List of ") << cit->second.name() << "}\n";
105 int InsetFloatList::ascii(Buffer const * buffer, std::ostream & os, int) const
107 os << getScreenLabel() << "\n\n";
109 Buffer::Lists const toc_list = buffer->getLists();
110 Buffer::Lists::const_iterator cit =
111 toc_list.find(float_type);
112 if (cit != toc_list.end()) {
113 Buffer::SingleList::const_iterator ccit = cit->second.begin();
114 Buffer::SingleList::const_iterator end = cit->second.end();
115 for (; ccit != end; ++ccit)
116 os << string(4 * ccit->depth, ' ')
117 << ccit->str << "\n";