]> git.lyx.org Git - lyx.git/blob - src/insets/insetspace.h
ws changes only
[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 &, int linelen) const;
68         ///
69         int linuxdoc(Buffer const &, std::ostream &) const;
70         ///
71         int docbook(Buffer const &, std::ostream &, bool mixcont) const;
72         ///
73         virtual std::auto_ptr<InsetBase> clone() const;
74         ///
75         InsetOld::Code lyxCode() const { return InsetOld::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;
81         /// is this equivalent to a letter?
82         bool isLetter() const;
83         /// is this equivalent to a space (which is BTW different from
84         // a line separator)?
85         bool isSpace() const;
86         // should we break lines after this inset?
87         bool isLineSeparator() const;
88 private:
89         /// And which kind is this?
90         Kind kind_;
91 };
92
93 #endif // INSET_SPACE_H