]> git.lyx.org Git - lyx.git/blob - src/insets/insetlatexaccent.h
time to recompile everything: I removed #include directives from headers here and...
[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 "inset.h"
19 #include "LString.h"
20
21 class LyXLex;
22
23 /** Insertion of accents
24
25   Proper handling of accented characters.
26   This is class is supposed to handle all LaTeX accents, it
27   is also possible that the class will change a bit so that
28   it also can handle other special characters (e.g. Hstroke)
29   Initiated by Ivan Schreter, later modified by Lgb.
30   */
31 class InsetLatexAccent : public Inset {
32 public:
33         ///
34         InsetLatexAccent();
35         ///
36         explicit
37         InsetLatexAccent(string const & string);
38         ///
39         int ascent(BufferView *, LyXFont const &) const;
40         ///
41         int descent(BufferView *, LyXFont const &) const;
42         ///
43         int width(BufferView *, LyXFont const &) const;
44         ///
45         void draw(BufferView *, LyXFont const &, int, float &, bool) const;
46         ///
47         int lbearing(LyXFont const & font) const;
48         ///
49         int rbearing(LyXFont const & font) const;
50         ///
51         bool displayISO8859_9(BufferView *, LyXFont const & font,
52                               int baseline, float & x) const;
53         ///
54         void write(Buffer const *, std::ostream &) const;
55         ///
56         void read(Buffer const *, LyXLex & lex);
57         ///
58         int latex(Buffer const *, std::ostream &,
59                   bool fragile, bool free_spc) const;
60         ///
61         int ascii(Buffer const *, std::ostream &, int linelen) const;
62         ///
63         int linuxdoc(Buffer const *, std::ostream &) const;
64         ///
65         int docbook(Buffer const *, std::ostream &, bool mixcont) const;
66         ///
67         bool deletable() const;
68         ///
69         bool directWrite() const;
70         ///
71         virtual Inset * clone(Buffer const &, bool same_id = false) const;
72         ///
73         Inset::Code lyxCode()const;
74         ///
75         inline bool canDisplay();
76         // should this inset be handled like a normal charater
77         bool isChar() const { return true; }
78
79         /// all the accent types
80         enum ACCENT_TYPES{
81                 ///
82                 ACUTE, // 0
83                 ///
84                 GRAVE,
85                 ///
86                 MACRON,
87                 ///
88                 TILDE,
89                 ///
90                 UNDERBAR,
91                 ///
92                 CEDILLA, // 5
93                 ///
94                 UNDERDOT,
95                 ///
96                 CIRCLE,
97                 ///
98                 TIE,
99                 ///
100                 BREVE,
101                 ///
102                 CARON, // 10
103                 ///
104                 SPECIAL_CARON,
105                 ///
106                 HUNGARIAN_UMLAUT,
107                 ///
108                 UMLAUT,
109                 ///
110                 DOT,
111                 ///
112                 CIRCUMFLEX, // 15
113                 ///
114                 OGONEK,
115                 ///
116                 DOT_LESS_I,
117                 ///
118                 DOT_LESS_J, // 18
119                 ///
120                 lSLASH,
121                 ///
122                 LSLASH
123         };
124 private:
125         friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES);
126         /// Check if we know the modifier and can display it ok on screen.
127         void checkContents();
128         ///
129         string contents;
130         /// can display as proper char
131         bool  candisp;
132         /// modifier type
133         ACCENT_TYPES  modtype;
134
135         /// remove dot from 'i' and 'j' or transform l, L into lslash, LSLaSH
136         bool  remdot;
137         /// add something to ascent - accent at the top
138         bool  plusasc;
139         /// add something to descent - underlined char
140         bool  plusdesc;
141         /// international char
142         mutable char  ic;
143 };
144
145
146 bool InsetLatexAccent::canDisplay()
147 {
148         return candisp;
149 }
150
151 #endif