X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFloatList.cpp;h=7de262f9a20f45c347161d81167fe387be1e4fef;hb=12c7e7dde3851ad894380fd42ba741dd3d0cbcc7;hp=23796fcf7d966785683b14b7103e8d2149295384;hpb=492663987948a391361c324336454bf6733a23b2;p=lyx.git diff --git a/src/insets/InsetFloatList.cpp b/src/insets/InsetFloatList.cpp index 23796fcf7d..7de262f9a2 100644 --- a/src/insets/InsetFloatList.cpp +++ b/src/insets/InsetFloatList.cpp @@ -17,10 +17,10 @@ #include "DispatchResult.h" #include "Floating.h" #include "FloatList.h" -#include "FuncRequest.h" +#include "Font.h" +#include "Language.h" #include "LaTeXFeatures.h" #include "Lexer.h" -#include "MetricsInfo.h" #include "Paragraph.h" #include "output_xhtml.h" #include "TextClass.h" @@ -39,12 +39,12 @@ namespace lyx { 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)); } @@ -119,23 +119,21 @@ int InsetFloatList::latex(odocstream & os, OutputParams const &) const 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; @@ -163,9 +161,15 @@ docstring InsetFloatList::xhtml(XHTMLStream &, OutputParams const &) const { 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"); @@ -214,10 +218,10 @@ docstring InsetFloatList::xhtml(XHTMLStream &, OutputParams const &) const { 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(); @@ -225,17 +229,17 @@ docstring InsetFloatList::xhtml(XHTMLStream &, OutputParams const &) const { 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(); }