]> git.lyx.org Git - lyx.git/blob - src/insets/InsetSpecialChar.h
Move Inset::Code to InsetCode.h
[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
18 #include "Inset.h"
19
20
21 namespace lyx {
22
23 class LaTeXFeatures;
24
25 ///  Used to insert special chars
26 class InsetSpecialChar : public Inset {
27 public:
28
29         /// The different kinds of special chars we support
30         enum Kind {
31                 /// Optional hyphenation point (\-)
32                 HYPHENATION,
33                 /// Ligature break point (\textcompwordmark)
34                 LIGATURE_BREAK,
35                 /// ... (\ldots)
36                 LDOTS,
37                 /// End of sentence punctuation (\@)
38                 END_OF_SENTENCE,
39                 /// Menu separator
40                 MENU_SEPARATOR,
41         };
42
43         ///
44         InsetSpecialChar() {}
45         ///
46         explicit
47         InsetSpecialChar(Kind k);
48         ///
49         Kind kind() const;
50         ///
51         void metrics(MetricsInfo &, Dimension &) const;
52         ///
53         void draw(PainterInfo & pi, int x, int y) const;
54         ///
55         void write(Buffer const &, std::ostream &) const;
56         /// Will not be used when lyxf3
57         void read(Buffer const &, Lexer & lex);
58         ///
59         int latex(Buffer const &, odocstream &,
60                   OutputParams const &) const;
61         ///
62         int plaintext(Buffer const &, odocstream &,
63                       OutputParams const &) const;
64         ///
65         int docbook(Buffer const &, odocstream &,
66                     OutputParams const &) const;
67         /// the string that is passed to the TOC
68         virtual int textString(Buffer const &, odocstream &,
69                 OutputParams const &) const;
70         ///
71         InsetCode lyxCode() const { return SPECIALCHAR_CODE; }
72         /// We don't need \begin_inset and \end_inset
73         bool directWrite() const { return true; }
74         ///
75         void validate(LaTeXFeatures &) const;
76
77         // should this inset be handled like a normal charater
78         bool isChar() const;
79         /// is this equivalent to a letter?
80         bool isLetter() const;
81         // should we break lines after this inset?
82         bool isLineSeparator() const;
83 private:
84         virtual Inset * clone() const;
85
86         /// And which kind is this?
87         Kind kind_;
88 };
89
90
91 } // namespace lyx
92
93 #endif