]> git.lyx.org Git - lyx.git/blob - src/insets/insetspace.h
Clean up InsetGraphics::Cache and rename as GraphicsInset.
[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 metrics(MetricsInfo &, Dimension &) const;
58         ///
59         void draw(PainterInfo & pi, int x, int y) 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() const;
75         ///
76         Inset::Code lyxCode() const { return Inset::SPACE_CODE; }
77         /// We don't need \begin_inset and \end_inset
78         bool directWrite() const { return true; }
79
80         // should this inset be handled like a normal charater
81         bool isChar() const;
82         /// is this equivalent to a letter?
83         bool isLetter() const;
84         /// is this equivalent to a space (which is BTW different from
85         // a line separator)?
86         bool isSpace() const;
87         // should we break lines after this inset?
88         bool isLineSeparator() const;
89 private:
90         /// And which kind is this?
91         Kind kind_;
92 };
93
94 #endif // INSET_SPACE_H