File indexing completed on 2024-05-12 16:36:50
0001 /* This file is part of the KDE project 0002 Copyright (C) 2008 James Hogan <james@albanarts.com> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Lesser General Public 0006 License as published by the Free Software Foundation; either 0007 version 2.1 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Lesser General Public License for more details. 0013 0014 You should have received a copy of the GNU Lesser General Public 0015 License along with this library; if not, write to the Free Software 0016 Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 Boston, MA 02110-1301 USA 0018 */ 0019 0020 #ifndef KPRVIEWADAPTOR_H 0021 #define KPRVIEWADAPTOR_H 0022 0023 #ifndef QT_NO_DBUS 0024 0025 #include <KoViewAdaptor.h> 0026 #include <QStringList> 0027 0028 class KPrView; 0029 0030 class KPrViewAdaptor : public KoViewAdaptor 0031 { 0032 Q_OBJECT 0033 Q_CLASSINFO( "D-Bus Interface", "org.kde.calligra.presentation.view" ) 0034 0035 public: 0036 explicit KPrViewAdaptor( KPrView* view ); 0037 ~KPrViewAdaptor() override; 0038 0039 public Q_SLOTS: 0040 0041 // custom slideshows 0042 0043 /** 0044 * Get a list of custom slide show names. 0045 * 0046 * @return List of custom slide show names not including the empty string 0047 * (for all slides) 0048 */ 0049 QStringList customSlideShows() const; 0050 0051 /** 0052 * Get the current active slide show name. 0053 * 0054 * @return Name of current slide show or empty string for all slides 0055 */ 0056 QString activeCustomSlideShow() const; 0057 0058 /** 0059 * Set the active custom slide show. 0060 * 0061 * @param name name of the custom slide show to activate or empty string 0062 * for all slides 0063 * @return true if the custom slideshow was changed 0064 */ 0065 bool setActiveCustomSlideShow( const QString &name ); 0066 0067 // slides in the custom slideshow 0068 0069 /** 0070 * Get the number of slides in the current slide show. 0071 */ 0072 int numCustomSlideShowSlides() const; 0073 0074 /** 0075 * Get the name of a page. 0076 * 0077 * If the page does not have a name an empty string is returned. 0078 * It is common in this case to use the string i18n( "Page %1", @p page + 1 ). 0079 * 0080 * @param page The page index within the current slideshow. 0081 * @returns The name of page with index @p page in the current slideshow. 0082 */ 0083 QString pageName( int page ) const; 0084 0085 /** 0086 * Get the notes associated with a page of the slideshow. 0087 * 0088 * The notes can be obtained in plain text or HTML. 0089 * 0090 * @param page The page index within the current slideshow. 0091 * @param format The format of the return value. Possible values are "plain" and "html". 0092 * @returns The notes associated with page @p page in the format specified by @p format. 0093 * An empty string is returned when @p format is not recognised or @p page is invalid. 0094 */ 0095 QString pageNotes( int page, const QString &format ) const; 0096 0097 /** 0098 * Save page to an image file. 0099 * 0100 * Export a page of the current presentation to disk 0101 * using a bitmap file like e.g. PNG 0102 * This method uses a QPixmap::save() call. 0103 * 0104 * @param page the page index within the current slideshow 0105 * @param width the desired image width in px 0106 * @param height the desired image height in px 0107 * @param filename the name of the image file to be created 0108 * @param format the format of the image file (see QPixmap::save()) 0109 * @param quality the quality of the image in [0,100] or -1 to use default (see QPixmap::save()) 0110 * 0111 * @returns whether the image was successfully saved 0112 */ 0113 bool exportPageThumbnail( int page, int width, int height, 0114 const QString &filename, const QString &format, int quality ); 0115 0116 // Presentation control 0117 void presentationStart(); 0118 void presentationStartFromFirst(); 0119 void presentationStop(); 0120 void presentationPrev(); 0121 void presentationNext(); 0122 void presentationPrevSlide(); 0123 void presentationNextSlide(); 0124 void presentationFirst(); 0125 void presentationLast(); 0126 void gotoPresentationPage( int pg ); 0127 0128 // Presentation accessors 0129 bool isPresentationRunning() const; 0130 int currentPresentationPage() const; 0131 int currentPresentationStep() const; 0132 int numStepsInPresentationPage() const; 0133 int numPresentationPages() const; 0134 0135 Q_SIGNALS: 0136 /** 0137 * Emitted when the active custom slide show changes. 0138 * 0139 * @param customSlideShow the new active custom slide show 0140 */ 0141 void activeCustomSlideShowChanged( const QString &customSlideShow ); 0142 0143 /** 0144 * Emitted when the custom slide shows have been modified. 0145 */ 0146 void customSlideShowsModified(); 0147 0148 /** 0149 * Emitted when the slideshow is started. 0150 * 0151 * @param numSlides Number of slides in the slideshow 0152 */ 0153 void presentationStarted( int numSlides ); 0154 0155 /** 0156 * Emitted when the slideshow is finished. 0157 */ 0158 void presentationStopped(); 0159 0160 /** 0161 * Emitted when the presentation page is changed. 0162 * 0163 * @param page new page index within the current slideshow 0164 * @param stepsInPage the number of steps in the new page 0165 */ 0166 void presentationPageChanged( int page, int stepsInPage ); 0167 0168 /** 0169 * Emitted when the presentation step is changed. 0170 * 0171 * @param step new step index within the page 0172 */ 0173 void presentationStepChanged( int step ); 0174 0175 private Q_SLOTS: 0176 /** 0177 * Fired when the presentation is activated. 0178 */ 0179 void presentationActivated(); 0180 0181 private: 0182 KPrView* m_view; 0183 }; 0184 0185 #endif // QT_NO_DBUS 0186 0187 #endif