libs/flake
KoCanvasBase.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 00003 Copyright (C) 2006 Boudewijn Rempt <boud@valdyas.org> 00004 Copyright (C) 2006 Thomas Zander <zander@kde.org> 00005 Copyright (C) 2006 Thorsten Zachmann <zachmann@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef KOCANVASBASE_H 00024 #define KOCANVASBASE_H 00025 00026 #include <KoUnit.h> 00027 00028 #include <QPointF> 00029 #include <QPoint> 00030 #include <QRectF> 00031 #include <QRect> 00032 #include <QWidget> 00033 00034 #include "flake_export.h" 00035 00036 class KoCanvasResourceProvider; 00037 class QUndoCommand; 00038 class KoShapeManager; 00039 class KoToolProxy; 00040 class KoViewConverter; 00041 class KoShapeController; 00042 class KoShapeControllerBase; 00043 class KoCanvasController; 00044 class KoShape; 00045 class KoSnapGuide; 00046 class KoGuidesData; 00047 00053 class FLAKE_EXPORT KoCanvasBase 00054 { 00055 00056 public: 00057 00063 explicit KoCanvasBase(KoShapeControllerBase *shapeControllerBase); 00064 virtual ~KoCanvasBase(); 00065 00066 public: 00067 00074 virtual void gridSize(qreal *horizontal, qreal *vertical) const = 0; 00075 00080 virtual bool snapToGrid() const = 0; 00081 00093 virtual void addCommand(QUndoCommand *command) = 0; 00094 00099 virtual KoShapeManager *shapeManager() const = 0; 00100 00105 virtual void updateCanvas(const QRectF &rc) = 0; 00106 00112 virtual KoToolProxy *toolProxy() const = 0; 00113 00118 virtual const KoViewConverter *viewConverter() const = 0; 00119 00123 virtual QWidget *canvasWidget() = 0; 00124 00128 virtual const QWidget *canvasWidget() const = 0; 00129 00135 virtual KoUnit unit() const = 0; 00136 00146 virtual void clipToDocument(const KoShape *shape, QPointF &move) const; 00147 00153 virtual QPoint documentOrigin() const { 00154 return QPoint(0, 0); 00155 } 00156 00160 virtual void updateInputMethodInfo() = 0; 00161 00167 KoCanvasResourceProvider *resourceProvider() const; 00168 00173 KoShapeController *shapeController() const; 00174 00178 KoCanvasController *canvasController() const; 00179 00187 virtual void ensureVisible(const QRectF &rect); 00188 00192 KoSnapGuide *snapGuide() const; 00193 00203 virtual KoGuidesData *guidesData(); 00204 00205 protected: 00206 friend class KoCanvasController; 00208 void setCanvasController(KoCanvasController *controller); 00209 00210 private: 00211 // we need a KoShapeControllerBase so that it can work 00212 KoCanvasBase(); 00213 00214 class Private; 00215 Private * const d; 00216 }; 00217 00218 #endif // KOCANVASBASE_H
