2 * \file InsetNewpage.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 "InsetNewpage.h"
15 #include "support/debug.h"
16 #include "support/gettext.h"
18 #include "MetricsInfo.h"
19 #include "OutputParams.h"
20 #include "TextMetrics.h"
22 #include "frontends/FontMetrics.h"
23 #include "frontends/Painter.h"
25 #include "support/docstring.h"
26 #include "support/docstream.h"
31 void InsetNewpage::read(Buffer const &, Lexer &)
37 void InsetNewpage::write(Buffer const &, std::ostream & os) const
39 os << "\n" << getCmdName() << '\n';
43 void InsetNewpage::metrics(MetricsInfo & mi, Dimension & dim) const
45 dim.asc = defaultRowHeight();
46 dim.des = defaultRowHeight();
47 dim.wid = mi.base.textwidth;
48 // Cache the inset dimension.
53 void InsetNewpage::draw(PainterInfo & pi, int x, int y) const
55 using frontend::Painter;
58 font.setColor(ColorName());
61 Dimension const dim = dimension(*pi.base.bv);
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 Color_none, Color_none);
74 pi.pain.line(x, y, text_start, y,
75 ColorName(), Painter::line_onoffdash);
76 pi.pain.line(text_end, y, int(x + dim.wid), y,
77 ColorName(), Painter::line_onoffdash);
81 int InsetNewpage::latex(Buffer const &, odocstream & os,
82 OutputParams const &) const
84 os << from_ascii(getCmdName()) << "{}";
89 int InsetNewpage::plaintext(Buffer const &, odocstream & os,
90 OutputParams const &) const
93 return PLAINTEXT_NEWLINE;
97 int InsetNewpage::docbook(Buffer const &, odocstream & os,
98 OutputParams const &) const