kformula/flake
KoFormulaShapeFactory.cpp
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 * Copyright (C) 2006 Martin Pfeiffer <hubipete@gmx.net> 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 #include "KoFormulaShapeFactory.h" 00020 #include "KoFormulaShape.h" 00021 00022 #include <KoShapeFactory.h> 00023 #include <klocale.h> 00024 #include <kdebug.h> 00025 00026 KoFormulaShapeFactory::KoFormulaShapeFactory( QObject *parent ) 00027 : KoShapeFactory( parent, KoFormulaShapeId, i18n( "Formula" ) ) 00028 { 00029 setToolTip(i18n( "A formula")); 00030 setIcon( "x-shape-formula" ); 00031 setOdfElementNames( "http://www.w3.org/1998/Math/MathML", QStringList("math") ); 00032 setLoadingPriority( 1 ); 00033 /* KoShapeTemplate t; 00034 t.id = KoFormulaShapeId; 00035 t.name = i18n("Formula"); 00036 t.toolTip = i18n("A formula"); 00037 t.icon = ""; //TODO add it 00038 props = new KoProperties(); 00039 t.properties = props; 00040 addTemplate( t );*/ 00041 } 00042 00043 KoFormulaShapeFactory::~KoFormulaShapeFactory() 00044 {} 00045 00046 KoShape* KoFormulaShapeFactory::createDefaultShape() const 00047 { 00048 KoFormulaShape* formula = new KoFormulaShape(); 00049 formula->setShapeId( KoFormulaShapeId ); 00050 return formula; 00051 } 00052 00053 KoShape* KoFormulaShapeFactory::createShape( const KoProperties* params ) const 00054 { 00055 Q_UNUSED( params ); 00056 00057 KoFormulaShape* formula = new KoFormulaShape(); 00058 if( !formula ) 00059 return 0; 00060 00061 formula->setShapeId( KoFormulaShapeId ); 00062 return formula; 00063 } 00064 00065 00066 bool KoFormulaShapeFactory::supports(const KoXmlElement& e) const 00067 { 00068 kDebug() << e.nodeName() << " - "<< e.namespaceURI(); 00069 return ( e.nodeName() == "math" ) && ( e.namespaceURI() == "http://www.w3.org/1998/Math/MathML" ); 00070 } 00071 00072 00073 #include "KoFormulaShapeFactory.moc"
