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