compile
[kdegraphics.git] / okular / ui / tocmodel.h
blob5d172573beaa23e7426d126c262e024832b739ee
1 /***************************************************************************
2 * Copyright (C) 2007 by Pino Toscano <pino@kde.org> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 ***************************************************************************/
10 #ifndef TOCMODEL_H
11 #define TOCMODEL_H
13 #include <qabstractitemmodel.h>
15 namespace Okular {
16 class Document;
17 class DocumentSynopsis;
18 class DocumentViewport;
21 class TOCModelPrivate;
23 class TOCModel : public QAbstractItemModel
25 Q_OBJECT
27 public:
28 TOCModel( Okular::Document *document, QObject *parent = 0 );
29 virtual ~TOCModel();
31 // reimplementations from QAbstractItemModel
32 virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
33 virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
34 virtual bool hasChildren( const QModelIndex &parent = QModelIndex() ) const;
35 virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
36 virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
37 virtual QModelIndex parent( const QModelIndex &index ) const;
38 virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
40 void fill( const Okular::DocumentSynopsis *toc );
41 void clear();
42 void setCurrentViewport( const Okular::DocumentViewport &viewport );
44 bool isEmpty() const;
46 QString externalFileNameForIndex( const QModelIndex &index ) const;
47 Okular::DocumentViewport viewportForIndex( const QModelIndex &index ) const;
49 private:
50 // storage
51 friend class TOCModelPrivate;
52 TOCModelPrivate *const d;
55 #endif