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