]> git.lyx.org Git - lyx.git/blob - src/insets/insetquotes.h
Don't remove cell selections after fontchange.
[lyx.git] / src / insets / insetquotes.h
1 // -*- C++ -*-
2 /* This file is part of*
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *       
7  *          Copyright 1995 Matthias Ettrich
8  *          Copyright 1995-2001 The LyX Team
9  *
10  * ====================================================== */
11
12 #ifndef INSET_QUOTES_H
13 #define INSET_QUOTES_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "inset.h"
20
21 class BufferParams;
22 class Language;
23
24 struct LaTeXFeatures;
25
26
27 /** Quotes.
28
29   Used for the various quotes. German, English, French, all either
30   double or single **/ 
31 class InsetQuotes : public Inset {
32 public:
33         ///
34         enum quote_language {
35                 ///
36                 EnglishQ,
37                 ///
38                 SwedishQ,
39                 ///
40                 GermanQ,
41                 ///
42                 PolishQ,
43                 ///
44                 FrenchQ,
45                 ///
46                 DanishQ
47         };
48         ///
49         enum quote_side {
50                 ///
51                 LeftQ,
52                 ///
53                 RightQ 
54         };
55         ///
56         enum quote_times {
57                 ///
58                 SingleQ,
59                 ///
60                 DoubleQ 
61         };
62         
63         /** The constructor works like this:
64           \begin{itemize}
65             \item fls <- french single quote left 
66             \item grd <- german double quote right 
67             \item etc.
68           \end{itemize}
69           */
70         explicit
71         InsetQuotes(string const & str = "eld");
72         /// Create the right quote inset after character c
73         InsetQuotes(char c, BufferParams const & params);
74
75         ///
76         int ascent(BufferView *, LyXFont const &) const;
77         ///
78         int descent(BufferView *, LyXFont const &) const;
79         ///
80         int width(BufferView *, LyXFont const &) const;
81         ///
82         void draw(BufferView *, LyXFont const &, int, float &, bool) const;
83 #if 0
84         ///
85         LyXFont const convertFont(LyXFont const & font) const;
86 #endif
87         ///
88         void write(Buffer const *, std::ostream &) const;
89         ///
90         void read(Buffer const *, LyXLex & lex);
91         ///
92         int latex(Buffer const *, std::ostream &,
93                   bool fragile, bool free_spc) const;
94         ///
95         int ascii(Buffer const *, std::ostream &, int linelen) const;
96         ///
97         int linuxdoc(Buffer const *, std::ostream &) const;
98         ///
99         int docbook(Buffer const *, std::ostream &) const;
100         ///
101         void validate(LaTeXFeatures &) const;
102         ///
103         virtual Inset * clone(Buffer const &, bool same_id = false) const;
104         ///
105         Inset::Code lyxCode() const;
106         // should this inset be handled like a normal charater
107         bool isChar() const { return true; }
108         
109 private:
110         ///
111         quote_language language_;
112         ///
113         quote_side side_;
114         ///
115         quote_times times_;
116
117         /** The parameters of the constructor are the language, the
118             side and the multiplicity of the quote.
119          */
120         InsetQuotes(quote_language l, quote_side s, quote_times t);
121         ///
122         void parseString(string const &);
123         ///
124         string const dispString(Language const *) const;
125 };
126 #endif
127