]> git.lyx.org Git - lyx.git/blob - src/insets/insetquotes.h
The speed patch: redraw only rows that have changed
[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 class 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         /// the string that is passed to the TOC
98         virtual int textString(Buffer const &, std::ostream & os,
99                 OutputParams const &) const;
100
101         ///
102         void validate(LaTeXFeatures &) const;
103         ///
104         InsetBase::Code lyxCode() const;
105         // should this inset be handled like a normal character
106         bool isChar() const { return true; }
107
108 private:
109         virtual std::auto_ptr<InsetBase> doClone() const;
110
111         ///
112         quote_language language_;
113         ///
114         quote_side side_;
115         ///
116         quote_times times_;
117
118         /** The parameters of the constructor are the language, the
119             side and the multiplicity of the quote.
120          */
121         InsetQuotes(quote_language l, quote_side s, quote_times t);
122         /// Decide whether we need left or right quotation marks
123         void getPosition(char c);
124         ///
125         void parseString(std::string const &);
126         ///
127         std::string const dispString(Language const *) const;
128 };
129 #endif