lib

styleelement.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2006 Alfredo Beaumont Sainz <alfredo.beaumont@gmail.com>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef STYLEELEMENT_H
00021 #define STYLEELEMENT_H
00022 
00023 #include "kformuladefs.h"
00024 #include "tokenstyleelement.h"
00025 
00026 KFORMULA_NAMESPACE_BEGIN
00027 
00028 class StyleElement : public TokenStyleElement {
00029     typedef TokenStyleElement inherited;
00030 public:
00031     
00032     StyleElement( BasicElement* parent = 0 );
00033 
00034 protected:
00035 
00036     virtual bool readAttributesFromMathMLDom( const QDomElement &element );
00037 
00038     virtual void setStyleSize( const ContextStyle& context, StyleAttributes& style );
00039     virtual void setStyleVariant( StyleAttributes& style );
00040     virtual void setStyleBackground( StyleAttributes& style );
00041     virtual void resetStyle( StyleAttributes& style );
00042 
00043 private:
00044     virtual QString getElementName() const { return "mstyle"; }
00045     virtual void writeMathMLAttributes( QDomElement& element ) const ;
00046 
00047     void readSizeAttribute( const QString& str, SizeType* st, double* s );
00048     void writeSizeAttribute( QDomElement element, const QString& str, SizeType st, double s ) const ;
00049 
00050     double sizeFactor( const ContextStyle& context, SizeType st, double length, double defvalue );
00051 
00052     int m_scriptLevel;
00053     SizeType m_scriptMinSizeType;
00054     double m_scriptSizeMultiplier;
00055     double m_scriptMinSize;
00056     QColor m_background;
00057     SizeType m_veryVeryThinMathSpaceType;
00058     double m_veryVeryThinMathSpace;
00059     SizeType m_veryThinMathSpaceType;
00060     double m_veryThinMathSpace;
00061     SizeType m_thinMathSpaceType;
00062     double m_thinMathSpace;
00063     SizeType m_mediumMathSpaceType;
00064     double m_mediumMathSpace;
00065     SizeType m_thickMathSpaceType;
00066     double m_thickMathSpace;
00067     SizeType m_veryThickMathSpaceType;
00068     double m_veryThickMathSpace;
00069     SizeType m_veryVeryThickMathSpaceType;
00070     double m_veryVeryThickMathSpace;
00071     bool m_displayStyle;
00072     bool m_customScriptLevel;
00073     bool m_relativeScriptLevel;
00074     bool m_customDisplayStyle;
00075     bool m_customScriptSizeMultiplier;
00076     bool m_customBackground;
00077 };
00078 
00079 KFORMULA_NAMESPACE_END
00080 
00081 #endif // TOKENSTYLEELEMENT_H
KDE Home | KDE Accessibility Home | Description of Access Keys