|
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_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: 00038 BBCodeBuilder(); 00039 00040 ~BBCodeBuilder() override; 00041 00042 void beginStrong() override; 00043 void endStrong() override; 00044 void beginEmph() override; 00045 void endEmph() override; 00046 void beginUnderline() override; 00047 void endUnderline() override; 00048 void beginStrikeout() override; 00049 void endStrikeout() override; 00050 void beginForeground(const QBrush &brush) override; 00051 void endForeground() override; 00052 00053 // Background colour not supported by BBCode. 00054 00055 void beginAnchor(const QString &href = QString(), 00056 const QString &name = QString()) override; 00057 void endAnchor() override; 00058 00059 // Font family not supported by BBCode. 00060 00068 void beginFontPointSize(int size) override; 00069 void endFontPointSize() override; 00070 00071 void beginParagraph(Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0, 00072 qreal bottom = 0.0, qreal left = 0.0, 00073 qreal right = 0.0) override; 00074 00075 void endParagraph() override; 00076 void addNewline() override; 00077 00078 void insertImage(const QString &src, qreal width, qreal height) override; 00079 00080 void beginList(QTextListFormat::Style type) override; 00081 00082 void endList() override; 00083 00084 void beginListItem() override; 00085 00086 void beginSuperscript() override; 00087 00088 void endSuperscript() override; 00089 00090 void beginSubscript() override; 00091 00092 void endSubscript() override; 00093 00094 void beginTable(qreal, qreal, const QString &) override; 00095 00096 void beginTableRow() override; 00097 00098 void appendLiteralText(const QString &text) override; 00099 00103 const QString escape(const QString &text) const; 00104 00105 QString getResult() override; 00106 00107 private: 00108 QList<QTextListFormat::Style> m_currentListItemStyles; 00109 00110 QString m_text; 00111 00112 Qt::Alignment m_currentAlignment; 00113 }; 00114 } 00115 00116 #endif
1.7.6.1