okular/ui/tocmodel.h
Pino Toscano a917f080e6 Create a model for the TOC, and use that for displaying the TOC of the document.
svn path=/trunk/KDE/kdegraphics/okular/; revision=710317
2007-09-09 16:15:33 +00:00

53 lines
2 KiB
C++

/***************************************************************************
* Copyright (C) 2007 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 TOCMODEL_H
#define TOCMODEL_H
#include <qabstractitemmodel.h>
namespace Okular {
class Document;
class DocumentSynopsis;
class DocumentViewport;
}
class TOCModelPrivate;
class TOCModel : public QAbstractItemModel
{
Q_OBJECT
public:
TOCModel( Okular::Document *document, QObject *parent = 0 );
virtual ~TOCModel();
// reimplementations from QAbstractItemModel
virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
virtual bool hasChildren( const QModelIndex &parent = QModelIndex() ) const;
virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
virtual QModelIndex parent( const QModelIndex &index ) const;
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
void fill( const Okular::DocumentSynopsis *toc );
void clear();
void setCurrentViewport( const Okular::DocumentViewport &viewport );
QString externalFileNameForIndex( const QModelIndex &index ) const;
Okular::DocumentViewport viewportForIndex( const QModelIndex &index ) const;
private:
// storage
friend class TOCModelPrivate;
TOCModelPrivate *const d;
};
#endif