Grantlee
0.2.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_TEXTHTMLBUILDER_H 00022 #define GRANTLEE_TEXTHTMLBUILDER_H 00023 00024 #ifdef Q_CC_MSVC 00025 #pragma warning( disable : 4250 ) 00026 #endif 00027 00028 #include "abstractmarkupbuilder.h" 00029 #include "grantlee_gui_export.h" 00030 #include "markupdirector.h" 00031 00032 00033 namespace Grantlee 00034 { 00035 00036 class TextHTMLBuilderPrivate; 00037 00039 00090 class GRANTLEE_GUI_EXPORT TextHTMLBuilder : virtual public AbstractMarkupBuilder 00091 { 00092 public: 00093 00097 TextHTMLBuilder(); 00098 virtual ~TextHTMLBuilder(); 00099 00100 /* reimp */ void beginStrong(); 00101 /* reimp */ void endStrong(); 00102 /* reimp */ void beginEmph(); 00103 /* reimp */ void endEmph(); 00104 /* reimp */ void beginUnderline(); 00105 /* reimp */ void endUnderline(); 00106 /* reimp */ void beginStrikeout(); 00107 /* reimp */ void endStrikeout(); 00108 /* reimp */ void beginForeground( const QBrush &brush ); 00109 /* reimp */ void endForeground(); 00110 /* reimp */ void beginBackground( const QBrush &brush ); 00111 /* reimp */ void endBackground(); 00112 /* reimp */ void beginAnchor( const QString &href = QString(), const QString &name = QString() ); 00113 /* reimp */ void endAnchor(); 00114 00115 // Maybe this stuff should just be added to a list, and then when I add literal text, 00116 // add some kind of style attribute in one span instead of many. 00117 /* reimp */ void beginFontFamily( const QString &family ); 00118 /* reimp */ void endFontFamily(); 00119 00124 /* reimp */ void beginFontPointSize( int size ); 00125 /* reimp */ void endFontPointSize(); 00126 00135 /* reimp */ void beginParagraph( Qt::Alignment al = Qt::AlignLeft, qreal topMargin = 0.0, qreal bottomMargin = 0.0, qreal leftMargin = 0.0, qreal rightMargin = 0.0 ); 00136 00141 /* reimp */ void beginHeader( int level ); 00142 00147 /* reimp */ void endHeader( int level ); 00148 00149 /* reimp */ void endParagraph(); 00150 /* reimp */ void addNewline(); 00151 00152 /* reimp */ void insertHorizontalRule( int width = -1 ); 00153 00154 /* reimp */ void insertImage( const QString &src, qreal width, qreal height ); 00155 00156 /* reimp */ void beginList( QTextListFormat::Style type ); 00157 00158 /* reimp */ void endList(); 00159 00160 /* reimp */ void beginListItem(); 00161 /* reimp */ void endListItem(); 00162 00163 /* reimp */ void beginSuperscript(); 00164 00165 /* reimp */ void endSuperscript(); 00166 00167 /* reimp */ void beginSubscript(); 00168 00169 /* reimp */ void endSubscript(); 00170 00171 00172 /* reimp */ void beginTable( qreal cellpadding, qreal cellspacing, const QString &width ); 00173 00174 /* reimp */ void beginTableRow(); 00175 /* reimp */ void beginTableHeaderCell( const QString &width, int colspan, int rowspan ); 00176 00177 /* reimp */ void beginTableCell( const QString &width, int colspan, int rowspan ); 00178 00179 /* reimp */ void endTable(); 00180 /* reimp */ void endTableRow(); 00181 /* reimp */ void endTableHeaderCell(); 00182 /* reimp */ void endTableCell(); 00183 00199 /* reimp */ void appendLiteralText( const QString &text ); 00200 00206 /* reimp */ void appendRawText( const QString &text ); 00207 00208 /* reimp */ QString getResult(); 00209 00210 private: 00211 TextHTMLBuilderPrivate *d_ptr; 00212 Q_DECLARE_PRIVATE( TextHTMLBuilder ) 00213 00214 }; 00215 00216 } 00217 00218 #endif