]> git.lyx.org Git - lyx.git/blob - src/insets/insetlatexaccent.h
Make it compile when USE_BOOST_FORMAT is unset
[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 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "inset.h"
20 #include "LString.h"
21
22 class LyXLex;
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 Inset {
33 public:
34         ///
35         InsetLatexAccent();
36         ///
37         explicit
38         InsetLatexAccent(string const & string);
39         ///
40         int ascent(BufferView *, LyXFont const &) const;
41         ///
42         int descent(BufferView *, LyXFont const &) const;
43         ///
44         int width(BufferView *, LyXFont const &) const;
45         ///
46         void draw(BufferView *, LyXFont const &, int, float &, bool) const;
47         ///
48         int lbearing(LyXFont const & font) const;
49         ///
50         int rbearing(LyXFont const & font) const;
51         ///
52         bool displayISO8859_9(BufferView *, LyXFont const & font,
53                               int baseline, float & x) const;
54         ///
55         void write(Buffer const *, std::ostream &) const;
56         ///
57         void read(Buffer const *, LyXLex & lex);
58         ///
59         int latex(Buffer const *, std::ostream &,
60                   bool fragile, bool free_spc) const;
61         ///
62         int ascii(Buffer const *, std::ostream &, int linelen) const;
63         ///
64         int linuxdoc(Buffer const *, std::ostream &) const;
65         ///
66         int docbook(Buffer const *, std::ostream &, bool mixcont) const;
67         ///
68         bool deletable() const;
69         ///
70         bool directWrite() const;
71         ///
72         virtual Inset * clone(Buffer const &, bool same_id = false) const;
73         ///
74         Inset::Code lyxCode()const;
75         ///
76         inline bool canDisplay();
77         // should this inset be handled like a normal charater
78         bool isChar() const { return true; }
79
80         /// all the accent types
81         enum ACCENT_TYPES{
82                 ///
83                 ACUTE, // 0
84                 ///
85                 GRAVE,
86                 ///
87                 MACRON,
88                 ///
89                 TILDE,
90                 ///
91                 UNDERBAR,
92                 ///
93                 CEDILLA, // 5
94                 ///
95                 UNDERDOT,
96                 ///
97                 CIRCLE,
98                 ///
99                 TIE,
100                 ///
101                 BREVE,
102                 ///
103                 CARON, // 10
104                 ///
105                 SPECIAL_CARON,
106                 ///
107                 HUNGARIAN_UMLAUT,
108                 ///
109                 UMLAUT,
110                 ///
111                 DOT,
112                 ///
113                 CIRCUMFLEX, // 15
114                 ///
115                 OGONEK,
116                 ///
117                 DOT_LESS_I,
118                 ///
119                 DOT_LESS_J, // 18
120                 ///
121                 lSLASH,
122                 ///
123                 LSLASH
124         };
125 private:
126         friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES);
127         /// Check if we know the modifier and can display it ok on screen.
128         void checkContents();
129         ///
130         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