File indexing completed on 2024-05-12 16:36:50
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org> 0003 * Copyright (C) 2008 C. Boemann <cbo@boemann.dk> 0004 * 0005 * This library is free software; you can redistribute it and/or 0006 * modify it under the terms of the GNU Library General Public 0007 * License as published by the Free Software Foundation; either 0008 * version 2 of the License, or ( at your option ) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 * Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, write to 0017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef KPRVIEWMODEPREVIEWPAGEEFFECT_H 0022 #define KPRVIEWMODEPREVIEWPAGEEFFECT_H 0023 0024 #include "stage_export.h" 0025 0026 #include <KoPAViewMode.h> 0027 #include "KPrAnimationDirector.h" 0028 #include <QTimeLine> 0029 #include <QPixmap> 0030 0031 class KPrPage; 0032 class KPrPageEffect; 0033 class KPrPageEffectRunner; 0034 0035 class STAGE_EXPORT KPrViewModePreviewPageEffect : public KoPAViewMode 0036 { 0037 0038 Q_OBJECT 0039 public: 0040 KPrViewModePreviewPageEffect( KoPAViewBase * view, KoPACanvasBase * m_canvas ); 0041 ~KPrViewModePreviewPageEffect() override; 0042 0043 void paint(KoPACanvasBase* canvas, QPainter& painter, const QRectF &paintRect) override; 0044 void tabletEvent( QTabletEvent *event, const QPointF &point ) override; 0045 void mousePressEvent( QMouseEvent *event, const QPointF &point ) override; 0046 void mouseDoubleClickEvent( QMouseEvent *event, const QPointF &point ) override; 0047 void mouseMoveEvent( QMouseEvent *event, const QPointF &point ) override; 0048 void mouseReleaseEvent( QMouseEvent *event, const QPointF &point ) override; 0049 void shortcutOverrideEvent( QKeyEvent *event ) override; 0050 void keyPressEvent( QKeyEvent *event ) override; 0051 void keyReleaseEvent( QKeyEvent *event ) override; 0052 void wheelEvent( QWheelEvent * event, const QPointF &point ) override; 0053 0054 void activate( KoPAViewMode * previousViewMode ) override; 0055 void deactivate() override; 0056 0057 /// reimplemented 0058 void updateActivePage( KoPAPageBase *page ) override; 0059 0060 0061 /** 0062 * Set a page effect 0063 * 0064 * @param pageEffect The effect which will be previewed. 0065 * @param page The current page used in the preview. If 0 the preview will be x 0066 * @param prevpage The page coming before @p page 0067 */ 0068 void setPageEffect( KPrPageEffect* pageEffect, KPrPage* page, KPrPage* prevpage ); 0069 0070 public Q_SLOTS: 0071 /** 0072 * @brief Activate the saved view mode 0073 * 0074 * This ends the presentation mode. The view mode that was active before the 0075 * presentation will be restored. 0076 */ 0077 void activateSavedViewMode(); 0078 0079 protected Q_SLOTS: 0080 void animate(); 0081 0082 private: 0083 void updatePixmaps(); 0084 0085 KoPAViewMode * m_savedViewMode; 0086 QTimeLine m_timeLine; 0087 0088 KPrPageEffect* m_pageEffect; 0089 KPrPageEffectRunner* m_pageEffectRunner; 0090 KPrPage* m_page; 0091 KPrPage* m_prevpage; 0092 0093 QPixmap m_oldPage; 0094 QPixmap m_newPage; 0095 }; 0096 0097 #endif /* KPRVIEWMODEPREVIEWPAGEEFFECT_H */