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