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