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