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 namespace lyx::support;
27 InsetLabel::InsetLabel(InsetCommandParams const & p)
32 InsetLabel::~InsetLabel()
34 InsetCommandMailer("label", *this).hideDialog();
38 void InsetLabel::getLabelList(std::vector<string> & list) const
40 list.push_back(getContents());
44 dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
49 InsetCommandMailer("label", *this).showDialog(cmd.view());
53 case LFUN_INSET_MODIFY: {
55 InsetCommandMailer::string2params(cmd.argument, p);
56 if (p.getCmdName().empty())
60 if (view() && p.getContents() != params().getContents()) {
61 clean = view()->ChangeRefsIfUnique(params().getContents(),
66 cmd.view()->updateInset(this);
71 return InsetCommand::localDispatch(cmd);
76 int InsetLabel::latex(Buffer const &, ostream & os,
77 LatexRunParams const &) const
79 os << escape(getCommand());
84 int InsetLabel::ascii(Buffer const &, ostream & os, int) const
86 os << '<' << getContents() << '>';
91 int InsetLabel::linuxdoc(Buffer const &, ostream & os) const
93 os << "<label id=\"" << getContents() << "\" >";
98 int InsetLabel::docbook(Buffer const &, ostream & os, bool) const
100 os << "<anchor id=\"" << getContents() << "\">";