Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtextodfwriter_p.h
Go to the documentation of this file.
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
4#ifndef QTEXTODFWRITER_H
5#define QTEXTODFWRITER_H
6
7#include <QtGui/private/qtguiglobal_p.h>
8
9#ifndef QT_NO_TEXTODFWRITER
10
11//
12// W A R N I N G
13// -------------
14//
15// This file is not part of the Qt API. It exists purely as an
16// implementation detail. This header file may change from version to
17// version without notice, or even be removed.
18//
19// We mean it.
20//
21
22#include <QtCore/qhash.h>
23#include <QtCore/qlist.h>
24#include <QtCore/qset.h>
25#include <QtCore/qstack.h>
26
29
31
32class QTextBlock;
33class QIODevice;
34class QTextBlockFormat;
35class QTextCharFormat;
36class QTextListFormat;
37class QTextFrameFormat;
38class QTextTableCellFormat;
39class QTextFrame;
40class QTextFragment;
41class QOutputStrategy;
42class QXmlStreamWriter;
43
44class Q_AUTOTEST_EXPORT QTextOdfWriter {
45public:
46 QTextOdfWriter(const QTextDocument &document, QIODevice *device);
47 bool writeAll();
48
49 void setCreateArchive(bool on) { m_createArchive = on; }
50 bool createArchive() const { return m_createArchive; }
51
52 void writeBlock(QXmlStreamWriter &writer, const QTextBlock &block);
53 void writeFormats(QXmlStreamWriter &writer, const QSet<int> &formatIds) const;
54 void writeBlockFormat(QXmlStreamWriter &writer, const QTextBlockFormat &format, int formatIndex) const;
55 void writeCharacterFormat(QXmlStreamWriter &writer, const QTextCharFormat &format, int formatIndex) const;
56 void writeListFormat(QXmlStreamWriter &writer, const QTextListFormat &format, int formatIndex) const;
57 void writeFrameFormat(QXmlStreamWriter &writer, const QTextFrameFormat &format, int formatIndex) const;
58 void writeTableFormat(QXmlStreamWriter &writer, const QTextTableFormat &format, int formatIndex) const;
59 void writeTableCellFormat(QXmlStreamWriter &writer, const QTextTableCellFormat &format,
60 int formatIndex, const QList<QTextFormat> &styles) const;
61 void writeFrame(QXmlStreamWriter &writer, const QTextFrame *frame);
62 void writeInlineCharacter(QXmlStreamWriter &writer, const QTextFragment &fragment) const;
63
64 const QString officeNS, textNS, styleNS, foNS, tableNS, drawNS, xlinkNS, svgNS;
65 const int defaultImageResolution = 11811; // 11811 dots per meter = (about) 300 dpi
66
67protected:
68 static QTextTableCellFormat mergeFormats(const QTextTableCellFormat &cell, const QTextTableFormat &table);
69 void tableCellStyleElement(QXmlStreamWriter &writer, int formatIndex,
70 const QTextTableCellFormat &format, bool hasBorder) const;
71
72private:
73 const QTextDocument *m_document;
74 QIODevice *m_device;
75
76 QOutputStrategy *m_strategy;
77 bool m_createArchive;
78
79 QStack<QTextList *> m_listStack;
80
81 QHash<int, QList<int>> m_cellFormatsInTablesWithBorders;
82 QSet<int> m_tableFormatsWithBorders;
83 mutable QSet<int> m_tableFormatsWithColWidthConstraints;
84};
85
86QT_END_NAMESPACE
87
88#endif // QT_NO_TEXTODFWRITER
89#endif // QTEXTODFWRITER_H
The QTextDocumentWriter class provides a format-independent interface for writing a QTextDocument to ...
Combined button and popup list for selecting options.