]> git.lyx.org Git - lyx.git/blob - src/insets/insetspecialchar.h
ws changes only
[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 &, int linelen) const;
60         ///
61         int linuxdoc(Buffer const &, std::ostream &) const;
62         ///
63         int docbook(Buffer const &, std::ostream &, bool mixcont) const;
64         ///
65         virtual std::auto_ptr<InsetBase> clone() const;
66         ///
67         InsetOld::Code lyxCode() const { return InsetOld::SPECIALCHAR_CODE; }
68         /// We don't need \begin_inset and \end_inset
69         bool directWrite() const { return true; }
70         ///
71         void validate(LaTeXFeatures &) const;
72
73         // should this inset be handled like a normal charater
74         bool isChar() const;
75         /// is this equivalent to a letter?
76         bool isLetter() const;
77         /// is this equivalent to a space (which is BTW different from
78         // a line separator)?
79         bool isSpace() const;
80         // should we break lines after this inset?
81         bool isLineSeparator() const;
82 private:
83         /// And which kind is this?
84         Kind kind_;
85 };
86
87 #endif