]> git.lyx.org Git - lyx.git/blob - src/insets/InsetNewline.h
This should be the last of the commits refactoring the InsetLayout code.
[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
16 #include "Inset.h"
17 #include "support/gettext.h"
18
19
20 namespace lyx {
21
22 class InsetNewline : public Inset {
23 public:
24
25         InsetNewline() {}
26
27         InsetCode lyxCode() const { return NEWLINE_CODE; }
28
29         void metrics(MetricsInfo &, Dimension &) const;
30
31         virtual void draw(PainterInfo & pi, int x, int y) const;
32
33         int latex(Buffer const &, odocstream &, OutputParams const &) const;
34
35         int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
36
37         int docbook(Buffer const &, odocstream &, OutputParams const &) const;
38
39         virtual void read(Buffer const &, Lexer & lex);
40
41         virtual void write(Buffer const &, std::ostream & os) const;
42         /// We don't need \begin_inset and \end_inset
43         virtual bool directWrite() const { return true; }
44         /// is this equivalent to a space (which is BTW different from
45         // a line separator)?
46         bool isSpace() const;
47
48         virtual docstring insetLabel() const { return docstring(); }
49
50         virtual std::string getLyXName() const { return "\\newline"; }
51
52         virtual std::string getCmdName() const { return "\\\\"; }
53
54         virtual ColorCode ColorName() const { return Color_eolmarker; }
55
56 private:
57         virtual Inset * clone() const
58         {
59                 return new InsetNewline;
60         }
61 };
62
63 class InsetLinebreak : public InsetNewline {
64 public:
65         InsetLinebreak() {}
66
67         docstring insetLabel() const { return _("line break"); }
68
69         std::string getLyXName() const { return "\\linebreak"; }
70
71         std::string getCmdName() const { return "\\linebreak{}"; }
72
73         ColorCode ColorName() const { return Color_pagebreak; }
74
75 private:
76         virtual Inset * clone() const
77         {
78                 return new InsetLinebreak;
79         }
80 };
81
82
83 } // namespace lyx
84
85 #endif // INSET_NEWLINE_H