#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 "TextClass.h"
#include "TocBackend.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()
}
-CommandInfo const * InsetFloatList::findInfo(std::string const & /* cmdName */)
+ParamInfo 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;
+ static ParamInfo param_info_;
+ if (param_info_.empty()) {
+ param_info_.add("type", ParamInfo::LATEX_REQUIRED);
+ }
+ return param_info_;
}
//HACK
-bool InsetFloatList::isCompatibleCommand(std::string const & s) {
- std::string str = s.substr(0, 6);
+bool InsetFloatList::isCompatibleCommand(string const & s)
+{
+ string str = s.substr(0, 6);
return str == "listof";
}
-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()) {
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
- lex.printError("InsetFloatList: Parse error: `$$Token'");
+ lex.printError("Unknown float type");
+ } else {
+ lex.printError("Parse error");
+ }
+
while (lex.isOK()) {
lex.next();
token = lex.getString();
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()) {
}
} else {
os << "\\listof{" << getParam("type") << "}{"
- << buf.B_(cit->second.listName()) << "}\n";
+ << buffer().B_(cit->second.listName()) << "}\n";
}
} else {
os << "%%\\listof{" << getParam("type") << "}{"
}
-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;
}