]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFloatList.cpp
* add PreBabelPreamble to Language definition (fixes #4786).
[lyx.git] / src / insets / InsetFloatList.cpp
index eab0b621b661e8ef59775035f39a0f5c1c69db55..7de262f9a20f45c347161d81167fe387be1e4fef 100644 (file)
 #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.needsFloatPkg()) {
-                       // Only two different types allowed here:
-                       string const type = cit->second.floattype();
-                       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,6 +161,12 @@ docstring InsetFloatList::xhtml(XHTMLStream &, OutputParams const &) const {
 
        string toctype;
        docstring toclabel;
+       // 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.floattype();
@@ -231,7 +235,7 @@ docstring InsetFloatList::xhtml(XHTMLStream &, OutputParams const &) const {
                   << html::StartTag("a", parattr)
                   // FIXME XHTML 
                   // There ought to be a simple way to customize this.
-                  << XHTMLStream::NextRaw() << "&seArr;"
+                  << XHTMLStream::NextRaw() << "&gt;"
                   << html::EndTag("a");
                xs << html::EndTag("div");
        }