File indexing completed on 2024-05-12 13:04:45
0001 /* 0002 * This file is part of the KDE project 0003 * 0004 * SPDX-FileCopyrightText: 2013 Shantanu Tushar <shantanu@kde.org> 0005 * SPDX-FileCopyrightText: 2013 Arjen Hiemstra <ahiemstra@heimr.nl> 0006 * 0007 * SPDX-License-Identifier: LGPL-2.0-or-later 0008 * 0009 */ 0010 0011 #ifndef CQPRESENTATIONCANVAS_H 0012 #define CQPRESENTATIONCANVAS_H 0013 0014 #include "CQCanvasBase.h" 0015 0016 class KoCanvasBase; 0017 class KPrDocument; 0018 class CQPresentationCanvas : public CQCanvasBase 0019 { 0020 Q_OBJECT 0021 Q_PROPERTY(int currentSlide READ currentSlide WRITE setCurrentSlide NOTIFY currentSlideChanged) 0022 Q_PROPERTY(QSizeF pageSize READ pageSize NOTIFY currentSlideChanged) 0023 Q_PROPERTY(QObjectList linkTargets READ linkTargets NOTIFY linkTargetsChanged) 0024 Q_PROPERTY(QObject* document READ doc NOTIFY documentChanged); 0025 Q_PROPERTY(QObject* textEditor READ textEditor NOTIFY textEditorChanged) 0026 0027 public: 0028 explicit CQPresentationCanvas(QDeclarativeItem* parent = 0); 0029 virtual ~CQPresentationCanvas(); 0030 0031 int currentSlide() const; 0032 Q_INVOKABLE int slideCount() const; 0033 KPrDocument* document() const; 0034 Q_INVOKABLE QObject* doc() const; 0035 Q_INVOKABLE QObject* part() const; 0036 QSizeF pageSize() const; 0037 0038 QObjectList linkTargets() const; 0039 0040 void setCurrentSlide(int slide); 0041 0042 virtual void render(QPainter* painter, const QRectF& target); 0043 0044 QObject* textEditor() const; 0045 // Deselects any text selection present in the document, and deselects all shapes 0046 // This is highly useful, as it makes navigation prettier. 0047 Q_INVOKABLE void deselectEverything(); 0048 0049 virtual qreal shapeTransparency() const; 0050 virtual void setShapeTransparency(qreal newTransparency); 0051 0052 Q_SIGNALS: 0053 void currentSlideChanged(); 0054 void linkTargetsChanged(); 0055 void documentChanged(); 0056 void textEditorChanged(); 0057 0058 protected: 0059 virtual bool event( QEvent* event ); 0060 virtual void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry); 0061 virtual void openFile(const QString& uri); 0062 0063 private Q_SLOTS: 0064 void updateDocumentSize(const QSize& size); 0065 0066 private: 0067 void createAndSetCanvasControllerOn(KoCanvasBase* canvas); 0068 void createAndSetZoomController(KoCanvasBase* canvas); 0069 0070 class Private; 0071 Private * const d; 0072 }; 0073 0074 #endif // CQPRESENTATIONCANVAS_H