compile
[kdegraphics.git] / okular / ui / presentationwidget.h
blob71ef1977ec75a2340ea95700c1cb4d551846a11b
1 /***************************************************************************
2 * Copyright (C) 2004 by Enrico Ros <eros.kde@email.it> *
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 _OKULAR_PRESENTATIONWIDGET_H_
11 #define _OKULAR_PRESENTATIONWIDGET_H_
13 #include <qlist.h>
14 #include <qpixmap.h>
15 #include <qstringlist.h>
16 #include <qwidget.h>
17 #include "core/observer.h"
18 #include "core/pagetransition.h"
20 class QLineEdit;
21 class QToolBar;
22 class QTimer;
23 class KActionCollection;
24 class KSelectAction;
25 class AnnotatorEngine;
26 struct PresentationFrame;
27 class PresentationSearchBar;
29 namespace Okular {
30 class Action;
31 class Annotation;
32 class Document;
33 class Page;
36 /**
37 * @short A widget that shows pages as fullscreen slides (with transitions fx).
39 * This is a fullscreen widget that displays
41 class PresentationWidget : public QWidget, public Okular::DocumentObserver
43 Q_OBJECT
44 public:
45 PresentationWidget( QWidget * parent, Okular::Document * doc );
46 ~PresentationWidget();
48 // inherited from DocumentObserver
49 uint observerId() const { return PRESENTATION_ID; }
50 void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags );
51 void notifyViewportChanged( bool smoothMove );
52 void notifyPageChanged( int pageNumber, int changedFlags );
53 bool canUnloadPixmap( int pageNumber ) const;
55 // create actions that interact with this widget
56 void setupActions( KActionCollection * collection );
58 public slots:
59 void slotFind();
61 protected:
62 // widget events
63 bool event( QEvent * e );
64 void keyPressEvent( QKeyEvent * e );
65 void wheelEvent( QWheelEvent * e );
66 void mousePressEvent( QMouseEvent * e );
67 void mouseReleaseEvent( QMouseEvent * e );
68 void mouseMoveEvent( QMouseEvent * e );
69 void paintEvent( QPaintEvent * e );
71 private:
72 const Okular::Action * getLink( int x, int y, QRect * geometry = 0 ) const;
73 void testCursorOnLink( int x, int y );
74 void overlayClick( const QPoint & position );
75 void changePage( int newPage );
76 void generatePage( bool disableTransition = false );
77 void generateIntroPage( QPainter & p );
78 void generateContentsPage( int page, QPainter & p );
79 void generateOverlay();
80 void initTransition( const Okular::PageTransition *transition );
81 const Okular::PageTransition defaultTransition() const;
82 const Okular::PageTransition defaultTransition( int ) const;
83 QRect routeMouseDrawingEvent( QMouseEvent * );
84 void startAutoChangeTimer();
85 void recalcGeometry();
86 void repositionContent();
87 void requestPixmaps();
88 void setScreen( int );
89 void inhibitScreenSaver();
90 void allowScreenSaver();
92 // cache stuff
93 int m_width;
94 int m_height;
95 QPixmap m_lastRenderedPixmap;
96 QPixmap m_lastRenderedOverlay;
97 QRect m_overlayGeometry;
98 const Okular::Action * m_pressedLink;
99 bool m_handCursor;
100 QList< Okular::Annotation * > m_currentPageDrawings;
101 AnnotatorEngine * m_drawingEngine;
102 QRect m_drawingRect;
103 int m_screen;
104 int m_screenSaverCookie;
106 // transition related
107 QTimer * m_transitionTimer;
108 QTimer * m_overlayHideTimer;
109 QTimer * m_nextPageTimer;
110 int m_transitionDelay;
111 int m_transitionMul;
112 QList< QRect > m_transitionRects;
114 // misc stuff
115 Okular::Document * m_document;
116 QVector< PresentationFrame * > m_frames;
117 int m_frameIndex;
118 QStringList m_metaStrings;
119 QToolBar * m_topBar;
120 QLineEdit *m_pagesEdit;
121 PresentationSearchBar *m_searchBar;
122 KActionCollection * m_ac;
123 KSelectAction * m_screenSelect;
124 bool m_blockNotifications;
125 bool m_inBlackScreenMode;
127 private slots:
128 void slotNextPage();
129 void slotPrevPage();
130 void slotFirstPage();
131 void slotLastPage();
132 void slotHideOverlay();
133 void slotTransitionStep();
134 void slotDelayedEvents();
135 void slotPageChanged();
136 void togglePencilMode( bool );
137 void clearDrawings();
138 void screenResized( int );
139 void chooseScreen( QAction * );
140 void toggleBlackScreenMode( bool );
143 #endif