2000-03-08 13:52:57 +00:00
|
|
|
/* This file is part of
|
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
2000-03-09 23:58:55 +00:00
|
|
|
* Copyright 1998 The LyX Team.
|
2000-03-08 13:52:57 +00:00
|
|
|
*
|
|
|
|
*======================================================*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "insetfoot.h"
|
|
|
|
#include "gettext.h"
|
|
|
|
#include "lyxfont.h"
|
|
|
|
#include "BufferView.h"
|
|
|
|
#include "lyxscreen.h"
|
|
|
|
#include "Painter.h"
|
|
|
|
|
|
|
|
|
|
|
|
InsetFoot::InsetFoot(Buffer * bf): InsetCollapsable(bf)
|
|
|
|
{
|
|
|
|
setLabel(_("foot"));
|
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
|
|
|
font.decSize();
|
|
|
|
font.decSize();
|
|
|
|
font.setColor(LColor::footnote);
|
|
|
|
setLabelFont(font);
|
|
|
|
setAutoCollapse(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-03-09 16:13:43 +00:00
|
|
|
Inset * InsetFoot::Clone() const
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
2000-03-28 16:18:02 +00:00
|
|
|
InsetFoot * result = new InsetFoot(buffer);
|
|
|
|
result->init(buffer, par);
|
|
|
|
|
2000-03-08 13:52:57 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-03-09 23:58:55 +00:00
|
|
|
char const * InsetFoot::EditMessage() const
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
|
|
|
return _("Opened Footnote Inset");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-03-09 03:36:48 +00:00
|
|
|
int InsetFoot::Latex(ostream & os, signed char fragile, bool fp) const
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
2000-03-09 23:58:55 +00:00
|
|
|
if (fragile)
|
|
|
|
os << "\\footnotetext{";
|
|
|
|
else
|
|
|
|
os << "\\footnote{";
|
|
|
|
|
|
|
|
int i = InsetText::Latex(os, fragile, fp);
|
|
|
|
os << "}";
|
|
|
|
|
|
|
|
return i;
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
|
2000-03-09 23:58:55 +00:00
|
|
|
|
2000-03-08 13:52:57 +00:00
|
|
|
void InsetFoot::Write(ostream & os) const
|
|
|
|
{
|
2000-03-09 23:58:55 +00:00
|
|
|
os << "Foot\n"
|
|
|
|
<< "\ncollapsed ";
|
|
|
|
if (display())
|
|
|
|
os << "false\n";
|
|
|
|
else
|
|
|
|
os << "true\n";
|
|
|
|
WriteParagraphData(os);
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
|
2000-03-09 23:58:55 +00:00
|
|
|
|
2000-03-08 13:52:57 +00:00
|
|
|
void InsetFoot::Read(LyXLex & lex)
|
|
|
|
{
|
|
|
|
if (lex.IsOK()) {
|
|
|
|
lex.next();
|
2000-03-09 23:58:55 +00:00
|
|
|
string token = lex.GetString();
|
2000-03-08 13:52:57 +00:00
|
|
|
if (token == "collapsed") {
|
|
|
|
lex.next();
|
|
|
|
collapsed = lex.GetBool();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
InsetText::Read(lex);
|
|
|
|
}
|
|
|
|
|
2000-03-09 23:58:55 +00:00
|
|
|
|
|
|
|
bool InsetFoot::InsertInset(BufferView * bv, Inset * inset)
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
|
|
|
if ((inset->LyxCode() == Inset::FOOT_CODE) ||
|
|
|
|
(inset->LyxCode() == Inset::MARGIN_CODE)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return InsetText::InsertInset(bv, inset);
|
|
|
|
}
|