]> git.lyx.org Git - features.git/blob - src/mathed/InsetMathSymbol.h
Account for real width of nucleus when positioning superscripts in mathed
[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
18 namespace lyx {
19
20 class latexkeys;
21
22
23 /** "normal" symbols that don't take limits and don't grow in displayed
24  *  formulae.
25  */
26 class InsetMathSymbol : public InsetMath {
27 public:
28         ///
29         explicit InsetMathSymbol(latexkeys const * l);
30         ///
31         explicit InsetMathSymbol(char const * name);
32         ///
33         explicit InsetMathSymbol(docstring const & name);
34         ///
35         bool metrics(MetricsInfo & mi, Dimension & dim) const;
36         ///
37         void draw(PainterInfo &, int x, int y) const;
38         ///
39         int width() const { return width_; }
40         ///
41         int kerning() const { return kerning_; }
42
43         ///
44         bool isRelOp() const;
45         /// do we take scripts?
46         bool isScriptable() const;
47         /// do we take \limits or \nolimits?
48         bool takesLimits() const;
49         /// identifies SymbolInset as such
50         InsetMathSymbol const * asSymbolInset() const { return this; }
51         /// the LaTeX name of the symbol (without the backslash)
52         docstring name() const;
53         /// request "external features"
54         void validate(LaTeXFeatures & features) const;
55
56         ///
57         void normalize(NormalStream &) const;
58         ///
59         void maple(MapleStream &) const;
60         ///
61         void maxima(MaximaStream &) const;
62         ///
63         void mathematica(MathematicaStream &) const;
64         ///
65         void mathmlize(MathStream &) const;
66         ///
67         void octave(OctaveStream &) const;
68         ///
69         void write(WriteStream & os) const;
70         ///
71         void infoize2(odocstream & os) const;
72
73 private:
74         virtual std::auto_ptr<InsetBase> doClone() const;
75         ///
76         latexkeys const * sym_;
77         ///
78         mutable int h_;
79         /// cached width
80         mutable int width_;
81         /// cached superscript kerning
82         mutable int kerning_;
83         ///
84         mutable bool scriptable_;
85 };
86
87 } // namespace lyx
88
89 #endif