#include "Cursor.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "LyXFunc.h"
#include "OutputParams.h"
#include "sgml.h"
+#include "support/docstream.h"
#include "support/lstrings.h"
+using namespace std;
+using namespace lyx::support;
namespace lyx {
-using support::escape;
-
-using std::string;
-using std::ostream;
-
InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf)
: InsetCommand(p, "ref"), isLatex(buf.isLatex())
{}
+bool InsetRef::isCompatibleCommand(string const & s) {
+ //FIXME This is likely not the best way to handle this.
+ //But this stuff is hardcoded elsewhere already.
+ return s == "ref"
+ || s == "pageref"
+ || s == "vref"
+ || s == "vpageref"
+ || s == "prettyref"
+ || s == "eqref";
+}
+
+
+CommandInfo const * InsetRef::findInfo(string const & /* cmdName */)
+{
+ static const char * const paramnames[] = {"name", "reference", ""};
+ static const bool isoptional[] = {true, false};
+ static const CommandInfo info = {2, paramnames, isoptional};
+ return &info;
+}
+
+
void InsetRef::doDispatch(Cursor & cur, FuncRequest & cmd)
{
switch (cmd.action) {
{
// We don't want to output p_["name"], since that is only used
// in docbook. So we construct new params, without it, and use that.
- InsetCommandParams p("ref", getCmdName());
+ InsetCommandParams p(REF_CODE, getCmdName());
p["reference"] = getParam("reference");
os << escape(p.getCommand());
return 0;
}
-int InsetRef::textString(Buffer const & buf, odocstream & os,
- OutputParams const & op) const
+void InsetRef::textString(Buffer const & buf, odocstream & os) const
{
- return plaintext(buf, os, op);
+ plaintext(buf, os, OutputParams(0));
}