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 Shantanu Tushar <shantanu@kde.org>
0005  * Copyright (C) 2013 Sujith Haridasan <sujith.h@gmail.com>
0006  * Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
0007  *
0008  * This library is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Library General Public
0010  * License as published by the Free Software Foundation; either
0011  * version 2 of the License, or (at your option) any later version.
0012  *
0013  * This library is distributed in the hope that it will be useful,
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * Library General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU Library General Public License
0019  * along with this library; see the file COPYING.LIB.  If not, write to
0020  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0021  * Boston, MA 02110-1301, USA.
0022  *
0023  */
0024 
0025 #ifndef CALLIGRA_COMPONENTS_COMPONENTSKOCANVASCONTROLLER_H
0026 #define CALLIGRA_COMPONENTS_COMPONENTSKOCANVASCONTROLLER_H
0027 
0028 #include <KoCanvasController.h>
0029 
0030 #include <QSize>
0031 #include <QPoint>
0032 
0033 class KoCanvasBase;
0034 namespace Calligra {
0035 namespace Components {
0036 
0037 class ComponentsKoCanvasController : public QObject, public KoCanvasController
0038 {
0039     Q_OBJECT
0040 public:
0041     explicit ComponentsKoCanvasController(KActionCollection* actionCollection);
0042     ~ComponentsKoCanvasController() override;
0043  
0044     void setVastScrolling(qreal factor) override;
0045     void setZoomWithWheel(bool zoom) override;
0046     void updateDocumentSize(const QSize& sz, bool recalculateCenter) override;
0047     void setScrollBarValue(const QPoint& value) override;
0048     QPoint scrollBarValue() const override;
0049     void pan(const QPoint& distance) override;
0050     QPointF preferredCenter() const override;
0051     void setPreferredCenter(const QPointF& viewPoint) override;
0052     void recenterPreferred() override;
0053     void zoomTo(const QRect& rect) override;
0054     void zoomBy(const QPoint& center, qreal zoom) override;
0055     void zoomOut(const QPoint& center) override;
0056     void zoomIn(const QPoint& center) override;
0057     void ensureVisible(KoShape* shape) override;
0058     void ensureVisible(const QRectF& rect, bool smooth) override;
0059     int canvasOffsetY() const override;
0060     int canvasOffsetX() const override;
0061     int visibleWidth() const override;
0062     int visibleHeight() const override;
0063     KoCanvasBase* canvas() const override;
0064     void setCanvas(KoCanvasBase* canvas) override;
0065     void setDrawShadow(bool drawShadow) override;
0066     QSize viewportSize() const override;
0067     void scrollContentsBy(int dx, int dy) override;
0068 
0069     QSize documentSize();
0070 
0071 Q_SIGNALS:
0072     void documentSizeChanged(const QSize &sz);
0073     void documentPositionChanged(const QPoint &pos);
0074 
0075 private:
0076     class Private;
0077     Private * const d;
0078 };
0079 
0080 } // Namespace Components
0081 } // Namespace Calligra
0082 
0083 #endif // CALLIGRA_COMPONENTS_COMPONENTSKOCANVASCONTROLLER_H
0084 
0085