File indexing completed on 2024-05-05 17:09:07

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 CQCANVASCONTROLLER_H
0026 #define CQCANVASCONTROLLER_H
0027 
0028 #include <KoCanvasController.h>
0029 
0030 class QSize;
0031 class QPoint;
0032 class KoCanvasBase;
0033 class CQCanvasController : public QObject, public KoCanvasController
0034 {
0035     Q_OBJECT
0036 public:
0037     explicit CQCanvasController(KActionCollection* actionCollection);
0038     virtual ~CQCanvasController();
0039 
0040     virtual void setVastScrolling(qreal factor);
0041     virtual void setZoomWithWheel(bool zoom);
0042     virtual void updateDocumentSize(const QSize& sz, bool recalculateCenter);
0043     virtual void setScrollBarValue(const QPoint& value);
0044     virtual QPoint scrollBarValue() const;
0045     virtual void pan(const QPoint& distance);
0046     virtual QPointF preferredCenter() const;
0047     virtual void setPreferredCenter(const QPointF& viewPoint);
0048     virtual void recenterPreferred();
0049     virtual void zoomTo(const QRect& rect);
0050     virtual void zoomBy(const QPoint& center, qreal zoom);
0051     virtual void zoomOut(const QPoint& center);
0052     virtual void zoomIn(const QPoint& center);
0053     virtual void ensureVisible(KoShape* shape);
0054     virtual void ensureVisible(const QRectF& rect, bool smooth);
0055     virtual int canvasOffsetY() const;
0056     virtual int canvasOffsetX() const;
0057     virtual int visibleWidth() const;
0058     virtual int visibleHeight() const;
0059     virtual KoCanvasBase* canvas() const;
0060     virtual void setCanvas(KoCanvasBase* canvas);
0061     virtual void setDrawShadow(bool drawShadow);
0062     virtual QSize viewportSize() const;
0063     virtual void scrollContentsBy(int dx, int dy);
0064 
0065     QSize documentSize() const;
0066 
0067 Q_SIGNALS:
0068     void documentSizeChanged(const QSize &sz);
0069     void documentPositionChanged(const QPoint &pos);
0070 
0071 private:
0072     class Private;
0073     Private * const d;
0074 };
0075 
0076 #endif // CQCANVASCONTROLLER_H
0077 
0078