Grantlee  0.2.0
textdocument/lib/abstractmarkupbuilder.h
00001 /*
00002   This file is part of the Grantlee template system.
00003 
00004   Copyright (c) 2008,2010 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_ABSTRACTMARKUPBUILDER_H
00022 #define GRANTLEE_ABSTRACTMARKUPBUILDER_H
00023 
00024 #include "grantlee_gui_export.h"
00025 
00026 #include <QtCore/QString>
00027 #include <QtGui/QTextListFormat>
00028 
00029 class QBrush;
00030 
00031 namespace Grantlee
00032 {
00033 
00034 class AbstractMarkupBuilderPrivate;
00035 
00037 
00049 class GRANTLEE_GUI_EXPORT AbstractMarkupBuilder
00050 {
00051 public:
00053   virtual ~AbstractMarkupBuilder() {}
00054 
00056   virtual void beginStrong() = 0;
00057 
00059   virtual void endStrong() = 0;
00060 
00062   virtual void beginEmph() = 0;
00063 
00065   virtual void endEmph() = 0;
00066 
00068   virtual void beginUnderline() = 0;
00069 
00071   virtual void endUnderline() = 0;
00072 
00074   virtual void beginStrikeout() = 0;
00075 
00077   virtual void endStrikeout() = 0;
00078 
00080   virtual void beginForeground( const QBrush &brush ) = 0;
00081 
00083   virtual void endForeground() = 0;
00084 
00086   virtual void beginBackground( const QBrush &brush ) = 0;
00087 
00089   virtual void endBackground() = 0;
00090 
00096   virtual void beginAnchor( const QString &href = QString(), const QString &name = QString() ) = 0;
00097 
00099   virtual void endAnchor() = 0;
00100 
00105   virtual void beginFontFamily( const QString &family ) = 0;
00106 
00108   virtual void endFontFamily() = 0;
00109 
00114   virtual void beginFontPointSize( int size ) = 0;
00115 
00117   virtual void endFontPointSize() = 0;
00118 
00127   virtual void beginParagraph( Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0, qreal bottom = 0.0, qreal left = 0.0, qreal right = 0.0 ) = 0;
00128 
00130   virtual void endParagraph() = 0;
00132   virtual void addNewline() = 0;
00133 
00138   virtual void insertHorizontalRule( int width = -1 ) = 0;
00139 
00146   virtual void insertImage( const QString &url, qreal width, qreal height ) = 0;
00147 
00153   virtual void beginList( QTextListFormat::Style style ) = 0;
00154 
00158   virtual void endList() = 0;
00159 
00161   virtual void beginListItem() = 0;
00162 
00164   virtual void endListItem() = 0;
00165 
00167   virtual void beginSuperscript() = 0;
00168 
00170   virtual void endSuperscript() = 0;
00171 
00173   virtual void beginSubscript() = 0;
00174 
00176   virtual void endSubscript() = 0;
00177 
00185   virtual void beginTable( qreal cellpadding, qreal cellspacing, const QString &width ) = 0;
00186 
00190   virtual void beginTableRow() = 0;
00191 
00198   virtual void beginTableHeaderCell( const QString &width, int colSpan, int rowSpan ) = 0;
00199 
00206   virtual void beginTableCell( const QString &width, int colSpan, int rowSpan ) = 0;
00207 
00209   virtual void endTable() = 0;
00210 
00212   virtual void endTableRow() = 0;
00213 
00215   virtual void endTableHeaderCell() = 0;
00216 
00218   virtual void endTableCell() = 0;
00219 
00224   virtual void beginHeader( int level ) = 0;
00225 
00230   virtual void endHeader( int level ) = 0;
00231 
00237   virtual void appendLiteralText( const QString &text ) = 0;
00238 
00242   virtual void appendRawText( const QString &text ) = 0;
00243 
00249   virtual QString getResult() = 0;
00250 };
00251 
00252 }
00253 
00254 #endif