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