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