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 int InsetFloatList::Latex(Buffer const *, std::ostream & os, bool, bool) const
73 FloatList::const_iterator cit = floatList[float_type];
76 if (cit != floatList.end()) {
77 if (cit->second.builtin()) {
78 // Only two different types allowed here:
79 string const type = cit->second.type();
80 if (type == "table") {
81 os << "\\listoftables\n";
82 } else if (type == "figure") {
83 os << "\\listoffigures\n";
85 os << "%% unknown builtin float\n";
88 os << "\\listof{" << float_type << "}{"
89 << _("List of ") << cit->second.name() << "}\n";
92 os << "%%\\listof{" << float_type << "}{"
93 << _("List of ") << cit->second.name() << "}\n";
99 int InsetFloatList::Ascii(Buffer const * buffer, std::ostream & os, int) const
101 os << getScreenLabel() << "\n\n";
103 Buffer::Lists const toc_list = buffer->getLists();
104 Buffer::Lists::const_iterator cit =
105 toc_list.find(float_type);
106 if (cit != toc_list.end()) {
107 Buffer::SingleList::const_iterator ccit = cit->second.begin();
108 Buffer::SingleList::const_iterator end = cit->second.end();
109 for (; ccit != end; ++ccit)
110 os << string(4 * ccit->depth, ' ')
111 << ccit->str << "\n";