]> git.lyx.org Git - lyx.git/blob - src/insets/insetquotes.h
Output docbook as utf8. Probably quite a bit more work needed, but then help form...
[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 class BufferParams;
21 class Language;
22
23 class LaTeXFeatures;
24
25
26 /** Quotes.
27   Used for the various quotes. German, English, French, all either
28   double or single **/
29 class InsetQuotes : public InsetOld {
30 public:
31         ///
32         enum quote_language {
33                 ///
34                 EnglishQ,
35                 ///
36                 SwedishQ,
37                 ///
38                 GermanQ,
39                 ///
40                 PolishQ,
41                 ///
42                 FrenchQ,
43                 ///
44                 DanishQ
45         };
46         ///
47         enum quote_side {
48                 ///
49                 LeftQ,
50                 ///
51                 RightQ
52         };
53         ///
54         enum quote_times {
55                 ///
56                 SingleQ,
57                 ///
58                 DoubleQ
59         };
60
61         /** The constructor works like this:
62           \begin{itemize}
63             \item fls <- french single quote left
64             \item grd <- german double quote right
65             \item etc.
66           \end{itemize}
67           */
68         explicit
69         InsetQuotes(std::string const & str = "eld");
70         /// Create the right quote inset after character c
71         InsetQuotes(lyx::char_type c, BufferParams const & params);
72         /// Direct access to inner/outer quotation marks
73         InsetQuotes(lyx::char_type c, quote_language l, quote_times t);
74         ///
75         void metrics(MetricsInfo &, Dimension &) const;
76         ///
77         void draw(PainterInfo & pi, int x, int y) const;
78 #if 0
79         ///
80         LyXFont const convertFont(LyXFont const & font) const;
81 #endif
82         ///
83         void write(Buffer const &, std::ostream &) const;
84         ///
85         void read(Buffer const &, LyXLex & lex);
86         ///
87         int latex(Buffer const &, lyx::odocstream &,
88                   OutputParams const &) const;
89         ///
90         int plaintext(Buffer const &, lyx::odocstream &,
91                   OutputParams const &) const;
92         ///
93         int docbook(Buffer const &, lyx::odocstream &,
94                     OutputParams const &) const;
95
96         /// the string that is passed to the TOC
97         virtual int textString(Buffer const &, lyx::odocstream &,
98                 OutputParams const &) const;
99
100         ///
101         void validate(LaTeXFeatures &) const;
102         ///
103         InsetBase::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<InsetBase> 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(lyx::char_type c);
123         ///
124         void parseString(std::string const &);
125         ///
126         std::string const dispString(Language const *) const;
127 };
128 #endif