SVN_SILENT made messages (.desktop file)
[kdegraphics.git] / okular / ui / presentationwidget.h
blob8ee786aa03b227b944af8e0c6b1f0b6928513edd
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, 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;
55 public slots:
56 void slotFind();
58 protected:
59 // widget events
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 );
69 private:
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 );
93 // cache stuff
94 int m_width;
95 int m_height;
96 QPixmap m_lastRenderedPixmap;
97 QPixmap m_lastRenderedOverlay;
98 QRect m_overlayGeometry;
99 const Okular::Action * m_pressedLink;
100 bool m_handCursor;
101 QList< Okular::Annotation * > m_currentPageDrawings;
102 AnnotatorEngine * m_drawingEngine;
103 QRect m_drawingRect;
104 int m_screen;
105 int m_screenSaverCookie;
107 // transition related
108 QTimer * m_transitionTimer;
109 QTimer * m_overlayHideTimer;
110 QTimer * m_nextPageTimer;
111 int m_transitionDelay;
112 int m_transitionMul;
113 QList< QRect > m_transitionRects;
115 // misc stuff
116 QWidget * m_parentWidget;
117 Okular::Document * m_document;
118 QVector< PresentationFrame * > m_frames;
119 int m_frameIndex;
120 QStringList m_metaStrings;
121 QToolBar * m_topBar;
122 QLineEdit *m_pagesEdit;
123 PresentationSearchBar *m_searchBar;
124 KActionCollection * m_ac;
125 KSelectAction * m_screenSelect;
126 bool m_blockNotifications;
127 bool m_inBlackScreenMode;
129 private slots:
130 void slotNextPage();
131 void slotPrevPage();
132 void slotFirstPage();
133 void slotLastPage();
134 void slotHideOverlay();
135 void slotTransitionStep();
136 void slotDelayedEvents();
137 void slotPageChanged();
138 void togglePencilMode( bool );
139 void clearDrawings();
140 void screenResized( int );
141 void chooseScreen( QAction * );
142 void toggleBlackScreenMode( bool );
145 #endif