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
30 InsetLabel::InsetLabel(InsetCommandParams const & p, bool)
35 InsetLabel::~InsetLabel()
37 InsetCommandMailer mailer("label", *this);
42 vector<string> const InsetLabel::getLabelList() const
44 return vector<string>(1, getContents());
48 void InsetLabel::edit(BufferView *, int, int, mouse_button::state)
50 InsetCommandMailer mailer("label", *this);
55 dispatch_result InsetLabel::localDispatch(FuncRequest const & cmd)
57 if (cmd.action != LFUN_INSET_APPLY)
61 InsetCommandMailer::string2params(cmd.argument, p);
62 if (p.getCmdName().empty())
66 if (view() && p.getContents() != params().getContents()) {
67 clean = view()->ChangeCitationsIfUnique(params().getContents(),
73 view()->updateInset(this, !clean);
76 // if (result.first) {
77 // string new_contents = trim(result.second);
78 // if (!new_contents.empty() &&
79 // getContents() != new_contents) {
80 // bv->buffer()->markDirty();
81 // bool flag = bv->ChangeRefsIfUnique(getContents(),
83 // setContents(new_contents);
84 // bv->updateInset(this, !flag);
90 void InsetLabel::edit(BufferView * bv, bool)
92 edit(bv, 0, 0, mouse_button::none);
96 int InsetLabel::latex(Buffer const *, ostream & os,
97 bool /*fragile*/, bool /*fs*/) const
99 os << escape(getCommand());
103 int InsetLabel::ascii(Buffer const *, ostream & os, int) const
105 os << '<' << getContents() << '>';
110 int InsetLabel::linuxdoc(Buffer const *, ostream & os) const
112 os << "<label id=\"" << getContents() << "\" >";
117 int InsetLabel::docbook(Buffer const *, ostream & os, bool) const
119 os << "<anchor id=\"" << getContents() << "\">";