2003-10-27 12:41:26 +00:00
|
|
|
|
/**
|
2003-11-01 14:09:35 +00:00
|
|
|
|
* \file insetpagebreak.C
|
2003-10-27 12:41:26 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "insetpagebreak.h"
|
|
|
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "LColor.h"
|
|
|
|
|
#include "lyxtext.h"
|
|
|
|
|
#include "metricsinfo.h"
|
|
|
|
|
#include "gettext.h"
|
|
|
|
|
|
2006-10-07 16:15:06 +00:00
|
|
|
|
#include "frontends/FontMetrics.h"
|
2003-10-27 12:41:26 +00:00
|
|
|
|
#include "frontends/Painter.h"
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
|
using frontend::Painter;
|
2006-06-20 08:39:16 +00:00
|
|
|
|
|
2003-10-27 12:41:26 +00:00
|
|
|
|
using std::endl;
|
|
|
|
|
using std::ostream;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetPagebreak::read(Buffer const &, LyXLex &)
|
|
|
|
|
{
|
|
|
|
|
/* Nothing to read */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetPagebreak::write(Buffer const &, ostream & os) const
|
|
|
|
|
{
|
2004-08-16 11:27:51 +00:00
|
|
|
|
os << "\n\\newpage\n";
|
2003-10-27 12:41:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetPagebreak::metrics(MetricsInfo & mi, Dimension & dim) const
|
|
|
|
|
{
|
|
|
|
|
dim.asc = defaultRowHeight();
|
|
|
|
|
dim.des = defaultRowHeight();
|
|
|
|
|
dim.wid = mi.base.textwidth;
|
|
|
|
|
dim_ = dim;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
|
|
|
|
|
{
|
2006-09-09 15:27:44 +00:00
|
|
|
|
static docstring const label = _("Page Break");
|
2003-10-27 12:41:26 +00:00
|
|
|
|
|
|
|
|
|
LyXFont font;
|
|
|
|
|
font.setColor(LColor::pagebreak);
|
|
|
|
|
font.decSize();
|
|
|
|
|
|
|
|
|
|
int w = 0;
|
|
|
|
|
int a = 0;
|
|
|
|
|
int d = 0;
|
2006-10-11 17:24:46 +00:00
|
|
|
|
theFontMetrics(font).rectText(label, w, a, d);
|
2003-10-27 12:41:26 +00:00
|
|
|
|
|
|
|
|
|
int const text_start = int(x + (dim_.wid - w) / 2);
|
|
|
|
|
int const text_end = text_start + w;
|
|
|
|
|
|
2006-09-09 15:27:44 +00:00
|
|
|
|
pi.pain.rectText(text_start, y + d, label, font,
|
2003-10-27 12:41:26 +00:00
|
|
|
|
LColor::none, LColor::none);
|
|
|
|
|
|
|
|
|
|
pi.pain.line(x, y, text_start, y,
|
|
|
|
|
LColor::pagebreak, Painter::line_onoffdash);
|
|
|
|
|
pi.pain.line(text_end, y, int(x + dim_.wid), y,
|
|
|
|
|
LColor::pagebreak, Painter::line_onoffdash);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
|
int InsetPagebreak::latex(Buffer const &, odocstream & os,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const
|
2003-10-27 12:41:26 +00:00
|
|
|
|
{
|
|
|
|
|
os << "\\newpage{}";
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
|
int InsetPagebreak::plaintext(Buffer const &, odocstream & os,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const
|
2003-10-27 12:41:26 +00:00
|
|
|
|
{
|
2003-11-01 14:09:35 +00:00
|
|
|
|
os << '\n';
|
2003-10-27 12:41:26 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-19 21:00:33 +00:00
|
|
|
|
int InsetPagebreak::docbook(Buffer const &, odocstream & os,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const
|
2003-10-27 12:41:26 +00:00
|
|
|
|
{
|
|
|
|
|
os << '\n';
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|