2 * \file insetpagebreak.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "insetpagebreak.h"
19 #include "metricsinfo.h"
20 #include "TextMetrics.h"
22 #include "frontends/FontMetrics.h"
23 #include "frontends/Painter.h"
28 using frontend::Painter;
34 void InsetPagebreak::read(Buffer const &, LyXLex &)
40 void InsetPagebreak::write(Buffer const &, ostream & os) const
42 os << "\n" << getCmdName() << '\n';
46 bool InsetPagebreak::metrics(MetricsInfo & mi, Dimension & dim) const
48 dim.asc = defaultRowHeight();
49 dim.des = defaultRowHeight();
50 dim.wid = mi.base.textwidth;
51 bool const changed = dim_ != dim;
57 void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
60 font.setColor(LColor::pagebreak);
66 theFontMetrics(font).rectText(insetLabel(), w, a, d);
68 int const text_start = int(x + (dim_.wid - w) / 2);
69 int const text_end = text_start + w;
71 pi.pain.rectText(text_start, y + d, insetLabel(), font,
72 LColor::none, LColor::none);
74 pi.pain.line(x, y, text_start, y,
75 LColor::pagebreak, Painter::line_onoffdash);
76 pi.pain.line(text_end, y, int(x + dim_.wid), y,
77 LColor::pagebreak, Painter::line_onoffdash);
81 int InsetPagebreak::latex(Buffer const &, odocstream & os,
82 OutputParams const &) const
84 os << from_ascii(getCmdName()) << "{}";
89 int InsetPagebreak::plaintext(Buffer const &, odocstream & os,
90 OutputParams const &) const
97 int InsetPagebreak::docbook(Buffer const &, odocstream & os,
98 OutputParams const &) const