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
, KActionCollection
* collection
);
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;
60 bool event( QEvent
* e
);
61 void keyPressEvent( QKeyEvent
* e
);
62 void wheelEvent( QWheelEvent
* e
);
63 void mousePressEvent( QMouseEvent
* e
);
64 void mouseReleaseEvent( QMouseEvent
* e
);
65 void mouseMoveEvent( QMouseEvent
* e
);
66 void paintEvent( QPaintEvent
* e
);
67 void resizeEvent( QResizeEvent
* e
);
70 const Okular::Action
* getLink( int x
, int y
, QRect
* geometry
= 0 ) const;
71 void testCursorOnLink( int x
, int y
);
72 void overlayClick( const QPoint
& position
);
73 void changePage( int newPage
);
74 void generatePage( bool disableTransition
= false );
75 void generateIntroPage( QPainter
& p
);
76 void generateContentsPage( int page
, QPainter
& p
);
77 void generateOverlay();
78 void initTransition( const Okular::PageTransition
*transition
);
79 const Okular::PageTransition
defaultTransition() const;
80 const Okular::PageTransition
defaultTransition( int ) const;
81 QRect
routeMouseDrawingEvent( QMouseEvent
* );
82 void startAutoChangeTimer();
83 void recalcGeometry();
84 void repositionContent();
85 void requestPixmaps();
86 void setScreen( int );
87 void applyNewScreenSize( const QSize
& oldSize
);
88 void inhibitScreenSaver();
89 void allowScreenSaver();
90 // create actions that interact with this widget
91 void setupActions( KActionCollection
* collection
);
96 QPixmap m_lastRenderedPixmap
;
97 QPixmap m_lastRenderedOverlay
;
98 QRect m_overlayGeometry
;
99 const Okular::Action
* m_pressedLink
;
101 QList
< Okular::Annotation
* > m_currentPageDrawings
;
102 AnnotatorEngine
* m_drawingEngine
;
105 int m_screenSaverCookie
;
107 // transition related
108 QTimer
* m_transitionTimer
;
109 QTimer
* m_overlayHideTimer
;
110 QTimer
* m_nextPageTimer
;
111 int m_transitionDelay
;
113 QList
< QRect
> m_transitionRects
;
116 QWidget
* m_parentWidget
;
117 Okular::Document
* m_document
;
118 QVector
< PresentationFrame
* > m_frames
;
120 QStringList m_metaStrings
;
122 QLineEdit
*m_pagesEdit
;
123 PresentationSearchBar
*m_searchBar
;
124 KActionCollection
* m_ac
;
125 KSelectAction
* m_screenSelect
;
127 bool m_blockNotifications
;
128 bool m_inBlackScreenMode
;
133 void slotFirstPage();
135 void slotHideOverlay();
136 void slotTransitionStep();
137 void slotDelayedEvents();
138 void slotPageChanged();
139 void togglePencilMode( bool );
140 void clearDrawings();
141 void screenResized( int );
142 void chooseScreen( QAction
* );
143 void toggleBlackScreenMode( bool );