1 | // Copyright (C) 2016 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | #ifndef QTEXTDOCUMENTWRITER_H |
4 | #define QTEXTDOCUMENTWRITER_H |
5 | |
6 | #include <QtGui/qtguiglobal.h> |
7 | #include <QtCore/qstring.h> |
8 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | |
12 | class QTextDocumentWriterPrivate; |
13 | class QIODevice; |
14 | class QByteArray; |
15 | class QTextDocument; |
16 | class QTextDocumentFragment; |
17 | |
18 | class Q_GUI_EXPORT QTextDocumentWriter |
19 | { |
20 | public: |
21 | QTextDocumentWriter(); |
22 | QTextDocumentWriter(QIODevice *device, const QByteArray &format); |
23 | explicit QTextDocumentWriter(const QString &fileName, const QByteArray &format = QByteArray()); |
24 | ~QTextDocumentWriter(); |
25 | |
26 | void setFormat (const QByteArray &format); |
27 | QByteArray format () const; |
28 | |
29 | void setDevice (QIODevice *device); |
30 | QIODevice *device () const; |
31 | void setFileName (const QString &fileName); |
32 | QString fileName () const; |
33 | |
34 | bool write(const QTextDocument *document); |
35 | bool write(const QTextDocumentFragment &fragment); |
36 | |
37 | static QList<QByteArray> supportedDocumentFormats(); |
38 | |
39 | private: |
40 | Q_DISABLE_COPY(QTextDocumentWriter) |
41 | QTextDocumentWriterPrivate *d; |
42 | }; |
43 | |
44 | QT_END_NAMESPACE |
45 | |
46 | #endif |
47 |