+/**
+ * \file inseturl.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author José Matos
+ *
+ * Full author contact details are available in file CREDITS
+ */
#include <config.h>
#ifdef __GNUG__
#include "inseturl.h"
#include "BufferView.h"
#include "LaTeXFeatures.h"
-#include "LyXView.h"
+#include "frontends/LyXView.h"
#include "debug.h"
#include "frontends/Dialogs.h"
+#include "support/lstrings.h"
#include "gettext.h"
using std::ostream;
{}
-void InsetUrl::edit(BufferView * bv, int, int, unsigned int)
+void InsetUrl::edit(BufferView * bv, int, int, mouse_button::state)
{
- bv->owner()->getDialogs()->showUrl( this );
+ bv->owner()->getDialogs().showUrl(this);
}
void InsetUrl::edit(BufferView * bv, bool)
{
- edit(bv, 0, 0, 0);
+ edit(bv, 0, 0, mouse_button::none);
}
string const InsetUrl::getScreenLabel(Buffer const *) const
{
string temp;
- if (getCmdName() == "url" )
+ if (getCmdName() == "url")
temp = _("Url: ");
- else
+ else
temp = _("HtmlUrl: ");
+ string url;
+
if (!getOptions().empty())
- temp += getOptions();
+ url += getOptions();
else
- temp += getContents();
-
- return temp;
+ url += getContents();
+
+ // elide if long
+ if (url.length() > 30) {
+ url = url.substr(0, 10) + "..."
+ + url.substr(url.length() - 17, url.length());
+ }
+ return temp + url;
}
}
-int InsetUrl::DocBook(Buffer const *, ostream & os) const
+int InsetUrl::docbook(Buffer const *, ostream & os, bool) const
{
- os << "<ulink url=\"" << getContents() << "\">"
- << getOptions() << "</ulink>";
+ os << "<ulink url=\"" << subst(getContents(),"&","&")
+ << "\">" << getOptions() << "</ulink>";
return 0;
}
void InsetUrl::validate(LaTeXFeatures & features) const
{
- features.url = true;
+ features.require("url");
}