Grantlee  5.1.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_textdocument_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 
00052 class GRANTLEE_TEXTDOCUMENT_EXPORT AbstractMarkupBuilder
00053 {
00054 public:
00056   virtual ~AbstractMarkupBuilder() {}
00057 
00059   virtual void beginStrong() = 0;
00060 
00062   virtual void endStrong() = 0;
00063 
00065   virtual void beginEmph() = 0;
00066 
00068   virtual void endEmph() = 0;
00069 
00071   virtual void beginUnderline() = 0;
00072 
00074   virtual void endUnderline() = 0;
00075 
00077   virtual void beginStrikeout() = 0;
00078 
00080   virtual void endStrikeout() = 0;
00081 
00085   virtual void beginForeground(const QBrush &brush) = 0;
00086 
00088   virtual void endForeground() = 0;
00089 
00092   virtual void beginBackground(const QBrush &brush) = 0;
00093 
00095   virtual void endBackground() = 0;
00096 
00102   virtual void beginAnchor(const QString &href = QString(),
00103                            const QString &name = QString())
00104       = 0;
00105 
00107   virtual void endAnchor() = 0;
00108 
00113   virtual void beginFontFamily(const QString &family) = 0;
00114 
00116   virtual void endFontFamily() = 0;
00117 
00122   virtual void beginFontPointSize(int size) = 0;
00123 
00125   virtual void endFontPointSize() = 0;
00126 
00135   virtual void beginParagraph(Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0,
00136                               qreal bottom = 0.0, qreal left = 0.0,
00137                               qreal right = 0.0)
00138       = 0;
00139 
00141   virtual void endParagraph() = 0;
00143   virtual void addNewline() = 0;
00144 
00149   virtual void insertHorizontalRule(int width = -1) = 0;
00150 
00157   virtual void insertImage(const QString &url, qreal width, qreal height) = 0;
00158 
00164   virtual void beginList(QTextListFormat::Style style) = 0;
00165 
00169   virtual void endList() = 0;
00170 
00172   virtual void beginListItem() = 0;
00173 
00175   virtual void endListItem() = 0;
00176 
00178   virtual void beginSuperscript() = 0;
00179 
00181   virtual void endSuperscript() = 0;
00182 
00184   virtual void beginSubscript() = 0;
00185 
00187   virtual void endSubscript() = 0;
00188 
00197   virtual void beginTable(qreal cellpadding, qreal cellspacing,
00198                           const QString &width)
00199       = 0;
00200 
00204   virtual void beginTableRow() = 0;
00205 
00212   virtual void beginTableHeaderCell(const QString &width, int colSpan,
00213                                     int rowSpan)
00214       = 0;
00215 
00222   virtual void beginTableCell(const QString &width, int colSpan, int rowSpan)
00223       = 0;
00224 
00226   virtual void endTable() = 0;
00227 
00229   virtual void endTableRow() = 0;
00230 
00232   virtual void endTableHeaderCell() = 0;
00233 
00235   virtual void endTableCell() = 0;
00236 
00241   virtual void beginHeader(int level) = 0;
00242 
00247   virtual void endHeader(int level) = 0;
00248 
00254   virtual void appendLiteralText(const QString &text) = 0;
00255 
00259   virtual void appendRawText(const QString &text) = 0;
00260 
00268   virtual QString getResult() = 0;
00269 };
00270 }
00271 
00272 #endif