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 2006 Martin Pfeiffer <hubipete@gmx.net> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License as published by the Free Software Foundation; either 00009 version 2 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef BRACKETELEMENT_H 00023 #define BRACKETELEMENT_H 00024 00025 #include <QPoint> 00026 #include <QSize> 00027 #include <QList> 00028 00029 #include "BasicElement.h" 00030 00031 namespace KFormula { 00032 00033 class Artwork; 00034 class SequenceElement; 00035 00036 00040 class BracketElement : public BasicElement { 00041 public: 00042 00043 enum { contentPos }; 00044 00045 BracketElement( BasicElement* parent = 0 ); 00046 ~BracketElement(); 00047 00048 00053 virtual TokenType getTokenType() const { return BRACKET; } 00054 00059 const QList<BasicElement*> childElements(); 00060 00061 00066 virtual void calcSizes(const ContextStyle& style, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle); 00067 00073 virtual void draw( QPainter& painter, const LuPixelRect& r, 00074 const ContextStyle& style, 00075 ContextStyle::TextStyle tstyle, 00076 ContextStyle::IndexStyle istyle, 00077 const LuPixelPoint& parentOrigin ); 00078 00079 void readMathML( const QDomElement& element ); 00080 00081 void writeMathML( KoXmlWriter* writer, bool oasisFormat = false ); 00082 00083 protected: 00084 00085 //Save/load support 00086 00090 virtual QString getTagName() const { return "BRACKET"; } 00091 00096 virtual bool readAttributesFromDom(QDomElement element); 00097 00098 virtual void writeDom(QDomElement element); 00099 00100 private: 00101 00105 QString latexString(char); 00106 00110 Artwork* left; 00111 Artwork* right; 00112 00113 SymbolType leftType; 00114 SymbolType rightType; 00115 }; 00116 00117 } // namespace KFormula 00118 00119 #endif // BRACKETELEMENT_H