]> git.lyx.org Git - lyx.git/blob - src/insets/insetquotes.h
Enable the external inset to handle unknown templates gracefully.
[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   Used for the various quotes. German, English, French, all either
26   double or single **/
27 class InsetQuotes : public Inset {
28 public:
29         ///
30         enum quote_language {
31                 ///
32                 EnglishQ,
33                 ///
34                 SwedishQ,
35                 ///
36                 GermanQ,
37                 ///
38                 PolishQ,
39                 ///
40                 FrenchQ,
41                 ///
42                 DanishQ
43         };
44         ///
45         enum quote_side {
46                 ///
47                 LeftQ,
48                 ///
49                 RightQ
50         };
51         ///
52         enum quote_times {
53                 ///
54                 SingleQ,
55                 ///
56                 DoubleQ
57         };
58
59         /** The constructor works like this:
60           \begin{itemize}
61             \item fls <- french single quote left
62             \item grd <- german double quote right
63             \item etc.
64           \end{itemize}
65           */
66         explicit
67         InsetQuotes(string const & str = "eld");
68         /// Create the right quote inset after character c
69         InsetQuotes(char c, BufferParams const & params);
70         ///
71         Inset * clone() const;
72         ///
73         void metrics(MetricsInfo &, Dimension &) const;
74         ///
75         void draw(PainterInfo & pi, int x, int y) const;
76 #if 0
77         ///
78         LyXFont const convertFont(LyXFont const & font) const;
79 #endif
80         ///
81         void write(Buffer const *, std::ostream &) const;
82         ///
83         void read(Buffer const *, LyXLex & lex);
84         ///
85         int latex(Buffer const *, std::ostream &,
86                   LatexRunParams const &) const;
87         ///
88         int ascii(Buffer const *, std::ostream &, int linelen) const;
89         ///
90         int linuxdoc(Buffer const *, std::ostream &) const;
91         ///
92         int docbook(Buffer const *, std::ostream &, bool mixcont) const;
93         ///
94         void validate(LaTeXFeatures &) const;
95         ///
96         Inset::Code lyxCode() const;
97         // should this inset be handled like a normal charater
98         bool isChar() const { return true; }
99
100 private:
101         ///
102         quote_language language_;
103         ///
104         quote_side side_;
105         ///
106         quote_times times_;
107
108         /** The parameters of the constructor are the language, the
109             side and the multiplicity of the quote.
110          */
111         InsetQuotes(quote_language l, quote_side s, quote_times t);
112         ///
113         void parseString(string const &);
114         ///
115         string const dispString(Language const *) const;
116 };
117 #endif