+ // InsetBibtex
+ if (name == "bibtex") {
+ static const char * const paramnames[] =
+ {"options", "btprint", "bibfiles", ""};
+ static const bool isoptional[] = {true, true, false};
+ static const CommandInfo info = {3, paramnames, isoptional};
+ return &info;
+ }
+
+ // InsetCitation
+ // FIXME: Use is_possible_cite_command() in
+ // src/frontends/controllers/biblio.C, see comment in src/factory.C.
+ if (name == "cite" || name == "citet" || name == "citep" || name == "citealt" ||
+ name == "citealp" || name == "citeauthor" || name == "citeyear" ||
+ name == "citeyearpar" || name == "citet*" || name == "citep*" ||
+ name == "citealt*" || name == "citealp*" ||
+ name == "citeauthor*" || name == "Citet" || name == "Citep" ||
+ name == "Citealt" || name == "Citealp" || name == "Citeauthor" ||
+ name == "Citet*" || name == "Citep*" || name == "Citealt*" ||
+ name == "Citealp*" || name == "Citeauthor*" ||
+ name == "citefield" || name == "citetitle" || name == "cite*") {
+ // standard cite does only take one argument if jurabib is
+ // not used, but jurabib extends this to two arguments, so
+ // we have to allow both here. InsetCitation takes care that
+ // LaTeX output is nevertheless correct.
+ static const char * const paramnames[] =
+ {"after", "before", "key", ""};
+ static const bool isoptional[] = {true, true, false};
+ static const CommandInfo info = {3, paramnames, isoptional};
+ return &info;
+ }
+
+ // InsetFloatlist
+ if (name == "floatlist") {
+ static const char * const paramnames[] = {"type", ""};
+ static const bool isoptional[] = {false};
+ static const CommandInfo info = {1, paramnames, isoptional};
+ return &info;
+ }
+
+ // InsetHfill
+ if (name == "hfill") {
+ static const char * const paramnames[] = {""};
+ static const CommandInfo info = {0, paramnames, 0};
+ return &info;
+ }
+
+ // InsetInclude
+ if (name == "include" || name == "input" || name == "verbatiminput" ||
+ name == "verbatiminput*") {
+ static const char * const paramnames[] = {"filename", ""};
+ static const bool isoptional[] = {false};
+ static const CommandInfo info = {1, paramnames, isoptional};
+ return &info;
+ }
+
+ // InsetIndex, InsetPrintIndex, InsetLabel
+ if (name == "index" || name == "printindex" || name == "label") {
+ static const char * const paramnames[] = {"name", ""};
+ static const bool isoptional[] = {false};
+ static const CommandInfo info = {1, paramnames, isoptional};
+ return &info;
+ }
+
+ // InsetNomencl
+ if (name == "nomenclature") {
+ static const char * const paramnames[] = {"prefix", "symbol", "description", ""};
+ static const bool isoptional[] = {true, false, false};
+ static const CommandInfo info = {3, paramnames, isoptional};
+ return &info;
+ }
+
+ // InsetPrintNomencl
+ if (name == "printnomenclature") {
+ static const char * const paramnames[] = {"labelwidth", ""};
+ static const bool isoptional[] = {true};
+ static const CommandInfo info = {1, paramnames, isoptional};
+ return &info;
+ }
+
+ // InsetRef
+ if (name == "eqref" || name == "pageref" || name == "vpageref" ||
+ name == "vref" || name == "prettyref" || name == "ref") {
+ static const char * const paramnames[] =
+ {"name", "reference", ""};
+ static const bool isoptional[] = {true, false};
+ static const CommandInfo info = {2, paramnames, isoptional};
+ return &info;
+ }
+
+ // InsetTOC
+ if (name == "tableofcontents") {
+ static const char * const paramnames[] = {"type", ""};
+ static const bool isoptional[] = {false};
+ static const CommandInfo info = {1, paramnames, isoptional};
+ return &info;
+ }
+
+ // InsetUrl
+ if (name == "htmlurl" || name == "url") {
+ static const char * const paramnames[] =
+ {"name", "target", ""};
+ static const bool isoptional[] = {true, false};
+ static const CommandInfo info = {2, paramnames, isoptional};
+ return &info;
+ }
+
+ return 0;
+}
+
+
+void InsetCommandParams::setCmdName(string const & name)
+{
+ name_ = name;
+ CommandInfo const * const info = findInfo(name);
+ BOOST_ASSERT(info);
+ ParamVector params(info->n);
+ // Overtake parameters with the same name
+ for (size_t i = 0; i < info_->n; ++i) {
+ int j = findToken(info->paramnames, info_->paramnames[i]);
+ if (j >= 0)
+ params[j] = params_[i];
+ }
+ info_ = info;
+ std::swap(params, params_);
+}