1
/* This file is part of the KDE project
2
Copyright (C) 2006 Martin Pfeiffer <hubipete@gmx.net>
3
Copyright (C) 2006 Alfredo Beaumont Sainz <alfredo.beaumont@gmail.com>
4
2009 Jeremias Epperlein <jeeree@web.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., 51 Franklin Street, Fifth Floor,
18
Boston, MA 02110-1301, USA.
21
#ifndef MULTISCRIPTELEMENT_H
22
#define MULTISCRIPTELEMENT_H
24
#include "FixedElement.h"
25
#include "kformula_export.h"
28
* @short Implementation of the mmultiscript element
30
class KOFORMULA_EXPORT MultiscriptElement : public FixedElement {
32
/// The standard constructor
33
MultiscriptElement( BasicElement* parent = 0 );
36
~MultiscriptElement();
39
* Obtain a list of all child elements of this element
40
* @return a QList with pointers to all child elements
42
const QList<BasicElement*> childElements() const;
44
virtual bool setCursorTo ( FormulaCursor& cursor, QPointF point );
46
virtual bool moveCursor ( FormulaCursor& newcursor, FormulaCursor& oldcursor );
48
// virtual int length() const;
50
* Render the element to the given QPainter
51
* @param painter The QPainter to paint the element to
52
* @param am AttributeManager containing style info
54
void paint( QPainter& painter, AttributeManager* am );
57
* Calculate the size of the element and the positions of its children
58
* @param am The AttributeManager providing information about attributes values
60
void layout( const AttributeManager* am );
63
* Implement the cursor behaviour for the element
64
* @param cursor The FormulaCursor that is moved around
65
* @return A this pointer if the element accepts if not the element to asked instead
67
virtual bool acceptCursor ( const FormulaCursor& cursor );
69
/// @return The default value of the attribute for this element
70
QString attributesDefaultValue( const QString& attribute ) const;
72
/// @return The element's ElementType
73
ElementType elementType() const;
76
/// Read all content from the node
77
bool readMathMLContent( const KoXmlElement& element );
79
/// Write all content to the KoXmlWriter
80
void writeMathMLContent( KoXmlWriter* writer ) const;
82
/// Make sure that there are an even number of elements, as the spec says
84
void ensureEvenNumberElements();
87
/// The BasicElement representing the base element of the multiscript
88
BasicElement* m_baseElement;
90
/// A list of BasicElements representing the sub- and super-scripts left to the base
91
/// element. The first item in the list is subscript, second is superscript, third
92
/// subscript and so on.
93
/// The first 2 items are drawn closest to the item, then moving increasingly
95
QList<BasicElement*> m_preScripts;
97
/// A list of BasicElements representing the sub- and super-scripts right to the base
98
/// element. The first item in the list is subscript, second is superscript, third
99
/// subscript and so on.
100
/// The first 2 items are drawn closest to the item, then moving increasingly
102
QList<BasicElement*> m_postScripts;
106
#endif // MULTISCRIPTELEMENT_H