1/* poppler-optcontent.h: qt interface to poppler
2 *
3 * Copyright (C) 2007, Brad Hards <bradh@kde.org>
4 * Copyright (C) 2008, Pino Toscano <pino@kde.org>
5 * Copyright (C) 2013, Anthony Granger <grangeranthony@gmail.com>
6 * Copyright (C) 2016, 2021, Albert Astals Cid <aacid@kde.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef POPPLER_OPTCONTENT_H
24#define POPPLER_OPTCONTENT_H
25
26#include <QtCore/QAbstractListModel>
27
28#include "poppler-export.h"
29#include "poppler-link.h"
30
31class OCGs;
32
33namespace Poppler {
34class Document;
35class OptContentModelPrivate;
36
37/**
38 * \brief Model for optional content
39 *
40 * OptContentModel is an item model representing the optional content items
41 * that can be found in PDF documents.
42 *
43 * The model offers a mostly read-only display of the data, allowing to
44 * enable/disable some contents setting the Qt::CheckStateRole data role.
45 */
46class POPPLER_QT6_EXPORT OptContentModel : public QAbstractItemModel
47{
48 friend class Document;
49
50 Q_OBJECT
51
52public:
53 ~OptContentModel() override;
54
55 QModelIndex index(int row, int column, const QModelIndex &parent) const override;
56 QModelIndex parent(const QModelIndex &child) const override;
57
58 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
59 int columnCount(const QModelIndex &parent) const override;
60
61 QVariant data(const QModelIndex &index, int role) const override;
62 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
63
64 Qt::ItemFlags flags(const QModelIndex &index) const override;
65
66 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
67
68 /**
69 * Applies the Optional Content Changes specified by that link.
70 */
71 void applyLink(LinkOCGState *link);
72
73private:
74 explicit OptContentModel(OCGs *optContent, QObject *parent = nullptr);
75
76 friend class OptContentModelPrivate;
77 OptContentModelPrivate *d;
78};
79}
80
81#endif
82

source code of poppler/qt6/src/poppler-optcontent.h