]> git.lyx.org Git - lyx.git/blob - src/insets/insetspecialchar.h
The BIG UNDO patch. Recodes undo handling for better use inside InsetText.
[lyx.git] / src / insets / insetspecialchar.h
1 // -*- C++ -*-
2 /* This file is part of*
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *       
7  *          Copyright 1997 Asger Alstrup
8  *
9  * ====================================================== */
10
11 #ifndef INSET_SPECIALCHAR_H
12 #define INSET_SPECIALCHAR_H
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "inset.h"
19 #include "LString.h"
20
21 struct LaTeXFeatures;
22
23 ///  Used to insert special chars
24 class InsetSpecialChar : public Inset {
25 public:
26
27         /// The different kinds of special chars we support
28         enum Kind {
29                 /// Optional hyphenation point (\-)
30                 HYPHENATION,
31                 /// ... (\ldots)
32                 LDOTS,
33                 /// End of sentence punctuation (\@)
34                 END_OF_SENTENCE,
35                 /// Menu separator
36                 MENU_SEPARATOR,
37                 /// Protected Separator
38                 PROTECTED_SEPARATOR
39         };
40
41         ///
42         InsetSpecialChar() {}
43         ///
44         explicit
45         InsetSpecialChar(Kind k);
46         ///
47         int ascent(BufferView *, LyXFont const &) const;
48         ///
49         int descent(BufferView *, LyXFont const &) const;
50         ///
51         int width(BufferView *, LyXFont const &) const;
52         ///
53         void draw(BufferView *, LyXFont const &, int, float &, bool) const;
54         ///
55         void write(Buffer const *, std::ostream &) const;
56         /// Will not be used when lyxf3
57         void read(Buffer const *, LyXLex & lex);
58         /// 
59         int latex(Buffer const *, std::ostream &,
60                   bool fragile, bool free_spc) const;
61         ///
62         int ascii(Buffer const *, std::ostream &, int linelen) const;
63         ///
64         int linuxdoc(Buffer const *, std::ostream &) const;
65         ///
66         int docBook(Buffer const *, std::ostream &) const;
67         ///
68         virtual Inset * clone(Buffer const &, bool same_id = false) const;
69         ///  
70         Inset::Code lyxCode() const
71         {
72                 return Inset::SPECIALCHAR_CODE;
73         }
74         /// We don't need \begin_inset and \end_inset
75         bool directWrite() const 
76         {
77                 return true;
78         };
79         ///
80         void validate(LaTeXFeatures &) const;
81 private:
82         /// And which kind is this?
83         Kind kind;
84 };
85
86 #endif