]> git.lyx.org Git - lyx.git/blob - src/insets/insetlatexaccent.h
fix the resize bug, make some more inset funcs const, cleanup in lyxscreen, painter...
[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) const;
57         ///
58         int Latex(string & file, signed char fragile) const;
59         ///
60         int Linuxdoc(string & file) const;
61         ///
62         int DocBook(string & file) const;
63         ///
64         bool Deletable() const;
65         ///
66         bool DirectWrite() const;
67         ///
68         Inset * Clone() const;
69         ///
70         Inset::Code LyxCode()const;
71         ///
72         inline bool CanDisplay();
73         /// all the accent types
74         enum ACCENT_TYPES{
75                 ///
76                 ACUTE, // 0
77                 ///
78                 GRAVE,
79                 ///
80                 MACRON,
81                 ///
82                 TILDE,
83                 ///
84                 UNDERBAR,
85                 ///
86                 CEDILLA, // 5
87                 ///
88                 UNDERDOT,
89                 ///
90                 CIRCLE,
91                 ///
92                 TIE,
93                 ///
94                 BREVE,
95                 ///
96                 CARON, // 10
97                 ///
98                 SPECIAL_CARON,
99                 ///
100                 HUNGARIAN_UMLAUT,
101                 ///
102                 UMLAUT,
103                 ///
104                 DOT,
105                 ///
106                 CIRCUMFLEX, // 15
107                 ///
108                 OGONEK,
109                 ///
110                 DOT_LESS_I,
111                 ///
112                 DOT_LESS_J, // 18
113                 ///
114                 lSLASH,
115                 ///
116                 LSLASH
117         };
118 private:
119         friend ostream & operator<<(ostream &, ACCENT_TYPES);
120         /// Check if we know the modifier and can display it ok on screen.
121         void checkContents();
122         ///
123         string contents;
124         /// can display as proper char
125         bool  candisp;
126         /// modifier type
127         ACCENT_TYPES  modtype;
128         
129         /// remove dot from 'i' and 'j' or transform l, L into lslash, LSLaSH
130         bool  remdot;
131         /// add something to ascent - accent at the top
132         bool  plusasc;
133         /// add something to descent - underlined char
134         bool  plusdesc;
135         /// international char
136         mutable char  ic;    
137 };
138
139 bool InsetLatexAccent::CanDisplay()
140 {
141         return candisp;
142 }
143
144 #endif