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