lib Library API Documentation

creationstrategy.cc

00001 /* This file is part of the KDE project 00002 Copyright (C) 2003 Ulrich Kuettler <ulrich.kuettler@gmx.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., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #include "bracketelement.h" 00021 #include "creationstrategy.h" 00022 #include "elementtype.h" 00023 #include "fractionelement.h" 00024 #include "indexelement.h" 00025 #include "matrixelement.h" 00026 #include "rootelement.h" 00027 #include "sequenceelement.h" 00028 #include "spaceelement.h" 00029 #include "symbolelement.h" 00030 #include "textelement.h" 00031 00032 KFORMULA_NAMESPACE_BEGIN 00033 00034 BasicElement* OrdinaryCreationStrategy::createElement( QString type ) 00035 { 00036 if ( type == "TEXT" ) return new TextElement(); 00037 else if ( type == "EMPTY" ) return new EmptyElement(); 00038 else if ( type == "SPACE" ) return new SpaceElement(); 00039 else if ( type == "ROOT" ) return new RootElement(); 00040 else if ( type == "BRACKET" ) return new BracketElement(); 00041 else if ( type == "MATRIX" ) return new MatrixElement(); 00042 else if ( type == "INDEX" ) return new IndexElement(); 00043 else if ( type == "FRACTION" ) return new FractionElement(); 00044 else if ( type == "SYMBOL" ) return new SymbolElement(); 00045 else if ( type == "NAMESEQUENCE" ) return new NameSequence(); 00046 else if ( type == "OVERLINE" ) return new OverlineElement(); 00047 else if ( type == "UNDERLINE" ) return new UnderlineElement(); 00048 else if ( type == "MULTILINE" ) return new MultilineElement(); 00049 else if ( type == "SEQUENCE" ) { 00050 kdWarning() << "malformed data: sequence inside sequence." << endl; 00051 return 0; 00052 } 00053 return 0; 00054 } 00055 00056 00057 TextElement* OrdinaryCreationStrategy::createTextElement( const QChar& ch, bool symbol ) 00058 { 00059 return new TextElement( ch, symbol ); 00060 } 00061 00062 EmptyElement* OrdinaryCreationStrategy::createEmptyElement() 00063 { 00064 return new EmptyElement; 00065 } 00066 00067 NameSequence* OrdinaryCreationStrategy::createNameSequence() 00068 { 00069 return new NameSequence; 00070 } 00071 00072 BracketElement* OrdinaryCreationStrategy::createBracketElement( SymbolType lhs, SymbolType rhs ) 00073 { 00074 return new BracketElement( lhs, rhs ); 00075 } 00076 00077 OverlineElement* OrdinaryCreationStrategy::createOverlineElement() 00078 { 00079 return new OverlineElement; 00080 } 00081 00082 UnderlineElement* OrdinaryCreationStrategy::createUnderlineElement() 00083 { 00084 return new UnderlineElement; 00085 } 00086 00087 MultilineElement* OrdinaryCreationStrategy::createMultilineElement() 00088 { 00089 return new MultilineElement; 00090 } 00091 00092 SpaceElement* OrdinaryCreationStrategy::createSpaceElement( SpaceWidth width ) 00093 { 00094 return new SpaceElement( width ); 00095 } 00096 00097 FractionElement* OrdinaryCreationStrategy::createFractionElement() 00098 { 00099 return new FractionElement; 00100 } 00101 00102 RootElement* OrdinaryCreationStrategy::createRootElement() 00103 { 00104 return new RootElement; 00105 } 00106 00107 SymbolElement* OrdinaryCreationStrategy::createSymbolElement( SymbolType type ) 00108 { 00109 return new SymbolElement( type ); 00110 } 00111 00112 MatrixElement* OrdinaryCreationStrategy::createMatrixElement( uint rows, uint columns ) 00113 { 00114 return new MatrixElement( rows, columns ); 00115 } 00116 00117 IndexElement* OrdinaryCreationStrategy::createIndexElement() 00118 { 00119 return new IndexElement; 00120 } 00121 00122 00123 KFORMULA_NAMESPACE_END
KDE Logo
This file is part of the documentation for lib Library Version 1.3.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Sep 24 18:22:22 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003