#include "DispatchResult.h"
#include "Floating.h"
#include "FloatList.h"
-#include "FuncRequest.h"
+#include "Language.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
-#include "MetricsInfo.h"
#include "Paragraph.h"
#include "output_xhtml.h"
#include "TextClass.h"
InsetFloatList::InsetFloatList(Buffer * buf)
- : InsetCommand(buf, InsetCommandParams(FLOAT_LIST_CODE), "toc")
+ : InsetCommand(buf, InsetCommandParams(FLOAT_LIST_CODE))
{}
InsetFloatList::InsetFloatList(Buffer * buf, string const & type)
- : InsetCommand(buf, InsetCommandParams(FLOAT_LIST_CODE), "toc")
+ : InsetCommand(buf, InsetCommandParams(FLOAT_LIST_CODE))
{
setParam("type", from_ascii(type));
}
FloatList::const_iterator cit = floats[to_ascii(getParam("type"))];
if (cit != floats.end()) {
- if (cit->second.builtin()) {
- // Only two different types allowed here:
- string const type = cit->second.type();
- if (type == "table") {
- os << "\\listoftables\n";
- } else if (type == "figure") {
- os << "\\listoffigures\n";
- } else {
- os << "%% unknown builtin float\n";
- }
- } else {
+ Floating const & fl = cit->second;
+ if (fl.needsFloatPkg())
os << "\\listof{" << getParam("type") << "}{"
- << buffer().B_(cit->second.listName()) << "}\n";
+ << buffer().B_(fl.listName()) << "}\n";
+ else {
+ if (!fl.listCommand().empty())
+ os << "\\" << from_ascii(fl.listCommand()) << "\n";
+ else
+ os << "%% "
+ << bformat(_("LyX cannot generate a list of %1$s"), getParam("type"))
+ << "\n";
}
} else {
os << "%%\\listof{" << getParam("type") << "}{"
- << bformat(_("List of %1$s"), from_utf8(cit->second.name()))
+ << bformat(_("List of %1$s"), getParam("type"))
<< "}\n";
}
return 1;
string toctype;
docstring toclabel;
- if (cit->second.builtin()) {
+ // FIXME
+ // Other builtin floats should be handled here. But I'm not sure if that is
+ // even possible yet, since I'm not sure if we have a TOC for such things.
+ // If so, then they should define ListName, as non-builtin floats do, and
+ // then we can use that.
+ // Really, all floats should define that.
+ if (!cit->second.needsFloatPkg()) {
// Only two different types allowed here:
- string const type = cit->second.type();
+ string const type = cit->second.floattype();
if (type == "table") {
toctype = "table";
toclabel = _("List of Tables");
odocstringstream ods;
XHTMLStream xs(ods);
- xs << StartTag("div", "class='toc'");
- xs << StartTag("div", tocattr)
+ xs << html::StartTag("div", "class='toc'");
+ xs << html::StartTag("div", tocattr)
<< toclabel
- << EndTag("div");
+ << html::EndTag("div");
Toc::const_iterator it = toc.begin();
Toc::const_iterator const en = toc.end();
Paragraph const & par = it->dit().innerParagraph();
string const attr = "class='lyxtoc-" + toctype + "'";
Font const dummy;
- xs << StartTag("div", attr);
+ xs << html::StartTag("div", attr);
string const parattr = "href='#" + par.magicLabel() + "' class='tocarrow'";
xs << it->str() << " "
- << StartTag("a", parattr)
+ << html::StartTag("a", parattr)
// FIXME XHTML
// There ought to be a simple way to customize this.
- << XHTMLStream::NextRaw() << "⇘"
- << EndTag("a");
- xs << EndTag("div");
+ << XHTMLStream::NextRaw() << ">"
+ << html::EndTag("a");
+ xs << html::EndTag("div");
}
- xs << EndTag("div");
+ xs << html::EndTag("div");
return ods.str();
}