]> git.lyx.org Git - lyx.git/blob - src/insets/InsetNewpage.h
d086276df2d674e933b5f50752fb4848b0cccf8e
[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
17
18 namespace lyx {
19
20 class InsetNewpageParams
21 {
22 public:
23         /// The different kinds of spaces we support
24         enum Kind {
25                 ///
26                 NEWPAGE,
27                 ///
28                 PAGEBREAK,
29                 ///
30                 CLEARPAGE,
31                 ///
32                 CLEARDOUBLEPAGE,
33                 ///
34                 NOPAGEBREAK
35         };
36         ///
37         InsetNewpageParams() : kind(NEWPAGE) {}
38         ///
39         void write(std::ostream & os) const;
40         ///
41         void read(Lexer & lex);
42         ///
43         Kind kind;
44 };
45
46
47 class InsetNewpage : public Inset
48 {
49 public:
50         ///
51         InsetNewpage();
52         ///
53         explicit InsetNewpage(InsetNewpageParams const & par);
54         ///
55         static void string2params(std::string const &, InsetNewpageParams &);
56         ///
57         static std::string params2string(InsetNewpageParams const &);
58 private:
59         ///
60         InsetCode lyxCode() const override { return NEWPAGE_CODE; }
61         ///
62         void metrics(MetricsInfo &, Dimension &) const override;
63         ///
64         void draw(PainterInfo & pi, int x, int y) const override;
65         ///
66         void latex(otexstream &, OutputParams const &) const override;
67         ///
68         int plaintext(odocstringstream & ods, OutputParams const & op,
69                       size_t max_length = INT_MAX) const override;
70         ///
71         void docbook(XMLStream &, OutputParams const &) const override;
72         ///
73         docstring xhtml(XMLStream &, OutputParams const &) const override;
74         ///
75         void read(Lexer & lex) override;
76         ///
77         void write(std::ostream & os) const override;
78         ///
79         int rowFlags() const override { return (params_.kind == InsetNewpageParams::NOPAGEBREAK) ? Inline : Display; }
80         ///
81         docstring insetLabel() const;
82         ///
83         ColorCode ColorName() const;
84         ///
85         std::string contextMenuName() const override;
86         ///
87         Inset * clone() const override { return new InsetNewpage(*this); }
88         ///
89         void doDispatch(Cursor & cur, FuncRequest & cmd) override;
90         ///
91         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const override;
92
93         ///
94         InsetNewpageParams params_;
95 };
96
97 } // namespace lyx
98
99 #endif // INSET_NEWPAGE_H