]> git.lyx.org Git - lyx.git/blob - src/insets/insetspace.h
ad6bbc1b30d0bebac10488d52c113872c9959e3a
[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 struct LaTeXFeatures;
22
23 ///  Used to insert different kinds of spaces
24 class InsetSpace : public InsetOld {
25 public:
26
27         /// The different kinds of spaces we support
28         enum Kind {
29                 /// Normal space ('\ ')
30                 NORMAL,
31                 /// Protected (no break) space ('~')
32                 PROTECTED,
33                 /// Thin space ('\,')
34                 THIN,
35                 /// \quad (1em)
36                 QUAD,
37                 /// \qquad (2em)
38                 QQUAD,
39                 /// \enspace (0.5em unbreakable)
40                 ENSPACE,
41                 /// \enspace (0.5em breakable)
42                 ENSKIP,
43                 /// Negative thin space ('\negthinspace')
44                 NEGTHIN
45         };
46
47         ///
48         InsetSpace();
49
50         ///
51         explicit
52         InsetSpace(Kind k);
53         ///
54         Kind kind() const;
55         ///
56         void metrics(MetricsInfo &, Dimension &) const;
57         ///
58         void draw(PainterInfo & pi, int x, int y) const;
59         ///
60         void write(Buffer const &, std::ostream &) const;
61         /// Will not be used when lyxf3
62         void read(Buffer const &, LyXLex & lex);
63         ///
64         int latex(Buffer const &, std::ostream &,
65                   LatexRunParams const &) const;
66         ///
67         int ascii(Buffer const &, std::ostream &,
68                   LatexRunParams const &) const;
69         ///
70         int linuxdoc(Buffer const &, std::ostream &,
71                      LatexRunParams const &) const;
72         ///
73         int docbook(Buffer const &, std::ostream &,
74                     LatexRunParams const &) const;
75         ///
76         virtual std::auto_ptr<InsetBase> clone() const;
77         ///
78         InsetOld::Code lyxCode() const { return InsetOld::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