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