kformula/flake

FractionElement.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Andrea Rizzi <rizzi@kde.org>
00003                       Ulrich Kuettler <ulrich.kuettler@mailbox.tu-dresden.de>
00004                  2006 Martin Pfeiffer <hubipete@gmx.net>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019    Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef FRACTIONELEMENT_H
00023 #define FRACTIONELEMENT_H
00024 
00025 #include "BasicElement.h"
00026 #include "FixedElement.h"
00027 #include "kformula_export.h"
00028 #include <QLineF>
00029 
00037 class KOFORMULA_EXPORT FractionElement : public FixedElement {
00038 public:
00040     FractionElement( BasicElement* parent = 0 );
00041    
00043     ~FractionElement();
00044 
00049     void paint( QPainter& painter, AttributeManager* am );
00050 
00055     void layout( const AttributeManager* am );
00056 
00061     const QList<BasicElement*> childElements() const;
00062 
00064     virtual bool replaceChild ( BasicElement* oldelement, BasicElement* newelement );
00065 
00067     virtual bool setCursorTo(FormulaCursor& cursor, QPointF point);
00068 
00070     virtual bool moveCursor(FormulaCursor& newcursor, FormulaCursor& oldcursor);
00071     
00073     virtual int endPosition() const;
00074     
00076     virtual int positionOfChild(BasicElement* child) const;
00077     
00079 //     virtual QLineF cursorLine(int position) const;
00080     
00082     QString attributesDefaultValue( const QString& attribute ) const;
00083     
00085     ElementType elementType() const;
00086 
00087     virtual QList<BasicElement*> elementsBetween(int pos1, int pos2) const;
00088     
00089 protected:
00091     bool readMathMLContent( const KoXmlElement& parent );
00092 
00094     void writeMathMLContent( KoXmlWriter* writer ) const;   
00095 
00096 private:
00098     void layoutBevelledFraction( const AttributeManager* am );
00099 
00101     RowElement* m_numerator;
00102 
00104     RowElement* m_denominator;
00105 
00107     QLineF m_fractionLine;
00108 
00110     double m_lineThickness;
00111 };
00112 
00113 #endif // FRACTIONELEMENT_H