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 #include "support/std_ostream.h"
22 using lyx::support::escape;
28 InsetLabel::InsetLabel(InsetCommandParams const & p)
33 InsetLabel::~InsetLabel()
35 InsetCommandMailer("label", *this).hideDialog();
39 void InsetLabel::getLabelList(Buffer const &, std::vector<string> & list) const
41 list.push_back(getContents());
45 dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
50 InsetCommandMailer("label", *this).showDialog(cmd.view());
54 case LFUN_INSET_MODIFY: {
56 InsetCommandMailer::string2params(cmd.argument, p);
57 if (p.getCmdName().empty())
61 if (view() && p.getContents() != params().getContents()) {
62 clean = view()->ChangeRefsIfUnique(params().getContents(),
67 cmd.view()->updateInset(this);
72 return InsetCommand::localDispatch(cmd);
77 int InsetLabel::latex(Buffer const &, ostream & os,
78 LatexRunParams const &) const
80 os << escape(getCommand());
85 int InsetLabel::ascii(Buffer const &, ostream & os, int) const
87 os << '<' << getContents() << '>';
92 int InsetLabel::linuxdoc(Buffer const &, ostream & os) const
94 os << "<label id=\"" << getContents() << "\" >";
99 int InsetLabel::docbook(Buffer const &, ostream & os, bool) const
101 os << "<anchor id=\"" << getContents() << "\">";