]> git.lyx.org Git - lyx.git/blob - src/insets/insetspecialchar.h
the freespacing patch from Kayvan, draw the math empty delim with onoffdash, asure...
[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 "lyxinset.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 #if 0
38                 /// Newline
39                 NEWLINE,
40 #endif
41                 /// Protected Separator
42                 PROTECTED_SEPARATOR
43         };
44
45         ///
46         InsetSpecialChar() {}
47         ///
48         InsetSpecialChar(Kind k);
49         ///
50         int ascent(Painter &, LyXFont const &) const;
51         ///
52         int descent(Painter &, LyXFont const &) const;
53         ///
54         int width(Painter &, LyXFont const &) const;
55         ///
56         void draw(Painter &, LyXFont const &, int baseline, float & x) const;
57         ///
58         void Write(ostream &) const;
59         /// Will not be used when lyxf3
60         void Read(LyXLex & lex);
61         /// 
62         int Latex(ostream &, signed char fragile, bool free_spc) const;
63 #ifndef USE_OSTREAM_ONLY
64         ///
65         int Latex(string & file, signed char fragile, bool free_spc) const;
66         ///
67         int Linuxdoc(string & file) const;
68         ///
69         int DocBook(string & file) const;
70 #else
71         ///
72         int Linuxdoc(ostream &) const;
73         ///
74         int DocBook(ostream &) const;
75 #endif
76         ///
77         Inset * Clone() const;
78         ///  
79         Inset::Code LyxCode() const
80         {
81                 return Inset::SPECIALCHAR_CODE;
82         }
83         /// We don't need \begin_inset and \end_inset
84         bool DirectWrite() const 
85         {
86                 return true;
87         };
88         ///
89         void Validate(LaTeXFeatures &) const;
90 private:
91         /// And which kind is this?
92         Kind kind;
93 };
94
95 #endif