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 {
75 /// Returns the unicode character of a given quote
76 char_type getQuoteChar(QuoteStyle const &, QuoteLevel const &,
77 QuoteSide const &) const;
78 /// Returns a map of quotation marks
79 std::map<std::string, docstring> getTypes() const;
81 docstring getLaTeXQuote(char_type c, std::string const &) const;
83 docstring getHTMLQuote(char_type c) const;
84 /// Returns a label suitable for dialog and menu
85 docstring const getGuiLabel(QuoteStyle const & qs);
87 int stylescount() const;
91 extern InsetQuotesParams quoteparams;
94 Used for the various quotes. German, English, French, all either
96 class InsetQuotes : public Inset
99 /** The constructor works like this:
101 \item fls <- french single quote left
102 \item grd <- german double quote right
106 explicit InsetQuotes(Buffer * buf, std::string const & str = "eld");
107 /// Direct access to inner/outer quotation marks
108 InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLevel level,
109 std::string const & side = std::string(),
110 std::string const & style = std::string());
112 docstring layoutName() const;
114 void metrics(MetricsInfo &, Dimension &) const;
116 void draw(PainterInfo & pi, int x, int y) const;
118 void write(std::ostream &) const;
120 void read(Lexer & lex);
122 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
124 void latex(otexstream &, OutputParams const &) const;
126 int plaintext(odocstringstream & ods, OutputParams const & op,
127 size_t max_length = INT_MAX) const;
129 int docbook(odocstream &, OutputParams const &) const;
131 docstring xhtml(XHTMLStream &, OutputParams const &) const;
134 void toString(odocstream &) const;
136 void forOutliner(docstring &, size_t const maxlen, bool const) const;
138 /// Update the contextual information of this inset
139 void updateBuffer(ParIterator const &, UpdateType);
142 void validate(LaTeXFeatures &) const;
144 std::string contextMenuName() const;
146 InsetCode lyxCode() const { return QUOTE_CODE; }
147 /// should this inset be handled like a normal character
148 bool isChar() const { return true; }
150 /// Returns the current quote type
151 std::string getType() const;
155 Inset * clone() const { return new InsetQuotes(*this); }
157 /// Decide whether we need left or right quotation marks
158 void setSide(char_type c);
160 void parseString(std::string const &,
161 bool const allow_wildcards = false);
163 docstring displayString() const;
165 docstring getQuoteEntity() const;
167 InsetQuotesParams::QuoteStyle getStyle(std::string const &);
170 InsetQuotesParams::QuoteStyle style_;
172 InsetQuotesParams::QuoteSide side_;
174 InsetQuotesParams::QuoteLevel level_;
176 InsetQuotesParams::QuoteStyle global_style_;
178 std::string fontenc_;
179 /// Code of the contextual language
180 std::string context_lang_;
181 /// Is this in a pass-thru context?
183 /// Do we use fontspec?
186 friend class InsetQuotesParams;
189 /// \name Protected functions inherited from Inset class
192 void doDispatch(Cursor & cur, FuncRequest & cmd);