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>
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
15
You should have received a copy of the GNU Library General Public License
16
along with this library; see the file COPYING.LIB. If not, write to
17
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
Boston, MA 02111-1307, USA.
21
#ifndef SPACEELEMENT_H
22
#define SPACEELEMENT_H
27
#include "basicelement.h"
32
KFORMULA_NAMESPACE_BEGIN
35
* A element that represents a space.
37
class SpaceElement : public BasicElement {
38
SpaceElement operator=( const SpaceElement& ) { return *this; }
41
SpaceElement( SpaceWidth space = THIN, bool tab=false, BasicElement* parent = 0 );
42
SpaceElement( const SpaceElement& );
44
virtual SpaceElement* clone() {
45
return new SpaceElement( *this );
48
virtual bool accept( ElementVisitor* visitor );
51
* @returns the type of this element. Used for
54
//virtual TokenType getTokenType() const;
57
* @returns the character that represents this element. Used for
60
virtual QChar getCharacter() const { return ' '; }
64
// Drawing depends on a conspace which knows the required properties like
65
// fonts, spaces and such.
66
// It is essential to calculate elements size with the same conspace
70
* Calculates our width and height and
71
* our children's parentPosition.
73
virtual void calcSizes( const ContextStyle& context,
74
ContextStyle::TextStyle tstyle,
75
ContextStyle::IndexStyle istyle );
78
* Draws the whole element including its children.
79
* The `parentOrigin' is the point this element's parent starts.
80
* We can use our parentPosition to get our own origin then.
82
virtual void draw( QPainter& painter, const LuPixelRect& r,
83
const ContextStyle& context,
84
ContextStyle::TextStyle tstyle,
85
ContextStyle::IndexStyle istyle,
86
const LuPixelPoint& parentOrigin );
89
* Moves the cursor away from the given child. The cursor is
90
* guaranteed to be inside this element.
92
//virtual void childWillVanish(FormulaCursor*, BasicElement*) {}
95
* @returns the latex representation of the element and
96
* of the element's children
98
virtual QString toLatex();
100
virtual void writeMathML( QDomDocument doc, QDomNode parent );
107
* @returns the tag name of this element type.
109
virtual QString getTagName() const { return "SPACE"; }
112
* Appends our attributes to the dom element.
114
virtual void writeDom(QDomElement element);
117
* Reads our attributes from the element.
118
* Returns false if it failed.
120
virtual bool readAttributesFromDom(QDomElement element);
123
* Reads our content from the node. Sets the node to the next node
124
* that needs to be read.
125
* Returns false if it failed.
127
virtual bool readContentFromDom(QDomNode& node);
131
SpaceWidth spaceWidth;
134
* Whether this space behaves like a tab.
139
KFORMULA_NAMESPACE_END
141
#endif // SPACEELEMENT_H