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