4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Jean-Marc Lasgouttes
8 * \author Jürgen Spitzmüller
10 * Full author contact details are available in file CREDITS.
13 #ifndef INSET_QUOTES_H
14 #define INSET_QUOTES_H
18 #include "support/docstring.h"
24 Used for the various quotes. German, English, French, all either
26 class InsetQuotesParams {
59 /// Returns the unicode character of a given quote
60 char_type getQuoteChar(QuoteStyle const &, QuoteLevel const &,
61 QuoteSide const &) const;
62 /// Returns a map of quotation marks
63 std::map<std::string, docstring> getTypes() const;
65 docstring getLaTeXQuote(char_type c, std::string const &) const;
67 docstring getHTMLQuote(char_type c) const;
68 /// Returns a label suitable for dialog and menu
69 docstring const getGuiLabel(QuoteStyle const & qs);
71 int stylescount() const;
75 extern InsetQuotesParams quoteparams;
78 Used for the various quotes. German, English, French, all either
80 class InsetQuotes : public Inset
83 /** The constructor works like this:
85 \item fls <- french single quote left
86 \item grd <- german double quote right
90 explicit InsetQuotes(Buffer * buf, std::string const & str = "eld");
91 /// Direct access to inner/outer quotation marks
92 InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLevel level,
93 std::string const & side = std::string(),
94 std::string const & style = std::string());
96 docstring layoutName() const;
98 void metrics(MetricsInfo &, Dimension &) const;
100 void draw(PainterInfo & pi, int x, int y) const;
102 void write(std::ostream &) const;
104 void read(Lexer & lex);
106 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
108 void latex(otexstream &, OutputParams const &) const;
110 int plaintext(odocstringstream & ods, OutputParams const & op,
111 size_t max_length = INT_MAX) const;
113 int docbook(odocstream &, OutputParams const &) const;
115 docstring xhtml(XHTMLStream &, OutputParams const &) const;
118 void toString(odocstream &) const;
120 void forOutliner(docstring &, size_t const maxlen, bool const) const;
122 /// Update the contextual information of this inset
123 void updateBuffer(ParIterator const &, UpdateType);
126 void validate(LaTeXFeatures &) const;
128 std::string contextMenuName() const;
130 InsetCode lyxCode() const { return QUOTE_CODE; }
131 /// should this inset be handled like a normal character
132 bool isChar() const { return true; }
134 /// Returns the current quote type
135 std::string getType() const;
139 Inset * clone() const { return new InsetQuotes(*this); }
141 /// Decide whether we need left or right quotation marks
142 void setSide(char_type c);
144 void parseString(std::string const &,
145 bool const allow_wildcards = false);
147 docstring displayString() const;
149 docstring getQuoteEntity() const;
151 InsetQuotesParams::QuoteStyle getStyle(std::string const &);
154 InsetQuotesParams::QuoteStyle style_;
156 InsetQuotesParams::QuoteSide side_;
158 InsetQuotesParams::QuoteLevel level_;
160 std::string fontenc_;
161 /// Code of the contextual language
162 std::string context_lang_;
163 /// Is this in a pass-thru context?
166 friend class InsetQuotesParams;
169 /// \name Protected functions inherited from Inset class
172 void doDispatch(Cursor & cur, FuncRequest & cmd);