1 // -*- C++ -*-
2 /**
3  * \file InsetMathSpecialChar.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Enrico Forestieri
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11 
12 #ifndef MATH_SPECIALCHARINSET_H
13 #define MATH_SPECIALCHARINSET_H
14 
15 #include "InsetMath.h"
16 
17 #include "support/docstring.h"
18 
19 namespace lyx {
20 
21 /// The special character inset.
22 class InsetMathSpecialChar : public InsetMath
23 {
24 public:
25 	///
26 	explicit InsetMathSpecialChar(docstring const & name);
27 	///
28 	void metrics(MetricsInfo & mi, Dimension & dim) const;
29 	///
30 	void draw(PainterInfo & pi, int x, int y) const;
31 	///
32 	void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
33 	///
34 	void drawT(TextPainter &, int x, int y) const;
35 	///
kerning(BufferView const *)36 	int kerning(BufferView const *) const { return kerning_; }
37 	///
38 	void write(WriteStream & os) const;
39 	///
40 	void validate(LaTeXFeatures & features) const;
41 	///
42 	void normalize(NormalStream & ns) const;
43 	///
44 	void octave(OctaveStream & os) const;
45 	///
46 	void maple(MapleStream &) const;
47 	///
48 	void mathematica(MathematicaStream &) const;
49 	///
50 	void mathmlize(MathStream & ms) const;
51 	///
52 	void htmlize(HtmlStream & ms) const;
53 	/// identifies SpecialChar insets
asSpecialCharInset()54 	InsetMathSpecialChar const * asSpecialCharInset() const { return this; }
55 	///
name()56 	docstring name() const { return name_; }
57 	///
getChar()58 	char_type getChar() const { return char_; }
59 	///
lyxCode()60 	InsetCode lyxCode() const { return MATH_SPECIALCHAR_CODE; }
61 
62 private:
63 	virtual Inset * clone() const;
64 	/// the latex name
65 	docstring name_;
66 	/// the displayed character
67 	char_type char_;
68 	/// cached kerning for superscript
69 	mutable int kerning_;
70 };
71 
72 } // namespace lyx
73 
74 #endif // MATH_SPECIALCHARINSET_H
75