]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFloatList.cpp
Remove all BufferParam arguments in InsetXXX methods (since insets know about their...
[lyx.git] / src / insets / InsetFloatList.cpp
index fd9a265cfa72ca8328d15c0cb735d1f57aeb0cb7..a476e23908e7d8f1b672fee3898b1e0af50784d3 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -21,8 +21,8 @@
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
-#include "TocBackend.h"
 #include "TextClass.h"
+#include "TocBackend.h"
 
 #include "support/debug.h"
 #include "support/gettext.h"
@@ -52,7 +52,7 @@ ParamInfo const & InsetFloatList::findInfo(string const & /* cmdName */)
 {
        static ParamInfo param_info_;
        if (param_info_.empty()) {
-               param_info_.add("type", false);
+               param_info_.add("type", ParamInfo::LATEX_REQUIRED);
        }
        return param_info_;
 }
@@ -66,26 +66,27 @@ bool InsetFloatList::isCompatibleCommand(string const & s)
 }
 
 
-docstring const InsetFloatList::getScreenLabel(Buffer const & buf) const
+docstring InsetFloatList::screenLabel() const
 {
-       FloatList const & floats = buf.params().getTextClass().floats();
+       FloatList const & floats = buffer().params().documentClass().floats();
        FloatList::const_iterator it = floats[to_ascii(getParam("type"))];
        if (it != floats.end())
-               return buf.B_(it->second.listName());
+               return buffer().B_(it->second.listName());
        else
                return _("ERROR: Nonexistent float type!");
 }
 
 
-void InsetFloatList::write(Buffer const &, ostream & os) const
+void InsetFloatList::write(ostream & os) const
 {
        os << "FloatList " << to_ascii(getParam("type")) << "\n";
 }
 
 
-void InsetFloatList::read(Buffer const & buf, Lexer & lex)
+void InsetFloatList::read(Lexer & lex)
 {
-       FloatList const & floats = buf.params().getTextClass().floats();
+       lex.setContext("InsetFloatList::read");
+       FloatList const & floats = buffer().params().documentClass().floats();
        string token;
 
        if (lex.eatLine()) {
@@ -93,9 +94,9 @@ void InsetFloatList::read(Buffer const & buf, Lexer & lex)
                LYXERR(Debug::INSETS, "FloatList::float_type: "
                                      << to_ascii(getParam("type")));
                if (!floats.typeExist(to_ascii(getParam("type"))))
-                       lex.printError("InsetFloatList: Unknown float type: `$$Token'");
+                       lex.printError("Unknown float type");
        } else {
-               lex.printError("InsetFloatList: Parse error: `$$Token'");
+               lex.printError("Parse error");
        }
 
        while (lex.isOK()) {
@@ -105,16 +106,14 @@ void InsetFloatList::read(Buffer const & buf, Lexer & lex)
                        break;
        }
        if (token != "\\end_inset") {
-               lex.printError("Missing \\end_inset at this point. "
-                              "Read: `$$Token'");
+               lex.printError("Missing \\end_inset at this point.");
        }
 }
 
 
-int InsetFloatList::latex(Buffer const & buf, odocstream & os,
-                         OutputParams const &) const
+int InsetFloatList::latex(odocstream & os, OutputParams const &) const
 {
-       FloatList const & floats = buf.params().getTextClass().floats();
+       FloatList const & floats = buffer().params().documentClass().floats();
        FloatList::const_iterator cit = floats[to_ascii(getParam("type"))];
 
        if (cit != floats.end()) {
@@ -130,7 +129,7 @@ int InsetFloatList::latex(Buffer const & buf, odocstream & os,
                        }
                } else {
                        os << "\\listof{" << getParam("type") << "}{"
-                          << buf.B_(cit->second.listName()) << "}\n";
+                          << buffer().B_(cit->second.listName()) << "}\n";
                }
        } else {
                os << "%%\\listof{" << getParam("type") << "}{"
@@ -141,12 +140,11 @@ int InsetFloatList::latex(Buffer const & buf, odocstream & os,
 }
 
 
-int InsetFloatList::plaintext(Buffer const & buffer, odocstream & os,
-                             OutputParams const &) const
+int InsetFloatList::plaintext(odocstream & os, OutputParams const &) const
 {
-       os << getScreenLabel(buffer) << "\n\n";
+       os << screenLabel() << "\n\n";
 
-       buffer.tocBackend().writePlaintextTocList(to_ascii(getParam("type")), os);
+       buffer().tocBackend().writePlaintextTocList(to_ascii(getParam("type")), os);
 
        return PLAINTEXT_NEWLINE;
 }