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"
18 #include "MetricsInfo.h"
19 #include "OutputParams.h"
20 #include "Paragraph.h"
21 #include "paragraph_funcs.h"
23 #include "frontends/FontMetrics.h"
24 #include "frontends/Painter.h"
33 void InsetNewline::read(Buffer const &, Lexer &)
39 void InsetNewline::write(Buffer const &, ostream & os) const
41 os << "\n\\newline\n";
45 bool InsetNewline::metrics(MetricsInfo & mi, Dimension & dim) const
47 frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
48 dim.asc = fm.maxAscent();
49 dim.des = fm.maxDescent();
50 dim.wid = fm.width('n');
51 bool const changed = dim_ != dim;
57 int InsetNewline::latex(Buffer const &, odocstream &,
58 OutputParams const &) const
60 lyxerr << "Eek, calling InsetNewline::latex !" << endl;
65 int InsetNewline::plaintext(Buffer const &, odocstream & os,
66 OutputParams const &) const
69 return PLAINTEXT_NEWLINE;
73 int InsetNewline::docbook(Buffer const &, odocstream & os,
74 OutputParams const &) const
81 void InsetNewline::draw(PainterInfo & pi, int x, int y) const
83 frontend::FontMetrics const & fm = theFontMetrics(pi.base.font);
84 int const wid = fm.width('n');
85 int const asc = fm.maxAscent();
90 yp[0] = int(y - 0.875 * asc * 0.75);
91 yp[1] = int(y - 0.500 * asc * 0.75);
92 yp[2] = int(y - 0.125 * asc * 0.75);
95 xp[0] = int(x + wid * 0.375);
97 xp[2] = int(x + wid * 0.375);
99 xp[0] = int(x + wid * 0.625);
100 xp[1] = int(x + wid);
101 xp[2] = int(x + wid * 0.625);
104 pi.pain.lines(xp, yp, 3, Color::eolmarker);
106 yp[0] = int(y - 0.500 * asc * 0.75);
107 yp[1] = int(y - 0.500 * asc * 0.75);
108 yp[2] = int(y - asc * 0.75);
112 xp[1] = int(x + wid);
113 xp[2] = int(x + wid);
115 xp[0] = int(x + wid);
120 pi.pain.lines(xp, yp, 3, Color::eolmarker);
124 bool InsetNewline::isSpace() const