2002-09-25 14:26:13 +00:00
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetFootlike.cpp
|
2002-09-25 14:26:13 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2000-07-04 19:16:35 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetFootlike.h"
|
2000-07-04 19:16:35 +00:00
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Buffer.h"
|
2006-02-22 15:44:57 +00:00
|
|
|
#include "BufferView.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "BufferParams.h"
|
2010-03-31 19:38:05 +00:00
|
|
|
#include "Font.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "MetricsInfo.h"
|
2000-07-04 19:16:35 +00:00
|
|
|
|
2014-11-14 13:53:11 +00:00
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
2007-11-01 22:17:22 +00:00
|
|
|
#include <iostream>
|
2007-08-30 18:03:17 +00:00
|
|
|
|
2007-12-12 19:28:07 +00:00
|
|
|
using namespace std;
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
2002-02-16 15:59:55 +00:00
|
|
|
|
2014-11-14 13:53:11 +00:00
|
|
|
using support::token;
|
2007-08-30 18:03:17 +00:00
|
|
|
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetFootlike::InsetFootlike(Buffer * buf)
|
2008-03-04 22:28:18 +00:00
|
|
|
: InsetCollapsable(buf)
|
2007-08-13 12:13:17 +00:00
|
|
|
{}
|
2001-07-27 12:03:36 +00:00
|
|
|
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
void InsetFootlike::metrics(MetricsInfo & mi, Dimension & dim) const
|
2005-04-10 14:07:33 +00:00
|
|
|
{
|
2007-10-28 18:51:54 +00:00
|
|
|
FontInfo tmpfont = mi.base.font;
|
|
|
|
mi.base.font = mi.base.bv->buffer().params().getFont().fontInfo();
|
2005-04-10 14:07:33 +00:00
|
|
|
InsetCollapsable::metrics(mi, dim);
|
|
|
|
mi.base.font = tmpfont;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetFootlike::draw(PainterInfo & pi, int x, int y) const
|
|
|
|
{
|
2007-10-28 18:51:54 +00:00
|
|
|
FontInfo tmpfont = pi.base.font;
|
|
|
|
pi.base.font = pi.base.bv->buffer().params().getFont().fontInfo();
|
2005-04-10 14:07:33 +00:00
|
|
|
InsetCollapsable::draw(pi, x, y);
|
|
|
|
pi.base.font = tmpfont;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
void InsetFootlike::write(ostream & os) const
|
2000-07-04 19:16:35 +00:00
|
|
|
{
|
2014-11-14 13:53:11 +00:00
|
|
|
// The layoutName may contain a "InTitle" qualifier
|
|
|
|
os << to_utf8(token(layoutName(), char_type(':'), 0)) << "\n";
|
2008-02-27 20:43:16 +00:00
|
|
|
InsetCollapsable::write(os);
|
2000-07-04 19:16:35 +00:00
|
|
|
}
|
2001-07-12 14:35:38 +00:00
|
|
|
|
|
|
|
|
2007-10-13 09:04:52 +00:00
|
|
|
bool InsetFootlike::insetAllowed(InsetCode code) const
|
2001-07-12 14:35:38 +00:00
|
|
|
{
|
2014-11-04 22:44:10 +00:00
|
|
|
if (code == FOOT_CODE || code == MARGIN_CODE || code == FLOAT_CODE
|
|
|
|
|| code == LISTINGS_CODE)
|
2001-07-12 14:35:38 +00:00
|
|
|
return false;
|
2001-07-19 08:52:59 +00:00
|
|
|
return InsetCollapsable::insetAllowed(code);
|
2001-07-12 14:35:38 +00:00
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|