[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/libs/flake
From: Thomas Zander <zander () kde ! org>
Date: 2007-04-05 19:17:44
Message-ID: 1175800664.734085.26030.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 650915 by zander:
Split KoShapeContainerModel out into its own file.
Noted that the KoShapeLayer had a copy paste of a SimpleShapeContainerModel
from KoShapeGroup, so splitted that out into its own file and remove the
duplicate.
M +1 -0 KoShapeContainer.cpp
M +1 -65 KoShapeContainer.h
A KoShapeContainerModel.h KoShapeContainer.h#650829 [License: LGPL (v2+)]
M +3 -34 KoShapeGroup.cpp
M +0 -15 KoShapeGroup.h
M +2 -50 KoShapeLayer.cpp
M +0 -16 KoShapeLayer.h
A SimpleShapeContainerModel.h [License: LGPL (v2+)]
--- trunk/koffice/libs/flake/KoShapeContainer.cpp #650914:650915
@@ -19,6 +19,7 @@
#include <kdebug.h>
#include "KoShapeContainer.h"
+#include "KoShapeContainerModel.h"
#include <QPointF>
#include <QPainter>
--- trunk/koffice/libs/flake/KoShapeContainer.h #650914:650915
@@ -29,73 +29,9 @@
class QPainter;
class QPointF;
+class KoShapeContainerModel;
/**
- * The interface for the container model.
- * This class has no implementation, but only pure virtual methods. Extending this
- * class and implementing all methods allows you to implement a custom data-backend
- * for the KoShapeContainer.
- * @see KoShapeContainer
- */
-class FLAKE_EXPORT KoShapeContainerModel {
-public:
- /// default constructor
- KoShapeContainerModel() {}
-
- /// destructor
- virtual ~KoShapeContainerModel() {}
-
- /**
- * Add a child to this models store.
- * @param child the child to be managed in the container.
- */
- virtual void add(KoShape *child) = 0;
-
- /**
- * Remove a child to be completely separated from the model.
- * @param child the child to be removed.
- */
- virtual void remove(KoShape *child) = 0;
-
- /**
- * Set the argument child to have its 'clipping' property set.
- * @param child the child for which the property will be changed.
- * @param clipping the property; see KoShapeContainerModel for an explenation of what
- * this bool is for.
- */
- virtual void setClipping(const KoShape *child, bool clipping) = 0;
-
- /**
- * Returns if the argument child has its 'clipping' property set.
- * See KoShapeContainerModel for an explenation of what this bool is for.
- * @return if the argument child has its 'clipping' property set.
- * @param child the child for which the property will be returned.
- */
- virtual bool childClipped(const KoShape *child) const = 0;
-
- /**
- * Return the current number of children registered.
- * @return the current number of children registered.
- */
- virtual int count() const = 0;
-
- /**
- * Create and return an iterator over all child objects.
- * @return an interator over all child objects.
- */
- virtual QList<KoShape*> iterator() const = 0;
-
- /**
- * This method is called as a notification that one of the properties of the
- * container changed. This can be one of size, position, rotation and skew.
- * Note that clipped children will automatically get all these changes, the model
- * does not have to do anything for that.
- * @param container the actual container that changed.
- */
- virtual void containerChanged(KoShapeContainer *container) = 0;
-};
-
-/**
* This is the base class that all Flake group-objects are based on.
* Extending from this class allows you to have child-objects.
* Like the KoShape class, this object is a visible class with
--- trunk/koffice/libs/flake/KoShapeGroup.cpp #650914:650915
@@ -18,9 +18,11 @@
*/
#include "KoShapeGroup.h"
+#include "KoShapeContainerModel.h"
+#include "SimpleShapeContainerModel.h"
KoShapeGroup::KoShapeGroup()
-: KoShapeContainer(new GroupMembers())
+: KoShapeContainer(new SimpleShapeContainerModel())
{
}
@@ -34,39 +36,6 @@
return false;
}
-// ############# GroupMembers #############
-void KoShapeGroup::GroupMembers::add(KoShape *child) {
- if(m_groupMembers.contains(child))
- return;
- m_groupMembers.append(child);
-}
-
-void KoShapeGroup::GroupMembers::remove(KoShape *child) {
- m_groupMembers.removeAll(child);
-}
-
-int KoShapeGroup::GroupMembers::count() const {
- return m_groupMembers.count();
-}
-
-QList<KoShape*> KoShapeGroup::GroupMembers::iterator() const {
- return QList<KoShape*>(m_groupMembers);
-}
-
-void KoShapeGroup::GroupMembers::containerChanged(KoShapeContainer *container) {
- Q_UNUSED(container);
-}
-
-void KoShapeGroup::GroupMembers::setClipping(const KoShape *child, bool clipping) {
- Q_UNUSED(child);
- Q_UNUSED(clipping);
-}
-
-bool KoShapeGroup::GroupMembers::childClipped(const KoShape *child) const {
- Q_UNUSED(child);
- return false;
-}
-
void KoShapeGroup::childCountChanged() {
QRectF br = boundingRect();
setPosition( br.topLeft() );
--- trunk/koffice/libs/flake/KoShapeGroup.h #650914:650915
@@ -49,22 +49,7 @@
bool hitTest( const QPointF &position ) const;
private:
- class GroupMembers: public KoShapeContainerModel {
- public:
- GroupMembers() {};
- ~GroupMembers() {}
- void add(KoShape *child);
- void setClipping(const KoShape *child, bool clipping);
- bool childClipped(const KoShape *child) const;
- void remove(KoShape *child);
- int count() const;
- QList<KoShape*> iterator() const;
- void containerChanged(KoShapeContainer *container);
- private: // members
- QList <KoShape *> m_groupMembers;
- };
-
void childCountChanged();
};
--- trunk/koffice/libs/flake/KoShapeLayer.cpp #650914:650915
@@ -18,9 +18,10 @@
*/
#include "KoShapeLayer.h"
+#include "SimpleShapeContainerModel.h"
KoShapeLayer::KoShapeLayer()
-: KoShapeContainer(new LayerMembers())
+: KoShapeContainer(new SimpleShapeContainerModel())
{
setSelectable(false);
}
@@ -45,52 +46,3 @@
return bb;
}
-
-
-// ############# LayerMembers #############
-KoShapeLayer::LayerMembers::LayerMembers()
-{
-}
-
-KoShapeLayer::LayerMembers::~LayerMembers()
-{
-}
-
-void KoShapeLayer::LayerMembers::add(KoShape *child)
-{
- if(m_layerMembers.contains(child))
- return;
- m_layerMembers.append(child);
-}
-
-void KoShapeLayer::LayerMembers::remove(KoShape *child)
-{
- m_layerMembers.removeAll(child);
-}
-
-int KoShapeLayer::LayerMembers::count() const
-{
- return m_layerMembers.count();
-}
-
-QList<KoShape*> KoShapeLayer::LayerMembers::iterator() const
-{
- return QList<KoShape*>(m_layerMembers);
-}
-
-void KoShapeLayer::LayerMembers::containerChanged(KoShapeContainer *container)
-{
- Q_UNUSED(container);
-}
-
-void KoShapeLayer::LayerMembers::setClipping(const KoShape *child, bool clipping)
-{
- Q_UNUSED(child);
- Q_UNUSED(clipping);
-}
-
-bool KoShapeLayer::LayerMembers::childClipped(const KoShape *child) const
-{
- Q_UNUSED(child);
- return false;
-}
--- trunk/koffice/libs/flake/KoShapeLayer.h #650914:650915
@@ -40,22 +40,6 @@
virtual void paintComponent(QPainter &, const KoViewConverter &) {}
bool hitTest( const QPointF &position ) const;
virtual QRectF boundingRect() const;
-private:
- class LayerMembers: public KoShapeContainerModel {
- public:
- LayerMembers();
- ~LayerMembers();
- void add(KoShape *child);
- void setClipping(const KoShape *child, bool clipping);
- bool childClipped(const KoShape *child) const;
- void remove(KoShape *child);
- int count() const;
- QList<KoShape*> iterator() const;
- void containerChanged(KoShapeContainer *container);
-
- private: // members
- QList <KoShape *> m_layerMembers;
- };
};
#endif // __KOSHAPELAYER_H__
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic