2007-09-08 17:10:35 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2006 by Pino Toscano <pino@kde.org> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef ANNOTATIONMODEL_H
|
|
|
|
#define ANNOTATIONMODEL_H
|
|
|
|
|
2020-07-08 11:54:37 +00:00
|
|
|
#include <QAbstractItemModel>
|
2007-09-08 17:10:35 +00:00
|
|
|
|
|
|
|
namespace Okular {
|
|
|
|
class Annotation;
|
|
|
|
class Document;
|
|
|
|
}
|
|
|
|
|
|
|
|
class AnnotationModelPrivate;
|
|
|
|
|
|
|
|
class AnnotationModel : public QAbstractItemModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
AuthorRole = Qt::UserRole + 1000,
|
|
|
|
PageRole
|
|
|
|
};
|
|
|
|
|
2017-03-02 19:09:32 +00:00
|
|
|
explicit AnnotationModel( Okular::Document *document, QObject *parent = nullptr );
|
2019-12-18 11:51:13 +00:00
|
|
|
~AnnotationModel() override;
|
2007-09-08 17:10:35 +00:00
|
|
|
|
|
|
|
// reimplementations from QAbstractItemModel
|
2017-03-02 19:39:24 +00:00
|
|
|
int columnCount( const QModelIndex &parent = QModelIndex() ) const override;
|
|
|
|
QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
|
|
|
|
bool hasChildren( const QModelIndex &parent = QModelIndex() ) const override;
|
|
|
|
QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
|
|
|
|
QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const override;
|
|
|
|
QModelIndex parent( const QModelIndex &index ) const override;
|
|
|
|
int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
|
2007-09-08 17:10:35 +00:00
|
|
|
|
|
|
|
bool isAnnotation( const QModelIndex &index ) const;
|
|
|
|
Okular::Annotation* annotationForIndex( const QModelIndex &index ) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// storage
|
|
|
|
friend class AnnotationModelPrivate;
|
|
|
|
AnnotationModelPrivate *const d;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|