1 /* This file is part of the KDE project 2 Copyright (C) 2009 Jeremias Epperlein <jeeree@web.de> 3 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Library General Public 6 License as published by the Free Software Foundation; either 7 version 2 of the License, or (at your option) any later version. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Library General Public License for more details. 13 14 You should have received a copy of the GNU Library General Public License 15 along with this library; see the file COPYING.LIB. If not, write to 16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef FORMULADATA_H 21 #define FORMULADATA_H 22 23 #include "FormulaElement.h" 24 #include "koformula_export.h" 25 #include <QObject> 26 #include <kundo2command.h> 27 #include "KoFormulaShape.h" 28 #include "KoShapeSavingContext.h" 29 30 class FormulaCommand; 31 32 /** 33 * This is a QObject wrapper around a formulaElement, which allows to communicate 34 * between tool, cursor and shape 35 */ 36 class KOFORMULA_EXPORT FormulaData : public QObject { 37 Q_OBJECT 38 public: 39 explicit FormulaData(FormulaElement *element); 40 41 ~FormulaData() override; 42 43 /// @return formulaElement that represents the data 44 FormulaElement* formulaElement() const; 45 46 ///emit a dataChanged signal 47 void notifyDataChange(FormulaCommand* command, bool undo); 48 void setFormulaElement ( FormulaElement* element); 49 50 Q_SIGNALS: 51 void dataChanged(FormulaCommand* element, bool undo); 52 53 public Q_SLOTS: 54 ///only for debugging 55 void writeElementTree(); 56 57 void saveMathML( KoShapeSavingContext& context); 58 59 private: 60 FormulaElement* m_element; 61 }; 62 63 #endif // FORMULADATA_H 64