File indexing completed on 2024-05-12 13:04:46

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 CQSPREADSHEETCANVAS_H
0012 #define CQSPREADSHEETCANVAS_H
0013 
0014 #include "CQCanvasBase.h"
0015 
0016 namespace Calligra {
0017     namespace Sheets {
0018         class Map;
0019     }
0020 }
0021 
0022 class KoCanvasBase;
0023 
0024 class CQSpreadsheetCanvas : public CQCanvasBase
0025 {
0026     Q_OBJECT
0027     Q_PROPERTY(int currentSheet READ currentSheet WRITE setCurrentSheet NOTIFY currentSheetChanged)
0028     Q_PROPERTY(QObjectList linkTargets READ linkTargets NOTIFY linkTargetsChanged)
0029 
0030 public:
0031     explicit CQSpreadsheetCanvas(QDeclarativeItem* parent = 0);
0032     virtual ~CQSpreadsheetCanvas();
0033 
0034     int currentSheet() const;
0035     Calligra::Sheets::Map* documentMap() const;
0036 
0037     QObjectList linkTargets() const;
0038 
0039     void setCurrentSheet(int sheet);
0040 
0041     virtual void render(QPainter* painter, const QRectF& target);
0042 
0043 Q_SIGNALS:
0044     void currentSheetChanged();
0045     void linkTargetsChanged();
0046 
0047 protected:
0048     virtual void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry);
0049     virtual void openFile(const QString& file);
0050 
0051 private Q_SLOTS:
0052     void updateDocumentSize(const QSize& size);
0053 
0054 private:
0055     void createAndSetCanvasControllerOn(KoCanvasBase* canvas);
0056     void createAndSetZoomController(KoCanvasBase* canvas);
0057 
0058     class Private;
0059     Private * const d;
0060 };
0061 
0062 #endif // CQSPREADSHEETCANVAS_H