]> git.lyx.org Git - lyx.git/blob - src/insets/InsetSpecialChar.h
Fix trailing whitespace in cpp files.
[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                 /// Optional line wrap point without hyphen (ZWSP)
34                 ALLOWBREAK,
35                 /// Ligature break point (\textcompwordmark)
36                 LIGATURE_BREAK,
37                 /// ... (\ldots)
38                 LDOTS,
39                 /// End of sentence punctuation (\@)
40                 END_OF_SENTENCE,
41                 /// Menu separator
42                 MENU_SEPARATOR,
43                 /// breakable slash
44                 SLASH,
45                 /// protected dash
46                 NOBREAKDASH,
47                 /// LyX logo
48                 PHRASE_LYX,
49                 /// TeX logo
50                 PHRASE_TEX,
51                 /// LaTeX2e logo
52                 PHRASE_LATEX2E,
53                 /// LaTeX logo
54                 PHRASE_LATEX
55         };
56
57         ///
58         InsetSpecialChar() : Inset(0), kind_(HYPHENATION) {}
59         ///
60         explicit InsetSpecialChar(Kind k);
61         ///
62         Kind kind() const;
63         ///
64         docstring toolTip(BufferView const & bv, int x, int y) const;
65         ///
66         void metrics(MetricsInfo &, Dimension &) const;
67         ///
68         void draw(PainterInfo & pi, int x, int y) const;
69         ///
70         void write(std::ostream &) const;
71         /// Will not be used when lyxf3
72         void read(Lexer & lex);
73         ///
74         void latex(otexstream &, OutputParams const &) const;
75         ///
76         int plaintext(odocstringstream & ods, OutputParams const & op,
77                       size_t max_length = INT_MAX) const;
78         ///
79         int docbook(odocstream &, OutputParams const &) const;
80         ///
81         docstring xhtml(XHTMLStream &, OutputParams const &) const;
82         ///
83         void toString(odocstream &) const;
84         ///
85         bool isInToc() const { return true; }
86         ///
87         void forOutliner(docstring &, size_t const, bool const) const;
88         ///
89         InsetCode lyxCode() const { return SPECIALCHAR_CODE; }
90         /// We don't need \begin_inset and \end_inset
91         bool directWrite() const { return true; }
92         ///
93         void validate(LaTeXFeatures &) const;
94
95         /// should this inset be handled like a normal character?
96         bool isChar() const;
97         /// is this equivalent to a letter?
98         bool isLetter() const;
99         /// should we break lines after this inset?
100         bool isLineSeparator() const;
101         /// Is the content of this inset part of the immediate (visible) text sequence?
102         bool isPartOfTextSequence() const { return isChar(); }
103 private:
104         Inset * clone() const { return new InsetSpecialChar(*this); }
105
106         /// And which kind is this?
107         Kind kind_;
108 };
109
110
111 } // namespace lyx
112
113 #endif