]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathSpecialChar.h
Reduce the number of accesses to coord cache when drawing a math row
[lyx.git] / src / mathed / InsetMathSpecialChar.h
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 override;
29         ///
30         void draw(PainterInfo & pi, int x, int y) const override;
31         ///
32         void metricsT(TextMetricsInfo const & mi, Dimension & dim) const override;
33         ///
34         void drawT(TextPainter &, int x, int y) const override;
35         ///
36         int kerning(BufferView const *) const override { return kerning_; }
37         ///
38         void write(TeXMathStream & os) const override;
39         ///
40         void validate(LaTeXFeatures & features) const override;
41         ///
42         void normalize(NormalStream & ns) const override;
43         ///
44         void octave(OctaveStream & os) const override;
45         ///
46         void maple(MapleStream &) const override;
47         ///
48         void mathematica(MathematicaStream &) const override;
49         ///
50         void mathmlize(MathMLStream & ms) const override;
51         ///
52         void htmlize(HtmlStream & ms) const override;
53         /// identifies SpecialChar insets
54         InsetMathSpecialChar const * asSpecialCharInset() const override { return this; }
55         ///
56         docstring name() const override { return name_; }
57         ///
58         char_type getChar() const override { return char_; }
59         ///
60         InsetCode lyxCode() const override { return MATH_SPECIALCHAR_CODE; }
61
62 private:
63         Inset * clone() const override;
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