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