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. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
#ifndef _OKULAR_PRESENTATIONWIDGET_H_
|
|
|
|
#define _OKULAR_PRESENTATIONWIDGET_H_
|
2004-12-17 17:14:46 +00:00
|
|
|
|
2005-06-13 16:55:57 +00:00
|
|
|
#include <qdialog.h>
|
2006-03-24 19:35:20 +00:00
|
|
|
#include <qlist.h>
|
2004-12-17 17:14:46 +00:00
|
|
|
#include <qpixmap.h>
|
|
|
|
#include <qstringlist.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
|
|
|
|
2006-06-29 18:12:12 +00:00
|
|
|
class QLineEdit;
|
2006-04-01 22:54:26 +00:00
|
|
|
class QToolBar;
|
2004-12-17 17:14:46 +00:00
|
|
|
class QTimer;
|
2006-06-25 16:34:11 +00:00
|
|
|
class KActionCollection;
|
2006-11-01 15:34:27 +00:00
|
|
|
class AnnotatorEngine;
|
2007-03-18 17:14:36 +00:00
|
|
|
struct PresentationFrame;
|
2007-03-17 22:58:41 +00:00
|
|
|
class PresentationSearchBar;
|
2005-01-02 14:55:14 +00:00
|
|
|
|
2006-09-21 08:45:36 +00:00
|
|
|
namespace Okular {
|
2007-04-20 12:37:12 +00:00
|
|
|
class Action;
|
2007-03-18 17:14:36 +00:00
|
|
|
class Annotation;
|
2006-09-21 08:45:36 +00:00
|
|
|
class Document;
|
|
|
|
class Page;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
*/
|
2006-09-21 08:45:36 +00:00
|
|
|
class PresentationWidget : public QDialog, public Okular::DocumentObserver
|
2004-12-17 17:14:46 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2006-09-21 08:45:36 +00:00
|
|
|
PresentationWidget( QWidget * parent, Okular::Document * doc );
|
2004-12-17 17:14:46 +00:00
|
|
|
~PresentationWidget();
|
|
|
|
|
2005-01-09 23:37:07 +00:00
|
|
|
// inherited from DocumentObserver
|
2004-12-17 17:14:46 +00:00
|
|
|
uint observerId() const { return PRESENTATION_ID; }
|
2007-09-09 10:50:36 +00:00
|
|
|
void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags );
|
2005-02-01 18:23:55 +00:00
|
|
|
void notifyViewportChanged( bool smoothMove );
|
2005-01-09 23:37:07 +00:00
|
|
|
void notifyPageChanged( int pageNumber, int changedFlags );
|
2006-11-20 20:10:42 +00:00
|
|
|
bool canUnloadPixmap( int pageNumber ) const;
|
2004-12-17 17:14:46 +00:00
|
|
|
|
2006-06-25 16:34:11 +00:00
|
|
|
// create actions that interact with this widget
|
|
|
|
void setupActions( KActionCollection * collection );
|
|
|
|
|
2007-04-20 19:45:33 +00:00
|
|
|
public slots:
|
|
|
|
void slotFind();
|
|
|
|
|
2004-12-17 17:14:46 +00:00
|
|
|
protected:
|
|
|
|
// widget events
|
2006-06-16 17:04:21 +00:00
|
|
|
bool event( QEvent * e );
|
2004-12-17 17:14:46 +00:00
|
|
|
void keyPressEvent( QKeyEvent * e );
|
|
|
|
void wheelEvent( QWheelEvent * e );
|
|
|
|
void mousePressEvent( QMouseEvent * e );
|
2005-07-18 17:51:27 +00:00
|
|
|
void mouseReleaseEvent( QMouseEvent * e );
|
2004-12-17 17:14:46 +00:00
|
|
|
void mouseMoveEvent( QMouseEvent * e );
|
|
|
|
void paintEvent( QPaintEvent * e );
|
|
|
|
|
|
|
|
private:
|
2007-04-20 12:37:12 +00:00
|
|
|
const Okular::Action * getLink( int x, int y, QRect * geometry = 0 ) const;
|
2005-07-18 17:51:27 +00:00
|
|
|
void testCursorOnLink( int x, int y );
|
2005-01-03 15:51:05 +00:00
|
|
|
void overlayClick( const QPoint & position );
|
|
|
|
void changePage( int newPage );
|
2006-11-01 15:34:27 +00:00
|
|
|
void generatePage( bool disableTransition = false );
|
2004-12-17 17:14:46 +00:00
|
|
|
void generateIntroPage( QPainter & p );
|
|
|
|
void generateContentsPage( int page, QPainter & p );
|
|
|
|
void generateOverlay();
|
2006-09-21 08:45:36 +00:00
|
|
|
void initTransition( const Okular::PageTransition *transition );
|
|
|
|
const Okular::PageTransition defaultTransition() const;
|
|
|
|
const Okular::PageTransition defaultTransition( int ) const;
|
2006-11-01 15:34:27 +00:00
|
|
|
QRect routeMouseDrawingEvent( QMouseEvent * );
|
2006-12-31 10:48:49 +00:00
|
|
|
void startAutoChangeTimer();
|
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;
|
2007-04-20 12:37:12 +00:00
|
|
|
const Okular::Action * m_pressedLink;
|
2005-07-18 17:51:27 +00:00
|
|
|
bool m_handCursor;
|
2006-11-01 15:34:27 +00:00
|
|
|
QList< Okular::Annotation * > m_currentPageDrawings;
|
|
|
|
AnnotatorEngine * m_drawingEngine;
|
|
|
|
QRect m_drawingRect;
|
2004-12-17 17:14:46 +00:00
|
|
|
|
|
|
|
// transition related
|
|
|
|
QTimer * m_transitionTimer;
|
|
|
|
QTimer * m_overlayHideTimer;
|
2006-11-27 20:17:11 +00:00
|
|
|
QTimer * m_nextPageTimer;
|
2004-12-17 17:14:46 +00:00
|
|
|
int m_transitionDelay;
|
|
|
|
int m_transitionMul;
|
2006-03-24 19:35:20 +00:00
|
|
|
QList< QRect > m_transitionRects;
|
2004-12-17 17:14:46 +00:00
|
|
|
|
|
|
|
// misc stuff
|
2006-09-21 08:45:36 +00:00
|
|
|
Okular::Document * m_document;
|
2006-03-24 19:35:20 +00:00
|
|
|
QVector< PresentationFrame * > m_frames;
|
2004-12-17 17:14:46 +00:00
|
|
|
int m_frameIndex;
|
|
|
|
QStringList m_metaStrings;
|
2006-04-01 22:54:26 +00:00
|
|
|
QToolBar * m_topBar;
|
2006-06-29 18:12:12 +00:00
|
|
|
QLineEdit *m_pagesEdit;
|
2007-03-17 22:58:41 +00:00
|
|
|
PresentationSearchBar *m_searchBar;
|
2006-06-25 16:34:11 +00:00
|
|
|
KActionCollection * m_ac;
|
2004-12-17 17:14:46 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void slotNextPage();
|
|
|
|
void slotPrevPage();
|
2005-06-13 16:47:01 +00:00
|
|
|
void slotFirstPage();
|
|
|
|
void slotLastPage();
|
2004-12-17 17:14:46 +00:00
|
|
|
void slotHideOverlay();
|
|
|
|
void slotTransitionStep();
|
2006-05-13 16:50:53 +00:00
|
|
|
void slotDelayedEvents();
|
2006-06-29 18:12:12 +00:00
|
|
|
void slotPageChanged();
|
2006-11-01 15:34:27 +00:00
|
|
|
void togglePencilMode( bool );
|
|
|
|
void clearDrawings();
|
2004-12-17 17:14:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|