]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathColor.h
Remove unneccessary uses of dynamic_cast from the code.
[lyx.git] / src / mathed / InsetMathColor.h
1 // -*- C++ -*-
2 /**
3  * \file InsetMathColor.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_COLORINSET_H
13 #define MATH_COLORINSET_H
14
15 #include "InsetMathNest.h"
16
17 #include "support/docstream.h"
18
19 namespace lyx {
20
21 /// Change colours.
22
23 class InsetMathColor : public InsetMathNest {
24 public:
25         /// Create a color inset from LyX color number
26         InsetMathColor(Buffer * buf, bool oldstyle, ColorCode color = Color_none);
27         /// Create a color inset from LaTeX color name
28         InsetMathColor(Buffer * buf, bool oldstyle, docstring const & color);
29         ///
30         void metrics(MetricsInfo & mi, Dimension & dim) const;
31         /// we write extra braces in any case...
32         /// FIXME Why? Are they necessary if oldstyle_ == false?
33         bool extraBraces() const { return true; }
34         ///
35         void draw(PainterInfo & pi, int x, int y) const;
36         /// we need package color
37         void validate(LaTeXFeatures & features) const;
38         ///
39         void write(WriteStream & os) const;
40         /// FIXME XHTML For now, we do nothing with color.
41         void mathmlize(MathStream &) const {}
42         /// FIXME XHTML For now, we do nothing with color.
43         void htmlize(HtmlStream &) const {}
44         ///
45         /// write normalized content
46         void normalize(NormalStream & ns) const;
47         ///
48         void infoize(odocstream & os) const;
49         ///
50         InsetCode lyxCode() const { return MATH_COLOR_CODE; }
51 private:
52         virtual Inset * clone() const;
53         /// width of '[' in current font
54         mutable int w_;
55         ///
56         bool oldstyle_;
57         /// Our color. Only valid LaTeX colors are allowed.
58         docstring color_;
59 };
60
61
62 } // namespace lyx
63
64 #endif