File indexing completed on 2024-12-22 04:09:14

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2006-2007 Thomas Zander <zander@kde.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef KOZOOMSTRATEGY_H
0008 #define KOZOOMSTRATEGY_H
0009 
0010 #include "KoShapeRubberSelectStrategy.h"
0011 
0012 class KoCanvasController;
0013 class KoZoomTool;
0014 
0015 /**
0016  * //internal
0017  * This is a strategy for the KoZoomTool which will be used to do the actual zooming
0018  */
0019 class KoZoomStrategy : public KoShapeRubberSelectStrategy
0020 {
0021 public:
0022     /**
0023      * constructor
0024      * @param tool the parent tool this strategy is for
0025      * @param controller the canvas controller that wraps the canvas the tool is acting on.
0026      * @param clicked the location (in document points) where the interaction starts.
0027      */
0028     KoZoomStrategy(KoZoomTool *tool, KoCanvasController *controller, const QPointF &clicked);
0029 
0030     void forceZoomOut();
0031     void forceZoomIn();
0032 
0033     /// Execute the zoom
0034     void finishInteraction(Qt::KeyboardModifiers modifiers) override;
0035     void cancelInteraction() override;
0036 
0037 protected:
0038     SelectionMode currentMode() const override;
0039 private:
0040     KoCanvasController *m_controller;
0041 
0042     bool m_forceZoomOut;
0043     Q_DECLARE_PRIVATE(KoShapeRubberSelectStrategy)
0044 };
0045 
0046 #endif
0047