]> git.lyx.org Git - lyx.git/blob - src/insets/InsetSpecialChar.h
Enable InsetQuote in verbatim and Hebrew
[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                 /// LyX logo
46                 PHRASE_LYX,
47                 /// TeX logo
48                 PHRASE_TEX,
49                 /// LaTeX2e logo
50                 PHRASE_LATEX2E,
51                 /// LaTeX logo
52                 PHRASE_LATEX
53         };
54
55         ///
56         InsetSpecialChar() : Inset(0), kind_(HYPHENATION) {}
57         ///
58         explicit InsetSpecialChar(Kind k);
59         ///
60         Kind kind() const;
61         ///
62         void metrics(MetricsInfo &, Dimension &) const;
63         ///
64         void draw(PainterInfo & pi, int x, int y) const;
65         ///
66         void write(std::ostream &) const;
67         /// Will not be used when lyxf3
68         void read(Lexer & lex);
69         ///
70         void latex(otexstream &, OutputParams const &) const;
71         ///
72         int plaintext(odocstringstream & ods, OutputParams const & op,
73                       size_t max_length = INT_MAX) const;
74         ///
75         int docbook(odocstream &, OutputParams const &) const;
76         ///
77         docstring xhtml(XHTMLStream &, OutputParams const &) const;
78         ///
79         void toString(odocstream &) const;
80         ///
81         bool isInToc() const { return true; }   
82         ///
83         void forOutliner(docstring &, size_t const, bool const) const;
84         ///
85         InsetCode lyxCode() const { return SPECIALCHAR_CODE; }
86         /// We don't need \begin_inset and \end_inset
87         bool directWrite() const { return true; }
88         ///
89         void validate(LaTeXFeatures &) const;
90
91         /// should this inset be handled like a normal character?
92         bool isChar() const { return true; }
93         /// is this equivalent to a letter?
94         bool isLetter() const;
95         /// should we break lines after this inset?
96         bool isLineSeparator() const;
97 private:
98         Inset * clone() const { return new InsetSpecialChar(*this); }
99
100         /// And which kind is this?
101         Kind kind_;
102 };
103
104
105 } // namespace lyx
106
107 #endif