3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
8 * Full author contact details are available in file CREDITS.
13 #include "insetlabel.h"
15 #include "BufferView.h"
16 #include "funcrequest.h"
18 #include "support/lstrings.h"
20 using lyx::support::escape;
25 InsetLabel::InsetLabel(InsetCommandParams const & p)
30 InsetLabel::~InsetLabel()
32 InsetCommandMailer("label", *this).hideDialog();
36 void InsetLabel::getLabelList(Buffer const &, std::vector<string> & list) const
38 list.push_back(getContents());
42 dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
47 InsetCommandMailer("label", *this).showDialog(cmd.view());
51 case LFUN_INSET_MODIFY: {
53 InsetCommandMailer::string2params(cmd.argument, p);
54 if (p.getCmdName().empty())
58 if (view() && p.getContents() != params().getContents()) {
59 clean = view()->ChangeRefsIfUnique(params().getContents(),
64 cmd.view()->updateInset(this);
69 return InsetCommand::localDispatch(cmd);
74 int InsetLabel::latex(Buffer const &, ostream & os,
75 LatexRunParams const &) const
77 os << escape(getCommand());
82 int InsetLabel::ascii(Buffer const &, ostream & os, int) const
84 os << '<' << getContents() << '>';
89 int InsetLabel::linuxdoc(Buffer const &, ostream & os) const
91 os << "<label id=\"" << getContents() << "\" >";
96 int InsetLabel::docbook(Buffer const &, ostream & os, bool) const
98 os << "<anchor id=\"" << getContents() << "\">";