1
/* This file is part of the KDE project
2
Copyright (C) 2001 Andrea Rizzi <rizzi@kde.org>
3
Copyright (C) 2001 Ulrich Kuettler <ulrich.kuettler@mailbox.tu-dresden.de>
4
Copyright (C) 2006 Martin Pfeiffer <hubipete@gmx.net>
5
Copyright (C) 2006 Alfredo Beaumont Sainz <alfredo.beaumont@gmail.com>
6
2009 Jeremias Epperlein <jeeree@web.de>
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Library General Public
10
License as published by the Free Software Foundation; either
11
version 2 of the License, or (at your option) any later version.
13
This library is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Library General Public License for more details.
18
You should have received a copy of the GNU Library General Public License
19
along with this library; see the file COPYING.LIB. If not, write to
20
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21
Boston, MA 02110-1301, USA.
24
#ifndef TABLEROWELEMENT_H
25
#define TABLEROWELEMENT_H
27
#include "BasicElement.h"
28
#include "AttributeManager.h"
29
#include "kformula_export.h"
31
class TableDataElement;
34
* @short Representing the MathML mtr element.
36
* Each row is responsible for painting the rowline which is placed over its content.
37
* For layouting each row in a table will query a list of height and width values
38
* from the parental TableElement which can determine these without hussel.
40
class KOFORMULA_EXPORT TableRowElement : public BasicElement {
42
/// The standard constructor
43
TableRowElement( BasicElement* parent = 0 );
45
/// The standard destructor
49
* Render the element to the given QPainter
50
* @param painter The QPainter to paint the element to
51
* @param am AttributeManager containing style info
53
void paint( QPainter& painter, AttributeManager* am );
56
* Calculate the size of the element and the positions of its children
57
* @param am The AttributeManager providing information about attributes values
59
void layout( const AttributeManager* am );
62
* Obtain a list of all child elements of this element
63
* @return a QList with pointers to all child elements
65
const QList<BasicElement*> childElements() const;
68
* Insert a new child at the cursor position
69
* @param cursor The cursor holding the position where to inser
70
* @param child A BasicElement to insert
72
bool insertChild( int position, BasicElement* child );
75
* Remove a child element
76
* @param element The BasicElement to remove
78
bool removeChild( BasicElement* child );
81
* Implement the cursor behaviour for the element
82
* @param direction Indicates whether the cursor moves up, down, right or left
83
* @return A this pointer if the element accepts if not the element to asked instead
85
bool acceptCursor( const FormulaCursor& cursor );
87
/// inherited from BasicElement
88
virtual int positionOfChild(BasicElement* child) const;
90
/// inherited from BasicElement
91
virtual int endPosition() const;
93
/// inherited from BasicElement
94
virtual bool moveCursor(FormulaCursor& newcursor, FormulaCursor& oldcursor);
96
/// inherited from BasicElement
97
virtual bool setCursorTo(FormulaCursor& cursor, QPointF point);
99
/// inherited from BasicElement
100
virtual QLineF cursorLine ( int position ) const;
102
/// @return The element's ElementType
103
ElementType elementType() const;
106
/// Read all content from the node - reimplemented by child elements
107
bool readMathMLContent( const KoXmlElement& element );
109
/// Write all content to the KoXmlWriter - reimplemented by the child elements
110
void writeMathMLContent( KoXmlWriter* writer ) const;
113
/// @return A list of alignments in @p orientation for each element of the table
114
QList<Align> alignments( Qt::Orientation orientation );
116
/// The list of entries in this row of the table
117
QList<TableDataElement*> m_data;