]> git.lyx.org Git - lyx.git/blob - src/insets/insetspecialchar.h
Make it compile when USE_BOOST_FORMAT is unset
[lyx.git] / src / insets / insetspecialchar.h
1 // -*- C++ -*-
2 /**
3  * \file insetspecialchar.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  *
11  * Full author contact details are available in file CREDITS
12  */
13
14 #ifndef INSET_SPECIALCHAR_H
15 #define INSET_SPECIALCHAR_H
16
17 #ifdef __GNUG__
18 #pragma interface
19 #endif
20
21 #include "inset.h"
22 #include "LString.h"
23
24 struct LaTeXFeatures;
25
26 ///  Used to insert special chars
27 class InsetSpecialChar : public Inset {
28 public:
29
30         /// The different kinds of special chars we support
31         enum Kind {
32                 /// Optional hyphenation point (\-)
33                 HYPHENATION,
34                 /// Ligature break point (\textcompwordmark)
35                 LIGATURE_BREAK,
36                 /// ... (\ldots)
37                 LDOTS,
38                 /// End of sentence punctuation (\@)
39                 END_OF_SENTENCE,
40                 /// Menu separator
41                 MENU_SEPARATOR,
42                 /// Protected Separator
43                 PROTECTED_SEPARATOR
44         };
45
46         ///
47         InsetSpecialChar() {}
48         ///
49         explicit
50         InsetSpecialChar(Kind k);
51         ///
52         Kind kind() const;
53         ///
54         int ascent(BufferView *, LyXFont const &) const;
55         ///
56         int descent(BufferView *, LyXFont const &) const;
57         ///
58         int width(BufferView *, LyXFont const &) const;
59         ///
60         void draw(BufferView *, LyXFont const &, int, float &, bool) const;
61         ///
62         void write(Buffer const *, std::ostream &) const;
63         /// Will not be used when lyxf3
64         void read(Buffer const *, LyXLex & lex);
65         ///
66         int latex(Buffer const *, std::ostream &,
67                   bool fragile, bool free_spc) const;
68         ///
69         int ascii(Buffer const *, std::ostream &, int linelen) const;
70         ///
71         int linuxdoc(Buffer const *, std::ostream &) const;
72         ///
73         int docbook(Buffer const *, std::ostream &, bool mixcont) const;
74         ///
75         virtual Inset * clone(Buffer const &, bool same_id = false) const;
76         ///
77         Inset::Code lyxCode() const
78         {
79                 return Inset::SPECIALCHAR_CODE;
80         }
81         /// We don't need \begin_inset and \end_inset
82         bool directWrite() const
83         {
84                 return true;
85         };
86         ///
87         void validate(LaTeXFeatures &) const;
88
89         // should this inset be handled like a normal charater
90         bool isChar() const;
91         /// is this equivalent to a letter?
92         bool isLetter() const;
93         /// is this equivalent to a space (which is BTW different from
94         // a line separator)?
95         bool isSpace() const;
96         // should we break lines after this inset?
97         bool isLineSeparator() const;
98 private:
99         /// And which kind is this?
100         Kind kind_;
101 };
102
103 #endif