]> git.lyx.org Git - lyx.git/blob - src/insets/insetpagebreak.C
Output docbook as utf8. Probably quite a bit more work needed, but then help form...
[lyx.git] / src / insets / insetpagebreak.C
1 /**
2  * \file insetpagebreak.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 "insetpagebreak.h"
14
15 #include "debug.h"
16 #include "LColor.h"
17 #include "lyxtext.h"
18 #include "metricsinfo.h"
19 #include "gettext.h"
20
21 #include "frontends/FontMetrics.h"
22 #include "frontends/Painter.h"
23
24 using lyx::docstring;
25 using lyx::odocstream;
26 using lyx::frontend::Painter;
27
28 using std::endl;
29 using std::ostream;
30
31
32 void InsetPagebreak::read(Buffer const &, LyXLex &)
33 {
34         /* Nothing to read */
35 }
36
37
38 void InsetPagebreak::write(Buffer const &, ostream & os) const
39 {
40         os << "\n\\newpage\n";
41 }
42
43
44 void InsetPagebreak::metrics(MetricsInfo & mi, Dimension & dim) const
45 {
46         dim.asc = defaultRowHeight();
47         dim.des = defaultRowHeight();
48         dim.wid = mi.base.textwidth;
49         dim_ = dim;
50 }
51
52
53 void InsetPagebreak::draw(PainterInfo & pi, int x, int y) const
54 {
55         static docstring const label = _("Page Break");
56
57         LyXFont font;
58         font.setColor(LColor::pagebreak);
59         font.decSize();
60
61         int w = 0;
62         int a = 0;
63         int d = 0;
64         theFontMetrics(font).rectText(label, w, a, d);
65
66         int const text_start = int(x + (dim_.wid - w) / 2);
67         int const text_end = text_start + w;
68
69         pi.pain.rectText(text_start, y + d, label, font,
70                 LColor::none, LColor::none);
71
72         pi.pain.line(x, y, text_start, y,
73                    LColor::pagebreak, Painter::line_onoffdash);
74         pi.pain.line(text_end, y, int(x + dim_.wid), y,
75                    LColor::pagebreak, Painter::line_onoffdash);
76 }
77
78
79 int InsetPagebreak::latex(Buffer const &, odocstream & os,
80                           OutputParams const &) const
81 {
82         os << "\\newpage{}";
83         return 0;
84 }
85
86
87 int InsetPagebreak::plaintext(Buffer const &, odocstream & os,
88                           OutputParams const &) const
89 {
90         os << '\n';
91         return 0;
92 }
93
94
95 int InsetPagebreak::docbook(Buffer const &, odocstream & os,
96                             OutputParams const &) const
97 {
98         os << '\n';
99         return 0;
100 }