]> git.lyx.org Git - lyx.git/blob - src/insets/InsetQuotes.h
Cleanup mouse/selection/context-menu interactions.
[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 #include "Inset.h"
16
17 #include "support/docstring.h"
18
19
20 namespace lyx {
21
22 /** Quotes.
23   Used for the various quotes. German, English, French, all either
24   double or single **/
25 class InsetQuotes : public Inset
26 {
27 public:
28         ///
29         enum QuoteLanguage {
30                 ///
31                 EnglishQuotes,
32                 ///
33                 SwedishQuotes,
34                 ///
35                 GermanQuotes,
36                 ///
37                 PolishQuotes,
38                 ///
39                 FrenchQuotes,
40                 ///
41                 DanishQuotes
42         };
43         ///
44         enum QuoteSide {
45                 ///
46                 LeftQuote,
47                 ///
48                 RightQuote
49         };
50         ///
51         enum QuoteTimes {
52                 ///
53                 SingleQuotes,
54                 ///
55                 DoubleQuotes
56         };
57
58         /** The constructor works like this:
59           \begin{itemize}
60             \item fls <- french single quote left
61             \item grd <- german double quote right
62             \item etc.
63           \end{itemize}
64           */
65         explicit InsetQuotes(std::string const & str = "eld");
66         /// Create the right quote inset after character c
67         InsetQuotes(Buffer const & buffer, char_type c);
68         /// Direct access to inner/outer quotation marks
69         InsetQuotes(char_type c, QuoteLanguage l, QuoteTimes t);
70         ///
71         docstring name() const;
72         ///
73         void metrics(MetricsInfo &, Dimension &) const;
74         ///
75         void draw(PainterInfo & pi, int x, int y) const;
76         ///
77         void write(std::ostream &) const;
78         ///
79         void read(Lexer & lex);
80         ///
81         int latex(odocstream &, OutputParams const &) const;
82         ///
83         int plaintext(odocstream &, OutputParams const &) const;
84         ///
85         int docbook(odocstream &, OutputParams const &) const;
86
87         /// the string that is passed to the TOC
88         void textString(odocstream &) const;
89
90         ///
91         void validate(LaTeXFeatures &) const;
92         ///
93         InsetCode lyxCode() const { return QUOTE_CODE; }
94         /// should this inset be handled like a normal character
95         bool isChar() const { return true; }
96
97 private:
98         ///
99         Inset * clone() const { return new InsetQuotes(*this); }
100
101         /** The parameters of the constructor are the language, the
102             side and the multiplicity of the quote.
103          */
104         InsetQuotes(QuoteLanguage l, QuoteSide s, QuoteTimes t);
105         /// Decide whether we need left or right quotation marks
106         void setSide(char_type c);
107         ///
108         void parseString(std::string const &);
109         ///
110         docstring displayString() const;
111
112         ///
113         QuoteLanguage language_;
114         ///
115         QuoteSide side_;
116         ///
117         QuoteTimes times_;
118 };
119
120 } // namespace lyx
121
122 #endif