libs/flake

KoShapeManager.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002 
00003    Copyright (C) 2006-2008 Thorsten Zachmann <zachmann@kde.org>
00004    Copyright (C) 2007, 2009 Thomas Zander <zander@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KOSHAPEMANAGER_H
00023 #define KOSHAPEMANAGER_H
00024 
00025 #include <QList>
00026 #include <QObject>
00027 #include <QSet>
00028 
00029 #include "KoFlake.h"
00030 #include "flake_export.h"
00031 
00032 class KoShape;
00033 class KoSelection;
00034 class KoViewConverter;
00035 class KoCanvasBase;
00036 class KoPointerEvent;
00037 class KoShapeManagerPaintingStrategy;
00038 
00039 
00040 class QPainter;
00041 class QPointF;
00042 class QRectF;
00043 
00050 class FLAKE_EXPORT KoShapeManager : public QObject
00051 {
00052     Q_OBJECT
00053 
00054 public:
00056     enum Repaint {
00057         PaintShapeOnAdd,    
00058         AddWithoutRepaint   
00059     };
00060 
00064     explicit KoShapeManager(KoCanvasBase *canvas);
00070     KoShapeManager(KoCanvasBase *canvas, const QList<KoShape *> &shapes);
00071     virtual ~KoShapeManager();
00072 
00079     void setShapes(const QList<KoShape *> &shapes, Repaint repaint = PaintShapeOnAdd);
00080 
00082     QList<KoShape*> shapes() const;
00083 
00087     QList<KoShape*> topLevelShapes() const;
00088 
00095     void add(KoShape *shape, Repaint repaint = PaintShapeOnAdd);
00096 
00102     void addAdditional(KoShape *shape);
00103 
00108     void remove(KoShape *shape);
00109 
00115     void removeAdditional(KoShape *shape);
00116 
00118     KoSelection *selection() const;
00119 
00126     virtual void paint(QPainter &painter, const KoViewConverter &converter, bool forPrint);
00127 
00136     KoShape *shapeAt(const QPointF &position, KoFlake::ShapeSelection selection = KoFlake::ShapeOnTop, bool omitHiddenShapes = true);
00137 
00143     QList<KoShape *> shapesAt(const QRectF &rect, bool omitHiddenShapes = true);
00144 
00157     void update(QRectF &rect, const KoShape *shape = 0, bool selectionHandles = false);
00158 
00166     void notifyShapeChanged(KoShape *shape);
00167 
00174     void suggestChangeTool(KoPointerEvent *event);
00175 
00184     void paintShape(KoShape *shape, QPainter &painter, const KoViewConverter &converter, bool forPrint);
00185 
00193     void setPaintingStrategy(KoShapeManagerPaintingStrategy *strategy);
00194 
00195 signals:
00197     void selectionChanged();
00199     void selectionContentChanged();
00200 
00201 private:
00202     class Private;
00203     Private * const d;
00204 };
00205 
00206 #endif