7 #include "insetfloatlist.h"
14 string const InsetFloatList::getScreenLabel() const
16 string const guiName = floatList[float_type]->second.name();
17 if (!guiName.empty()) {
18 string const res = _("List of ") + guiName;
21 return _("ERROR nonexistant float type!");
25 Inset::Code InsetFloatList::LyxCode() const
27 return Inset::FLOAT_LIST_CODE;
31 void InsetFloatList::Write(Buffer const *, ostream & os) const
33 os << "FloatList " << float_type << "\n";
37 void InsetFloatList::Read(Buffer const *, LyXLex & lex)
42 float_type = lex.GetString();
43 lyxerr << "FloatList::float_type: " << float_type << endl;
45 lex.printError("InsetFloatList: Parse error: `$$Token'");
48 token = lex.GetString();
49 if (token == "\\end_inset")
52 if (token != "\\end_inset") {
53 lex.printError("Missing \\end_inset at this point. "
59 void InsetFloatList::Edit(BufferView *, int, int, unsigned int)
62 #warning Implement me please.
65 bv->owner()->getDialogs()->showFloatList(this);
70 int InsetFloatList::Latex(Buffer const *, ostream & os, bool, bool) const
72 FloatList::const_iterator cit = floatList[float_type];
75 if (cit != floatList.end()) {
76 if (cit->second.builtin()) {
77 // Only two different types allowed here:
78 string const type = cit->second.type();
79 if (type == "table") {
80 os << "\\listoftables\n";
81 } else if (type == "figure") {
82 os << "\\listoffigures\n";
84 os << "%% unknown builtin float\n";
87 os << "\\listof{" << float_type << "}{"
88 << _("List of ") << cit->second.name() << "}\n";
91 os << "%%\\listof{" << float_type << "}{"
92 << _("List of ") << cit->second.name() << "}\n";
98 int InsetFloatList::Ascii(Buffer const * buffer, std::ostream & os, int) const
100 os << getScreenLabel() << "\n\n";
102 Buffer::Lists const toc_list = buffer->getLists();
103 Buffer::Lists::const_iterator cit =
104 toc_list.find(float_type);
105 if (cit != toc_list.end()) {
106 Buffer::SingleList::const_iterator ccit = cit->second.begin();
107 Buffer::SingleList::const_iterator end = cit->second.end();
108 for (; ccit != end; ++ccit)
109 os << string(4 * ccit->depth, ' ')
110 << ccit->str << "\n";