styleelement.h
1/* This file is part of the KDE project
2 Copyright (C) 2006 Alfredo Beaumont Sainz <alfredo.beaumont@gmail.com>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef STYLEELEMENT_H
21#define STYLEELEMENT_H
22
23#include "kformuladefs.h"
24#include "tokenstyleelement.h"
25
26KFORMULA_NAMESPACE_BEGIN
27
28class StyleElement : public TokenStyleElement {
29 typedef TokenStyleElement inherited;
30public:
31
32 StyleElement( BasicElement* parent = 0 );
33
34protected:
35
36 virtual bool readAttributesFromMathMLDom( const TQDomElement &element );
37
38 virtual void setStyleSize( const ContextStyle& context, StyleAttributes& style );
39 virtual void setStyleVariant( StyleAttributes& style );
40 virtual void setStyleBackground( StyleAttributes& style );
41 virtual void resetStyle( StyleAttributes& style );
42
43private:
44 virtual TQString getElementName() const { return "mstyle"; }
45 virtual void writeMathMLAttributes( TQDomElement& element ) const ;
46
47 void readSizeAttribute( const TQString& str, SizeType* st, double* s );
48 void writeSizeAttribute( TQDomElement element, const TQString& str, SizeType st, double s ) const ;
49
50 double sizeFactor( const ContextStyle& context, SizeType st, double length, double defvalue );
51
52 int m_scriptLevel;
53 SizeType m_scriptMinSizeType;
54 double m_scriptSizeMultiplier;
55 double m_scriptMinSize;
56 TQColor m_background;
57 SizeType m_veryVeryThinMathSpaceType;
58 double m_veryVeryThinMathSpace;
59 SizeType m_veryThinMathSpaceType;
60 double m_veryThinMathSpace;
61 SizeType m_thinMathSpaceType;
62 double m_thinMathSpace;
63 SizeType m_mediumMathSpaceType;
64 double m_mediumMathSpace;
65 SizeType m_thickMathSpaceType;
66 double m_thickMathSpace;
67 SizeType m_veryThickMathSpaceType;
68 double m_veryThickMathSpace;
69 SizeType m_veryVeryThickMathSpaceType;
70 double m_veryVeryThickMathSpace;
71 bool m_displayStyle;
72 bool m_customScriptLevel;
73 bool m_relativeScriptLevel;
74 bool m_customDisplayStyle;
75 bool m_customScriptSizeMultiplier;
76 bool m_customBackground;
77};
78
79KFORMULA_NAMESPACE_END
80
81#endif // TOKENSTYLEELEMENT_H
Basis of every formula element.
Contains all the style information for the formela.
This class handles mathematical style attributes common to token elements, as explained in MathML Spe...
virtual bool readAttributesFromMathMLDom(const TQDomElement &element)
Reads our attributes from the MathML element.
virtual void setStyleVariant(StyleAttributes &style)
Set the mathvariant related info in style stacks, including info for deprecated attributes.