]> git.lyx.org Git - features.git/blob - src/insets/InsetNewline.h
Use new display() values to remove some inset hardcoding.
[features.git] / src / insets / InsetNewline.h
1 // -*- C++ -*-
2 /**
3  * \file InsetNewline.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSET_NEWLINE_H
13 #define INSET_NEWLINE_H
14
15 #include "Inset.h"
16
17
18 namespace lyx {
19
20 class InsetNewlineParams
21 {
22 public:
23         /// The different kinds of spaces we support
24         enum Kind {
25                 ///
26                 NEWLINE,
27                 ///
28                 LINEBREAK
29         };
30         ///
31         InsetNewlineParams() : kind(NEWLINE) {}
32         ///
33         void write(std::ostream & os) const;
34         ///
35         void read(Lexer & lex);
36         ///
37         Kind kind;
38 };
39
40
41 class InsetNewline : public Inset
42 {
43 public:
44         ///
45         InsetNewline();
46         ///
47         InsetNewline(InsetNewlineParams par) : Inset(0)
48         { params_.kind = par.kind; }
49         ///
50         DisplayType display() const { return BreakAfter | NoBoundary; }
51         ///
52         static void string2params(std::string const &, InsetNewlineParams &);
53         ///
54         static std::string params2string(InsetNewlineParams const &);
55 private:
56         ///
57         InsetNewlineParams params() const { return params_; }
58         ///
59         InsetCode lyxCode() const { return NEWLINE_CODE; }
60         ///
61         void metrics(MetricsInfo &, Dimension &) const;
62         ///
63         void draw(PainterInfo & pi, int x, int y) const;
64         ///
65         void latex(otexstream &, OutputParams const &) const;
66         ///
67         int plaintext(odocstringstream & ods, OutputParams const & op,
68                       size_t max_length = INT_MAX) const;
69         ///
70         int docbook(odocstream &, OutputParams const &) const;
71         ///
72         docstring xhtml(XHTMLStream &, OutputParams const &) const;
73         ///
74         void read(Lexer & lex);
75         ///
76         void write(std::ostream & os) const;
77         /// is this equivalent to a space (which is BTW different from
78         /// a line separator)?
79         bool isSpace() const { return true; }
80         ///
81         ColorCode ColorName() const;
82         ///
83         std::string contextMenuName() const;
84         ///
85         Inset * clone() const { return new InsetNewline(*this); }
86         ///
87         void doDispatch(Cursor & cur, FuncRequest & cmd);
88         ///
89         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
90
91         ///
92         InsetNewlineParams params_;
93 };
94
95
96 } // namespace lyx
97
98 #endif // INSET_NEWLINE_H