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 2006 Martin Pfeiffer <hubipete@gmx.net>
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.
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.
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.
25 #include "BasicElement.h"
26 #include "kformula_export.h"
31 * @short Implementation of the MathML mrow element
33 * The mrow element is specified in the MathML spec section 3.3.1. It primarily
34 * serves as container for other elements that are grouped together and aligned
36 * mrow has no own visual representance that is why the paint() method is empty.
37 * The handling of background and other global attributes is done generically
38 * inside FormulaRenderer.
39 * The layout() method implements the layouting and size calculation for the mrow
40 * element. The calculations assume that spacing is done per element and therefore
42 * At the moment there is no linebreaking implementation in RowElement.
44 class KFORMULA_EXPORT RowElement
: public BasicElement
{
46 /// The standard constructor
47 RowElement( BasicElement
* parent
= 0 );
49 /// The standard destructor
53 * Calculate the size of the element and the positions of its children
54 * @param am The AttributeManager providing information about attributes values
56 virtual void layout( const AttributeManager
* am
);
59 * Render the element to the given QPainter
60 * @param painter The QPainter to paint the element to
61 * @param am AttributeManager containing style info
63 virtual void paint( QPainter
& painter
, AttributeManager
* am
);
67 * Obtain a list of all child elements of this element
68 * @return a QList with pointers to all child elements
70 const QList
<BasicElement
*> childElements();
73 * Insert a new child at the cursor position - reimplemented from BasicElement
74 * @param cursor The cursor holding the position where to inser
75 * @param child A BasicElement to insert
77 void insertChild( FormulaCursor
* cursor
, BasicElement
* child
);
80 * Remove a child element
81 * @param cursor The cursor holding the position where to remove
82 * @param element The BasicElement to remove
84 void removeChild( FormulaCursor
* cursor
, BasicElement
* element
);
87 * Implement the cursor behaviour for the element
88 * @param direction Indicates whether the cursor moves up, down, right or left
89 * @return A this pointer if the element accepts if not the element to asked instead
91 BasicElement
* acceptCursor( const FormulaCursor
* cursor
);
93 /// @return The element's ElementType
94 ElementType
elementType() const;
97 /// Read contents of the token element. Content should be unicode text strings or mglyphs
98 bool readMathMLContent( const QDomElement
& parent
);
100 /// Write all content to the QXmlStreamWriter - reimplemented by the child elements
101 void writeMathMLContent( QXmlStreamWriter
* writer
) const;
103 /// A list of the child elements
104 QList
<BasicElement
*> m_childElements
;
107 #endif // ROWELEMENT_H