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 "InsetLine.h"
15 #include "Dimension.h"
17 #include "LaTeXFeatures.h"
18 #include "MetricsInfo.h"
19 #include "OutputParams.h"
20 #include "output_xhtml.h"
23 #include "frontends/Painter.h"
25 #include "support/debug.h"
26 #include "support/docstream.h"
34 using frontend::Painter;
37 void InsetLine::read(Lexer &)
43 void InsetLine::write(ostream & os) const
45 os << "\n\\lyxline\n";
49 void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
53 dim.wid = mi.base.textwidth;
54 // Cache the inset dimension.
59 void InsetLine::draw(PainterInfo & pi, int x, int y) const
61 Dimension const dim = dimension(*pi.base.bv);
63 FontInfo f = pi.base.font;
64 Color Line_color = f.realColor();
66 pi.pain.line(x, y, x + dim.wid, y, Line_color,
67 Painter::line_solid, 1);
71 int InsetLine::latex(odocstream & os, OutputParams const & runparams) const
74 << from_ascii(runparams.local_font->latexSize()) << '}';
79 int InsetLine::plaintext(odocstream & os, OutputParams const &) const
81 os << "\n-------------------------------------------\n";
82 return PLAINTEXT_NEWLINE;
86 int InsetLine::docbook(odocstream & os, OutputParams const &) const
93 docstring InsetLine::xhtml(XHTMLStream & xs, OutputParams const &) const
95 xs << html::CompTag("hr");
101 void InsetLine::validate(LaTeXFeatures & features) const
103 features.require("lyxline");