lib
creationstrategy.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <qdom.h>
00021
00022 #include "bracketelement.h"
00023 #include "creationstrategy.h"
00024 #include "elementtype.h"
00025 #include "fractionelement.h"
00026 #include "identifierelement.h"
00027 #include "indexelement.h"
00028 #include "matrixelement.h"
00029 #include "operatorelement.h"
00030 #include "rootelement.h"
00031 #include "sequenceelement.h"
00032 #include "spaceelement.h"
00033 #include "symbolelement.h"
00034 #include "textelement.h"
00035 #include "numberelement.h"
00036
00037 KFORMULA_NAMESPACE_BEGIN
00038
00039 BasicElement* OrdinaryCreationStrategy::createElement( QString type, const QDomElement& )
00040 {
00041 if ( type == "TEXT" ) return new TextElement();
00042 else if ( type == "EMPTY" ) return new EmptyElement();
00043 else if ( type == "SPACE" ) return new SpaceElement();
00044 else if ( type == "ROOT" ) return new RootElement();
00045 else if ( type == "BRACKET" ) return new BracketElement();
00046 else if ( type == "MATRIX" ) return new MatrixElement();
00047 else if ( type == "INDEX" ) return new IndexElement();
00048 else if ( type == "FRACTION" ) return new FractionElement();
00049 else if ( type == "SYMBOL" ) return new SymbolElement();
00050 else if ( type == "NAMESEQUENCE" ) return new NameSequence();
00051 else if ( type == "OVERLINE" ) return new OverlineElement();
00052 else if ( type == "UNDERLINE" ) return new UnderlineElement();
00053 else if ( type == "MULTILINE" ) return new MultilineElement();
00054 else if ( type == "SEQUENCE" ) {
00055 kdWarning() << "malformed data: sequence inside sequence." << endl;
00056 return 0;
00057 }
00058 return 0;
00059 }
00060
00061
00062 TextElement* OrdinaryCreationStrategy::createTextElement( const QChar& ch, bool symbol )
00063 {
00064 return new TextElement( ch, symbol );
00065 }
00066
00067 EmptyElement* OrdinaryCreationStrategy::createEmptyElement()
00068 {
00069 return new EmptyElement;
00070 }
00071
00072 NameSequence* OrdinaryCreationStrategy::createNameSequence()
00073 {
00074 return new NameSequence;
00075 }
00076
00077 BracketElement* OrdinaryCreationStrategy::createBracketElement( SymbolType lhs, SymbolType rhs )
00078 {
00079 return new BracketElement( lhs, rhs );
00080 }
00081
00082 OverlineElement* OrdinaryCreationStrategy::createOverlineElement()
00083 {
00084 return new OverlineElement;
00085 }
00086
00087 UnderlineElement* OrdinaryCreationStrategy::createUnderlineElement()
00088 {
00089 return new UnderlineElement;
00090 }
00091
00092 MultilineElement* OrdinaryCreationStrategy::createMultilineElement()
00093 {
00094 return new MultilineElement;
00095 }
00096
00097 SpaceElement* OrdinaryCreationStrategy::createSpaceElement( SpaceWidth width )
00098 {
00099 return new SpaceElement( width );
00100 }
00101
00102 FractionElement* OrdinaryCreationStrategy::createFractionElement()
00103 {
00104 return new FractionElement;
00105 }
00106
00107 RootElement* OrdinaryCreationStrategy::createRootElement()
00108 {
00109 return new RootElement;
00110 }
00111
00112 SymbolElement* OrdinaryCreationStrategy::createSymbolElement( SymbolType type )
00113 {
00114 return new SymbolElement( type );
00115 }
00116
00117 MatrixElement* OrdinaryCreationStrategy::createMatrixElement( uint rows, uint columns )
00118 {
00119 return new MatrixElement( rows, columns );
00120 }
00121
00122 IndexElement* OrdinaryCreationStrategy::createIndexElement()
00123 {
00124 return new IndexElement;
00125 }
00126
00127 IdentifierElement* OrdinaryCreationStrategy::createIdentifierElement()
00128 {
00129 return new IdentifierElement();
00130 }
00131
00132 OperatorElement* OrdinaryCreationStrategy::createOperatorElement()
00133 {
00134 return new OperatorElement();
00135 }
00136
00137 NumberElement* OrdinaryCreationStrategy::createNumberElement()
00138 {
00139 return new NumberElement();
00140 }
00141
00142
00143
00144 KFORMULA_NAMESPACE_END
|