lyx_mirror/src/insets/inseturl.C
Lars Gullik Bjønnes adaef99e60 some formatting changes some simplifications and removal of dead code
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1198 a592a061-630c-0410-9148-cb99ea01b6c8
2000-11-04 10:00:12 +00:00

89 lines
1.5 KiB
C

#include <config.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include "inseturl.h"
#include "BufferView.h"
#include "LaTeXFeatures.h"
#include "LyXView.h"
#include "debug.h"
#include "frontends/Dialogs.h"
using std::ostream;
InsetUrl::InsetUrl(InsetCommandParams const & p)
: InsetCommand(p)
{}
void InsetUrl::Edit(BufferView * bv, int, int, unsigned int)
{
bv->owner()->getDialogs()->showUrl( this );
}
string const InsetUrl::getScreenLabel() const
{
string temp;
if (getCmdName() == "url" )
temp = _("Url: ");
else
temp = _("HtmlUrl: ");
if (!getOptions().empty())
temp += getOptions();
else
temp += getContents();
return temp;
}
int InsetUrl::Latex(Buffer const *, ostream & os,
bool fragile, bool /*free_spc*/) const
{
if (!getOptions().empty())
os << getOptions() + ' ';
if (fragile)
os << "\\protect";
os << "\\url{" << getContents() << '}';
return 0;
}
int InsetUrl::Ascii(Buffer const *, ostream & os, int) const
{
if (getOptions().empty())
os << "[" << getContents() << "]";
else
os << "[" << getContents() << "||" << getOptions() << "]";
return 0;
}
int InsetUrl::Linuxdoc(Buffer const *, ostream & os) const
{
os << "<" << getCmdName()
<< " url=\"" << getContents() << "\""
<< " name=\"" << getOptions() << "\">";
return 0;
}
int InsetUrl::DocBook(Buffer const *, ostream & os) const
{
os << "<ulink url=\"" << getContents() << "\">"
<< getOptions() << "</ulink>";
return 0;
}
void InsetUrl::Validate(LaTeXFeatures & features) const
{
features.url = true;
}