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 "metricsinfo.h"
21 #include "support/LOstream.h"
22 #include "frontends/Painter.h"
23 #include "frontends/font_metrics.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 LyXFont & font = mi.base.font;
44 dim.asc = font_metrics::maxAscent(font);
45 dim.des = font_metrics::maxDescent(font);
46 dim.wid = font_metrics::width('n', font);
50 int InsetNewline::latex(Buffer const *, ostream &,
51 LatexRunParams const &) const
53 lyxerr << "Eek, calling InsetNewline::latex !" << endl;
58 int InsetNewline::ascii(Buffer const *, ostream & os, int) const
65 int InsetNewline::linuxdoc(Buffer const *, std::ostream &) const
72 int InsetNewline::docbook(Buffer const *, std::ostream &, bool) const
79 void InsetNewline::draw(PainterInfo & pi, int x, int y) const
81 int const wid = font_metrics::width('n', pi.base.font);
82 int const asc = font_metrics::maxAscent(pi.base.font);
84 // hack, and highly dubious
85 lyx::pos_type pos = parOwner()->getPositionOfInset(this);
86 bool const ltr_pos = (pi.base.bv->text->bidi_level(pos) % 2 == 0);
91 yp[0] = int(y - 0.875 * asc * 0.75);
92 yp[1] = int(y - 0.500 * asc * 0.75);
93 yp[2] = int(y - 0.125 * asc * 0.75);
96 xp[0] = int(x + wid * 0.375);
98 xp[2] = int(x + wid * 0.375);
100 xp[0] = int(x + wid * 0.625);
101 xp[1] = int(x + wid);
102 xp[2] = int(x + wid * 0.625);
105 pi.pain.lines(xp, yp, 3, LColor::eolmarker);
107 yp[0] = int(y - 0.500 * asc * 0.75);
108 yp[1] = int(y - 0.500 * asc * 0.75);
109 yp[2] = int(y - asc * 0.75);
113 xp[1] = int(x + wid);
114 xp[2] = int(x + wid);
116 xp[0] = int(x + wid);
121 pi.pain.lines(xp, yp, 3, LColor::eolmarker);