lib

paddedelement.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 PADDEDELEMENT_H
21#define PADDEDELEMENT_H
22
23#include "sequenceelement.h"
24
25KFORMULA_NAMESPACE_BEGIN
26
27class PaddedElement : public SequenceElement {
28 typedef SequenceElement inherited;
29 enum SizeType { NoSize, RelativeSize, AbsoluteSize, PixelSize, WidthRelativeSize, HeightRelativeSize };
30public:
31 PaddedElement( BasicElement* parent = 0 );
32
37 virtual void calcSizes( const ContextStyle& cstyle,
39 ContextStyle::IndexStyle istyle,
40 StyleAttributes& style );
41
42protected:
43 virtual bool readAttributesFromMathMLDom(const TQDomElement& element);
44
45private:
46 virtual TQString getElementName() const { return "mpadded"; }
47 virtual void writeMathMLAttributes( TQDomElement& element ) const ;
48
49 double readSizeAttribute( const TQString& str, SizeType* st, bool* relative );
50 double getSize( const TQString& str, SizeType* st );
51 double str2size( const TQString& str, SizeType* st, SizeType type );
52 void writeSizeAttribute( TQDomElement element, const TQString& str,
53 SizeType st, bool relative, double s ) const ;
54 luPixel calcSize( const ContextStyle& context, SizeType type,
55 bool relative, double length, luPixel width,
56 luPixel height, luPixel defvalue );
57
58 SizeType m_widthType;
59 double m_width;
60 SizeType m_lspaceType;
61 double m_lspace;
62 SizeType m_heightType;
63 double m_height;
64 SizeType m_depthType;
65 double m_depth;
66
67 bool m_widthRelative;
68 bool m_lspaceRelative;
69 bool m_heightRelative;
70 bool m_depthRelative;
71};
72
73KFORMULA_NAMESPACE_END
74
75#endif // PADDEDELEMENT_H
TextStyle
Textstyles like in TeX.
The element that contains a number of children.