lib

creationstrategy.h
1/* This file is part of the KDE project
2 Copyright (C) 2003 Ulrich Kuettler <ulrich.kuettler@gmx.de>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20
21#ifndef CREATIONSTRATEGY_H
22#define CREATIONSTRATEGY_H
23
24
25#include <tqstring.h>
26#include <tqdom.h>
27
28#include "kformuladefs.h"
29
30KFORMULA_NAMESPACE_BEGIN
31
32class BasicElement;
33class BracketElement;
34class EmptyElement;
35class FractionElement;
36class IdentifierElement;
37class IndexElement;
38class MatrixElement;
40class NameSequence;
41class OperatorElement;
42class OverlineElement;
43class RootElement;
44class SpaceElement;
45class SymbolElement;
46class TextElement;
47class NumberElement;
49
55public:
56 virtual ~ElementCreationStrategy() {}
57
58 virtual BasicElement* createElement( TQString type, const TQDomElement& element ) = 0;
59
61 virtual TextElement* createTextElement( const TQChar& ch, bool symbol=false ) = 0;
62
64 virtual MatrixElement* createMatrixElement( uint rows, uint columns ) = 0;
65
66 virtual EmptyElement* createEmptyElement() = 0;
67 virtual NameSequence* createNameSequence() = 0;
68 virtual BracketElement* createBracketElement( SymbolType lhs, SymbolType rhs ) = 0;
69 virtual OverlineElement* createOverlineElement() = 0;
70 virtual UnderlineElement* createUnderlineElement() = 0;
71 virtual MultilineElement* createMultilineElement() = 0;
72 virtual SpaceElement* createSpaceElement( SpaceWidth width ) = 0;
73 virtual FractionElement* createFractionElement() = 0;
74 virtual RootElement* createRootElement() = 0;
75 virtual SymbolElement* createSymbolElement( SymbolType type ) = 0;
76 virtual IndexElement* createIndexElement() = 0;
77 virtual IdentifierElement* createIdentifierElement() = 0;
78 virtual OperatorElement* createOperatorElement() = 0;
79 virtual NumberElement* createNumberElement() = 0;
80 virtual TQString type() const = 0;
81};
82
83
88public:
89 virtual BasicElement* createElement( TQString type, const TQDomElement& element );
90
91 virtual TextElement* createTextElement( const TQChar& ch, bool symbol=false );
92 virtual EmptyElement* createEmptyElement();
93 virtual NameSequence* createNameSequence();
94 virtual BracketElement* createBracketElement( SymbolType lhs, SymbolType rhs );
95 virtual OverlineElement* createOverlineElement();
96 virtual UnderlineElement* createUnderlineElement();
97 virtual MultilineElement* createMultilineElement();
98 virtual SpaceElement* createSpaceElement( SpaceWidth width );
99 virtual FractionElement* createFractionElement();
100 virtual RootElement* createRootElement();
101 virtual SymbolElement* createSymbolElement( SymbolType type );
102 virtual MatrixElement* createMatrixElement( uint rows, uint columns );
103 virtual IndexElement* createIndexElement();
104 virtual IdentifierElement* createIdentifierElement();
105 virtual OperatorElement* createOperatorElement();
106 virtual NumberElement* createNumberElement();
107 virtual TQString type() const { return "Ordinary"; }
108};
109
110
111KFORMULA_NAMESPACE_END
112
113#endif // CREATIONSTRATEGY_H
Basis of every formula element.
A left and/or right bracket around one child.
An object of this type needs to be known by the SequenceElement.
virtual TextElement * createTextElement(const TQChar &ch, bool symbol=false)=0
there must always be a TextElement, so this can never return 0
virtual MatrixElement * createMatrixElement(uint rows, uint columns)=0
when this gets called the user has seen the matrix dialog and expects a matrix!
An element that represents an empty box.
The element with up to four indexes in the four corners.
Any number of lines.
The sequence thats a name.
The ordinary strategy to be used for plain kformula.
virtual MatrixElement * createMatrixElement(uint rows, uint columns)
when this gets called the user has seen the matrix dialog and expects a matrix!
virtual TextElement * createTextElement(const TQChar &ch, bool symbol=false)
there must always be a TextElement, so this can never return 0
A line above the content.
A nice graphical root.
Definition rootelement.h:35
A element that represents a space.
A symbol is simply a piece of art.
An element that represents one char.
Definition textelement.h:37
A line below the content.