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"
18 #include "metricsinfo.h"
19 #include "paragraph.h"
20 #include "paragraph_funcs.h"
22 #include "frontends/FontMetrics.h"
23 #include "frontends/Painter.h"
25 using lyx::odocstream;
31 void InsetNewline::read(Buffer const &, LyXLex &)
37 void InsetNewline::write(Buffer const &, ostream & os) const
39 os << "\n\\newline\n";
43 void InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const
45 lyx::frontend::FontMetrics const & fm
46 = theFontMetrics(mi.base.font);
47 dim.asc = fm.maxAscent();
48 dim.des = fm.maxDescent();
49 dim.wid = fm.width('n');
54 int InsetNewline::latex(Buffer const &, odocstream &,
55 OutputParams const &) const
57 lyxerr << "Eek, calling InsetNewline::latex !" << endl;
62 int InsetNewline::plaintext(Buffer const &, odocstream & os,
63 OutputParams const &) const
70 int InsetNewline::docbook(Buffer const &, odocstream & os,
71 OutputParams const &) const
78 void InsetNewline::draw(PainterInfo & pi, int x, int y) const
80 lyx::frontend::FontMetrics const & fm =
81 theFontMetrics(pi.base.font);
82 int const wid = fm.width('n');
83 int const asc = fm.maxAscent();
88 yp[0] = int(y - 0.875 * asc * 0.75);
89 yp[1] = int(y - 0.500 * asc * 0.75);
90 yp[2] = int(y - 0.125 * asc * 0.75);
93 xp[0] = int(x + wid * 0.375);
95 xp[2] = int(x + wid * 0.375);
97 xp[0] = int(x + wid * 0.625);
99 xp[2] = int(x + wid * 0.625);
102 pi.pain.lines(xp, yp, 3, LColor::eolmarker);
104 yp[0] = int(y - 0.500 * asc * 0.75);
105 yp[1] = int(y - 0.500 * asc * 0.75);
106 yp[2] = int(y - asc * 0.75);
110 xp[1] = int(x + wid);
111 xp[2] = int(x + wid);
113 xp[0] = int(x + wid);
118 pi.pain.lines(xp, yp, 3, LColor::eolmarker);
122 bool InsetNewline::isSpace() const