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