3 * \file InsetIPAMacro.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Jürgen Spitzmüller
9 * Full author contact details are available in file CREDITS.
12 #ifndef INSET_IPAMACRO_H
13 #define INSET_IPAMACRO_H
17 #include "InsetCollapsable.h"
24 class InsetIPADecoParams
34 void write(std::ostream & os) const;
36 void read(Lexer & lex);
41 /////////////////////////////////////////////////////////////////////////
45 /////////////////////////////////////////////////////////////////////////
47 /// Used to insert IPA decorations
48 class InsetIPADeco : public InsetCollapsable
52 InsetIPADeco(Buffer *, std::string const &);
56 static std::string params2string(InsetIPADecoParams const &);
58 static void string2params(std::string const &, InsetIPADecoParams &);
60 InsetIPADecoParams const & params() const { return params_; }
63 InsetCode lyxCode() const { return IPADECO_CODE; }
65 docstring layoutName() const;
67 void metrics(MetricsInfo &, Dimension &) const;
69 void draw(PainterInfo & pi, int x, int y) const;
71 void write(std::ostream &) const;
73 void read(Lexer & lex);
75 bool neverIndent() const { return true; }
77 void latex(otexstream &, OutputParams const &) const;
79 int plaintext(odocstringstream & ods, OutputParams const & op,
80 size_t max_length = INT_MAX) const;
82 int docbook(odocstream &, OutputParams const &) const;
84 docstring xhtml(XHTMLStream &, OutputParams const &) const;
86 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
88 void doDispatch(Cursor & cur, FuncRequest & cmd);
90 void validate(LaTeXFeatures & features) const;
92 bool allowSpellCheck() const { return false; }
94 bool insetAllowed(InsetCode code) const;
96 docstring toolTip(BufferView const & bv, int x, int y) const;
98 Inset * clone() const { return new InsetIPADeco(*this); }
99 /// used by the constructors
102 friend class InsetIPADecoParams;
105 InsetIPADecoParams params_;
109 /////////////////////////////////////////////////////////////////////////
113 /////////////////////////////////////////////////////////////////////////
115 /// Used to insert special IPA chars that are not available in unicode
116 class InsetIPAChar : public Inset {
119 /// The different kinds of special chars we support
121 /// falling tone mark
125 /// high-rising tone mark
127 /// low-rising tone mark
129 /// high rising-falling tone mark
130 TONE_HIGH_RISING_FALLING
134 InsetIPAChar() : Inset(0), kind_(TONE_FALLING) {}
136 explicit InsetIPAChar(Kind k);
140 void metrics(MetricsInfo &, Dimension &) const;
142 void draw(PainterInfo & pi, int x, int y) const;
144 void write(std::ostream &) const;
145 /// Will not be used when lyxf3
146 void read(Lexer & lex);
148 void latex(otexstream &, OutputParams const &) const;
150 int plaintext(odocstringstream & ods, OutputParams const & op,
151 size_t max_length = INT_MAX) const;
153 int docbook(odocstream &, OutputParams const &) const;
155 docstring xhtml(XHTMLStream &, OutputParams const &) const;
157 void toString(odocstream &) const;
159 void forOutliner(docstring &, size_t const, bool const) const;
161 InsetCode lyxCode() const { return IPACHAR_CODE; }
162 /// We don't need \begin_inset and \end_inset
163 bool directWrite() const { return true; }
165 void validate(LaTeXFeatures &) const;
167 /// should this inset be handled like a normal character?
168 bool isChar() const { return true; }
169 /// is this equivalent to a letter?
170 bool isLetter() const { return true; }
172 Inset * clone() const { return new InsetIPAChar(*this); }
174 /// And which kind is this?