00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KOSHAPEMANAGER_H
00022 #define KOSHAPEMANAGER_H
00023
00024 #include <QList>
00025 #include <QObject>
00026 #include <QSet>
00027
00028 #include "KoFlake.h"
00029 #include <koffice_export.h>
00030 #include <KoRTree.h>
00031
00032 class KoShape;
00033 class KoSelection;
00034 class KoViewConverter;
00035 class KoCanvasBase;
00036
00037 class QPainter;
00038 class QPointF;
00039 class QRectF;
00040
00047 class FLAKE_EXPORT KoShapeManager : public QObject
00048 {
00049 Q_OBJECT
00050
00051 public:
00055 KoShapeManager(KoCanvasBase *canvas);
00061 KoShapeManager(KoCanvasBase *canvas, const QList<KoShape *> &shapes);
00062 virtual ~KoShapeManager();
00063
00069 void setShapes( const QList<KoShape *> &shapes );
00070
00072 const QList<KoShape *> & shapes() const { return m_shapes; }
00073
00078 void add(KoShape *shape);
00079
00084 void remove(KoShape *shape);
00085
00087 KoSelection * selection() const { return m_selection; }
00088
00095 virtual void paint( QPainter &painter, const KoViewConverter &converter, bool forPrint );
00096
00105 KoShape * shapeAt( const QPointF &position, KoFlake::ShapeSelection selection = KoFlake::ShapeOnTop, bool omitHiddenShapes = false );
00106
00112 QList<KoShape *> shapesAt( const QRectF &rect, bool omitHiddenShapes = false );
00113
00126 void repaint( QRectF &rect, const KoShape *shape = 0, bool selectionHandles = false );
00127
00135 void updateTree( KoShape * shape );
00136
00137 protected:
00142 void updateTree();
00143
00144 signals:
00146 void selectionChanged();
00147
00148 private:
00149 QList<KoShape *> m_shapes;
00150 KoSelection * m_selection;
00151 KoCanvasBase * m_canvas;
00152 KoRTree<KoShape *> m_tree;
00153 QSet<KoShape *> m_aggregate4update;
00154 };
00155
00156 #endif
00157