File indexing completed on 2024-05-05 17:09:08
0001 /* 0002 * This file is part of the KDE project 0003 * 0004 * Copyright (C) 2013 Shantanu Tushar <shantanu@kde.org> 0005 * Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl> 0006 * 0007 * This library is free software; you can redistribute it and/or 0008 * modify it under the terms of the GNU Library General Public 0009 * License as published by the Free Software Foundation; either 0010 * version 2 of the License, or (at your option) any later version. 0011 * 0012 * This library is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Library General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Library General Public License 0018 * along with this library; see the file COPYING.LIB. If not, write to 0019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0020 * Boston, MA 02110-1301, USA. 0021 * 0022 */ 0023 0024 #ifndef CQPRESENTATIONCANVAS_H 0025 #define CQPRESENTATIONCANVAS_H 0026 0027 #include "CQCanvasBase.h" 0028 0029 class KoCanvasBase; 0030 class KPrDocument; 0031 class CQPresentationCanvas : public CQCanvasBase 0032 { 0033 Q_OBJECT 0034 Q_PROPERTY(int currentSlide READ currentSlide WRITE setCurrentSlide NOTIFY currentSlideChanged) 0035 Q_PROPERTY(QSizeF pageSize READ pageSize NOTIFY currentSlideChanged) 0036 Q_PROPERTY(QObjectList linkTargets READ linkTargets NOTIFY linkTargetsChanged) 0037 Q_PROPERTY(QObject* document READ doc NOTIFY documentChanged); 0038 Q_PROPERTY(QObject* textEditor READ textEditor NOTIFY textEditorChanged) 0039 0040 public: 0041 explicit CQPresentationCanvas(QDeclarativeItem* parent = 0); 0042 virtual ~CQPresentationCanvas(); 0043 0044 int currentSlide() const; 0045 Q_INVOKABLE int slideCount() const; 0046 KPrDocument* document() const; 0047 Q_INVOKABLE QObject* doc() const; 0048 Q_INVOKABLE QObject* part() const; 0049 QSizeF pageSize() const; 0050 0051 QObjectList linkTargets() const; 0052 0053 void setCurrentSlide(int slide); 0054 0055 virtual void render(QPainter* painter, const QRectF& target); 0056 0057 QObject* textEditor() const; 0058 // Deselects any text selection present in the document, and deselects all shapes 0059 // This is highly useful, as it makes navigation prettier. 0060 Q_INVOKABLE void deselectEverything(); 0061 0062 virtual qreal shapeTransparency() const; 0063 virtual void setShapeTransparency(qreal newTransparency); 0064 0065 Q_SIGNALS: 0066 void currentSlideChanged(); 0067 void linkTargetsChanged(); 0068 void documentChanged(); 0069 void textEditorChanged(); 0070 0071 protected: 0072 virtual bool event( QEvent* event ); 0073 virtual void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry); 0074 virtual void openFile(const QString& uri); 0075 0076 private Q_SLOTS: 0077 void updateDocumentSize(const QSize& size); 0078 0079 private: 0080 void createAndSetCanvasControllerOn(KoCanvasBase* canvas); 0081 void createAndSetZoomController(KoCanvasBase* canvas); 0082 0083 class Private; 0084 Private * const d; 0085 }; 0086 0087 #endif // CQPRESENTATIONCANVAS_H