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"
29 void InsetNewline::read(Buffer const &, LyXLex &)
35 void InsetNewline::write(Buffer const &, ostream & os) const
37 os << "\n\\newline\n";
41 void InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const
43 lyx::frontend::FontMetrics const & fm
44 = theFontMetrics(mi.base.font);
45 dim.asc = fm.maxAscent();
46 dim.des = fm.maxDescent();
47 dim.wid = fm.width('n');
52 int InsetNewline::latex(Buffer const &, ostream &,
53 OutputParams const &) const
55 lyxerr << "Eek, calling InsetNewline::latex !" << endl;
60 int InsetNewline::plaintext(Buffer const &, ostream & os,
61 OutputParams const &) const
68 int InsetNewline::docbook(Buffer const &, std::ostream & os,
69 OutputParams const &) const
76 void InsetNewline::draw(PainterInfo & pi, int x, int y) const
78 lyx::frontend::FontMetrics const & fm =
79 theFontMetrics(pi.base.font);
80 int const wid = fm.width('n');
81 int const asc = fm.maxAscent();
86 yp[0] = int(y - 0.875 * asc * 0.75);
87 yp[1] = int(y - 0.500 * asc * 0.75);
88 yp[2] = int(y - 0.125 * asc * 0.75);
91 xp[0] = int(x + wid * 0.375);
93 xp[2] = int(x + wid * 0.375);
95 xp[0] = int(x + wid * 0.625);
97 xp[2] = int(x + wid * 0.625);
100 pi.pain.lines(xp, yp, 3, LColor::eolmarker);
102 yp[0] = int(y - 0.500 * asc * 0.75);
103 yp[1] = int(y - 0.500 * asc * 0.75);
104 yp[2] = int(y - asc * 0.75);
108 xp[1] = int(x + wid);
109 xp[2] = int(x + wid);
111 xp[0] = int(x + wid);
116 pi.pain.lines(xp, yp, 3, LColor::eolmarker);
120 bool InsetNewline::isSpace() const