]> git.lyx.org Git - lyx.git/blob - src/insets/insetlatexaccent.h
024ef9fe991589fec5d620569a5729934a279c80
[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         ///
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(string &file, signed char fragile);
59         ///
60         int Linuxdoc(string &file);
61         ///
62         int DocBook(string &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         friend ostream & operator<<(ostream &, ACCENT_TYPES);
123         /// Check if we know the modifier and can display it ok on screen.
124         void checkContents();
125         ///
126         string contents;
127         /// can display as proper char
128         bool  candisp;
129         /// modifier type
130         ACCENT_TYPES  modtype;
131         
132         /// remove dot from 'i' and 'j' or transform l,L into lslash,LSLaSH
133         bool  remdot;
134         /// add something to ascent - accent at the top
135         bool  plusasc;
136         /// add something to descent - underlined char
137         bool  plusdesc;
138         /// international char
139         char  ic;    
140 };
141
142 bool InsetLatexAccent::CanDisplay()
143 {
144         return candisp;
145 }
146
147 #endif
148