kformula/flake

FormulaEditor.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                  2009 Jeremias Epperlein <jeeree@web.de>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020    Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #ifndef FORMULAEDITOR_H
00024 #define FORMULAEDITOR_H
00025 
00026 #include "kformula_export.h"
00027 #include <QString>
00028 #include <QPair>
00029 #include "FormulaData.h"
00030 #include "FormulaCursor.h"
00031 
00032 class BasicElement;
00033 class QString;
00034 class QPainter;
00035 class QPointF;
00036 class QRectF;
00037 class QUndoCommand;
00038 
00049 class KOFORMULA_EXPORT FormulaEditor {
00050 public:
00052     explicit FormulaEditor( FormulaCursor cursor, FormulaData* data );
00053 
00055     explicit FormulaEditor( FormulaData* data );
00056 
00062     void paint( QPainter &painter ) const;
00063 
00068     FormulaCommand* insertText( const QString& text );
00069 
00074     FormulaCommand* insertElement( BasicElement* element );
00075 
00077     FormulaCommand* insertMathML( const QString& data );
00078 
00080     FormulaCommand* changeTable(bool insert, bool rows);
00081     
00086     FormulaCommand* remove( bool elementBeforePosition );
00087     
00089     FormulaData* formulaData() const;
00090 
00092     void setData(FormulaData* data);
00093 
00095     QString inputBuffer() const;
00096 
00098     void setCursor(FormulaCursor& cursor);
00099 
00101     FormulaCursor& cursor();
00102 
00103 private:
00105     QString tokenType(const QChar& character) const;
00106 
00107 private:
00109     FormulaCursor m_cursor;
00110 
00112     FormulaData* m_data;
00113 
00115     QString m_inputBuffer;
00116 
00117 };
00118 
00119 #endif // FORMULAEDITOR_H