]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathSymbol.h
Please Coverity (code should be equivalent)
[lyx.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 /** "normal" symbols that don't take limits and don't grow in displayed
23  *  formulae.
24  */
25 class InsetMathSymbol : public InsetMath {
26 public:
27         ///
28         explicit InsetMathSymbol(latexkeys const * l);
29         ///
30         explicit InsetMathSymbol(char const * name);
31         ///
32         explicit InsetMathSymbol(docstring const & name);
33         ///
34         void metrics(MetricsInfo & mi, Dimension & dim) const;
35         ///
36         void draw(PainterInfo &, int x, int y) const;
37         ///
38         int kerning(BufferView const *) const { return kerning_; }
39
40         ///
41         mode_type currentMode() const;
42         ///
43         bool isMathRel() const;
44         ///
45         bool isMathBin() const;
46         ///
47         bool isMathPunct() const;
48         ///
49         bool isOrdAlpha() const;
50         /// do we take scripts?
51         bool isScriptable() const;
52         /// do we take \limits or \nolimits?
53         bool takesLimits() const;
54         /// identifies SymbolInset as such
55         InsetMathSymbol const * asSymbolInset() const { return this; }
56         /// the LaTeX name of the symbol (without the backslash)
57         docstring name() const;
58         /// request "external features"
59         void validate(LaTeXFeatures & features) const;
60
61         ///
62         void normalize(NormalStream &) const;
63         ///
64         void maple(MapleStream &) const;
65         ///
66         void maxima(MaximaStream &) const;
67         ///
68         void mathematica(MathematicaStream &) const;
69         ///
70         void mathmlize(MathStream &) const;
71         ///
72         void htmlize(HtmlStream &) const;
73         /// \param spacing controls whether we print spaces around
74         /// "operator"-type symbols or just print them raw
75         void htmlize(HtmlStream &, bool spacing) const;
76         ///
77         void octave(OctaveStream &) const;
78         ///
79         void write(WriteStream & os) const;
80         ///
81         void infoize2(odocstream & os) const;
82         ///
83         InsetCode lyxCode() const { return MATH_SYMBOL_CODE; }
84
85 private:
86         virtual Inset * clone() const;
87         ///
88         latexkeys const * sym_;
89         ///
90         mutable int h_;
91         /// cached superscript kerning
92         mutable int kerning_;
93         ///
94         mutable bool scriptable_;
95 };
96
97 } // namespace lyx
98
99 #endif