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 "Painter.h"
|
2000-04-08 17:02:02 +00:00
|
|
|
#include "support/LOstream.h"
|
2000-03-08 13:52:57 +00:00
|
|
|
|
2000-04-04 00:19:15 +00:00
|
|
|
using std::ostream;
|
2000-05-04 10:57:00 +00:00
|
|
|
using std::endl;
|
2000-03-08 13:52:57 +00:00
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
InsetFoot::InsetFoot() : InsetCollapsable()
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
|
|
|
setLabel(_("foot"));
|
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
|
|
|
font.decSize();
|
|
|
|
font.decSize();
|
|
|
|
font.setColor(LColor::footnote);
|
|
|
|
setLabelFont(font);
|
|
|
|
setAutoCollapse(false);
|
2000-04-19 14:42:19 +00:00
|
|
|
setInsetName("Foot");
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-03-09 16:13:43 +00:00
|
|
|
Inset * InsetFoot::Clone() const
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
2000-06-12 11:27:15 +00:00
|
|
|
InsetFoot * result = new InsetFoot();
|
|
|
|
result->init(this);
|
2000-03-28 16:18:02 +00:00
|
|
|
|
2000-03-31 10:35:53 +00:00
|
|
|
result->collapsed = collapsed;
|
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-06-12 11:27:15 +00:00
|
|
|
int InsetFoot::Latex(Buffer const * buf, ostream & os, bool fragile, bool fp) const
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
2000-05-04 08:14:34 +00:00
|
|
|
os << "\\footnote{%" << endl;
|
2000-04-19 14:42:19 +00:00
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
int i = InsetText::Latex(buf, os, fragile, fp);
|
2000-05-04 08:14:34 +00:00
|
|
|
os << "}%" << endl;
|
2000-04-19 14:42:19 +00:00
|
|
|
|
2000-05-04 08:14:34 +00:00
|
|
|
return i + 2;
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|
|
|
|
|
2000-03-09 23:58:55 +00:00
|
|
|
|
|
|
|
bool InsetFoot::InsertInset(BufferView * bv, Inset * inset)
|
2000-04-10 14:29:05 +00:00
|
|
|
{
|
|
|
|
if (!InsertInsetAllowed(inset))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return InsetText::InsertInset(bv, inset);
|
|
|
|
}
|
|
|
|
|
2000-05-18 13:26:04 +00:00
|
|
|
|
2000-04-10 14:29:05 +00:00
|
|
|
bool InsetFoot::InsertInsetAllowed(Inset * inset) const
|
2000-03-08 13:52:57 +00:00
|
|
|
{
|
|
|
|
if ((inset->LyxCode() == Inset::FOOT_CODE) ||
|
|
|
|
(inset->LyxCode() == Inset::MARGIN_CODE)) {
|
|
|
|
return false;
|
|
|
|
}
|
2000-04-10 14:29:05 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-05-18 13:26:04 +00:00
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
LyXFont InsetFoot::GetDrawFont(Buffer const * buf, LyXParagraph * p, int pos) const
|
2000-04-10 14:29:05 +00:00
|
|
|
{
|
2000-06-12 11:27:15 +00:00
|
|
|
LyXFont fn = InsetCollapsable::GetDrawFont(buf, p, pos);
|
2000-05-18 13:26:04 +00:00
|
|
|
fn.decSize().decSize();
|
2000-04-10 14:29:05 +00:00
|
|
|
return fn;
|
2000-03-08 13:52:57 +00:00
|
|
|
}
|