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 MATRIXELEMENT_H 00023 #define MATRIXELEMENT_H 00024 00025 #include "BasicElement.h" 00026 00027 namespace KFormula { 00028 00029 class MatrixRowElement; 00030 class MatrixEntryElement; 00031 00040 class MatrixElement : public BasicElement { 00041 friend class KFCRemoveColumn; 00042 friend class KFCRemoveRow; 00043 00044 public: 00046 MatrixElement( BasicElement* parent = 0); 00047 00049 ~MatrixElement(); 00050 00055 void paint( QPainter& painter ) const; 00056 00058 void calculateSize(); 00059 00064 const QList<BasicElement*> childElements(); 00065 00071 void moveLeft( FormulaCursor* cursor, BasicElement* from ); 00072 00078 void moveRight( FormulaCursor* cursor, BasicElement* from ); 00079 00085 void moveUp( FormulaCursor* cursor, BasicElement* from ); 00086 00092 void moveDown( FormulaCursor* cursor, BasicElement* from ); 00093 00095 void readMathML( const QDomElement& element ); 00096 00098 void writeMathML( KoXmlWriter* writer, bool oasisFormat = false ); 00099 00100 00101 00102 00104 /* int rows() const; 00105 00107 int cols() const; 00108 00110 MatrixEntryElement* matrixEntryAt( int row, int col ); 00111 */ 00116 virtual void goInside(FormulaCursor* cursor); 00117 00119 virtual void selectChild( FormulaCursor*, BasicElement* ); 00120 00121 00122 protected: 00124 virtual QString getTagName() const { return "MATRIX"; } 00125 00127 virtual void writeDom(QDomElement element); 00128 00130 virtual bool readAttributesFromDom(QDomElement element); 00131 00136 virtual bool readContentFromDom(QDomNode& node); 00137 00138 private: 00140 int indexOfRow( BasicElement* row ) const; 00141 00143 QList<MatrixRowElement*> m_matrixRowElements; 00144 }; 00145 00146 } // namespace KFormula 00147 00148 #endif // MATRIXELEMENT_H