]> git.lyx.org Git - lyx.git/blob - src/insets/InsetSpecialChar.h
Improve handling of top and bottom margin
[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         /// some special chars allow line breaking after them
66         RowFlags rowFlags() const;
67         ///
68         void metrics(MetricsInfo &, Dimension &) const;
69         ///
70         void draw(PainterInfo & pi, int x, int y) const;
71         ///
72         void write(std::ostream &) const;
73         /// Will not be used when lyxf3
74         void read(Lexer & lex);
75         ///
76         void latex(otexstream &, OutputParams const &) const;
77         ///
78         int plaintext(odocstringstream & ods, OutputParams const & op,
79                       size_t max_length = INT_MAX) const;
80         ///
81         void docbook(XMLStream &, OutputParams const &) const;
82         ///
83         docstring xhtml(XMLStream &, OutputParams const &) const;
84         ///
85         void toString(odocstream &) const;
86         ///
87         bool isInToc() const { return true; }
88         ///
89         void forOutliner(docstring &, size_t const, bool const) const;
90         ///
91         InsetCode lyxCode() const { return SPECIALCHAR_CODE; }
92         /// We don't need \begin_inset and \end_inset
93         bool directWrite() const { return true; }
94         ///
95         void validate(LaTeXFeatures &) const;
96
97         /// should this inset be handled like a normal character?
98         bool isChar() const;
99         /// is this equivalent to a letter?
100         bool isLetter() const;
101         /// should we break lines after this inset?
102         bool isLineSeparator() const;
103         /// Is the content of this inset part of the immediate (visible) text sequence?
104         bool isPartOfTextSequence() const { return isChar(); }
105 private:
106         Inset * clone() const { return new InsetSpecialChar(*this); }
107
108         /// And which kind is this?
109         Kind kind_;
110 };
111
112
113 } // namespace lyx
114
115 #endif