~ubuntu-branches/ubuntu/oneiric/koffice/oneiric-updates

« back to all changes in this revision

Viewing changes to kformula/flake/elements/TableRowElement.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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>
 
7
 
 
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.
 
12
 
 
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.
 
17
 
 
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.
 
22
*/
 
23
 
 
24
#ifndef TABLEROWELEMENT_H
 
25
#define TABLEROWELEMENT_H
 
26
 
 
27
#include "BasicElement.h"
 
28
#include "AttributeManager.h"
 
29
#include "kformula_export.h"
 
30
 
 
31
class TableDataElement;
 
32
 
 
33
/**
 
34
 * @short Representing the MathML mtr element.
 
35
 *
 
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.
 
39
 */
 
40
class KOFORMULA_EXPORT TableRowElement : public BasicElement {
 
41
public:
 
42
    /// The standard constructor
 
43
    TableRowElement( BasicElement* parent = 0 );
 
44
 
 
45
    /// The standard destructor
 
46
    ~TableRowElement();
 
47
 
 
48
    /**
 
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
 
52
     */
 
53
    void paint( QPainter& painter, AttributeManager* am );
 
54
 
 
55
    /**
 
56
     * Calculate the size of the element and the positions of its children
 
57
     * @param am The AttributeManager providing information about attributes values
 
58
     */
 
59
    void layout( const AttributeManager* am );
 
60
 
 
61
    /**
 
62
     * Obtain a list of all child elements of this element
 
63
     * @return a QList with pointers to all child elements
 
64
     */
 
65
    const QList<BasicElement*> childElements() const;
 
66
 
 
67
    /**
 
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
 
71
     */
 
72
    bool insertChild( int position, BasicElement* child );
 
73
    
 
74
    /**
 
75
     * Remove a child element
 
76
     * @param element The BasicElement to remove
 
77
     */ 
 
78
    bool removeChild( BasicElement* child );
 
79
 
 
80
    /**
 
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
 
84
     */
 
85
    bool acceptCursor( const FormulaCursor& cursor );
 
86
    
 
87
    /// inherited from BasicElement
 
88
    virtual int positionOfChild(BasicElement* child) const;
 
89
    
 
90
    /// inherited from BasicElement
 
91
    virtual int endPosition() const;
 
92
    
 
93
    /// inherited from BasicElement
 
94
    virtual bool moveCursor(FormulaCursor& newcursor, FormulaCursor& oldcursor);
 
95
    
 
96
    /// inherited from BasicElement
 
97
    virtual bool setCursorTo(FormulaCursor& cursor, QPointF point);
 
98
    
 
99
    /// inherited from BasicElement
 
100
    virtual QLineF cursorLine ( int position ) const;
 
101
    
 
102
    /// @return The element's ElementType
 
103
    ElementType elementType() const;
 
104
 
 
105
protected:
 
106
    /// Read all content from the node - reimplemented by child elements
 
107
    bool readMathMLContent( const KoXmlElement& element );
 
108
 
 
109
    /// Write all content to the KoXmlWriter - reimplemented by the child elements
 
110
    void writeMathMLContent( KoXmlWriter* writer ) const;
 
111
 
 
112
private:
 
113
    /// @return A list of alignments in @p orientation for each element of the table
 
114
    QList<Align> alignments( Qt::Orientation orientation );
 
115
 
 
116
    /// The list of entries in this row of the table 
 
117
    QList<TableDataElement*> m_data;
 
118
};
 
119
 
 
120
#endif
 
121