]> git.lyx.org Git - lyx.git/blob - src/insets/InsetSpace.h
Remove TextClassPtr without losing the type safety it provided.
[lyx.git] / src / insets / InsetSpace.h
1 // -*- C++ -*-
2 /**
3  * \file InsetSpace.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Asger Alstrup Nielsen
8  * \author Jean-Marc Lasgouttes
9  * \author Lars Gullik Bjønnes
10  * \author Jürgen Spitzmüller
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef INSET_SPACE_H
16 #define INSET_SPACE_H
17
18
19 #include "Inset.h"
20
21
22 namespace lyx {
23
24 class LaTeXFeatures;
25
26 ///  Used to insert different kinds of spaces
27 class InsetSpace : public Inset {
28 public:
29
30         /// The different kinds of spaces we support
31         enum Kind {
32                 /// Normal space ('\ ')
33                 NORMAL,
34                 /// Protected (no break) space ('~')
35                 PROTECTED,
36                 /// Thin space ('\,')
37                 THIN,
38                 /// \quad (1em)
39                 QUAD,
40                 /// \qquad (2em)
41                 QQUAD,
42                 /// \enspace (0.5em unbreakable)
43                 ENSPACE,
44                 /// \enspace (0.5em breakable)
45                 ENSKIP,
46                 /// Negative thin space ('\negthinspace')
47                 NEGTHIN
48         };
49
50         ///
51         InsetSpace();
52
53         ///
54         explicit
55         InsetSpace(Kind k);
56         ///
57         Kind kind() const;
58         ///
59         void metrics(MetricsInfo &, Dimension &) const;
60         ///
61         void draw(PainterInfo & pi, int x, int y) const;
62         ///
63         void write(std::ostream &) const;
64         /// Will not be used when lyxf3
65         void read(Lexer & lex);
66         ///
67         int latex(odocstream &, OutputParams const &) const;
68         ///
69         int plaintext(odocstream &, OutputParams const &) const;
70         ///
71         int docbook(odocstream &, OutputParams const &) const;
72         /// the string that is passed to the TOC
73         void textString(odocstream &) const;
74         ///
75         InsetCode lyxCode() const { return SPACE_CODE; }
76         /// We don't need \begin_inset and \end_inset
77         bool directWrite() const { return true; }
78
79         // should this inset be handled like a normal charater
80         bool isChar() const { return true; }
81         /// is this equivalent to a letter?
82         bool isLetter() const { return false; }
83         /// is this equivalent to a space (which is BTW different from
84         // a line separator)?
85         bool isSpace() const { return true; }
86 private:
87         virtual Inset * clone() const;
88
89         /// And which kind is this?
90         Kind kind_;
91 };
92
93
94 } // namespace lyx
95
96 #endif // INSET_SPACE_H