1 /*
2  * This file is part of the KDE project
3  *
4  * Copyright (C) 2013 Shantanu Tushar <shantanu@kde.org>
5  * Copyright (C) 2013 Sujith Haridasan <sujith.h@gmail.com>
6  * Copyright (C) 2013 Arjen Hiemstra <ahiemstra@heimr.nl>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB.  If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  */
24 
25 #ifndef CQCANVASCONTROLLER_H
26 #define CQCANVASCONTROLLER_H
27 
28 #include <KoCanvasController.h>
29 
30 class QSize;
31 class QPoint;
32 class KoCanvasBase;
33 class CQCanvasController : public QObject, public KoCanvasController
34 {
35     Q_OBJECT
36 public:
37     explicit CQCanvasController(KActionCollection* actionCollection);
38     virtual ~CQCanvasController();
39 
40     virtual void setVastScrolling(qreal factor);
41     virtual void setZoomWithWheel(bool zoom);
42     virtual void updateDocumentSize(const QSize& sz, bool recalculateCenter);
43     virtual void setScrollBarValue(const QPoint& value);
44     virtual QPoint scrollBarValue() const;
45     virtual void pan(const QPoint& distance);
46     virtual QPointF preferredCenter() const;
47     virtual void setPreferredCenter(const QPointF& viewPoint);
48     virtual void recenterPreferred();
49     virtual void zoomTo(const QRect& rect);
50     virtual void zoomBy(const QPoint& center, qreal zoom);
51     virtual void zoomOut(const QPoint& center);
52     virtual void zoomIn(const QPoint& center);
53     virtual void ensureVisible(KoShape* shape);
54     virtual void ensureVisible(const QRectF& rect, bool smooth);
55     virtual int canvasOffsetY() const;
56     virtual int canvasOffsetX() const;
57     virtual int visibleWidth() const;
58     virtual int visibleHeight() const;
59     virtual KoCanvasBase* canvas() const;
60     virtual void setCanvas(KoCanvasBase* canvas);
61     virtual void setDrawShadow(bool drawShadow);
62     virtual QSize viewportSize() const;
63     virtual void scrollContentsBy(int dx, int dy);
64 
65     QSize documentSize() const;
66 
67 Q_SIGNALS:
68     void documentSizeChanged(const QSize &sz);
69     void documentPositionChanged(const QPoint &pos);
70 
71 private:
72     class Private;
73     Private * const d;
74 };
75 
76 #endif // CQCANVASCONTROLLER_H
77 
78 
79