]> git.lyx.org Git - lyx.git/blob - src/insets/insetquotes.h
changelogs
[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 InsetOld {
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(std::string const & str = "eld");
68         /// Create the right quote inset after character c
69         InsetQuotes(char c, BufferParams const & params);
70         /// Direct access to inner/outer quotation marks
71         InsetQuotes(char c, quote_language l, quote_times t);
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                   OutputParams const &) const;
87         ///
88         int plaintext(Buffer const &, std::ostream &,
89                   OutputParams const &) const;
90         ///
91         int linuxdoc(Buffer const &, std::ostream &,
92                      OutputParams const &) const;
93         ///
94         int docbook(Buffer const &, std::ostream &,
95                     OutputParams const &) const;
96         ///
97         void validate(LaTeXFeatures &) const;
98         ///
99         InsetOld::Code lyxCode() const;
100         // should this inset be handled like a normal character
101         bool isChar() const { return true; }
102
103 private:
104         virtual std::auto_ptr<InsetBase> doClone() const;
105
106         ///
107         quote_language language_;
108         ///
109         quote_side side_;
110         ///
111         quote_times times_;
112
113         /** The parameters of the constructor are the language, the
114             side and the multiplicity of the quote.
115          */
116         InsetQuotes(quote_language l, quote_side s, quote_times t);
117         /// Decide whether we need left or right quotation marks
118         void getPosition(char c);
119         ///
120         void parseString(std::string const &);
121         ///
122         std::string const dispString(Language const *) const;
123 };
124 #endif