]> git.lyx.org Git - lyx.git/blob - src/insets/insetlatexaccent.h
ws changes only
[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
34         InsetLatexAccent(std::string const & str);
35         ///
36         void metrics(MetricsInfo &, Dimension &) const;
37         ///
38         void draw(PainterInfo & pi, int x, int y) const;
39         ///
40         int lbearing(LyXFont const & font) const;
41         ///
42         int rbearing(LyXFont const & font) const;
43         ///
44         bool displayISO8859_9(PainterInfo & pi, int x, int y) const;
45         ///
46         void write(Buffer const &, std::ostream &) const;
47         ///
48         void read(Buffer const &, LyXLex & lex);
49         ///
50         int latex(Buffer const &, std::ostream &,
51                   LatexRunParams const &) const;
52         ///
53         int ascii(Buffer const &, std::ostream &, int linelen) const;
54         ///
55         int linuxdoc(Buffer const &, std::ostream &) const;
56         ///
57         int docbook(Buffer const &, std::ostream &, bool mixcont) const;
58         ///
59         bool directWrite() const;
60         ///
61         virtual std::auto_ptr<InsetBase> clone() const;
62         ///
63         InsetOld::Code lyxCode()const;
64         ///
65         inline bool canDisplay();
66         // should this inset be handled like a normal charater
67         bool isChar() const { return true; }
68
69         /// all the accent types
70         enum ACCENT_TYPES{
71                 ///
72                 ACUTE, // 0
73                 ///
74                 GRAVE,
75                 ///
76                 MACRON,
77                 ///
78                 TILDE,
79                 ///
80                 UNDERBAR,
81                 ///
82                 CEDILLA, // 5
83                 ///
84                 UNDERDOT,
85                 ///
86                 CIRCLE,
87                 ///
88                 TIE,
89                 ///
90                 BREVE,
91                 ///
92                 CARON, // 10
93                 ///
94                 SPECIAL_CARON,
95                 ///
96                 HUNGARIAN_UMLAUT,
97                 ///
98                 UMLAUT,
99                 ///
100                 DOT,
101                 ///
102                 CIRCUMFLEX, // 15
103                 ///
104                 OGONEK,
105                 ///
106                 DOT_LESS_I,
107                 ///
108                 DOT_LESS_J, // 18
109                 ///
110                 lSLASH,
111                 ///
112                 LSLASH
113         };
114 private:
115         friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES);
116         /// Check if we know the modifier and can display it ok on screen.
117         void checkContents();
118         ///
119         std::string contents;
120         /// can display as proper char
121         bool  candisp;
122         /// modifier type
123         ACCENT_TYPES  modtype;
124
125         /// remove dot from 'i' and 'j' or transform l, L into lslash, LSLaSH
126         bool  remdot;
127         /// add something to ascent - accent at the top
128         bool  plusasc;
129         /// add something to descent - underlined char
130         bool  plusdesc;
131         /// international char
132         mutable char  ic;
133 };
134
135
136 bool InsetLatexAccent::canDisplay()
137 {
138         return candisp;
139 }
140
141 #endif