]> git.lyx.org Git - lyx.git/blob - src/insets/insetlatexaccent.h
the freespacing patch from Kayvan, draw the math empty delim with onoffdash, asure...
[lyx.git] / src / insets / insetlatexaccent.h
1 // -*- C++ -*-
2 /* This file is part of*
3  * ====================================================== 
4  *
5  *           LyX, The Document Processor
6  *       
7  *          Copyright 1995 Matthias Ettrich
8  *
9  * ====================================================== */
10
11 #ifndef INSET_LATEX_ACCENT_H
12 #define INSET_LATEX_ACCENT_H
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "lyxinset.h"
19 #include "LString.h"
20 #include "lyxlex.h"
21
22 /** Insertion of accents
23   
24   Proper handling of accented characters.
25   This is class is supposed to handle all LaTeX accents, it
26   is also possible that the class will change a bit so that
27   it also can handle other special characters (e.g. Hstroke)
28   Initiated by Ivan Schreter, later modified by Lgb.
29   */
30 class InsetLatexAccent : public Inset {
31 public:
32         ///
33         InsetLatexAccent(); 
34         ///
35         InsetLatexAccent(string const & string);
36         ///
37         int ascent(Painter &, LyXFont const &) const;
38         ///
39         int descent(Painter &, LyXFont const &) const;
40         ///
41         int width(Painter &, LyXFont const &) const;
42         ///
43         void draw(Painter &, LyXFont const &, int baseline, float & x) const;
44         ///
45         int Lbearing(LyXFont const & font) const;
46         ///
47         int Rbearing(LyXFont const & font) const;
48         ///
49         bool DisplayISO8859_9(Painter &, LyXFont const & font,
50                               int baseline, float & x) const;
51         ///
52         void Write(ostream &) const;
53         ///
54         void Read(LyXLex & lex);
55         ///
56         int Latex(ostream &, signed char fragile, bool free_spc) const;
57 #ifndef USE_OSTREAM_ONLY
58         ///
59         int Latex(string & file, signed char fragile, bool free_spc) const;
60         ///
61         int Linuxdoc(string & file) const;
62         ///
63         int DocBook(string & file) const;
64 #else
65         ///
66         int Linuxdoc(ostream &) const;
67         ///
68         int DocBook(ostream &) const;
69 #endif
70         ///
71         bool Deletable() const;
72         ///
73         bool DirectWrite() const;
74         ///
75         Inset * Clone() const;
76         ///
77         Inset::Code LyxCode()const;
78         ///
79         inline bool CanDisplay();
80         /// all the accent types
81         enum ACCENT_TYPES{
82                 ///
83                 ACUTE, // 0
84                 ///
85                 GRAVE,
86                 ///
87                 MACRON,
88                 ///
89                 TILDE,
90                 ///
91                 UNDERBAR,
92                 ///
93                 CEDILLA, // 5
94                 ///
95                 UNDERDOT,
96                 ///
97                 CIRCLE,
98                 ///
99                 TIE,
100                 ///
101                 BREVE,
102                 ///
103                 CARON, // 10
104                 ///
105                 SPECIAL_CARON,
106                 ///
107                 HUNGARIAN_UMLAUT,
108                 ///
109                 UMLAUT,
110                 ///
111                 DOT,
112                 ///
113                 CIRCUMFLEX, // 15
114                 ///
115                 OGONEK,
116                 ///
117                 DOT_LESS_I,
118                 ///
119                 DOT_LESS_J, // 18
120                 ///
121                 lSLASH,
122                 ///
123                 LSLASH
124         };
125 private:
126         friend ostream & operator<<(ostream &, ACCENT_TYPES);
127         /// Check if we know the modifier and can display it ok on screen.
128         void checkContents();
129         ///
130         string contents;
131         /// can display as proper char
132         bool  candisp;
133         /// modifier type
134         ACCENT_TYPES  modtype;
135         
136         /// remove dot from 'i' and 'j' or transform l, L into lslash, LSLaSH
137         bool  remdot;
138         /// add something to ascent - accent at the top
139         bool  plusasc;
140         /// add something to descent - underlined char
141         bool  plusdesc;
142         /// international char
143         mutable char  ic;    
144 };
145
146 bool InsetLatexAccent::CanDisplay()
147 {
148         return candisp;
149 }
150
151 #endif