| 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 |
* \since 0.8 |
| 48 |
*/ |
| 49 |
class POPPLER_QT5_EXPORT OptContentModel : public QAbstractItemModel |
| 50 |
{ |
| 51 |
friend class Document; |
| 52 |
|
| 53 |
Q_OBJECT |
| 54 |
|
| 55 |
public: |
| 56 |
~OptContentModel() override; |
| 57 |
|
| 58 |
QModelIndex index(int row, int column, const QModelIndex &parent) const override; |
| 59 |
QModelIndex parent(const QModelIndex &child) const override; |
| 60 |
|
| 61 |
int rowCount(const QModelIndex &parent = QModelIndex()) const override; |
| 62 |
int columnCount(const QModelIndex &parent) const override; |
| 63 |
|
| 64 |
QVariant data(const QModelIndex &index, int role) const override; |
| 65 |
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; |
| 66 |
|
| 67 |
Qt::ItemFlags flags(const QModelIndex &index) const override; |
| 68 |
|
| 69 |
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; |
| 70 |
|
| 71 |
/** |
| 72 |
* Applies the Optional Content Changes specified by that link. |
| 73 |
* \since 0.50 |
| 74 |
*/ |
| 75 |
void applyLink(LinkOCGState *link); |
| 76 |
|
| 77 |
private: |
| 78 |
explicit OptContentModel(const OCGs *optContent, QObject *parent = nullptr); |
| 79 |
|
| 80 |
friend class OptContentModelPrivate; |
| 81 |
OptContentModelPrivate *d; |
| 82 |
}; |
| 83 |
} |
| 84 |
|
| 85 |
#endif |