]> git.lyx.org Git - lyx.git/blob - src/insets/insetspace.h
Rename LatexRunParams::fragile as moving_arg.
[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         explicit
52         InsetSpace(Kind k);
53         ///
54         Kind kind() const;
55         ///
56         void dimension(BufferView *, LyXFont const &, Dimension &) const;
57         ///
58         void draw(BufferView *, LyXFont const &, int, float &) 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 Inset * clone(Buffer const &, bool same_id = false) const;
74         ///
75         Inset::Code lyxCode() const { return Inset::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