]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFloatList.cpp
This should be the last of the commits refactoring the InsetLayout code.
[lyx.git] / src / insets / InsetFloatList.cpp
index ec8cf428c25fcf359b76077e89c3fac7b8fc635c..87e6bd2d343b412b9b68cc0c24508248f972ea4a 100644 (file)
 
 #include "Buffer.h"
 #include "BufferParams.h"
-#include "debug.h"
 #include "DispatchResult.h"
 #include "Floating.h"
 #include "FloatList.h"
 #include "FuncRequest.h"
-#include "gettext.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
 #include "TocBackend.h"
+#include "TextClass.h"
 
+#include "support/debug.h"
+#include "support/gettext.h"
 #include "support/lstrings.h"
 
+#include <ostream>
 
-namespace lyx {
-
-using support::bformat;
+using namespace std;
+using namespace lyx::support;
 
-using std::endl;
-using std::string;
-using std::ostream;
+namespace lyx {
 
 
 InsetFloatList::InsetFloatList()
-       : InsetCommand(InsetCommandParams("floatlist"), "toc")
+       : InsetCommand(InsetCommandParams(FLOAT_LIST_CODE), "toc")
 {}
 
 
 InsetFloatList::InsetFloatList(string const & type)
-       : InsetCommand(InsetCommandParams("floatlist"), "toc")
+       : InsetCommand(InsetCommandParams(FLOAT_LIST_CODE), "toc")
 {
        setParam("type", from_ascii(type));
 }
 
 
+CommandInfo const * InsetFloatList::findInfo(string const & /* cmdName */)
+{
+       static const char * const paramnames[] = {"type", ""};
+       static const bool isoptional[] = {false};
+       static const CommandInfo info = {1, paramnames, isoptional};
+       return &info;
+}
+
+
+//HACK
+bool InsetFloatList::isCompatibleCommand(string const & s)
+{
+       string str = s.substr(0, 6);
+       return str == "listof";
+}
+
+
 docstring const InsetFloatList::getScreenLabel(Buffer const & buf) const
 {
        FloatList const & floats = buf.params().getTextClass().floats();
@@ -60,12 +76,6 @@ docstring const InsetFloatList::getScreenLabel(Buffer const & buf) const
 }
 
 
-Inset::Code InsetFloatList::lyxCode() const
-{
-       return Inset::FLOAT_LIST_CODE;
-}
-
-
 void InsetFloatList::write(Buffer const &, ostream & os) const
 {
        os << "FloatList " << to_ascii(getParam("type")) << "\n";
@@ -79,12 +89,14 @@ void InsetFloatList::read(Buffer const & buf, Lexer & lex)
 
        if (lex.eatLine()) {
                setParam("type", lex.getDocString());
-               LYXERR(Debug::INSETS) << "FloatList::float_type: "
-                                     << to_ascii(getParam("type")) << endl;
+               LYXERR(Debug::INSETS, "FloatList::float_type: "
+                                     << to_ascii(getParam("type")));
                if (!floats.typeExist(to_ascii(getParam("type"))))
                        lex.printError("InsetFloatList: Unknown float type: `$$Token'");
-       } else
+       } else {
                lex.printError("InsetFloatList: Parse error: `$$Token'");
+       }
+
        while (lex.isOK()) {
                lex.next();
                token = lex.getString();