lib

spaceelement.h
1/* This file is part of the KDE project
2 Copyright (C) 2001 Andrea Rizzi <rizzi@kde.org>
3 Ulrich Kuettler <ulrich.kuettler@mailbox.tu-dresden.de>
4 Copyright (C) 2006 Alfredo Beaumont Sainz <alfredo.beaumont@gmail.com>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#ifndef SPACEELEMENT_H
23#define SPACEELEMENT_H
24
25#include <tqfont.h>
26#include <tqstring.h>
27
28#include "basicelement.h"
29
30class SymbolTable;
31
32
33KFORMULA_NAMESPACE_BEGIN
34
38class SpaceElement : public BasicElement {
39 enum LineBreakType {
40 NoBreakType,
41 AutoBreak,
42 NewLineBreak,
43 IndentingNewLineBreak,
44 NoBreak,
45 GoodBreak,
46 BadBreak
47 };
48 SpaceElement operator=( const SpaceElement& ) { return *this; }
49public:
50
51 SpaceElement( SpaceWidth space = THIN, bool tab=false, BasicElement* parent = 0 );
52 SpaceElement( const SpaceElement& );
53
54 virtual SpaceElement* clone() {
55 return new SpaceElement( *this );
56 }
57
58 virtual bool accept( ElementVisitor* visitor );
59
64 //virtual TokenType getTokenType() const;
65
70 virtual TQChar getCharacter() const { return ' '; }
71
72 // drawing
73 //
74 // Drawing depends on a conspace which knows the required properties like
75 // fonts, spaces and such.
76 // It is essential to calculate elements size with the same conspace
77 // before you draw.
78
83 virtual void calcSizes( const ContextStyle& cstyle,
85 ContextStyle::IndexStyle istyle,
86 StyleAttributes& style );
87
93 virtual void draw( TQPainter& painter, const LuPixelRect& r,
94 const ContextStyle& context,
96 ContextStyle::IndexStyle istyle,
97 StyleAttributes& style,
98 const LuPixelPoint& parentOrigin );
99
104 //virtual void childWillVanish(FormulaCursor*, BasicElement*) {}
105
110 virtual TQString toLatex();
111
112protected:
113
114 //Save/load support
115
119 virtual TQString getTagName() const { return "SPACE"; }
120
124 virtual void writeDom(TQDomElement element);
125
130 virtual bool readAttributesFromDom(TQDomElement element);
131
137 virtual bool readContentFromDom(TQDomNode& node);
138
143 virtual bool readAttributesFromMathMLDom(const TQDomElement& element);
144
145private:
146
147 virtual TQString getElementName() const { return "mspace"; }
148 virtual void writeMathMLAttributes( TQDomElement& element ) const ;
149
153 bool m_tab;
154
155 // MathML Attributes, Section 3.2.7.2
156 SizeType m_widthType;
157 double m_width;
158 SizeType m_heightType;
159 double m_height;
160 SizeType m_depthType;
161 double m_depth;
162 LineBreakType m_lineBreak;
163};
164
165KFORMULA_NAMESPACE_END
166
167#endif // SPACEELEMENT_H
Contains all the style information for the formela.
TextStyle
Textstyles like in TeX.
virtual void writeDom(TQDomElement element)
Appends our attributes to the dom element.
virtual TQString toLatex()
Draws the whole element including its children.
virtual TQString getTagName() const
virtual TQChar getCharacter() const
virtual bool readAttributesFromDom(TQDomElement element)
Reads our attributes from the element.
virtual void calcSizes(const ContextStyle &cstyle, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, StyleAttributes &style)
Calculates our width and height and our children's parentPosition.
virtual bool accept(ElementVisitor *visitor)
Visit this element.
virtual bool readContentFromDom(TQDomNode &node)
Reads our content from the node.
virtual bool readAttributesFromMathMLDom(const TQDomElement &element)
Reads our attributes from the MathML element.
The symbol table.
Definition symboltable.h:77