|
Grantlee
5.1.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_textdocument_export.h" 00030 #include "markupdirector.h" 00031 00032 namespace Grantlee 00033 { 00034 00035 class TextHTMLBuilderPrivate; 00036 00038 00103 class GRANTLEE_TEXTDOCUMENT_EXPORT TextHTMLBuilder 00104 : virtual public AbstractMarkupBuilder 00105 { 00106 public: 00110 TextHTMLBuilder(); 00111 ~TextHTMLBuilder() override; 00112 00113 void beginStrong() override; 00114 void endStrong() override; 00115 void beginEmph() override; 00116 void endEmph() override; 00117 void beginUnderline() override; 00118 void endUnderline() override; 00119 void beginStrikeout() override; 00120 void endStrikeout() override; 00121 void beginForeground(const QBrush &brush) override; 00122 void endForeground() override; 00123 void beginBackground(const QBrush &brush) override; 00124 void endBackground() override; 00125 void beginAnchor(const QString &href = QString(), 00126 const QString &name = QString()) override; 00127 void endAnchor() override; 00128 00129 // Maybe this stuff should just be added to a list, and then when I add 00130 // literal text, 00131 // add some kind of style attribute in one span instead of many. 00132 void beginFontFamily(const QString &family) override; 00133 void endFontFamily() override; 00134 00139 void beginFontPointSize(int size) override; 00140 void endFontPointSize() override; 00141 00150 void beginParagraph(Qt::Alignment al = Qt::AlignLeft, qreal topMargin = 0.0, 00151 qreal bottomMargin = 0.0, qreal leftMargin = 0.0, 00152 qreal rightMargin = 0.0) override; 00153 00158 void beginHeader(int level) override; 00159 00164 void endHeader(int level) override; 00165 00166 void endParagraph() override; 00167 void addNewline() override; 00168 00169 void insertHorizontalRule(int width = -1) override; 00170 00171 void insertImage(const QString &src, qreal width, qreal height) override; 00172 00173 void beginList(QTextListFormat::Style type) override; 00174 00175 void endList() override; 00176 00177 void beginListItem() override; 00178 void endListItem() override; 00179 00180 void beginSuperscript() override; 00181 00182 void endSuperscript() override; 00183 00184 void beginSubscript() override; 00185 00186 void endSubscript() override; 00187 00188 void beginTable(qreal cellpadding, qreal cellspacing, 00189 const QString &width) override; 00190 00191 void beginTableRow() override; 00192 void beginTableHeaderCell(const QString &width, int colspan, 00193 int rowspan) override; 00194 00195 void beginTableCell(const QString &width, int colspan, int rowspan) override; 00196 00197 void endTable() override; 00198 void endTableRow() override; 00199 void endTableHeaderCell() override; 00200 void endTableCell() override; 00201 00217 void appendLiteralText(const QString &text) override; 00218 00224 void appendRawText(const QString &text) override; 00225 00226 QString getResult() override; 00227 00228 private: 00229 TextHTMLBuilderPrivate *d_ptr; 00230 Q_DECLARE_PRIVATE(TextHTMLBuilder) 00231 }; 00232 } 00233 00234 #endif
1.7.6.1