7 #include "insetfloatlist.h"
15 string const InsetFloatList::getScreenLabel(Buffer const *) const
17 string const guiName = floatList[float_type]->second.name();
18 if (!guiName.empty()) {
19 string const res = guiName + _(" List");
22 return _("ERROR: Nonexistent 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)
62 // FIX: Implement me please.
64 bv->owner()->getDialogs()->showFloatList(this);
69 void InsetFloatList::edit(BufferView * bv, bool)
75 int InsetFloatList::latex(Buffer const *, std::ostream & os, bool, bool) const
77 FloatList::const_iterator cit = floatList[float_type];
80 if (cit != floatList.end()) {
81 if (cit->second.builtin()) {
82 // Only two different types allowed here:
83 string const type = cit->second.type();
84 if (type == "table") {
85 os << "\\listoftables\n";
86 } else if (type == "figure") {
87 os << "\\listoffigures\n";
89 os << "%% unknown builtin float\n";
92 os << "\\listof{" << float_type << "}{"
93 << _("List of ") << cit->second.name() << "}\n";
96 os << "%%\\listof{" << float_type << "}{"
97 << _("List of ") << cit->second.name() << "}\n";
103 int InsetFloatList::ascii(Buffer const * buffer, std::ostream & os, int) const
105 os << getScreenLabel(buffer) << "\n\n";
107 Buffer::Lists const toc_list = buffer->getLists();
108 Buffer::Lists::const_iterator cit =
109 toc_list.find(float_type);
110 if (cit != toc_list.end()) {
111 Buffer::SingleList::const_iterator ccit = cit->second.begin();
112 Buffer::SingleList::const_iterator end = cit->second.end();
113 for (; ccit != end; ++ccit)
114 os << string(4 * ccit->depth, ' ')
115 << ccit->str << "\n";