~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kformula/flake/MultiscriptElement.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) 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.
9
 
 
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.
14
 
 
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.
19
 
*/
20
 
 
21
 
#ifndef MULTISCRIPTELEMENT_H
22
 
#define MULTISCRIPTELEMENT_H
23
 
 
24
 
#include "FixedElement.h"
25
 
#include "kformula_export.h"
26
 
 
27
 
/**
28
 
 * @short Implementation of the mmultiscript element
29
 
 */
30
 
class KOFORMULA_EXPORT MultiscriptElement : public FixedElement {
31
 
public:
32
 
    /// The standard constructor
33
 
    MultiscriptElement( BasicElement* parent = 0 );
34
 
 
35
 
    /// The destructor
36
 
    ~MultiscriptElement();
37
 
 
38
 
    /**
39
 
     * Obtain a list of all child elements of this element
40
 
     * @return a QList with pointers to all child elements
41
 
     */
42
 
    const QList<BasicElement*> childElements() const;
43
 
    
44
 
    virtual bool setCursorTo ( FormulaCursor& cursor, QPointF point );
45
 
 
46
 
    virtual bool moveCursor ( FormulaCursor& newcursor, FormulaCursor& oldcursor );
47
 
    
48
 
//     virtual int length() const;
49
 
    /**
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
53
 
     */
54
 
    void paint( QPainter& painter, AttributeManager* am );
55
 
 
56
 
    /**
57
 
     * Calculate the size of the element and the positions of its children
58
 
     * @param am The AttributeManager providing information about attributes values
59
 
     */
60
 
    void layout( const AttributeManager* am );
61
 
 
62
 
    /**
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
66
 
     */
67
 
    virtual bool acceptCursor ( const FormulaCursor& cursor );
68
 
 
69
 
    /// @return The default value of the attribute for this element
70
 
    QString attributesDefaultValue( const QString& attribute ) const; 
71
 
 
72
 
    /// @return The element's ElementType
73
 
    ElementType elementType() const;
74
 
 
75
 
protected:
76
 
    /// Read all content from the node
77
 
    bool readMathMLContent( const KoXmlElement& element );
78
 
 
79
 
    /// Write all content to the KoXmlWriter
80
 
    void writeMathMLContent( KoXmlWriter* writer ) const;
81
 
 
82
 
    /// Make sure that there are an even number of elements, as the spec says
83
 
    /// there must be.
84
 
    void ensureEvenNumberElements();
85
 
 
86
 
private:
87
 
    /// The BasicElement representing the base element of the multiscript
88
 
    BasicElement* m_baseElement;
89
 
 
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
94
 
    /// further away
95
 
    QList<BasicElement*> m_preScripts;
96
 
 
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
101
 
    /// further away
102
 
    QList<BasicElement*> m_postScripts;
103
 
};
104
 
 
105
 
 
106
 
#endif // MULTISCRIPTELEMENT_H