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"
16 #include "MetricsInfo.h"
17 #include "OutputParams.h"
18 #include "TextMetrics.h"
20 #include "frontends/FontMetrics.h"
21 #include "frontends/Painter.h"
23 #include "support/debug.h"
24 #include "support/docstring.h"
25 #include "support/docstream.h"
26 #include "support/gettext.h"
33 void InsetNewpage::read( Lexer &)
39 void InsetNewpage::write(ostream & os) const
41 os << "\n" << getCmdName() << '\n';
45 void InsetNewpage::metrics(MetricsInfo & mi, Dimension & dim) const
47 dim.asc = defaultRowHeight();
48 dim.des = defaultRowHeight();
49 dim.wid = mi.base.textwidth;
50 // Cache the inset dimension.
55 void InsetNewpage::draw(PainterInfo & pi, int x, int y) const
57 using frontend::Painter;
60 font.setColor(ColorName());
63 Dimension const dim = dimension(*pi.base.bv);
68 theFontMetrics(font).rectText(insetLabel(), w, a, d);
70 int const text_start = int(x + (dim.wid - w) / 2);
71 int const text_end = text_start + w;
73 pi.pain.rectText(text_start, y + d, insetLabel(), font,
74 Color_none, Color_none);
76 pi.pain.line(x, y, text_start, y,
77 ColorName(), Painter::line_onoffdash);
78 pi.pain.line(text_end, y, int(x + dim.wid), y,
79 ColorName(), Painter::line_onoffdash);
83 int InsetNewpage::latex(odocstream & os, OutputParams const &) const
85 os << from_ascii(getCmdName()) << "{}";
90 int InsetNewpage::plaintext(odocstream & os, OutputParams const &) const
93 return PLAINTEXT_NEWLINE;
97 int InsetNewpage::docbook(odocstream & os, OutputParams const &) const