File indexing completed on 2024-05-12 16:34:02

0001 /* This file is part of the KDE project
0002    Copyright (C) 2009 Jeremias Epperlein <jeeree@web.de>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017    Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #include "FormulaElement.h"
0021 #include "FormulaCursor.h"
0022 #include "FormulaData.h"
0023 #include "FormulaCommand.h"
0024 #include "KoFormulaShape.h"
0025 #include <KoXmlWriter.h>
0026 
0027 
0028 FormulaData::FormulaData(FormulaElement* element)
0029            : QObject()
0030 {
0031     m_element=element;
0032 }
0033 
0034 FormulaData::~FormulaData() 
0035 {
0036     if (m_element) {
0037         delete m_element;
0038     }
0039 }
0040 
0041 void FormulaData::notifyDataChange(FormulaCommand* command, bool undo)
0042 {
0043     emit dataChanged(command,undo);
0044 }
0045 
0046 void FormulaData::setFormulaElement ( FormulaElement* element )
0047 {
0048     m_element=element;
0049 }
0050 
0051 FormulaElement* FormulaData::formulaElement() const
0052 {
0053     return m_element;
0054 }
0055 
0056 void FormulaData::writeElementTree()
0057 {
0058     m_element->writeElementTree();
0059 }
0060 
0061 void FormulaData::saveMathML(KoShapeSavingContext& context)
0062 {
0063     context.xmlWriter().startDocument( "math", "http://www.w3.org/1998/Math/MathML" );
0064     formulaElement()->writeMathML( &context.xmlWriter() );
0065     context.xmlWriter().endDocument();
0066 }
0067 
0068 
0069 
0070