2 * \file InsetNewline.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 "InsetNewline.h"
16 #include "MetricsInfo.h"
17 #include "OutputParams.h"
19 #include "frontends/FontMetrics.h"
20 #include "frontends/Painter.h"
29 void InsetNewline::read(Buffer const &, Lexer &)
35 void InsetNewline::write(Buffer const &, ostream & os) const
37 os << "\n\\newline\n";
41 void InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const
43 frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
44 dim.asc = fm.maxAscent();
45 dim.des = fm.maxDescent();
46 dim.wid = fm.width('n');
50 int InsetNewline::latex(Buffer const &, odocstream &,
51 OutputParams const &) const
53 lyxerr << "Eek, calling InsetNewline::latex !" << endl;
58 int InsetNewline::plaintext(Buffer const &, odocstream & os,
59 OutputParams const &) const
62 return PLAINTEXT_NEWLINE;
66 int InsetNewline::docbook(Buffer const &, odocstream & os,
67 OutputParams const &) const
74 void InsetNewline::draw(PainterInfo & pi, int x, int y) const
76 frontend::FontMetrics const & fm = theFontMetrics(pi.base.font);
77 int const wid = fm.width('n');
78 int const asc = fm.maxAscent();
83 yp[0] = int(y - 0.875 * asc * 0.75);
84 yp[1] = int(y - 0.500 * asc * 0.75);
85 yp[2] = int(y - 0.125 * asc * 0.75);
88 xp[0] = int(x + wid * 0.375);
90 xp[2] = int(x + wid * 0.375);
92 xp[0] = int(x + wid * 0.625);
94 xp[2] = int(x + wid * 0.625);
97 pi.pain.lines(xp, yp, 3, Color::eolmarker);
99 yp[0] = int(y - 0.500 * asc * 0.75);
100 yp[1] = int(y - 0.500 * asc * 0.75);
101 yp[2] = int(y - asc * 0.75);
105 xp[1] = int(x + wid);
106 xp[2] = int(x + wid);
108 xp[0] = int(x + wid);
113 pi.pain.lines(xp, yp, 3, Color::eolmarker);
117 bool InsetNewline::isSpace() const