2004-12-17 17:14:46 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2004 by Enrico Ros <eros.kde@email.it> *
|
|
|
|
* *
|
|
|
|
* 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 _KPDF_PRESENTATIONWIDGET_H_
|
|
|
|
#define _KPDF_PRESENTATIONWIDGET_H_
|
|
|
|
|
|
|
|
#include <qwidget.h>
|
|
|
|
#include <qpixmap.h>
|
|
|
|
#include <qstringlist.h>
|
|
|
|
#include <qvaluevector.h>
|
2005-01-02 14:55:14 +00:00
|
|
|
#include "core/observer.h"
|
2005-01-02 20:32:58 +00:00
|
|
|
#include "core/pagetransition.h"
|
2004-12-17 17:14:46 +00:00
|
|
|
|
|
|
|
class KToolBar;
|
|
|
|
class QTimer;
|
|
|
|
|
2005-01-02 14:55:14 +00:00
|
|
|
class KPDFDocument;
|
|
|
|
class KPDFPage;
|
|
|
|
class PresentationFrame;
|
|
|
|
|
2004-12-17 17:14:46 +00:00
|
|
|
/**
|
|
|
|
* @short A widget that shows pages as fullscreen slides (with transitions fx).
|
|
|
|
*
|
|
|
|
* This is a fullscreen widget that displays
|
|
|
|
*/
|
|
|
|
class PresentationWidget : public QWidget, public KPDFDocumentObserver
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
PresentationWidget( KPDFDocument * doc );
|
|
|
|
~PresentationWidget();
|
|
|
|
|
|
|
|
// inherited from KPDFDocumentObserver
|
|
|
|
uint observerId() const { return PRESENTATION_ID; }
|
|
|
|
void pageSetup( const QValueVector<KPDFPage*> & pages, bool documentChanged );
|
2004-12-22 18:21:36 +00:00
|
|
|
bool canUnloadPixmap( int pageNumber );
|
2004-12-17 17:14:46 +00:00
|
|
|
void notifyPixmapChanged( int pageNumber );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// widget events
|
|
|
|
void keyPressEvent( QKeyEvent * e );
|
|
|
|
void wheelEvent( QWheelEvent * e );
|
|
|
|
void mousePressEvent( QMouseEvent * e );
|
|
|
|
void mouseMoveEvent( QMouseEvent * e );
|
|
|
|
void paintEvent( QPaintEvent * e );
|
|
|
|
|
|
|
|
private:
|
2005-01-03 15:51:05 +00:00
|
|
|
void overlayClick( const QPoint & position );
|
|
|
|
void changePage( int newPage );
|
2004-12-17 17:14:46 +00:00
|
|
|
void generatePage();
|
|
|
|
void generateIntroPage( QPainter & p );
|
|
|
|
void generateContentsPage( int page, QPainter & p );
|
|
|
|
void generateOverlay();
|
2005-01-02 20:32:58 +00:00
|
|
|
void initTransition( const KPDFPageTransition *transition );
|
2004-12-17 17:14:46 +00:00
|
|
|
|
|
|
|
// cache stuff
|
|
|
|
int m_width;
|
|
|
|
int m_height;
|
|
|
|
QPixmap m_lastRenderedPixmap;
|
|
|
|
QPixmap m_lastRenderedOverlay;
|
|
|
|
QRect m_overlayGeometry;
|
|
|
|
|
|
|
|
// transition related
|
|
|
|
QTimer * m_transitionTimer;
|
|
|
|
QTimer * m_overlayHideTimer;
|
|
|
|
int m_transitionDelay;
|
|
|
|
int m_transitionMul;
|
|
|
|
QValueList< QRect > m_transitionRects;
|
|
|
|
|
|
|
|
// misc stuff
|
|
|
|
KPDFDocument * m_document;
|
|
|
|
QValueVector< PresentationFrame * > m_frames;
|
|
|
|
int m_frameIndex;
|
|
|
|
QStringList m_metaStrings;
|
|
|
|
KToolBar * m_topBar;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void slotNextPage();
|
|
|
|
void slotPrevPage();
|
|
|
|
void slotHideOverlay();
|
|
|
|
void slotTransitionStep();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|