]> git.lyx.org Git - lyx.git/blob - src/insets/insetline.C
Output docbook as utf8. Probably quite a bit more work needed, but then help form...
[lyx.git] / src / insets / insetline.C
1 /**
2  * \file insetline.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "insetline.h"
14
15 #include "debug.h"
16 #include "LColor.h"
17 #include "lyxtext.h"
18 #include "metricsinfo.h"
19 #include "LaTeXFeatures.h"
20 #include "outputparams.h"
21
22 #include "frontends/Painter.h"
23
24 using lyx::odocstream;
25 using lyx::frontend::Painter;
26
27 using std::endl;
28 using std::ostream;
29
30
31 void InsetLine::read(Buffer const &, LyXLex &)
32 {
33         /* Nothing to read */
34 }
35
36
37 void InsetLine::write(Buffer const &, ostream & os) const
38 {
39         os << "\n\\lyxline\n";
40 }
41
42
43 void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
44 {
45         dim.asc = 3;
46         dim.des = 3;
47         dim.wid = mi.base.textwidth;
48         dim_ = dim;
49 }
50
51
52 void InsetLine::draw(PainterInfo & pi, int x, int y) const
53 {
54         pi.pain.line(x, y, x + dim_.wid, y, LColor::topline, Painter::line_solid,
55                         Painter::line_thick);
56 }
57
58
59 int InsetLine::latex(Buffer const &, odocstream & os,
60                         OutputParams const & runparams) const
61 {
62         os << "\\lyxline{\\"
63            << lyx::from_ascii(runparams.local_font->latexSize()) << '}';
64         return 0;
65 }
66
67
68 int InsetLine::plaintext(Buffer const &, odocstream & os,
69                      OutputParams const &) const
70 {
71         os << "-------------------------------------------";
72         return 0;
73 }
74
75
76 int InsetLine::docbook(Buffer const &, odocstream & os,
77                        OutputParams const &) const
78 {
79         os << '\n';
80         return 0;
81 }
82
83
84 void InsetLine::validate(LaTeXFeatures & features) const
85 {
86         features.require("lyxline");
87 }