F:/KPlato/koffice/libs/kformula/FormulaElement.h

Aller à la documentation de ce fichier.
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., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
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     // void insertChild( int position, BasicElement* element );
00068 
00072     virtual bool readOnly( const BasicElement* /*child*/ ) 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 //    void tell( const QString& msg );
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 //    virtual KCommand* buildCommand( Container*, Request* );
00166 
00170     //const SymbolTable& getSymbolTable() const;
00171 
00172     int getBaseSize() const { return baseSize; }
00173     void setBaseSize( int size );
00174 
00175     bool hasOwnBaseSize() const { return ownBaseSize; }
00176 
00177 //    virtual KCommand* input( Container* container, QKeyEvent* event );
00178 
00179  
00183     virtual void writeDom(QDomElement element);
00184 
00188     QDomElement emptyFormulaElement( QDomDocument& doc );
00189 
00190 protected:
00191     //Save/load support
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 } // namespace KFormula
00234 
00235 #endif // FORMULAELEMENT_H

Généré le Wed Nov 22 23:41:00 2006 pour KPlato par  doxygen 1.5.1-p1