1999-09-27 18:44:28 +00:00
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "inseturl.h"
|
2000-07-27 08:55:59 +00:00
|
|
|
#include "BufferView.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "LaTeXFeatures.h"
|
2000-07-27 08:55:59 +00:00
|
|
|
#include "LyXView.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "frontends/Dialogs.h"
|
2001-04-05 12:26:41 +00:00
|
|
|
#include "gettext.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-04-04 00:19:15 +00:00
|
|
|
using std::ostream;
|
2000-02-22 00:36:17 +00:00
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
|
2000-07-27 08:55:59 +00:00
|
|
|
InsetUrl::InsetUrl(InsetCommandParams const & p)
|
|
|
|
: InsetCommand(p)
|
|
|
|
{}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
2000-02-25 12:06:15 +00:00
|
|
|
void InsetUrl::Edit(BufferView * bv, int, int, unsigned int)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2000-07-27 08:55:59 +00:00
|
|
|
bv->owner()->getDialogs()->showUrl( this );
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-14 17:53:12 +00:00
|
|
|
string const InsetUrl::getScreenLabel() const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
1999-10-02 16:21:10 +00:00
|
|
|
string temp;
|
2000-11-04 10:00:12 +00:00
|
|
|
if (getCmdName() == "url" )
|
2000-07-27 08:55:59 +00:00
|
|
|
temp = _("Url: ");
|
1999-09-27 18:44:28 +00:00
|
|
|
else
|
2000-07-27 08:55:59 +00:00
|
|
|
temp = _("HtmlUrl: ");
|
|
|
|
|
2000-11-04 10:00:12 +00:00
|
|
|
if (!getOptions().empty())
|
1999-09-27 18:44:28 +00:00
|
|
|
temp += getOptions();
|
2000-07-27 08:55:59 +00:00
|
|
|
else
|
|
|
|
temp += getContents();
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
int InsetUrl::Latex(Buffer const *, ostream & os,
|
2000-04-19 01:42:55 +00:00
|
|
|
bool fragile, bool /*free_spc*/) const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
2000-03-02 02:19:43 +00:00
|
|
|
if (!getOptions().empty())
|
|
|
|
os << getOptions() + ' ';
|
|
|
|
if (fragile)
|
|
|
|
os << "\\protect";
|
|
|
|
os << "\\url{" << getContents() << '}';
|
|
|
|
return 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
2000-03-06 02:42:40 +00:00
|
|
|
|
2000-09-27 15:23:24 +00:00
|
|
|
int InsetUrl::Ascii(Buffer const *, ostream & os, int) const
|
2000-04-24 20:58:23 +00:00
|
|
|
{
|
|
|
|
if (getOptions().empty())
|
|
|
|
os << "[" << getContents() << "]";
|
|
|
|
else
|
|
|
|
os << "[" << getContents() << "||" << getOptions() << "]";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
int InsetUrl::Linuxdoc(Buffer const *, ostream & os) const
|
2000-03-06 02:42:40 +00:00
|
|
|
{
|
|
|
|
os << "<" << getCmdName()
|
|
|
|
<< " url=\"" << getContents() << "\""
|
|
|
|
<< " name=\"" << getOptions() << "\">";
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
int InsetUrl::DocBook(Buffer const *, ostream & os) const
|
2000-03-06 02:42:40 +00:00
|
|
|
{
|
|
|
|
os << "<ulink url=\"" << getContents() << "\">"
|
|
|
|
<< getOptions() << "</ulink>";
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
void InsetUrl::Validate(LaTeXFeatures & features) const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
features.url = true;
|
|
|
|
}
|