File indexing completed on 2024-05-12 16:36:49
0001 /* This file is part of the KDE project 0002 Copyright (C) 2006-2007 Thorsten Zachmann <zachmann@kde.org> 0003 Copyright (C) 2009-2010 Benjamin Port <port.benjamin@gmail.com> 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 KPRVIEW_H 0022 #define KPRVIEW_H 0023 0024 #include "stage_export.h" 0025 #include <QObject> 0026 #include <KoPAView.h> 0027 0028 class KPrDocument; 0029 class KPrPart; 0030 0031 #ifndef QT_NO_DBUS 0032 class KPrViewAdaptor; 0033 #endif 0034 0035 class KPrViewModeNotes; 0036 class KPrViewModeSlidesSorter; 0037 class KPrViewModePresentation; 0038 class KActionMenu; 0039 class KoPAPageBase; 0040 0041 class STAGE_EXPORT KPrView : public KoPAView 0042 { 0043 Q_OBJECT 0044 friend class KPrConfigureSlideShowDialog; 0045 public: 0046 explicit KPrView(KPrPart *part, KPrDocument *document, QWidget *parent = 0); 0047 ~KPrView() override; 0048 0049 using KoPAViewBase::viewConverter; 0050 KoViewConverter * viewConverter( KoPACanvasBase * canvas) override; 0051 0052 /** 0053 * Get the document object the view was initialised with 0054 */ 0055 KPrDocument * kprDocument() const; 0056 0057 #ifndef QT_NO_DBUS 0058 /** 0059 * Get the view's dbus adaptor 0060 */ 0061 virtual KPrViewAdaptor * dbusObject() const; 0062 #endif 0063 0064 /** 0065 * Get the presentation view mode 0066 */ 0067 Q_INVOKABLE KPrViewModePresentation * presentationMode() const; 0068 0069 /** 0070 * Get the slides sorter view mode 0071 */ 0072 KPrViewModeSlidesSorter *slidesSorter() const; 0073 0074 /** 0075 * Find whether the presentation view mode is active 0076 */ 0077 bool isPresentationRunning() const; 0078 0079 /** 0080 * Load zoom configuration 0081 */ 0082 void initZoomConfig(); 0083 0084 /** 0085 * Restore zoom configuration 0086 */ 0087 void restoreZoomConfig(); 0088 0089 /** 0090 * Save zoom value 0091 */ 0092 void saveZoomConfig(KoZoomMode::Mode zoomMode, int zoom); 0093 0094 /** 0095 * Setter of the zoom 0096 * 0097 * @param zoomMode mode 0098 * @param zoom zoom percent 0099 */ 0100 void setZoom(KoZoomMode::Mode zoomMode, int zoom); 0101 0102 /** 0103 * Return the last zoom stored 0104 * 0105 * @return the last zoom stored 0106 */ 0107 int zoom(); 0108 0109 /** 0110 * Return the last zoom mode stored 0111 * 0112 * @return the last zoom mode stored 0113 */ 0114 KoZoomMode::Mode zoomMode(); 0115 0116 public Q_SLOTS: 0117 /** 0118 * Activate the presentation view mode 0119 */ 0120 void startPresentation(); 0121 0122 /** 0123 * Activate the presentation view mode from the first slide 0124 */ 0125 void startPresentationFromBeginning(); 0126 0127 /** 0128 * Stop the presentation and activate the previously active view mode. 0129 */ 0130 void stopPresentation(); 0131 0132 void showNormal(); 0133 0134 /** Change current view mode using a given index */ 0135 void changeViewByIndex(int index); 0136 0137 void replaceActivePage(KoPAPageBase *page, KoPAPageBase *newActivePage); 0138 0139 protected: 0140 void initGUI(); 0141 void initActions(); 0142 bool event(QEvent* event) override; 0143 0144 protected Q_SLOTS: 0145 void createAnimation(); 0146 void showNotes(); 0147 void showSlidesSorter(); 0148 void editCustomSlideShows(); 0149 void configureSlideShow(); 0150 void configurePresenterView(); 0151 void exportToHtml(); 0152 void insertPictures(); 0153 void drawOnPresentation(); 0154 void highlightPresentation(); 0155 void blackPresentation(); 0156 void showStatusBar(bool toggled); 0157 /// called if the zoom changed 0158 void zoomChanged(KoZoomMode::Mode mode, qreal zoom); 0159 0160 private: 0161 KPrPart *m_part; 0162 QAction *m_actionStopPresentation; 0163 QAction *m_actionCreateAnimation; 0164 QAction *m_actionViewModeNormal; 0165 QAction *m_actionViewModeNotes; 0166 QAction *m_actionViewModeSlidesSorter; 0167 QAction *m_actionEditCustomSlideShows; 0168 QAction *m_actionExportHtml; 0169 QAction *m_actionInsertPictures; 0170 QAction *m_actionDrawOnPresentation; 0171 QAction *m_actionHighlightPresentation; 0172 QAction *m_actionBlackPresentation; 0173 0174 KPrViewModePresentation *m_presentationMode; 0175 KoPAViewMode *m_normalMode; 0176 KPrViewModeNotes *m_notesMode; 0177 KPrViewModeSlidesSorter *m_slidesSorterMode; 0178 0179 #ifndef QT_NO_DBUS 0180 KPrViewAdaptor *m_dbus; 0181 #endif 0182 0183 int m_zoom; 0184 KoZoomMode::Mode m_zoomMode; 0185 0186 KoPrintJob *createPdfPrintJob() override; 0187 }; 0188 0189 #endif /* KPRVIEW_H */