File indexing completed on 2024-05-12 16:28:23
0001 /* 0002 * This file is part of the KDE project 0003 * 0004 * Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl> 0005 * 0006 * This library is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Library General Public 0008 * License as published by the Free Software Foundation; either 0009 * version 2 of the License, or (at your option) any later version. 0010 * 0011 * This library is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Library General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Library General Public License 0017 * along with this library; see the file COPYING.LIB. If not, write to 0018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 * 0021 */ 0022 0023 #ifndef CALLIGRA_COMPONENTS_DOCUMENTIMPL_H 0024 #define CALLIGRA_COMPONENTS_DOCUMENTIMPL_H 0025 0026 #include <QObject> 0027 #include "Global.h" 0028 0029 class KoDocument; 0030 class QGraphicsWidget; 0031 class KoFindBase; 0032 class KoCanvasController; 0033 class KoZoomController; 0034 class KoDocument; 0035 class KoCanvasBase; 0036 0037 namespace Calligra { 0038 namespace Components { 0039 0040 /** 0041 * \brief Defines an interface for handling specific documents in Document. 0042 * 0043 */ 0044 0045 class DocumentImpl : public QObject 0046 { 0047 Q_OBJECT 0048 public: 0049 explicit DocumentImpl(QObject* parent = 0); 0050 ~DocumentImpl() override; 0051 0052 virtual bool load(const QUrl& url) = 0; 0053 virtual int currentIndex() = 0; 0054 virtual void setCurrentIndex(int newValue) = 0; 0055 virtual int indexCount() const = 0; 0056 virtual QUrl urlAtPoint(QPoint point) = 0; 0057 0058 DocumentType::Type documentType() const; 0059 KoFindBase* finder() const; 0060 QGraphicsWidget* canvas() const; 0061 KoCanvasController* canvasController() const; 0062 KoZoomController* zoomController() const; 0063 QSize documentSize() const; 0064 KoDocument* koDocument() const; 0065 virtual QObject* part() const = 0; 0066 0067 void setReadOnly(bool readOnly); 0068 0069 Q_SIGNALS: 0070 void documentSizeChanged(); 0071 void currentIndexChanged(); 0072 void requestViewUpdate(); 0073 0074 protected: 0075 void setDocumentType(DocumentType::Type type); 0076 void setKoDocument(KoDocument* document); 0077 void setCanvas(QGraphicsWidget* newCanvas); 0078 void setFinder(KoFindBase* newFinder); 0079 0080 void createAndSetCanvasController(KoCanvasBase* canvas); 0081 void createAndSetZoomController(KoCanvasBase* canvas); 0082 0083 protected Q_SLOTS: 0084 void setDocumentSize(const QSize& size); 0085 0086 private: 0087 class Private; 0088 Private* const d; 0089 }; 0090 0091 } // Namespace Components 0092 } // Namespace Calligra 0093 0094 #endif // CALLIGRA_COMPONENTS_DOCUMENTIMPL_H