2 * \file InsetPagebreak.cpp
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;
32 void InsetPagebreak::read(Buffer const &, Lexer &)
38 void InsetPagebreak::write(Buffer const &, std::ostream & os) const
40 os << "\n" << getCmdName() << '\n';
44 void InsetPagebreak::metrics(MetricsInfo & mi, Dimension & dim) const
46 dim.asc = defaultRowHeight();
47 dim.des = defaultRowHeight();
48 dim.wid = mi.base.textwidth;
49 // Cache the inset dimension.
54 void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
57 font.setColor(Color::pagebreak);
60 Dimension const dim = dimension(*pi.base.bv);
65 theFontMetrics(font).rectText(insetLabel(), w, a, d);
67 int const text_start = int(x + (dim.wid - w) / 2);
68 int const text_end = text_start + w;
70 pi.pain.rectText(text_start, y + d, insetLabel(), font,
71 Color::none, Color::none);
73 pi.pain.line(x, y, text_start, y,
74 Color::pagebreak, Painter::line_onoffdash);
75 pi.pain.line(text_end, y, int(x + dim.wid), y,
76 Color::pagebreak, Painter::line_onoffdash);
80 int InsetPagebreak::latex(Buffer const &, odocstream & os,
81 OutputParams const &) const
83 os << from_ascii(getCmdName()) << "{}";
88 int InsetPagebreak::plaintext(Buffer const &, odocstream & os,
89 OutputParams const &) const
92 return PLAINTEXT_NEWLINE;
96 int InsetPagebreak::docbook(Buffer const &, odocstream & os,
97 OutputParams const &) const