]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFloatList.cpp
Andre's s/getTextClass/textClass/ cleanup.
[lyx.git] / src / insets / InsetFloatList.cpp
index c43a64a03446b3c4ef4906917ef65bdbe96cb6ef..f3299d899f7892d7c7e1fa79c892818d0c8ad6b8 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 "LyXLex.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));
 }
 
 
+ParamInfo const & InsetFloatList::findInfo(string const & /* cmdName */)
+{
+       static ParamInfo param_info_;
+       if (param_info_.empty()) {
+               param_info_.add("type", false);
+       }
+       return param_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().getLyXTextClass().floats();
+       FloatList const & floats = buf.params().textClass().floats();
        FloatList::const_iterator it = floats[to_ascii(getParam("type"))];
        if (it != floats.end())
                return buf.B_(it->second.listName());
@@ -60,31 +77,27 @@ docstring const InsetFloatList::getScreenLabel(Buffer const & buf) const
 }
 
 
-InsetBase::Code InsetFloatList::lyxCode() const
-{
-       return InsetBase::FLOAT_LIST_CODE;
-}
-
-
 void InsetFloatList::write(Buffer const &, ostream & os) const
 {
        os << "FloatList " << to_ascii(getParam("type")) << "\n";
 }
 
 
-void InsetFloatList::read(Buffer const & buf, LyXLex & lex)
+void InsetFloatList::read(Buffer const & buf, Lexer & lex)
 {
-       FloatList const & floats = buf.params().getLyXTextClass().floats();
+       FloatList const & floats = buf.params().textClass().floats();
        string token;
 
        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();
@@ -99,9 +112,9 @@ void InsetFloatList::read(Buffer const & buf, LyXLex & lex)
 
 
 int InsetFloatList::latex(Buffer const & buf, odocstream & os,
-                          OutputParams const &) const
+                         OutputParams const &) const
 {
-       FloatList const & floats = buf.params().getLyXTextClass().floats();
+       FloatList const & floats = buf.params().textClass().floats();
        FloatList::const_iterator cit = floats[to_ascii(getParam("type"))];
 
        if (cit != floats.end()) {
@@ -129,7 +142,7 @@ int InsetFloatList::latex(Buffer const & buf, odocstream & os,
 
 
 int InsetFloatList::plaintext(Buffer const & buffer, odocstream & os,
-                              OutputParams const &) const
+                             OutputParams const &) const
 {
        os << getScreenLabel(buffer) << "\n\n";