Debian Codegraph @

qt6/src/poppler-optcontent.h

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