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