]> git.lyx.org Git - features.git/blob - src/mathed/InsetMathSymbol.h
Do not allow pasting backslashes in macro names
[features.git] / src / mathed / InsetMathSymbol.h
1 // -*- C++ -*-
2 /**
3  * \file InsetMathSymbol.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef MATH_SYMBOLINSET_H
13 #define MATH_SYMBOLINSET_H
14
15 #include "InsetMath.h"
16
17 namespace lyx {
18
19 class latexkeys;
20
21
22 // \xxx symbols that may take limits or grow in displayed formulæ.
23 class InsetMathSymbol : public InsetMath {
24 public:
25         ///
26         explicit InsetMathSymbol(latexkeys const * l);
27         ///
28         explicit InsetMathSymbol(char const * name);
29         ///
30         explicit InsetMathSymbol(docstring const & name);
31         ///
32         void metrics(MetricsInfo & mi, Dimension & dim) const override;
33         ///
34         void draw(PainterInfo &, int x, int y) const override;
35         ///
36         int kerning(BufferView const *) const override { return kerning_; }
37
38         ///
39         mode_type currentMode() const override;
40         ///
41         MathClass mathClass() const override;
42         ///
43         bool isOrdAlpha() const;
44         /// The default limits value
45         Limits defaultLimits(bool display) const override;
46         /// whether the inset has limit-like sub/superscript
47         Limits limits() const override { return limits_; }
48         /// sets types of sub/superscripts
49         void limits(Limits lim) override { limits_ = lim; }
50         /// identifies SymbolInset as such
51         InsetMathSymbol const * asSymbolInset() const override { return this; }
52         /// the LaTeX name of the symbol (without the backslash)
53         docstring name() const override;
54         /// request "external features"
55         void validate(LaTeXFeatures & features) const override;
56
57         ///
58         void normalize(NormalStream &) const override;
59         ///
60         void maple(MapleStream &) const override;
61         ///
62         void maxima(MaximaStream &) const override;
63         ///
64         void mathematica(MathematicaStream &) const override;
65         ///
66         void mathmlize(MathMLStream &) const override;
67         ///
68         void htmlize(HtmlStream &) const override;
69         /// \param spacing controls whether we print spaces around
70         /// "operator"-type symbols or just print them raw
71         void htmlize(HtmlStream &, bool spacing) const;
72         ///
73         void octave(OctaveStream &) const override;
74         ///
75         void write(TeXMathStream & os) const override;
76         ///
77         void infoize2(odocstream & os) const override;
78         ///
79         InsetCode lyxCode() const override { return MATH_SYMBOL_CODE; }
80
81 private:
82         Inset * clone() const override;
83         ///
84         latexkeys const * sym_;
85         ///
86         Limits limits_ = AUTO_LIMITS;
87
88         // FIXME: these depend on BufferView
89
90         ///
91         mutable int h_ = 0;
92         /// cached superscript kerning
93         mutable int kerning_ = 0;
94 };
95
96 } // namespace lyx
97
98 #endif