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
60 InsetLabel::priv_dispatch(FuncRequest const & cmd,
61 idx_type & idx, pos_type & pos)
63 BOOST_ASSERT(cmd.view());
64 BufferView * const bv = cmd.view();
69 InsetCommandMailer("label", *this).showDialog(bv);
73 case LFUN_INSET_MODIFY: {
75 InsetCommandMailer::string2params(cmd.argument, p);
76 if (p.getCmdName().empty())
80 if (bv && p.getContents() != params().getContents()) {
81 clean = bv->ChangeRefsIfUnique(params().getContents(),
86 bv->updateInset(this);
91 return InsetCommand::priv_dispatch(cmd, idx, pos);
96 int InsetLabel::latex(Buffer const &, ostream & os,
97 LatexRunParams const &) const
99 os << escape(getCommand());
104 int InsetLabel::ascii(Buffer const &, ostream & os, int) const
106 os << '<' << getContents() << '>';
111 int InsetLabel::linuxdoc(Buffer const &, ostream & os) const
113 os << "<label id=\"" << getContents() << "\" >";
118 int InsetLabel::docbook(Buffer const &, ostream & os, bool) const
120 os << "<anchor id=\"" << getContents() << "\">";