Cutelee  6.1.0
bbcodebuilder.h
1 /*
2  This file is part of the Cutelee template system.
3 
4  Copyright (c) 2008 Stephen Kelly <steveire@gmail.com>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either version
9  2.1 of the Licence, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 
19 */
20 
21 #ifndef CUTELEE_BBCODEBUILDER_H
22 #define CUTELEE_BBCODEBUILDER_H
23 
24 #include "abstractmarkupbuilder.h"
25 
26 namespace Cutelee
27 {
28 
33 {
34 public:
38  BBCodeBuilder();
39 
40  ~BBCodeBuilder() override;
41 
42  void beginStrong() override;
43  void endStrong() override;
44  void beginEmph() override;
45  void endEmph() override;
46  void beginUnderline() override;
47  void endUnderline() override;
48  void beginStrikeout() override;
49  void endStrikeout() override;
50  void beginForeground(const QBrush &brush) override;
51  void endForeground() override;
52 
53  // Background colour not supported by BBCode.
54 
55  void beginAnchor(const QString &href = {}, const QString &name = {}) override;
56  void endAnchor() override;
57 
58  // Font family not supported by BBCode.
59 
65  void beginFontPointSize(int size) override;
66  void endFontPointSize() override;
67 
68  void beginParagraph(Qt::Alignment a = Qt::AlignLeft, qreal top = 0.0,
69  qreal bottom = 0.0, qreal left = 0.0,
70  qreal right = 0.0) override;
71 
72  void endParagraph() override;
73  void addNewline() override;
74 
75  void insertImage(const QString &src, qreal width, qreal height) override;
76 
77  void beginList(QTextListFormat::Style type) override;
78 
79  void endList() override;
80 
81  void beginListItem() override;
82 
83  void beginSuperscript() override;
84 
85  void endSuperscript() override;
86 
87  void beginSubscript() override;
88 
89  void endSubscript() override;
90 
91  void beginTable(qreal, qreal, const QString &) override;
92 
93  void beginTableRow() override;
94 
95  void appendLiteralText(const QString &text) override;
96 
100  const QString escape(const QString &text) const;
101 
102  QString getResult() override;
103 
104 private:
105  QList<QTextListFormat::Style> m_currentListItemStyles;
106 
107  QString m_text;
108 
109  Qt::Alignment m_currentAlignment;
110 };
111 }
112 
113 #endif
Interface for creating marked-up text output.
Builder to create BBCode from a QTextDocument.
Definition: bbcodebuilder.h:33
void endSubscript() override
void endFontPointSize() override
void endParagraph() override
void beginSubscript() override
void beginForeground(const QBrush &brush) override
void beginList(QTextListFormat::Style type) override
const QString escape(const QString &text) const
void beginParagraph(Qt::Alignment a=Qt::AlignLeft, qreal top=0.0, qreal bottom=0.0, qreal left=0.0, qreal right=0.0) override
void beginFontPointSize(int size) override
void beginTableRow() override
void beginSuperscript() override
void beginStrikeout() override
void endUnderline() override
void insertImage(const QString &src, qreal width, qreal height) override
void addNewline() override
void endEmph() override
void endList() override
void endStrong() override
void beginStrong() override
QString getResult() override
void endForeground() override
void endStrikeout() override
void beginTable(qreal, qreal, const QString &) override
void beginAnchor(const QString &href={}, const QString &name={}) override
void endSuperscript() override
void endAnchor() override
void appendLiteralText(const QString &text) override
void beginListItem() override
void beginUnderline() override
void beginEmph() override
The Cutelee namespace holds all public Cutelee API.
Definition: Mainpage.dox:8