creationstrategy.cc
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
This file is part of the documentation for lib Library Version 1.3.5.