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 #include "CQCanvasController.h" 0026 0027 #include <QPoint> 0028 #include <QSize> 0029 #include <QGraphicsWidget> 0030 0031 #include <KoCanvasBase.h> 0032 #include <KoShape.h> 0033 0034 class CQCanvasController::Private 0035 { 0036 public: 0037 Private() : canvas(0) { } 0038 KoCanvasBase *canvas; 0039 }; 0040 0041 CQCanvasController::CQCanvasController(KActionCollection* actionCollection) 0042 : KoCanvasController(actionCollection), d(new Private) 0043 { 0044 } 0045 0046 CQCanvasController::~CQCanvasController() 0047 { 0048 delete d; 0049 } 0050 0051 void CQCanvasController::setVastScrolling(qreal factor) 0052 { 0053 Q_UNUSED(factor) 0054 } 0055 0056 void CQCanvasController::setZoomWithWheel(bool zoom) 0057 { 0058 Q_UNUSED(zoom) 0059 } 0060 0061 void CQCanvasController::updateDocumentSize(const QSize& sz, bool recalculateCenter) 0062 { 0063 Q_UNUSED(recalculateCenter) 0064 setDocumentSize(sz); 0065 emit documentSizeChanged(sz); 0066 } 0067 0068 void CQCanvasController::setScrollBarValue(const QPoint& value) 0069 { 0070 Q_UNUSED(value) 0071 } 0072 0073 QPoint CQCanvasController::scrollBarValue() const 0074 { 0075 return QPoint(); 0076 } 0077 0078 void CQCanvasController::pan(const QPoint& distance) 0079 { 0080 QPoint offset = documentOffset() + distance; 0081 setDocumentOffset(offset); 0082 proxyObject->emitMoveDocumentOffset(offset); 0083 emit documentPositionChanged(offset); 0084 } 0085 0086 QPointF CQCanvasController::preferredCenter() const 0087 { 0088 return QPointF(); 0089 } 0090 0091 void CQCanvasController::setPreferredCenter(const QPointF& viewPoint) 0092 { 0093 Q_UNUSED(viewPoint) 0094 } 0095 0096 void CQCanvasController::recenterPreferred() 0097 { 0098 } 0099 0100 void CQCanvasController::zoomTo(const QRect& rect) 0101 { 0102 Q_UNUSED(rect) 0103 } 0104 0105 void CQCanvasController::zoomBy(const QPoint& center, qreal zoom) 0106 { 0107 Q_UNUSED(center) 0108 Q_UNUSED(zoom) 0109 } 0110 0111 void CQCanvasController::zoomOut(const QPoint& center) 0112 { 0113 Q_UNUSED(center) 0114 } 0115 0116 void CQCanvasController::zoomIn(const QPoint& center) 0117 { 0118 Q_UNUSED(center) 0119 } 0120 0121 void CQCanvasController::ensureVisible(KoShape* shape) 0122 { 0123 Q_UNUSED(shape) 0124 } 0125 0126 void CQCanvasController::ensureVisible(const QRectF& rect, bool smooth) 0127 { 0128 Q_UNUSED(rect) 0129 Q_UNUSED(smooth) 0130 } 0131 0132 int CQCanvasController::canvasOffsetY() const 0133 { 0134 return 0; 0135 } 0136 0137 int CQCanvasController::canvasOffsetX() const 0138 { 0139 return 0; 0140 } 0141 0142 int CQCanvasController::visibleWidth() const 0143 { 0144 return 0; 0145 } 0146 0147 int CQCanvasController::visibleHeight() const 0148 { 0149 return 0; 0150 } 0151 0152 KoCanvasBase* CQCanvasController::canvas() const 0153 { 0154 return d->canvas; 0155 } 0156 0157 void CQCanvasController::setCanvas(KoCanvasBase* canvas) 0158 { 0159 d->canvas = canvas; 0160 canvas->setCanvasController(this); 0161 proxyObject->emitCanvasSet(this); 0162 } 0163 0164 void CQCanvasController::setDrawShadow(bool drawShadow) 0165 { 0166 Q_UNUSED(drawShadow) 0167 } 0168 0169 QSize CQCanvasController::viewportSize() const 0170 { 0171 QGraphicsWidget *canvasWidget = dynamic_cast<QGraphicsWidget*>(d->canvas); 0172 return canvasWidget->size().toSize(); 0173 } 0174 0175 void CQCanvasController::scrollContentsBy(int dx, int dy) 0176 { 0177 Q_UNUSED(dx) 0178 Q_UNUSED(dy) 0179 } 0180 0181 QSize CQCanvasController::documentSize() const 0182 { 0183 return KoCanvasController::documentSize(); 0184 } 0185