]> git.lyx.org Git - lyx.git/blob - src/insets/InsetSpecialChar.h
Embedding: display a pin at the top left corner of embedded figures
[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                 /// breakable slash
42                 SLASH,
43                 /// protected dash
44                 NOBREAKDASH,
45         };
46
47         ///
48         InsetSpecialChar() {}
49         ///
50         explicit
51         InsetSpecialChar(Kind k);
52         ///
53         Kind kind() const;
54         ///
55         void metrics(MetricsInfo &, Dimension &) const;
56         ///
57         void draw(PainterInfo & pi, int x, int y) const;
58         ///
59         void write(Buffer const &, std::ostream &) const;
60         /// Will not be used when lyxf3
61         void read(Buffer const &, Lexer & lex);
62         ///
63         int latex(Buffer const &, odocstream &,
64                   OutputParams const &) const;
65         ///
66         int plaintext(Buffer const &, odocstream &,
67                       OutputParams const &) const;
68         ///
69         int docbook(Buffer const &, odocstream &,
70                     OutputParams const &) const;
71         /// the string that is passed to the TOC
72         virtual int textString(Buffer const &, odocstream &,
73                 OutputParams const &) const;
74         ///
75         InsetCode lyxCode() const { return SPECIALCHAR_CODE; }
76         /// We don't need \begin_inset and \end_inset
77         bool directWrite() const { return true; }
78         ///
79         void validate(LaTeXFeatures &) const;
80
81         // should this inset be handled like a normal charater
82         bool isChar() const;
83         /// is this equivalent to a letter?
84         bool isLetter() const;
85         // should we break lines after this inset?
86         bool isLineSeparator() const;
87 private:
88         virtual Inset * clone() const;
89
90         /// And which kind is this?
91         Kind kind_;
92 };
93
94
95 } // namespace lyx
96
97 #endif