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 "Dimension.h"
17 #include "MetricsInfo.h"
18 #include "OutputParams.h"
20 #include "frontends/FontMetrics.h"
21 #include "frontends/Painter.h"
30 void InsetNewline::read(Buffer const &, Lexer &)
36 void InsetNewline::write(Buffer const &, ostream & os) const
38 os << "\n\\newline\n";
42 void InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const
44 frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
45 dim.asc = fm.maxAscent();
46 dim.des = fm.maxDescent();
47 dim.wid = fm.width('n');
51 int InsetNewline::latex(Buffer const &, odocstream &,
52 OutputParams const &) const
54 lyxerr << "Eek, calling InsetNewline::latex !" << endl;
59 int InsetNewline::plaintext(Buffer const &, odocstream & os,
60 OutputParams const &) const
63 return PLAINTEXT_NEWLINE;
67 int InsetNewline::docbook(Buffer const &, odocstream & os,
68 OutputParams const &) const
75 void InsetNewline::draw(PainterInfo & pi, int x, int y) const
77 frontend::FontMetrics const & fm = theFontMetrics(pi.base.font);
78 int const wid = fm.width('n');
79 int const asc = fm.maxAscent();
84 yp[0] = int(y - 0.875 * asc * 0.75);
85 yp[1] = int(y - 0.500 * asc * 0.75);
86 yp[2] = int(y - 0.125 * asc * 0.75);
89 xp[0] = int(x + wid * 0.375);
91 xp[2] = int(x + wid * 0.375);
93 xp[0] = int(x + wid * 0.625);
95 xp[2] = int(x + wid * 0.625);
98 pi.pain.lines(xp, yp, 3, Color_eolmarker);
100 yp[0] = int(y - 0.500 * asc * 0.75);
101 yp[1] = int(y - 0.500 * asc * 0.75);
102 yp[2] = int(y - asc * 0.75);
106 xp[1] = int(x + wid);
107 xp[2] = int(x + wid);
109 xp[0] = int(x + wid);
114 pi.pain.lines(xp, yp, 3, Color_eolmarker);
118 bool InsetNewline::isSpace() const