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 "frontends/LyXView.h"
20 #include "support/lstrings.h"
22 #include "support/std_ostream.h"
24 using lyx::support::escape;
30 InsetLabel::InsetLabel(InsetCommandParams const & p)
35 InsetLabel::~InsetLabel()
37 InsetCommandMailer("label", *this).hideDialog();
41 std::auto_ptr<InsetBase> InsetLabel::clone() const
43 return std::auto_ptr<InsetBase>(new InsetLabel(params()));
47 void InsetLabel::getLabelList(Buffer const &, std::vector<string> & list) const
49 list.push_back(getContents());
53 string const InsetLabel::getScreenLabel(Buffer const &) const
59 dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
61 BOOST_ASSERT(cmd.view());
62 BufferView * const bv = cmd.view();
67 InsetCommandMailer("label", *this).showDialog(bv);
71 case LFUN_INSET_MODIFY: {
73 InsetCommandMailer::string2params(cmd.argument, p);
74 if (p.getCmdName().empty())
78 if (bv && p.getContents() != params().getContents()) {
79 clean = bv->ChangeRefsIfUnique(params().getContents(),
84 bv->updateInset(this);
89 return InsetCommand::localDispatch(cmd);
94 int InsetLabel::latex(Buffer const &, ostream & os,
95 LatexRunParams const &) const
97 os << escape(getCommand());
102 int InsetLabel::ascii(Buffer const &, ostream & os, int) const
104 os << '<' << getContents() << '>';
109 int InsetLabel::linuxdoc(Buffer const &, ostream & os) const
111 os << "<label id=\"" << getContents() << "\" >";
116 int InsetLabel::docbook(Buffer const &, ostream & os, bool) const
118 os << "<anchor id=\"" << getContents() << "\">";