-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqbasichtmlexporter.h
41 lines (33 loc) · 1.13 KB
/
qbasichtmlexporter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef QBASICHTML_H
#define QBASICHTML_H
#include <QTextDocument>
#include <QTextFrame>
class QBasicHtmlExporter
{
public:
QBasicHtmlExporter(QTextDocument *_doc);
enum ExportMode {
ExportEntireDocument,
ExportFragment
};
QString toHtml();
private:
enum StyleMode { EmitStyleTag, OmitStyleTag };
enum FrameType { TextFrame, TableFrame, RootFrame };
enum Heading {paragraph, h1,h2,h3,h4,h5}; // Unfortunately Qt won't allow us to accurately find h6
Heading headingType(QString name);
QString headingStr(Heading heading);
QString getTagName(const QTextCharFormat &format);
void emitFrame(const QTextFrame::Iterator &frameIt);
void emitTable(const QTextTable *table);
void emitTextFrame(const QTextFrame *f);
void emitBlock(const QTextBlock &block);
void emitFragment(const QTextFragment &fragment);
void emitAttribute(const char *attribute, const QString &value);
QStringList emitCharFormatStyle(const QTextCharFormat &format);
QString html;
QTextCharFormat defaultCharFormat;
const QTextDocument *doc;
bool fragmentMarkers;
};
#endif // QBASICHTML_H