#include "BufferView.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
-#include "InsetList.h"
-#include "LyXText.h"
-#include "Paragraph.h"
-#include "ParIterator.h"
+#include "Text.h"
#include "sgml.h"
#include "support/lstrings.h"
#include "support/lyxalgo.h"
-#include "support/std_ostream.h"
+using namespace std;
+using namespace lyx::support;
namespace lyx {
-using support::escape;
-
-using std::string;
-using std::ostream;
-using std::vector;
-
InsetLabel::InsetLabel(InsetCommandParams const & p)
: InsetCommand(p, "label")
{}
-std::auto_ptr<InsetBase> InsetLabel::doClone() const
+CommandInfo const * InsetLabel::findInfo(string const & /* cmdName */)
+{
+ static const char * const paramnames[] = {"name", ""};
+ static const bool isoptional[] = {false};
+ static const CommandInfo info = {1, paramnames, isoptional};
+ return &info;
+}
+
+
+Inset * InsetLabel::clone() const
{
- return std::auto_ptr<InsetBase>(new InsetLabel(params()));
+ return new InsetLabel(params());
}
-void InsetLabel::getLabelList(Buffer const &, std::vector<docstring> & list) const
+void InsetLabel::getLabelList(Buffer const &, vector<docstring> & list) const
{
list.push_back(getParam("name"));
}
switch (cmd.action) {
case LFUN_INSET_MODIFY: {
- InsetCommandParams p("label");
+ InsetCommandParams p(LABEL_CODE);
// FIXME UNICODE
InsetCommandMailer::string2params("label", to_utf8(cmd.argument()), p);
if (p.getCmdName().empty()) {
break;
}
if (p["name"] != params()["name"])
- cur.bv().buffer()->changeRefsIfUnique(params()["name"],
- p["name"], InsetBase::REF_CODE);
+ cur.bv().buffer().changeRefsIfUnique(params()["name"],
+ p["name"], REF_CODE);
setParams(p);
break;
}
int InsetLabel::latex(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
os << escape(getCommand());
return 0;
int InsetLabel::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
docstring const str = getParam("name");
os << '<' << str << '>';
int InsetLabel::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
os << "<!-- anchor id=\""
- << sgml::cleanID(buf, runparams, getParam("name"))
- << "\" -->";
+ << sgml::cleanID(buf, runparams, getParam("name"))
+ << "\" -->";
return 0;
}