8 #include "BufferView.h"
9 #include "LaTeXFeatures.h"
10 #include "frontends/LyXView.h"
12 #include "frontends/Dialogs.h"
13 #include "support/lstrings.h"
19 InsetUrl::InsetUrl(InsetCommandParams const & p, bool)
24 void InsetUrl::edit(BufferView * bv, int, int, mouse_button::state)
26 bv->owner()->getDialogs().showUrl(this);
30 void InsetUrl::edit(BufferView * bv, bool)
32 edit(bv, 0, 0, mouse_button::none);
36 string const InsetUrl::getScreenLabel(Buffer const *) const
39 if (getCmdName() == "url")
42 temp = _("HtmlUrl: ");
46 if (!getOptions().empty())
52 if (url.length() > 30) {
53 url = url.substr(0, 10) + "..."
54 + url.substr(url.length() - 17, url.length());
60 int InsetUrl::latex(Buffer const *, ostream & os,
61 bool fragile, bool /*free_spc*/) const
63 if (!getOptions().empty())
64 os << getOptions() + ' ';
67 os << "\\url{" << getContents() << '}';
72 int InsetUrl::ascii(Buffer const *, ostream & os, int) const
74 if (getOptions().empty())
75 os << "[" << getContents() << "]";
77 os << "[" << getContents() << "||" << getOptions() << "]";
82 int InsetUrl::linuxdoc(Buffer const *, ostream & os) const
84 os << "<" << getCmdName()
85 << " url=\"" << getContents() << "\""
86 << " name=\"" << getOptions() << "\">";
92 int InsetUrl::docbook(Buffer const *, ostream & os, bool) const
94 os << "<ulink url=\"" << subst(getContents(),"&","&")
95 << "\">" << getOptions() << "</ulink>";
100 void InsetUrl::validate(LaTeXFeatures & features) const
102 features.require("url");