]> git.lyx.org Git - lyx.git/blob - src/insets/insetlatexaccent.h
The speed patch: redraw only rows that have changed
[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         /// the string that is passed to the TOC
61         virtual int textString(Buffer const &, std::ostream & os,
62                 OutputParams const &) const;
63         ///
64         bool directWrite() const;
65         ///
66         InsetBase::Code lyxCode()const;
67         ///
68         inline bool canDisplay();
69         // should this inset be handled like a normal charater
70         bool isChar() const { return true; }
71
72         /// is this equivalent to a letter?
73         virtual bool isLetter() const { return candisp; }
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
123         virtual std::auto_ptr<InsetBase> doClone() const;
124
125         /// Check if we know the modifier and can display it ok on screen.
126         void checkContents();
127         ///
128         void drawAccent(PainterInfo const & pi, int x, int y, char accent) const;
129         ///
130         std::string contents;
131         /// can display as proper char
132         bool  candisp;
133         /// modifier type
134         ACCENT_TYPES  modtype;
135
136         /// remove dot from 'i' and 'j' or transform l, L into lslash, LSLaSH
137         bool  remdot;
138         /// add something to ascent - accent at the top
139         bool  plusasc;
140         /// add something to descent - underlined char
141         bool  plusdesc;
142         /// international char
143         mutable char  ic;
144 };
145
146
147 bool InsetLatexAccent::canDisplay()
148 {
149         return candisp;
150 }
151
152 #endif