lib
creationstrategy.h
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., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 00021 #ifndef CREATIONSTRATEGY_H 00022 #define CREATIONSTRATEGY_H 00023 00024 00025 #include <qstring.h> 00026 00027 #include "kformuladefs.h" 00028 00029 KFORMULA_NAMESPACE_BEGIN 00030 00031 class BasicElement; 00032 class BracketElement; 00033 class EmptyElement; 00034 class FractionElement; 00035 class IndexElement; 00036 class MatrixElement; 00037 class MultilineElement; 00038 class NameSequence; 00039 class OverlineElement; 00040 class RootElement; 00041 class SpaceElement; 00042 class SymbolElement; 00043 class TextElement; 00044 class UnderlineElement; 00045 00050 class ElementCreationStrategy { 00051 public: 00052 virtual ~ElementCreationStrategy() {} 00053 00054 virtual BasicElement* createElement( QString type ) = 0; 00055 00057 virtual TextElement* createTextElement( const QChar& ch, bool symbol=false ) = 0; 00058 00060 virtual MatrixElement* createMatrixElement( uint rows, uint columns ) = 0; 00061 00062 virtual EmptyElement* createEmptyElement() = 0; 00063 virtual NameSequence* createNameSequence() = 0; 00064 virtual BracketElement* createBracketElement( SymbolType lhs, SymbolType rhs ) = 0; 00065 virtual OverlineElement* createOverlineElement() = 0; 00066 virtual UnderlineElement* createUnderlineElement() = 0; 00067 virtual MultilineElement* createMultilineElement() = 0; 00068 virtual SpaceElement* createSpaceElement( SpaceWidth width ) = 0; 00069 virtual FractionElement* createFractionElement() = 0; 00070 virtual RootElement* createRootElement() = 0; 00071 virtual SymbolElement* createSymbolElement( SymbolType type ) = 0; 00072 virtual IndexElement* createIndexElement() = 0; 00073 }; 00074 00075 00079 class OrdinaryCreationStrategy : public ElementCreationStrategy { 00080 public: 00081 virtual BasicElement* createElement( QString type ); 00082 00083 virtual TextElement* createTextElement( const QChar& ch, bool symbol=false ); 00084 virtual EmptyElement* createEmptyElement(); 00085 virtual NameSequence* createNameSequence(); 00086 virtual BracketElement* createBracketElement( SymbolType lhs, SymbolType rhs ); 00087 virtual OverlineElement* createOverlineElement(); 00088 virtual UnderlineElement* createUnderlineElement(); 00089 virtual MultilineElement* createMultilineElement(); 00090 virtual SpaceElement* createSpaceElement( SpaceWidth width ); 00091 virtual FractionElement* createFractionElement(); 00092 virtual RootElement* createRootElement(); 00093 virtual SymbolElement* createSymbolElement( SymbolType type ); 00094 virtual MatrixElement* createMatrixElement( uint rows, uint columns ); 00095 virtual IndexElement* createIndexElement(); 00096 }; 00097 00098 00099 KFORMULA_NAMESPACE_END 00100 00101 #endif // CREATIONSTRATEGY_H