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"
15 #include "BufferView.h"
17 #include "dimension.h"
18 #include "paragraph.h"
20 #include "support/LOstream.h"
21 #include "frontends/Painter.h"
22 #include "frontends/font_metrics.h"
28 void InsetNewline::read(Buffer const *, LyXLex &)
34 void InsetNewline::write(Buffer const *, ostream & os) const
36 os << "\n\\newline \n";
40 void InsetNewline::dimension(BufferView *, LyXFont const & font,
41 Dimension & dim) const
43 dim.asc = font_metrics::maxAscent(font);
44 dim.des = font_metrics::maxDescent(font);
45 dim.wid = font_metrics::width('n', font);
49 int InsetNewline::latex(Buffer const *, ostream &,
50 LatexRunParams const &) const
52 lyxerr << "Eek, calling InsetNewline::latex !" << endl;
57 int InsetNewline::ascii(Buffer const *, ostream & os, int) const
64 int InsetNewline::linuxdoc(Buffer const *, std::ostream &) const
71 int InsetNewline::docbook(Buffer const *, std::ostream &, bool) const
78 void InsetNewline::draw(BufferView * bv, LyXFont const & font,
79 int baseline, float & x) const
81 Painter & pain(bv->painter());
83 int const wid = font_metrics::width('n', font);
84 int const asc = font_metrics::maxAscent(font);
85 int const y = baseline;
87 // hack, and highly dubious
88 lyx::pos_type pos = parOwner()->getPositionOfInset(this);
89 bool const ltr_pos = (bv->text->bidi_level(pos) % 2 == 0);
94 yp[0] = int(y - 0.875 * asc * 0.75);
95 yp[1] = int(y - 0.500 * asc * 0.75);
96 yp[2] = int(y - 0.125 * asc * 0.75);
99 xp[0] = int(x + wid * 0.375);
101 xp[2] = int(x + wid * 0.375);
103 xp[0] = int(x + wid * 0.625);
104 xp[1] = int(x + wid);
105 xp[2] = int(x + wid * 0.625);
108 pain.lines(xp, yp, 3, LColor::eolmarker);
110 yp[0] = int(y - 0.500 * asc * 0.75);
111 yp[1] = int(y - 0.500 * asc * 0.75);
112 yp[2] = int(y - asc * 0.75);
116 xp[1] = int(x + wid);
117 xp[2] = int(x + wid);
119 xp[0] = int(x + wid);
124 pain.lines(xp, yp, 3, LColor::eolmarker);