]> git.lyx.org Git - lyx.git/blob - src/insets/insetlatexaccent.h
new painter,workarea and lcolor. Read the diff/sources and ChangeLog...
[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 #ifdef USE_PAINTER
37         ///
38         int ascent(Painter &, LyXFont const &) const;
39         ///
40         int descent(Painter &, LyXFont const &) const;
41         ///
42         int width(Painter &, LyXFont const &) const;
43         ///
44         void draw(Painter &, LyXFont const &, int baseline, float & x) const;
45 #else
46         ///
47         int Ascent(LyXFont const & font) const;
48         ///
49         int Descent(LyXFont const & font) const;
50         ///
51         int Width(LyXFont const & font) const;
52         ///
53         void Draw(LyXFont, LyXScreen & scr, int baseline, float & x);
54 #endif
55         ///
56         int Lbearing(LyXFont const & font) const;
57         ///
58         int Rbearing(LyXFont const & font) const;
59 #ifdef USE_PAINTER
60         ///
61         bool DisplayISO8859_9(Painter &, LyXFont const & font,
62                               int baseline, float & x) const;
63 #else
64         ///
65         bool DisplayISO8859_9(LyXFont font, LyXScreen & scr,
66                               int baseline, float & x);
67 #endif
68         ///
69         void Write(ostream &);
70         ///
71         void Read(LyXLex & lex);
72         ///
73         int Latex(ostream &, signed char fragile);
74         ///
75         int Latex(string & file, signed char fragile);
76         ///
77         int Linuxdoc(string & file);
78         ///
79         int DocBook(string & file);
80         ///
81         bool Deletable() const;
82         ///
83         bool DirectWrite() const;
84         ///
85         Inset * Clone() const;
86         ///
87         Inset::Code LyxCode()const;
88         ///
89         inline bool CanDisplay();
90         /// all the accent types
91         enum ACCENT_TYPES{
92                 ///
93                 ACUTE, // 0
94                 ///
95                 GRAVE,
96                 ///
97                 MACRON,
98                 ///
99                 TILDE,
100                 ///
101                 UNDERBAR,
102                 ///
103                 CEDILLA, // 5
104                 ///
105                 UNDERDOT,
106                 ///
107                 CIRCLE,
108                 ///
109                 TIE,
110                 ///
111                 BREVE,
112                 ///
113                 CARON, // 10
114                 ///
115                 SPECIAL_CARON,
116                 ///
117                 HUNGARIAN_UMLAUT,
118                 ///
119                 UMLAUT,
120                 ///
121                 DOT,
122                 ///
123                 CIRCUMFLEX, // 15
124                 ///
125                 OGONEK,
126                 ///
127                 DOT_LESS_I,
128                 ///
129                 DOT_LESS_J, // 18
130                 ///
131                 lSLASH,
132                 ///
133                 LSLASH
134         };
135 private:
136         friend ostream & operator<<(ostream &, ACCENT_TYPES);
137         /// Check if we know the modifier and can display it ok on screen.
138         void checkContents();
139         ///
140         string contents;
141         /// can display as proper char
142         bool  candisp;
143         /// modifier type
144         ACCENT_TYPES  modtype;
145         
146         /// remove dot from 'i' and 'j' or transform l, L into lslash, LSLaSH
147         bool  remdot;
148         /// add something to ascent - accent at the top
149         bool  plusasc;
150         /// add something to descent - underlined char
151         bool  plusdesc;
152         /// international char
153         mutable char  ic;    
154 };
155
156 bool InsetLatexAccent::CanDisplay()
157 {
158         return candisp;
159 }
160
161 #endif