]> git.lyx.org Git - lyx.git/blob - src/insets/insetpagebreak.h
missing bits of the new insets for \clearpage and \cleardoublepage
[lyx.git] / src / insets / insetpagebreak.h
1 // -*- C++ -*-
2 /**
3  * \file insetpagebreak.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_PAGEBREAK_H
13 #define INSET_PAGEBREAK_H
14
15
16 #include "inset.h"
17
18
19 namespace lyx {
20
21 class InsetPagebreak : public InsetOld {
22 public:
23         InsetPagebreak() {}
24
25         InsetBase::Code lyxCode() const { return InsetBase::LINE_CODE; }
26
27         void metrics(MetricsInfo &, Dimension &) const;
28
29         void draw(PainterInfo & pi, int x, int y) const;
30
31         virtual int latex(Buffer const &, odocstream &,
32                   OutputParams const &) const;
33
34         int plaintext(Buffer const &, odocstream &,
35                   OutputParams const &) const;
36
37         int docbook(Buffer const &, odocstream &,
38                     OutputParams const &) const;
39
40         void read(Buffer const &, LyXLex & lex);
41
42         virtual void write(Buffer const & buf, std::ostream & os) const;
43         /// We don't need \begin_inset and \end_inset
44         bool directWrite() const { return true; }
45
46         bool display() const { return true; }
47
48         virtual std::string insetLabel() const { return "Page Break"; }
49
50         virtual std::string getCmdName() const { return "\\newpage"; }
51
52 private:
53         virtual std::auto_ptr<InsetBase> doClone() const
54         {
55                 return std::auto_ptr<InsetBase>(new InsetPagebreak);
56         }
57 };
58
59
60 class InsetClearPage : public InsetPagebreak {
61 public:
62         InsetClearPage() {}
63
64         std::string insetLabel() const { return "Clear Page"; }
65         
66         std::string getCmdName() const { return "\\clearpage"; }
67
68 private:
69         virtual std::auto_ptr<InsetBase> doClone() const
70         {
71                 return std::auto_ptr<InsetBase>(new InsetClearPage);
72         }
73 };
74
75
76 class InsetClearDoublePage : public InsetPagebreak {
77 public:
78         InsetClearDoublePage() {}
79
80         std::string insetLabel() const { return "Clear Double Page"; }
81         
82         std::string getCmdName() const { return "\\cleardoublepage"; }
83
84 private:
85         virtual std::auto_ptr<InsetBase> doClone() const
86         {
87                 return std::auto_ptr<InsetBase>(new InsetClearDoublePage);
88         }
89 };
90
91 } // namespace lyx
92
93 #endif // INSET_PAGEBREAK_H