lib Library API Documentation

formulaelement.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Andrea Rizzi <rizzi@kde.org>
00003                   Ulrich Kuettler <ulrich.kuettler@mailbox.tu-dresden.de>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef FORMULAELEMENT_H
00022 #define FORMULAELEMENT_H
00023 
00024 // Formula include
00025 #include "sequenceelement.h"
00026 
00027 KFORMULA_NAMESPACE_BEGIN
00028 
00029 class BasicElement;
00030 class ContextStyle;
00031 class FormulaDocument;
00032 class SymbolTable;
00033 
00034 
00040 class FormulaElement : public SequenceElement {
00041     typedef SequenceElement inherited;
00042 public:
00043 
00048     FormulaElement(FormulaDocument* container);
00049 
00050     virtual FormulaElement* clone() { return 0; }
00051 
00055     BasicElement* goToPos( FormulaCursor*, const LuPixelPoint& point );
00056 
00060     virtual bool readOnly( const BasicElement* /*child*/ ) const { return false; }
00061 
00065     virtual bool readOnly( const FormulaCursor* ) const { return false; }
00066 
00070     virtual FormulaElement* formula() { return this; }
00071 
00075     virtual const FormulaElement* formula() const { return this; }
00076 
00081     void elementRemoval(BasicElement* child);
00082 
00087     virtual void changed();
00088 
00094     void cursorHasMoved( FormulaCursor* );
00095 
00096     void moveOutLeft( FormulaCursor* );
00097     void moveOutRight( FormulaCursor* );
00098     void moveOutBelow( FormulaCursor* );
00099     void moveOutAbove( FormulaCursor* );
00100 
00104     void tell( const QString& msg );
00105 
00110     void removeFormula( FormulaCursor* );
00111 
00112     void insertFormula( FormulaCursor* );
00113 
00118     virtual void calcSizes( const ContextStyle& context,
00119                             ContextStyle::TextStyle tstyle,
00120                             ContextStyle::IndexStyle istyle);
00121 
00127     virtual void draw( QPainter& painter, const LuPixelRect& r,
00128                        const ContextStyle& context,
00129                        ContextStyle::TextStyle tstyle,
00130                        ContextStyle::IndexStyle istyle,
00131                        const LuPixelPoint& parentOrigin );
00132 
00136     void calcSizes( ContextStyle& context );
00137 
00141     void draw( QPainter& painter, const LuPixelRect& r, ContextStyle& context );
00142 
00151     virtual KCommand* buildCommand( Container*, Request* );
00152 
00156     const SymbolTable& getSymbolTable() const;
00157 
00162     virtual QString toLatex();
00163 
00164     int getBaseSize() const { return baseSize; }
00165     void setBaseSize( int size );
00166 
00167     bool hasOwnBaseSize() const { return ownBaseSize; }
00168 
00169     virtual KCommand* input( Container* container, QKeyEvent* event );
00170 
00171     virtual void writeMathML( QDomDocument doc, QDomNode parent );
00172 
00176     virtual void writeDom(QDomElement element);
00177 
00181     QDomElement emptyFormulaElement( QDomDocument doc );
00182 
00183 protected:
00184 
00185     //Save/load support
00186 
00190     virtual QString getTagName() const { return "FORMULA"; }
00191 
00196     virtual bool readAttributesFromDom(QDomElement element);
00197 
00203     virtual bool readContentFromDom(QDomNode& node);
00204 
00205 
00206 private:
00207 
00212     void convertNames( QDomNode node );
00213 
00217     FormulaDocument* document;
00218 
00222     int baseSize;
00223 
00227     bool ownBaseSize;
00228 };
00229 
00230 KFORMULA_NAMESPACE_END
00231 
00232 #endif // FORMULAELEMENT_H
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:21 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003