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.
14 #include "insetlabel.h"
16 #include "BufferView.h"
17 #include "funcrequest.h"
21 #include "support/lstrings.h"
22 #include "support/LOstream.h"
23 #include "support/lstrings.h" //frontStrip, strip
25 using namespace lyx::support;
32 InsetLabel::InsetLabel(InsetCommandParams const & p)
37 InsetLabel::~InsetLabel()
39 InsetCommandMailer("label", *this).hideDialog();
43 void InsetLabel::getLabelList(std::vector<string> & list) const
45 list.push_back(getContents());
49 dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
54 InsetCommandMailer("label", *this).showDialog(cmd.view());
58 case LFUN_INSET_MODIFY: {
60 InsetCommandMailer::string2params(cmd.argument, p);
61 if (p.getCmdName().empty())
65 if (view() && p.getContents() != params().getContents()) {
66 clean = view()->ChangeRefsIfUnique(params().getContents(),
71 cmd.view()->updateInset(this);
76 return InsetCommand::localDispatch(cmd);
81 int InsetLabel::latex(Buffer const &, ostream & os,
82 LatexRunParams const &) const
84 os << escape(getCommand());
89 int InsetLabel::ascii(Buffer const &, ostream & os, int) const
91 os << '<' << getContents() << '>';
96 int InsetLabel::linuxdoc(Buffer const &, ostream & os) const
98 os << "<label id=\"" << getContents() << "\" >";
103 int InsetLabel::docbook(Buffer const &, ostream & os, bool) const
105 os << "<anchor id=\"" << getContents() << "\">";