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 QTEXTTABLE_P_H
5#define QTEXTTABLE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/private/qtguiglobal_p.h>
19#include "private/qtextobject_p.h"
20#include "private/qtextdocument_p.h"
21
22#include <vector>
23
24QT_BEGIN_NAMESPACE
25
26class QTextTablePrivate : public QTextFramePrivate
27{
28 Q_DECLARE_PUBLIC(QTextTable)
29public:
30 QTextTablePrivate(QTextDocument *document) : QTextFramePrivate(document), nRows(0), nCols(0), dirty(true), blockFragmentUpdates(false) {}
31
32 static QTextTable *createTable(QTextDocumentPrivate *, int pos, int rows, int cols, const QTextTableFormat &tableFormat);
33 void fragmentAdded(QChar type, uint fragment) override;
34 void fragmentRemoved(QChar type, uint fragment) override;
35
36 void update() const;
37
38 int findCellIndex(int fragment) const;
39
40 QList<int> cells;
41 // symmetric to cells array and maps to indecs in grid,
42 // used for fast-lookup for row/column by fragment
43 mutable QList<int> cellIndices;
44 mutable std::vector<int> grid;
45 mutable int nRows;
46 mutable int nCols;
47 mutable bool dirty;
48 bool blockFragmentUpdates;
49};
50
51QT_END_NAMESPACE
52
53#endif // QTEXTTABLE_P_H
54

source code of qtbase/src/gui/text/qtexttable_p.h