]> git.lyx.org Git - lyx.git/blob - src/insets/insetlatexaccent.h
insetlatexaccent is part of a word
[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         // is this equivalent to a letter?
72         virtual bool isLetter() const { return candisp; }
73
74         /// all the accent types
75         enum ACCENT_TYPES{
76                 ///
77                 ACUTE, // 0
78                 ///
79                 GRAVE,
80                 ///
81                 MACRON,
82                 ///
83                 TILDE,
84                 ///
85                 UNDERBAR,
86                 ///
87                 CEDILLA, // 5
88                 ///
89                 UNDERDOT,
90                 ///
91                 CIRCLE,
92                 ///
93                 TIE,
94                 ///
95                 BREVE,
96                 ///
97                 CARON, // 10
98                 ///
99                 SPECIAL_CARON,
100                 ///
101                 HUNGARIAN_UMLAUT,
102                 ///
103                 UMLAUT,
104                 ///
105                 DOT,
106                 ///
107                 CIRCUMFLEX, // 15
108                 ///
109                 OGONEK,
110                 ///
111                 DOT_LESS_I,
112                 ///
113                 DOT_LESS_J, // 18
114                 ///
115                 lSLASH,
116                 ///
117                 LSLASH
118         };
119 private:
120         friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES);
121         /// Check if we know the modifier and can display it ok on screen.
122         void checkContents();
123         ///
124         void drawAccent(PainterInfo const & pi, int x, int y, char accent) const;
125         ///
126         std::string contents;
127         /// can display as proper char
128         bool  candisp;
129         /// modifier type
130         ACCENT_TYPES  modtype;
131
132         /// remove dot from 'i' and 'j' or transform l, L into lslash, LSLaSH
133         bool  remdot;
134         /// add something to ascent - accent at the top
135         bool  plusasc;
136         /// add something to descent - underlined char
137         bool  plusdesc;
138         /// international char
139         mutable char  ic;
140 };
141
142
143 bool InsetLatexAccent::canDisplay()
144 {
145         return candisp;
146 }
147
148 #endif