Grantlee
0.4.0
|
00001 /* 00002 This file is part of the Grantlee template system. 00003 00004 Copyright (c) 2008 Stephen Kelly <steveire@gmail.com> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either version 00009 2.1 of the Licence, 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 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00018 00019 */ 00020 00021 #ifndef GRANTLEE_BBCODEBUILDER_H 00022 #define GRANTLEE_BBCODEBUILDER_H 00023 00024 #include "abstractmarkupbuilder.h" 00025 00026 namespace Grantlee 00027 { 00028 00032 class BBCodeBuilder : public AbstractMarkupBuilder 00033 { 00034 public: 00035 00039 BBCodeBuilder(); 00040 00041 virtual ~BBCodeBuilder(); 00042 00043 /* reimp */ void beginStrong(); 00044 /* reimp */ void endStrong(); 00045 /* reimp */ void beginEmph(); 00046 /* reimp */ void endEmph(); 00047 /* reimp */ void beginUnderline(); 00048 /* reimp */ void endUnderline(); 00049 /* reimp */ void beginStrikeout(); 00050 /* reimp */ void endStrikeout(); 00051 /* reimp */ void beginForeground( const QBrush &brush ); 00052 /* reimp */ void endForeground(); 00053 00054 // Background colour not supported by BBCode. 00055 00056 /* reimp */ void beginAnchor( const QString &href = QString(), const QString &name = QString() ); 00057 /* reimp */ void endAnchor(); 00058 00059 // Font family not supported by BBCode. 00060 00066 /* reimp */ void beginFontPointSize( int size ); 00067 /* reimp */ void endFontPointSize(); 00068 00069 /* reimp */ void beginParagraph( Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0, qreal bottom = 0.0, qreal left = 0.0, qreal right = 0.0 ); 00070 00071 /* reimp */ void endParagraph(); 00072 /* reimp */ void addNewline(); 00073 00074 /* reimp */ void insertImage( const QString &src, qreal width, qreal height ); 00075 00076 /* reimp */ void beginList( QTextListFormat::Style type ); 00077 00078 /* reimp */ void endList(); 00079 00080 00081 /* reimp */ void beginListItem(); 00082 00083 /* reimp */ void beginSuperscript(); 00084 00085 /* reimp */ void endSuperscript(); 00086 00087 /* reimp */ void beginSubscript(); 00088 00089 /* reimp */ void endSubscript(); 00090 00091 00092 /* reimp */ void beginTable( qreal, qreal, const QString & ); 00093 00094 /* reimp */ void beginTableRow(); 00095 00096 00097 /* reimp */ void appendLiteralText( const QString &text ); 00098 00102 const QString escape( const QString &text ) const; 00103 00104 /* reimp */ QString getResult(); 00105 00106 private: 00107 QList<QTextListFormat::Style> m_currentListItemStyles; 00108 00109 QString m_text; 00110 00111 Qt::Alignment m_currentAlignment; 00112 00113 }; 00114 00115 } 00116 00117 #endif