00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FORMULAELEMENT_H
00022 #define FORMULAELEMENT_H
00023
00024 #include "SequenceElement.h"
00025 #include <QKeyEvent>
00026
00027 namespace KFormula {
00028
00029 class BasicElement;
00030 class ContextStyle;
00031 class SymbolTable;
00032
00033
00042 class FormulaElement : public BasicElement {
00043 public:
00045 FormulaElement();
00046
00048 ~FormulaElement();
00049
00054 const QList<BasicElement*> childElements();
00055
00056 void readMathML( const QDomElement& element );
00057
00058 void writeMathML( KoXmlWriter* writer, bool oasisFormat = false );
00059
00060
00061
00062
00063
00064
00065 void addChild( BasicElement* element );
00066 void deleteChild( BasicElement* element );
00067
00068
00072 virtual bool readOnly( const BasicElement* ) const { return false; }
00073
00077 virtual bool readOnly( const FormulaCursor* ) const { return false; }
00078
00082 virtual FormulaElement* formula() { return this; }
00083
00087 virtual const FormulaElement* formula() const { return this; }
00088
00093 void elementRemoval(BasicElement* child);
00094
00099 virtual void changed();
00100
00106 void cursorHasMoved( FormulaCursor* );
00107
00108 void moveOutLeft( FormulaCursor* );
00109 void moveOutRight( FormulaCursor* );
00110 void moveOutBelow( FormulaCursor* );
00111 void moveOutAbove( FormulaCursor* );
00112
00116
00117
00122 void removeFormula( FormulaCursor* );
00123
00124 void insertFormula( FormulaCursor* );
00125
00130 virtual void calcSizes( const ContextStyle& context,
00131 ContextStyle::TextStyle tstyle,
00132 ContextStyle::IndexStyle istyle,
00133 StyleAttributes& style );
00134
00140 virtual void draw( QPainter& painter, const LuPixelRect& r,
00141 const ContextStyle& context,
00142 ContextStyle::TextStyle tstyle,
00143 ContextStyle::IndexStyle istyle,
00144 StyleAttributes& style,
00145 const LuPixelPoint& parentOrigin );
00146
00150 void calcSizes( ContextStyle& context );
00151
00155 void draw( QPainter& painter, const LuPixelRect& r, ContextStyle& context );
00156
00165
00166
00170
00171
00172 int getBaseSize() const { return baseSize; }
00173 void setBaseSize( int size );
00174
00175 bool hasOwnBaseSize() const { return ownBaseSize; }
00176
00177
00178
00179
00183 virtual void writeDom(QDomElement element);
00184
00188 QDomElement emptyFormulaElement( QDomDocument& doc );
00189
00190 protected:
00191
00192
00196 virtual QString getTagName() const { return "FORMULA"; }
00197
00202 virtual bool readAttributesFromDom(QDomElement element);
00203
00209 virtual bool readContentFromDom(QDomNode& node);
00210
00211
00212 private:
00214 QList<BasicElement*> m_childElements;
00215
00220 void convertNames( QDomNode node );
00221
00225 int baseSize;
00226
00230 bool ownBaseSize;
00231 };
00232
00233 }
00234
00235 #endif // FORMULAELEMENT_H