]> git.lyx.org Git - lyx.git/blob - src/insets/InsetQuotes.h
rename InsetBase to Inset
[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 #include "support/types.h"
19
20
21 namespace lyx {
22
23 class BufferParams;
24 class Language;
25 class LaTeXFeatures;
26
27
28 /** Quotes.
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(std::string const & str = "eld");
72         /// Create the right quote inset after character c
73         InsetQuotes(char_type c, BufferParams const & params);
74         /// Direct access to inner/outer quotation marks
75         InsetQuotes(char_type c, quote_language l, quote_times t);
76         ///
77         docstring insetName() const { return from_ascii("Quotes"); }
78         ///
79         bool metrics(MetricsInfo &, Dimension &) const;
80         ///
81         void draw(PainterInfo & pi, int x, int y) const;
82 #if 0
83         ///
84         LyXFont const convertFont(LyXFont const & font) const;
85 #endif
86         ///
87         void write(Buffer const &, std::ostream &) const;
88         ///
89         void read(Buffer const &, Lexer & lex);
90         ///
91         int latex(Buffer const &, odocstream &, OutputParams const &) const;
92         ///
93         int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
94         ///
95         int docbook(Buffer const &, odocstream &, OutputParams const &) const;
96
97         /// the string that is passed to the TOC
98         virtual void textString(Buffer const &, odocstream &) const;
99
100         ///
101         void validate(LaTeXFeatures &) const;
102         ///
103         Inset::Code lyxCode() const;
104         // should this inset be handled like a normal character
105         bool isChar() const { return true; }
106
107 private:
108         virtual std::auto_ptr<Inset> doClone() const;
109
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         /// Decide whether we need left or right quotation marks
122         void getPosition(char_type c);
123         ///
124         void parseString(std::string const &);
125         ///
126         lyx::docstring const dispString(Language const *) const;
127 };
128
129 } // namespace lyx
130
131 #endif