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