]> git.lyx.org Git - lyx.git/blob - src/insets/InsetNewline.h
Fix trailing whitespace in cpp files.
[lyx.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         static void string2params(std::string const &, InsetNewlineParams &);
51         ///
52         static std::string params2string(InsetNewlineParams const &);
53 private:
54         ///
55         InsetNewlineParams params() const { return params_; }
56         ///
57         InsetCode lyxCode() const { return NEWLINE_CODE; }
58         ///
59         void metrics(MetricsInfo &, Dimension &) const;
60         ///
61         void draw(PainterInfo & pi, int x, int y) const;
62         ///
63         void latex(otexstream &, OutputParams const &) const;
64         ///
65         int plaintext(odocstringstream & ods, OutputParams const & op,
66                       size_t max_length = INT_MAX) const;
67         ///
68         int docbook(odocstream &, OutputParams const &) const;
69         ///
70         docstring xhtml(XHTMLStream &, OutputParams const &) const;
71         ///
72         void read(Lexer & lex);
73         ///
74         void write(std::ostream & os) const;
75         /// is this equivalent to a space (which is BTW different from
76         /// a line separator)?
77         bool isSpace() const { return true; }
78         ///
79         ColorCode ColorName() const;
80         ///
81         std::string contextMenuName() const;
82         ///
83         Inset * clone() const { return new InsetNewline(*this); }
84         ///
85         void doDispatch(Cursor & cur, FuncRequest & cmd);
86         ///
87         bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
88
89         ///
90         InsetNewlineParams params_;
91 };
92
93
94 } // namespace lyx
95
96 #endif // INSET_NEWLINE_H