]> git.lyx.org Git - lyx.git/blob - src/insets/InsetNewpage.h
96479bbef65693b0e257397621e7eb9fc5f7eda0
[lyx.git] / src / insets / InsetNewpage.h
1 // -*- C++ -*-
2 /**
3  * \file InsetNewpage.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_NEWPAGE_H
13 #define INSET_NEWPAGE_H
14
15 #include "Inset.h"
16 #include "MailInset.h"
17
18 #include "support/docstring.h"
19 #include "support/gettext.h"
20
21
22 namespace lyx {
23
24 class InsetNewpageParams {
25 public:
26         /// The different kinds of spaces we support
27         enum Kind {
28                 ///
29                 NEWPAGE,
30                 ///
31                 PAGEBREAK,
32                 ///
33                 CLEARPAGE,
34                 ///
35                 CLEARDOUBLEPAGE
36         };
37         ///
38         InsetNewpageParams() : kind(NEWPAGE) {}
39         ///
40         void write(std::ostream & os) const;
41         ///
42         void read(Lexer & lex);
43         ///
44         Kind kind;
45 };
46
47
48 class InsetNewpage : public Inset
49 {
50 public:
51         ///
52         InsetNewpage();
53
54         ///
55         explicit
56         InsetNewpage(InsetNewpageParams par);
57         ///
58         InsetNewpageParams params() const { return params_; }
59         ///
60         InsetCode lyxCode() const { return NEWPAGE_CODE; }
61         ///
62         void metrics(MetricsInfo &, Dimension &) const;
63         ///
64         void draw(PainterInfo & pi, int x, int y) const;
65         ///
66         int latex(odocstream &, OutputParams const &) const;
67         ///
68         int plaintext(odocstream &, OutputParams const &) const;
69         ///
70         int docbook(odocstream &, OutputParams const &) const;
71         ///
72         void read(Lexer & lex);
73         ///
74         void write(std::ostream & os) const;
75         ///
76         DisplayType display() const { return AlignCenter; }
77         ///
78         docstring insetLabel() const;
79         ///
80         ColorCode ColorName() const;
81         ///
82         virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
83 private:
84         ///
85         Inset * clone() const { return new InsetNewpage(*this); }
86         ///
87         void doDispatch(Cursor & cur, FuncRequest & cmd);
88         ///
89         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
90         ///
91         InsetNewpageParams params_;
92 };
93
94
95 class InsetNewpageMailer : public MailInset {
96 public:
97         ///
98         InsetNewpageMailer(InsetNewpage & inset);
99         ///
100         virtual Inset & inset() const { return inset_; }
101         ///
102         virtual std::string const & name() const { return name_; }
103         ///
104         virtual std::string const inset2string(Buffer const &) const;
105         ///
106         static void string2params(std::string const &, InsetNewpageParams &);
107         ///
108         static std::string const params2string(InsetNewpageParams const &);
109 private:
110         ///
111         static std::string const name_;
112         ///
113         InsetNewpage & inset_;
114 };
115
116 } // namespace lyx
117
118 #endif // INSET_NEWPAGE_H