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 00027 namespace KFormula { 00028 00036 class FractionElement : public BasicElement { 00037 public: 00039 FractionElement( BasicElement* parent = 0 ); 00040 00042 ~FractionElement(); 00043 00048 void paint( QPainter& painter ) const; 00049 00051 void calculateSize(); 00052 00058 void insertChild( FormulaCursor* cursor, BasicElement* child ); 00059 00064 void removeChild( BasicElement* element ); 00065 00070 const QList<BasicElement*> childElements(); 00071 00077 void moveLeft( FormulaCursor* cursor, BasicElement* from ); 00078 00084 void moveRight( FormulaCursor* cursor, BasicElement* from ); 00085 00091 void moveUp( FormulaCursor* cursor, BasicElement* from ); 00092 00098 void moveDown( FormulaCursor* cursor, BasicElement* from ); 00099 00100 00101 void readMathML( const QDomElement& element ); 00102 00103 void writeMathML( KoXmlWriter* writer, bool oasisFormat = false ); 00104 00105 protected: 00107 virtual QString getTagName() const { return "FRACTION"; } 00108 00110 virtual void writeDom(QDomElement element); 00111 00113 virtual bool readAttributesFromDom(QDomElement element); 00114 00119 virtual bool readContentFromDom(QDomNode& node); 00120 00121 private: 00123 BasicElement* m_numerator; 00124 00126 BasicElement* m_denominator; 00127 }; 00128 00129 } // namespace KFormula 00130 00131 #endif // FRACTIONELEMENT_H