File indexing completed on 2024-05-12 13:04:44
0001 /* 0002 * This file is part of the KDE project 0003 * 0004 * SPDX-FileCopyrightText: 2013 Shantanu Tushar <shantanu@kde.org> 0005 * SPDX-FileCopyrightText: 2013 Sujith Haridasan <sujith.h@gmail.com> 0006 * SPDX-FileCopyrightText: 2013 Arjen Hiemstra <ahiemstra@heimr.nl> 0007 * 0008 * SPDX-License-Identifier: LGPL-2.0-or-later 0009 * 0010 */ 0011 0012 #include "CQCanvasController.h" 0013 0014 #include <QPoint> 0015 #include <QSize> 0016 #include <QGraphicsWidget> 0017 0018 #include <KoCanvasBase.h> 0019 #include <KoShape.h> 0020 0021 class CQCanvasController::Private 0022 { 0023 public: 0024 Private() : canvas(0) { } 0025 KoCanvasBase *canvas; 0026 }; 0027 0028 CQCanvasController::CQCanvasController(KActionCollection* actionCollection) 0029 : KoCanvasController(actionCollection), d(new Private) 0030 { 0031 } 0032 0033 CQCanvasController::~CQCanvasController() 0034 { 0035 delete d; 0036 } 0037 0038 void CQCanvasController::setVastScrolling(qreal factor) 0039 { 0040 Q_UNUSED(factor) 0041 } 0042 0043 void CQCanvasController::setZoomWithWheel(bool zoom) 0044 { 0045 Q_UNUSED(zoom) 0046 } 0047 0048 void CQCanvasController::updateDocumentSize(const QSize& sz, bool recalculateCenter) 0049 { 0050 Q_UNUSED(recalculateCenter) 0051 setDocumentSize(sz); 0052 emit documentSizeChanged(sz); 0053 } 0054 0055 void CQCanvasController::setScrollBarValue(const QPoint& value) 0056 { 0057 Q_UNUSED(value) 0058 } 0059 0060 QPoint CQCanvasController::scrollBarValue() const 0061 { 0062 return QPoint(); 0063 } 0064 0065 void CQCanvasController::pan(const QPoint& distance) 0066 { 0067 QPoint offset = documentOffset() + distance; 0068 setDocumentOffset(offset); 0069 proxyObject->emitMoveDocumentOffset(offset); 0070 emit documentPositionChanged(offset); 0071 } 0072 0073 QPointF CQCanvasController::preferredCenter() const 0074 { 0075 return QPointF(); 0076 } 0077 0078 void CQCanvasController::setPreferredCenter(const QPointF& viewPoint) 0079 { 0080 Q_UNUSED(viewPoint) 0081 } 0082 0083 void CQCanvasController::recenterPreferred() 0084 { 0085 } 0086 0087 void CQCanvasController::zoomTo(const QRect& rect) 0088 { 0089 Q_UNUSED(rect) 0090 } 0091 0092 void CQCanvasController::zoomBy(const QPoint& center, qreal zoom) 0093 { 0094 Q_UNUSED(center) 0095 Q_UNUSED(zoom) 0096 } 0097 0098 void CQCanvasController::zoomOut(const QPoint& center) 0099 { 0100 Q_UNUSED(center) 0101 } 0102 0103 void CQCanvasController::zoomIn(const QPoint& center) 0104 { 0105 Q_UNUSED(center) 0106 } 0107 0108 void CQCanvasController::ensureVisible(KoShape* shape) 0109 { 0110 Q_UNUSED(shape) 0111 } 0112 0113 void CQCanvasController::ensureVisible(const QRectF& rect, bool smooth) 0114 { 0115 Q_UNUSED(rect) 0116 Q_UNUSED(smooth) 0117 } 0118 0119 int CQCanvasController::canvasOffsetY() const 0120 { 0121 return 0; 0122 } 0123 0124 int CQCanvasController::canvasOffsetX() const 0125 { 0126 return 0; 0127 } 0128 0129 int CQCanvasController::visibleWidth() const 0130 { 0131 return 0; 0132 } 0133 0134 int CQCanvasController::visibleHeight() const 0135 { 0136 return 0; 0137 } 0138 0139 KoCanvasBase* CQCanvasController::canvas() const 0140 { 0141 return d->canvas; 0142 } 0143 0144 void CQCanvasController::setCanvas(KoCanvasBase* canvas) 0145 { 0146 d->canvas = canvas; 0147 canvas->setCanvasController(this); 0148 proxyObject->emitCanvasSet(this); 0149 } 0150 0151 void CQCanvasController::setDrawShadow(bool drawShadow) 0152 { 0153 Q_UNUSED(drawShadow) 0154 } 0155 0156 QSize CQCanvasController::viewportSize() const 0157 { 0158 QGraphicsWidget *canvasWidget = dynamic_cast<QGraphicsWidget*>(d->canvas); 0159 return canvasWidget->size().toSize(); 0160 } 0161 0162 void CQCanvasController::scrollContentsBy(int dx, int dy) 0163 { 0164 Q_UNUSED(dx) 0165 Q_UNUSED(dy) 0166 } 0167 0168 QSize CQCanvasController::documentSize() const 0169 { 0170 return KoCanvasController::documentSize(); 0171 } 0172