1 /***************************************************************************
2 * Copyright (C) 2004 by Enrico Ros <eros.kde@email.it> *
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_
15 #include <qstringlist.h>
17 #include "core/observer.h"
18 #include "core/pagetransition.h"
23 class KActionCollection
;
25 class AnnotatorEngine
;
26 struct PresentationFrame
;
27 class PresentationSearchBar
;
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
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
);
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
);
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();
95 QPixmap m_lastRenderedPixmap
;
96 QPixmap m_lastRenderedOverlay
;
97 QRect m_overlayGeometry
;
98 const Okular::Action
* m_pressedLink
;
100 QList
< Okular::Annotation
* > m_currentPageDrawings
;
101 AnnotatorEngine
* m_drawingEngine
;
104 int m_screenSaverCookie
;
106 // transition related
107 QTimer
* m_transitionTimer
;
108 QTimer
* m_overlayHideTimer
;
109 QTimer
* m_nextPageTimer
;
110 int m_transitionDelay
;
112 QList
< QRect
> m_transitionRects
;
115 Okular::Document
* m_document
;
116 QVector
< PresentationFrame
* > m_frames
;
118 QStringList m_metaStrings
;
120 QLineEdit
*m_pagesEdit
;
121 PresentationSearchBar
*m_searchBar
;
122 KActionCollection
* m_ac
;
123 KSelectAction
* m_screenSelect
;
124 bool m_blockNotifications
;
125 bool m_inBlackScreenMode
;
130 void slotFirstPage();
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 );