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 "outputparams.h"
21 #include "TextMetrics.h"
23 #include "frontends/FontMetrics.h"
24 #include "frontends/Painter.h"
29 using frontend::Painter;
35 void InsetPagebreak::read(Buffer const &, LyXLex &)
41 void InsetPagebreak::write(Buffer const &, ostream & os) const
43 os << "\n" << getCmdName() << '\n';
47 bool InsetPagebreak::metrics(MetricsInfo & mi, Dimension & dim) const
49 dim.asc = defaultRowHeight();
50 dim.des = defaultRowHeight();
51 dim.wid = mi.base.textwidth;
52 bool const changed = dim_ != dim;
58 void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
61 font.setColor(LColor::pagebreak);
67 theFontMetrics(font).rectText(insetLabel(), w, a, d);
69 int const text_start = int(x + (dim_.wid - w) / 2);
70 int const text_end = text_start + w;
72 pi.pain.rectText(text_start, y + d, insetLabel(), font,
73 LColor::none, LColor::none);
75 pi.pain.line(x, y, text_start, y,
76 LColor::pagebreak, Painter::line_onoffdash);
77 pi.pain.line(text_end, y, int(x + dim_.wid), y,
78 LColor::pagebreak, Painter::line_onoffdash);
82 int InsetPagebreak::latex(Buffer const &, odocstream & os,
83 OutputParams const &) const
85 os << from_ascii(getCmdName()) << "{}";
90 int InsetPagebreak::plaintext(Buffer const &, odocstream & os,
91 OutputParams const & runparams) const
94 return runparams.linelen; // start with column 0 in new line
98 int InsetPagebreak::docbook(Buffer const &, odocstream & os,
99 OutputParams const &) const