3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS
14 #include "BufferView.h"
15 #include "LaTeXFeatures.h"
16 #include "frontends/LyXView.h"
18 #include "frontends/Dialogs.h"
19 #include "support/lstrings.h"
25 InsetUrl::InsetUrl(InsetCommandParams const & p, bool)
32 InsetCommandMailer mailer("url", *this);
37 void InsetUrl::edit(BufferView *, int, int, mouse_button::state)
39 InsetCommandMailer mailer("url", *this);
44 void InsetUrl::edit(BufferView * bv, bool)
46 edit(bv, 0, 0, mouse_button::none);
50 string const InsetUrl::getScreenLabel(Buffer const *) const
53 if (getCmdName() == "url")
56 temp = _("HtmlUrl: ");
60 if (!getOptions().empty())
66 if (url.length() > 30) {
67 url = url.substr(0, 10) + "..."
68 + url.substr(url.length() - 17, url.length());
74 int InsetUrl::latex(Buffer const *, ostream & os,
75 bool fragile, bool /*free_spc*/) const
77 if (!getOptions().empty())
78 os << getOptions() + ' ';
81 os << "\\url{" << getContents() << '}';
86 int InsetUrl::ascii(Buffer const *, ostream & os, int) const
88 if (getOptions().empty())
89 os << '[' << getContents() << ']';
91 os << '[' << getContents() << "||" << getOptions() << ']';
96 int InsetUrl::linuxdoc(Buffer const *, ostream & os) const
98 os << '<' << getCmdName()
99 << " url=\"" << getContents() << "\""
100 << " name=\"" << getOptions() << "\">";
106 int InsetUrl::docbook(Buffer const *, ostream & os, bool) const
108 os << "<ulink url=\"" << subst(getContents(),"&","&")
109 << "\">" << getOptions() << "</ulink>";
114 void InsetUrl::validate(LaTeXFeatures & features) const
116 features.require("url");