kformula/flake
FormulaData.cpp
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 2009 Jeremias Epperlein <jeeree@web.de> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "FormulaElement.h" 00021 #include "FormulaCursor.h" 00022 #include "FormulaData.h" 00023 #include "FormulaCommand.h" 00024 #include "KoFormulaShape.h" 00025 #include <KoXmlWriter.h> 00026 00027 00028 FormulaData::FormulaData(FormulaElement* element) 00029 : QObject() 00030 { 00031 m_element=element; 00032 } 00033 00034 FormulaData::~FormulaData() 00035 { 00036 if (m_element) { 00037 delete m_element; 00038 } 00039 } 00040 00041 void FormulaData::notifyDataChange(FormulaCommand* command, bool undo) 00042 { 00043 emit dataChanged(command,undo); 00044 } 00045 00046 void FormulaData::setFormulaElement ( FormulaElement* element ) 00047 { 00048 m_element=element; 00049 } 00050 00051 FormulaElement* FormulaData::formulaElement() const 00052 { 00053 return m_element; 00054 } 00055 00056 void FormulaData::writeElementTree() 00057 { 00058 m_element->writeElementTree(); 00059 } 00060 00061 void FormulaData::saveMathML(KoShapeSavingContext& context) 00062 { 00063 context.xmlWriter().startDocument( "math", "http://www.w3.org/1998/Math/MathML" ); 00064 formulaElement()->writeMathML( &context.xmlWriter() ); 00065 context.xmlWriter().endDocument(); 00066 } 00067 00068 00069 00070
