X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFloatList.cpp;h=87e6bd2d343b412b9b68cc0c24508248f972ea4a;hb=2c357c1d23b7b83839a9beb8225d4f1ae4f793b4;hp=54711a87d0821743d3530f3f47f2390abe01067b;hpb=32871c1284f15265f652ff01c438e539a7c8181f;p=lyx.git diff --git a/src/insets/InsetFloatList.cpp b/src/insets/InsetFloatList.cpp index 54711a87d0..87e6bd2d34 100644 --- a/src/insets/InsetFloatList.cpp +++ b/src/insets/InsetFloatList.cpp @@ -14,44 +14,60 @@ #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 -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().getLyXTextClass().floats(); + FloatList const & floats = buf.params().getTextClass().floats(); FloatList::const_iterator it = floats[to_ascii(getParam("type"))]; if (it != floats.end()) return buf.B_(it->second.listName()); @@ -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"; @@ -74,17 +84,19 @@ void InsetFloatList::write(Buffer const &, ostream & os) const void InsetFloatList::read(Buffer const & buf, Lexer & lex) { - FloatList const & floats = buf.params().getLyXTextClass().floats(); + FloatList const & floats = buf.params().getTextClass().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 +111,9 @@ void InsetFloatList::read(Buffer const & buf, Lexer & 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().getTextClass().floats(); FloatList::const_iterator cit = floats[to_ascii(getParam("type"))]; if (cit != floats.end()) { @@ -129,7 +141,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";