]> git.lyx.org Git - lyx.git/blob - src/insets/insetspace.h
parlist-24-a.diff
[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 Juergen Spitzmueller
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 #include "LString.h"
21
22 struct LaTeXFeatures;
23
24 ///  Used to insert different kinds of spaces
25 class InsetSpace : public Inset {
26 public:
27
28         /// The different kinds of spaces we support
29         enum Kind {
30                 /// Normal space ('\ ')
31                 NORMAL,
32                 /// Protected (no break) space ('~')
33                 PROTECTED,
34                 /// Thin space ('\,')
35                 THIN,
36                 /// \quad (1em)
37                 QUAD,
38                 /// \qquad (2em)
39                 QQUAD,
40                 /// \enspace (0.5em unbreakable)
41                 ENSPACE,
42                 /// \enspace (0.5em breakable)
43                 ENSKIP,
44                 /// Negative thin space ('\negthinspace')
45                 NEGTHIN
46         };
47
48         ///
49         InsetSpace();
50
51         ///
52         explicit
53         InsetSpace(Kind k);
54         ///
55         Kind kind() const;
56         ///
57         void dimension(BufferView *, LyXFont const &, Dimension &) const;
58         ///
59         void draw(BufferView *, LyXFont const &, int, float &) const;
60         ///
61         void write(Buffer const *, std::ostream &) const;
62         /// Will not be used when lyxf3
63         void read(Buffer const *, LyXLex & lex);
64         ///
65         int latex(Buffer const *, std::ostream &,
66                   LatexRunParams const &) const;
67         ///
68         int ascii(Buffer const *, std::ostream &, int linelen) const;
69         ///
70         int linuxdoc(Buffer const *, std::ostream &) const;
71         ///
72         int docbook(Buffer const *, std::ostream &, bool mixcont) const;
73         ///
74         virtual Inset * clone(Buffer const &) const;
75         ///
76         //virtual Inset * clone(Buffer const &, bool same_id) const;
77         ///
78         Inset::Code lyxCode() const { return Inset::SPACE_CODE; }
79         /// We don't need \begin_inset and \end_inset
80         bool directWrite() const { return true; }
81
82         // should this inset be handled like a normal charater
83         bool isChar() const;
84         /// is this equivalent to a letter?
85         bool isLetter() const;
86         /// is this equivalent to a space (which is BTW different from
87         // a line separator)?
88         bool isSpace() const;
89         // should we break lines after this inset?
90         bool isLineSeparator() const;
91 private:
92         /// And which kind is this?
93         Kind kind_;
94 };
95
96 #endif // INSET_SPACE_H