]> git.lyx.org Git - lyx.git/blob - src/insets/insetline.C
fix bug 2014 (lyxline font size)
[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
21 #include "frontends/Painter.h"
22
23 using std::endl;
24 using std::ostream;
25
26
27 void InsetLine::read(Buffer const &, LyXLex &)
28 {
29         /* Nothing to read */
30 }
31
32
33 void InsetLine::write(Buffer const &, ostream & os) const
34 {
35         os << "\n\\lyxline\n";
36 }
37
38
39 void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
40 {
41         dim.asc = 3;
42         dim.des = 3;
43         dim.wid = mi.base.textwidth;
44         dim_ = dim;
45 }
46
47
48 void InsetLine::draw(PainterInfo & pi, int x, int y) const
49 {
50         pi.pain.line(x, y, x + dim_.wid, y, LColor::topline, Painter::line_solid,
51                         Painter::line_thick);
52 }
53
54
55 int InsetLine::latex(Buffer const &, ostream & os,
56                         OutputParams const & runparams) const
57 {
58         os << "\\lyxline{\\" << runparams.local_font->latexSize() << '}';
59         return 0;
60 }
61
62
63 int InsetLine::plaintext(Buffer const &, ostream & os,
64                      OutputParams const &) const
65 {
66         os << "-------------------------------------------";
67         return 0;
68 }
69
70
71 int InsetLine::linuxdoc(Buffer const &, std::ostream & os,
72                         OutputParams const &) const
73 {
74         os << '\n';
75         return 0;
76 }
77
78
79 int InsetLine::docbook(Buffer const &, std::ostream & os,
80                        OutputParams const &) const
81 {
82         os << '\n';
83         return 0;
84 }
85
86
87 void InsetLine::validate(LaTeXFeatures & features) const
88 {
89         features.require("lyxline");
90 }