]> git.lyx.org Git - lyx.git/blob - src/insets/InsetNewline.h
0ffbb64331ea0c7ebba701b606dde278916571f4
[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(odocstream &, OutputParams const &) const;
34
35         int plaintext(odocstream &, OutputParams const &) const;
36
37         int docbook(odocstream &, OutputParams const &) const;
38
39         virtual void read(Lexer & lex);
40
41         virtual void write(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         Inset * clone() const { return new InsetNewline; }
58 };
59
60 class InsetLinebreak : public InsetNewline {
61 public:
62         InsetLinebreak() {}
63
64         docstring insetLabel() const { return _("line break"); }
65
66         std::string getLyXName() const { return "\\linebreak"; }
67
68         std::string getCmdName() const { return "\\linebreak{}"; }
69
70         ColorCode ColorName() const { return Color_pagebreak; }
71
72 private:
73         virtual Inset * clone() const
74         {
75                 return new InsetLinebreak;
76         }
77 };
78
79
80 } // namespace lyx
81
82 #endif // INSET_NEWLINE_H