Commit 7114c121 authored by Thomas Zander's avatar Thomas Zander

API review of KoShapeContainer

Make the methods much more consistent both with each other
and with other classes which follow a Qt-ish api.
childClipped() -> isClipped()
setClipping() -> setClipped()

etc.

svn path=/trunk/koffice/; revision=1124024
parent 8ad80697
......@@ -113,7 +113,7 @@ bool recursiveFindActiveLayerInChildren(KoSelection* _selection, KoShapeLayer* _
_selection->setActiveLayer(_currentLayer);
return true;
}
foreach(KoShape* shape, _currentLayer->childShapes()) {
foreach(KoShape* shape, _currentLayer->shapes()) {
KoShapeLayer* layer = dynamic_cast<KoShapeLayer*>(shape);
if (layer && recursiveFindActiveLayerInChildren(_selection, layer)) {
return true;
......
......@@ -49,7 +49,7 @@ KisNodeShape::KisNodeShape(KoShapeContainer * parent, KisNodeSP node)
setShapeId(KIS_NODE_SHAPE_ID);
KoShape::setParent(parent);
parent->addChild(this);
parent->addShape(this);
connect(node, SIGNAL(visibilityChanged(bool)), SLOT(setNodeVisible(bool)));
connect(node, SIGNAL(userLockingChanged(bool)), SLOT(editabilityChanged()));
......@@ -131,7 +131,7 @@ void KisNodeShape::addChild(KoShape * shape)
if (!m_d->node->allowAsChild(nodeShape->node())) return;
KoShapeContainer::addChild(shape);
KoShapeContainer::addShape(shape);
}
void KisNodeShape::saveOdf(KoShapeSavingContext & /*context*/) const
......
......@@ -103,7 +103,7 @@ void KisShapeController::Private::removeShapeAndChildrenFromMap(KoShape* shape)
{
KoShapeContainer * parent = dynamic_cast<KoShapeContainer*>(shape);
if (parent) {
foreach(KoShape * child, parent->childShapes()) {
foreach(KoShape * child, parent->shapes()) {
removeShapeAndChildrenFromMap(child);
}
}
......@@ -203,7 +203,7 @@ void KisShapeController::removeShape(KoShape* shape)
{
KoShapeContainer * parent = dynamic_cast<KoShapeContainer*>(shape);
if (parent) {
foreach(KoShape * child, parent->childShapes()) {
foreach(KoShape * child, parent->shapes()) {
dbgUI << "Removing " << child << " as child of " << parent;
removeShape(child);
}
......@@ -399,7 +399,7 @@ void KisShapeController::slotNodeAdded(KisNode* parentNode, int index)
// Put the layer in the right place in the hierarchy
shape->setParent(parent);
parent->addChild(shape);
parent->addShape(shape);
m_d->nodeShapes[node] = shape;
......
......@@ -110,7 +110,7 @@ KisShapeLayer::KisShapeLayer(const KisShapeLayer& _rhs)
KoShapeContainer::setParent(_rhs.KoShapeContainer::parent());
initShapeLayer(_rhs.m_d->controller);
KoShapeOdfSaveHelper saveHelper(_rhs.childShapes());
KoShapeOdfSaveHelper saveHelper(_rhs.shapes());
KoDrag drag;
drag.setOdf(KoOdf::mimeType(KoOdf::Text), saveHelper);
QMimeData* mimeData = drag.mimeData();
......@@ -157,7 +157,7 @@ void KisShapeLayer::addChild(KoShape *object)
{
QRect updatedRect = m_d->converter->documentToView(object->boundingRect()).toRect();
KoShapeLayer::addChild(object);
KoShapeLayer::addShape(object);
m_d->canvas->shapeManager()->add(object);
setDirty(updatedRect);
......@@ -168,7 +168,7 @@ void KisShapeLayer::removeChild(KoShape *object)
QRect updatedRect = m_d->converter->documentToView(object->boundingRect()).toRect();
m_d->canvas->shapeManager()->remove(object);
KoShapeLayer::removeChild(object);
KoShapeLayer::removeShape(object);
setDirty(updatedRect);
}
......
......@@ -42,7 +42,7 @@ public:
KoShape * shape = KoShapeRegistry::instance()->createShapeFromOdf(child, context);
if (shape) {
kDebug() << "Adding " << shape << "with parent" << shape->parent() << "to container" << m_container;
m_container->addChild(shape);
m_container->addShape(shape);
}
}
return true;
......
......@@ -83,7 +83,7 @@ KisShapeSelection::KisShapeSelection(const KisShapeSelection& rhs, KisSelection*
m_canvas = new KisShapeSelectionCanvas();
m_canvas->shapeManager()->add(this);
KoShapeOdfSaveHelper saveHelper(rhs.childShapes());
KoShapeOdfSaveHelper saveHelper(rhs.shapes());
KoDrag drag;
drag.setOdf(KoOdf::mimeType(KoOdf::Text), saveHelper);
QMimeData* mimeData = drag.mimeData();
......@@ -280,20 +280,20 @@ bool KisShapeSelection::loadSelection(KoStore* store)
void KisShapeSelection::addChild(KoShape *object)
{
KoShapeLayer::addChild(object);
KoShapeLayer::addShape(object);
m_canvas->shapeManager()->add(object);
}
void KisShapeSelection::removeChild(KoShape *object)
{
m_canvas->shapeManager()->remove(object);
KoShapeLayer::removeChild(object);
KoShapeLayer::removeShape(object);
}
QPainterPath KisShapeSelection::selectionOutline()
{
if (m_dirty) {
QList<KoShape*> shapesList = childShapes();
QList<KoShape*> shapesList = shapes();
QPainterPath outline;
foreach(KoShape * shape, shapesList) {
......
......@@ -86,13 +86,13 @@ void KisShapeSelectionModel::remove(KoShape *child)
m_image->undoAdapter()->emitSelectionChanged();
}
void KisShapeSelectionModel::setClipping(const KoShape *child, bool clipping)
void KisShapeSelectionModel::setClipped(const KoShape *child, bool clipping)
{
Q_UNUSED(child);
Q_UNUSED(clipping);
}
bool KisShapeSelectionModel::childClipped(const KoShape *child) const
bool KisShapeSelectionModel::isClipped(const KoShape *child) const
{
Q_UNUSED(child);
return false;
......@@ -103,7 +103,7 @@ int KisShapeSelectionModel::count() const
return m_shapeMap.count();
}
QList<KoShape*> KisShapeSelectionModel::childShapes() const
QList<KoShape*> KisShapeSelectionModel::shapes() const
{
return QList<KoShape*>(m_shapeMap.keys());
}
......
......@@ -36,11 +36,11 @@ public:
void add(KoShape *child);
void remove(KoShape *child);
void setClipping(const KoShape *child, bool clipping);
bool childClipped(const KoShape *child) const;
void setClipped(const KoShape *child, bool clipping);
bool isClipped(const KoShape *child) const;
int count() const;
QList<KoShape*> childShapes() const;
QList<KoShape*> shapes() const;
void containerChanged(KoShapeContainer *);
void childChanged(KoShape * child, KoShape::ChangeType type);
......
......@@ -1327,7 +1327,7 @@ KoPathShape * KoPathShape::createShapeFromPainterPath(const QPainterPath &path)
bool KoPathShape::hitTest(const QPointF &position) const
{
if (parent() && parent()->childClipped(this) && ! parent()->hitTest(position))
if (parent() && parent()->isClipped(this) && ! parent()->hitTest(position))
return false;
QPointF point = absoluteTransformation(0).inverted().map(position);
......
......@@ -83,7 +83,7 @@ void KoSelectionPrivate::selectGroupChildren(KoShapeGroup *group)
if (! group)
return;
foreach(KoShape *shape, group->childShapes()) {
foreach(KoShape *shape, group->shapes()) {
if (selectedShapes.contains(shape))
continue;
selectedShapes << shape;
......@@ -99,7 +99,7 @@ void KoSelectionPrivate::deselectGroupChildren(KoShapeGroup *group)
if (! group)
return;
foreach(KoShape *shape, group->childShapes()) {
foreach(KoShape *shape, group->shapes()) {
if (selectedShapes.contains(shape))
selectedShapes.removeAll(shape);
......
......@@ -99,7 +99,7 @@ KoShapePrivate::~KoShapePrivate()
{
Q_Q(KoShape);
if (parent)
parent->removeChild(q);
parent->removeShape(q);
foreach(KoShapeManager *manager, shapeManagers) {
manager->remove(q);
manager->removeAdditional(q);
......@@ -286,7 +286,7 @@ void KoShape::setPosition(const QPointF &newPosition)
bool KoShape::hitTest(const QPointF &position) const
{
Q_D(const KoShape);
if (d->parent && d->parent->childClipped(this) && !d->parent->hitTest(position))
if (d->parent && d->parent->isClipped(this) && !d->parent->hitTest(position))
return false;
QPointF point = absoluteTransformation(0).inverted().map(position);
......@@ -342,7 +342,7 @@ QMatrix KoShape::absoluteTransformation(const KoViewConverter *converter) const
// apply parents matrix to inherit any transformations done there.
KoShapeContainer * container = d->parent;
if (container) {
if (container->childClipped(this)) {
if (container->isClipped(this)) {
// We do need to pass the converter here, otherwise the parent's
// translation is not inherited.
matrix = container->absoluteTransformation(converter);
......@@ -437,10 +437,10 @@ void KoShape::setParent(KoShapeContainer *parent)
KoShapeContainer *oldParent = d->parent;
d->parent = 0; // avoids recursive removing
if (oldParent)
oldParent->removeChild(this);
oldParent->removeShape(this);
if (parent && parent != this) {
d->parent = parent;
parent->addChild(this);
parent->addShape(this);
}
notifyChanged();
d->shapeChanged(ParentChanged);
......@@ -949,7 +949,7 @@ QString KoShape::saveStyle(KoGenStyle &style, KoShapeSavingContext &context) con
style.addProperty(it.key(), it.value());
}
if (parent() && parent()->childClipped(this)) {
if (parent() && parent()->isClipped(this)) {
/*
* In KOffice clipping is done using a parent shape which can be rotated, sheared etc
* and even non-square. So the ODF interoperability version we write here is really
......@@ -1306,7 +1306,7 @@ void KoShape::saveOdfAttributes(KoShapeSavingContext &context, int attributes) c
if (attributes & OdfSize) {
QSizeF s(size());
if (parent() && parent()->childClipped(this)) { // being clipped shrinks our visible size
if (parent() && parent()->isClipped(this)) { // being clipped shrinks our visible size
// clipping in ODF is done using a combination of visual size and content cliprect.
// A picture of 10cm x 10cm displayed in a box of 2cm x 4cm will be scaled (out
// of proportion in this case). If we then add a fo:clip like;
......
/* This file is part of the KDE project
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2006-2010 Thomas Zander <zander@kde.org>
* Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
......@@ -59,27 +59,27 @@ KoShapeContainer::~KoShapeContainer()
{
Q_D(KoShapeContainer);
if (d->children) {
foreach(KoShape *shape, d->children->childShapes())
foreach(KoShape *shape, d->children->shapes())
shape->setParent(0);
}
}
void KoShapeContainer::addChild(KoShape *shape)
void KoShapeContainer::addShape(KoShape *shape)
{
Q_D(KoShapeContainer);
Q_ASSERT(shape);
if (shape->parent() == this && childShapes().contains(shape))
if (shape->parent() == this && shapes().contains(shape))
return;
if (d->children == 0)
d->children = new KoShapeContainerDefaultModel();
if (shape->parent() && shape->parent() != this)
shape->parent()->removeChild(shape);
shape->parent()->removeShape(shape);
d->children->add(shape);
shape->setParent(this);
childCountChanged();
shapeCountChanged();
}
void KoShapeContainer::removeChild(KoShape *shape)
void KoShapeContainer::removeShape(KoShape *shape)
{
Q_D(KoShapeContainer);
Q_ASSERT(shape);
......@@ -87,7 +87,7 @@ void KoShapeContainer::removeChild(KoShape *shape)
return;
d->children->remove(shape);
shape->setParent(0);
childCountChanged();
shapeCountChanged();
KoShapeContainer * grandparent = parent();
if (grandparent) {
......@@ -95,7 +95,7 @@ void KoShapeContainer::removeChild(KoShape *shape)
}
}
int KoShapeContainer::childCount() const
int KoShapeContainer::shapeCount() const
{
Q_D(const KoShapeContainer);
if (d->children == 0)
......@@ -111,12 +111,12 @@ bool KoShapeContainer::isChildLocked(const KoShape *child) const
return d->children->isChildLocked(child);
}
void KoShapeContainer::setClipping(const KoShape *child, bool clipping)
void KoShapeContainer::setClipped(const KoShape *child, bool clipping)
{
Q_D(KoShapeContainer);
if (d->children == 0)
return;
d->children->setClipping(child, clipping);
d->children->setClipped(child, clipping);
}
void KoShapeContainer::paint(QPainter &painter, const KoViewConverter &converter)
......@@ -128,7 +128,7 @@ void KoShapeContainer::paint(QPainter &painter, const KoViewConverter &converter
if (d->children == 0 || d->children->count() == 0)
return;
QList<KoShape*> sortedObjects = d->children->childShapes();
QList<KoShape*> sortedObjects = d->children->shapes();
qSort(sortedObjects.begin(), sortedObjects.end(), KoShape::compareShapeZIndex);
// Do the following to revert the absolute transformation of the container
......@@ -147,7 +147,7 @@ void KoShapeContainer::paint(QPainter &painter, const KoViewConverter &converter
//kDebug(30006) <<"KoShapeContainer::painting shape:" << shape->shapeId() <<"," << shape->boundingRect();
if (! shape->isVisible())
continue;
if (! childClipped(shape)) // the shapeManager will have to draw those, or else we can't do clipRects
if (! isClipped(shape)) // the shapeManager will have to draw those, or else we can't do clipRects
continue;
if (painter.hasClipping()) {
QRectF rect = converter.viewToDocument(painter.clipRegion().boundingRect());
......@@ -180,16 +180,16 @@ void KoShapeContainer::shapeChanged(ChangeType type, KoShape *shape)
|| type == SizeChanged || type == PositionChanged))
return;
d->children->containerChanged(this);
foreach(KoShape *shape, d->children->childShapes())
foreach(KoShape *shape, d->children->shapes())
shape->notifyChanged();
}
bool KoShapeContainer::childClipped(const KoShape *child) const
bool KoShapeContainer::isClipped(const KoShape *child) const
{
Q_D(const KoShapeContainer);
if (d->children == 0) // throw exception??
return false;
return d->children->childClipped(child);
return d->children->isClipped(child);
}
void KoShapeContainer::update() const
......@@ -197,17 +197,17 @@ void KoShapeContainer::update() const
Q_D(const KoShapeContainer);
KoShape::update();
if (d->children)
foreach(KoShape *shape, d->children->childShapes())
foreach(KoShape *shape, d->children->shapes())
shape->update();
}
QList<KoShape*> KoShapeContainer::childShapes() const
QList<KoShape*> KoShapeContainer::shapes() const
{
Q_D(const KoShapeContainer);
if (d->children == 0)
return QList<KoShape*>();
return d->children->childShapes();
return d->children->shapes();
}
KoShapeContainerModel *KoShapeContainer::model() const
......
/* This file is part of the KDE project
* Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
* Copyright (C) 2006-2010 Thomas Zander <zander@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -94,33 +94,33 @@ public:
* Add a child to this container.
* @param shape the child to be managed in the container.
*/
void addChild(KoShape *shape);
void addShape(KoShape *shape);
/**
* Remove a child to be completely separated from the container.
* @param shape the child to be removed.
*/
void removeChild(KoShape *shape);
void removeShape(KoShape *shape);
/**
* Return the current number of children registered.
* @return the current number of children registered.
*/
int childCount() const;
int shapeCount() const;
/**
* 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
*/
void setClipping(const KoShape *child, bool clipping);
void setClipped(const KoShape *child, bool clipping);
/**
* Returns if the argument child has its 'clipping' property set.
* @return if the argument child has its 'clipping' property set.
* @param child the child for which the property will be returned.
*/
bool childClipped(const KoShape *child) const;
bool isClipped(const KoShape *child) const;
/**
* Return wheather the child has the effective state of being locked for user modifications.
......@@ -151,7 +151,7 @@ public:
* Create and return an iterator over all child shapes.
* @return an interator over all child shapes.
*/
QList<KoShape*> childShapes() const;
QList<KoShape*> shapes() const;
/**
* return the model for this container
......@@ -165,7 +165,7 @@ protected:
* This method will be called just after the child has been added/removed.
* The default implementation is empty.
*/
virtual void childCountChanged() { }
virtual void shapeCountChanged() { }
/// constructor
KoShapeContainer(KoShapeContainerPrivate &);
......
......@@ -96,7 +96,7 @@ void KoShapeContainerDefaultModel::proposeMove(KoShape *shape, QPointF &move)
}
void KoShapeContainerDefaultModel::setClipping(const KoShape *child, bool clipping)
void KoShapeContainerDefaultModel::setClipped(const KoShape *child, bool clipping)
{
Private::Relation *relation = d->findRelation(child);
if (relation == 0)
......@@ -109,7 +109,7 @@ void KoShapeContainerDefaultModel::setClipping(const KoShape *child, bool clippi
relation->child()->update();
}
bool KoShapeContainerDefaultModel::childClipped(const KoShape *child) const
bool KoShapeContainerDefaultModel::isClipped(const KoShape *child) const
{
Private::Relation *relation = d->findRelation(child);
return relation ? relation->m_inside: false;
......@@ -128,7 +128,7 @@ int KoShapeContainerDefaultModel::count() const
return d->relations.count();
}
QList<KoShape*> KoShapeContainerDefaultModel::childShapes() const
QList<KoShape*> KoShapeContainerDefaultModel::shapes() const
{
QList<KoShape*> answer;
foreach(Private::Relation *relation, d->relations) {
......
......@@ -41,10 +41,10 @@ public:
void proposeMove(KoShape *shape, QPointF &move);
/// reimplemented
virtual void setClipping(const KoShape *child, bool clipping);
virtual void setClipped(const KoShape *child, bool clipping);
/// reimplemented
virtual bool childClipped(const KoShape *child) const;
virtual bool isClipped(const KoShape *child) const;
// reimplemented
virtual void remove(KoShape *child);
......@@ -53,7 +53,7 @@ public:
virtual int count() const;
/// reimplemented
virtual QList<KoShape*> childShapes() const;
virtual QList<KoShape*> shapes() const;
/// reimplemented
virtual bool isChildLocked(const KoShape *child) const;
......
......@@ -63,7 +63,7 @@ public:
* @param clipping the property; see KoShapeContainerModel for an explenation of what
* this bool is for.
*/
virtual void setClipping(const KoShape *child, bool clipping) = 0;
virtual void setClipped(const KoShape *child, bool clipping) = 0;
/**
* Returns if the argument child has its 'clipping' property set.
......@@ -71,7 +71,7 @@ public:
* @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;
virtual bool isClipped(const KoShape *child) const = 0;
/**
* Return wheather the child has the effective state of being locked for user modifications.
......@@ -91,7 +91,7 @@ public:
* Create and return an iterator over all child objects.
* @return an interator over all child objects.
*/
virtual QList<KoShape*> childShapes() const = 0;
virtual QList<KoShape*> shapes() const = 0;
/**
* This method is called as a notification that one of the properties of the
......
......@@ -54,7 +54,7 @@ bool KoShapeGroup::hitTest(const QPointF &position) const
return false;
}
void KoShapeGroup::childCountChanged()
void KoShapeGroup::shapeCountChanged()
{
// TODO: why is this needed here ? the group/ungroup command should take care of this
QRectF br = boundingRect();
......@@ -68,7 +68,7 @@ void KoShapeGroup::saveOdf(KoShapeSavingContext & context) const
saveOdfAttributes(context, (OdfMandatories ^ OdfLayer) | OdfAdditionalAttributes);
context.xmlWriter().addAttributePt("svg:y", position().y());
QList<KoShape*> shapes = childShapes();
QList<KoShape*> shapes = this->shapes();
qSort(shapes.begin(), shapes.end(), KoShape::compareShapeZIndex);
foreach(KoShape* shape, shapes) {
......@@ -92,7 +92,7 @@ bool KoShapeGroup::loadOdf(const KoXmlElement & element, KoShapeLoadingContext &
if (layer) {
usedLayers[layer]++;
}
addChild(shape);
addShape(shape);
}
}
KoShapeLayer *parent = 0;
......@@ -108,7 +108,7 @@ bool KoShapeGroup::loadOdf(const KoXmlElement & element, KoShapeLoadingContext &
QRectF bound;
bool boundInitialized = false;
foreach(KoShape * shape, childShapes()) {
foreach(KoShape * shape, shapes()) {
if (! boundInitialized) {
bound = shape->boundingRect();
boundInitialized = true;
......@@ -119,7 +119,7 @@ bool KoShapeGroup::loadOdf(const KoXmlElement & element, KoShapeLoadingContext &
setSize(bound.size());
setPosition(bound.topLeft());
foreach(KoShape * shape, childShapes())
foreach(KoShape * shape, shapes())
shape->setAbsolutePosition(shape->absolutePosition() - bound.topLeft());
return true;
......
......@@ -58,7 +58,7 @@ public:
virtual bool loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context);
private:
void childCountChanged();
void shapeCountChanged();
virtual void shapeChanged(ChangeType type, KoShape *shape = 0);
};
......
......@@ -49,7 +49,7 @@ QRectF KoShapeLayer::boundingRect() const
{
QRectF bb;
foreach(KoShape* shape, childShapes()) {
foreach(KoShape* shape, shapes()) {
if (bb.isEmpty())
bb = shape->boundingRect();
else
......@@ -61,7 +61,7 @@ QRectF KoShapeLayer::boundingRect() const
void KoShapeLayer::saveOdf(KoShapeSavingContext & context) const
{
QList<KoShape*> shapes = childShapes();
QList<KoShape*> shapes = this->shapes();
qSort(shapes.begin(), shapes.end(), KoShape::compareShapeZIndex);
foreach(KoShape* shape, shapes) {
......
......@@ -149,9 +149,9 @@ void KoShapeManager::Private::updateTree()
void KoShapeManager::Private::paintGroup(KoShapeGroup *group, QPainter &painter, const KoViewConverter &converter, bool forPrint)
{
QList<KoShape*> childShapes = group->childShapes();
qSort(childShapes.begin(), childShapes.end(), KoShape::compareShapeZIndex);
foreach(KoShape *child, childShapes) {
QList<KoShape*> shapes = group->shapes();
qSort(shapes.begin(), shapes.end(), KoShape::compareShapeZIndex);
foreach(KoShape *child, shapes) {
// we paint recursively here, so we do not have to check recursively for visibility
if (!child->isVisible())
continue;
......@@ -226,7 +226,7 @@ void KoShapeManager::add(KoShape *shape, Repaint repaint)
KoShapeContainer *container = dynamic_cast<KoShapeContainer*>(shape);
if (container) {
foreach (KoShape *containerShape, container->childShapes()) {
foreach (KoShape *containerShape, container->shapes()) {
add(containerShape, repaint);
}
}
......@@ -263,7 +263,7 @@ void KoShapeManager::remove(KoShape *shape)
// remove the children of a KoShapeContainer
KoShapeContainer *container = dynamic_cast<KoShapeContainer*>(shape);
if (container) {
foreach (KoShape *containerShape, container->childShapes()) {
foreach (KoShape *containerShape, container->shapes()) {
remove(containerShape);
}
}
......@@ -321,7 +321,7 @@ void KoShapeManager::paint(QPainter &painter, const KoViewConverter &converter,
qSort(sortedShapes.begin(), sortedShapes.end(), KoShape::compareShapeZIndex);
foreach (KoShape *shape, sortedShapes) {
if (shape->parent() != 0 && shape->parent()->childClipped(shape))
if (shape->parent() != 0 && shape->parent()->isClipped(shape))
continue;
painter.save();
......@@ -573,7 +573,7 @@ void KoShapeManager::notifyShapeChanged(KoShape *shape)
KoShapeContainer *container = dynamic_cast<KoShapeContainer*>(shape);
if (container) {
foreach(KoShape *child, container->childShapes())
foreach(KoShape *child, container->shapes())
d->aggregate4update.insert(child);
}
}
......
......@@ -67,7 +67,7 @@ bool KoShapePaste::process(const KoXmlElement & body, KoOdfReadStore & odfStore)
KoOdfLoadingContext loadingContext(odfStore.styles(), odfStore.store());
KoShapeLoadingContext context(loadingContext, d->canvas->shapeController()->resourceManager());
QList<KoShape*> shapes(d->layer ? d->layer->childShapes(): d->canvas->shapeManager()->topLevelShapes());
QList<KoShape*> shapes(d->layer ? d->layer->shapes(): d->canvas->shapeManager()->topLevelShapes());
int zIndex = 0;
if (!shapes.isEmpty()) {
......
......@@ -32,8 +32,8 @@ public:
return;
m_members.append(child);
}
void setClipping(const KoShape *, bool) { }
bool childClipped(const KoShape *) const {
void setClipped(const KoShape *, bool) { }
bool isClipped(const KoShape *) const {
return false;
}
void remove(KoShape *child) {
......@@ -42,7 +42,7 @@ public:
int count() const {
return m_members.count();
}
QList<KoShape*> childShapes() const {
QList<KoShape*> shapes() const {
return QList<KoShape*>(m_members);
}
void containerChanged(KoShapeContainer *) { }
......
......@@ -87,12 +87,12 @@ void KoPathCombineCommand::redo()
foreach(KoPathShape* p, d->paths) {
d->controller->removeShape(p);
if (*parentIt)
(*parentIt)->removeChild(p);
(*parentIt)->removeShape(p);
parentIt++;
}
if (d->combinedPathParent)
d->combinedPathParent->addChild(d->combinedPath);
d->combinedPathParent->addShape(d->combinedPath);
d->controller->addShape(d->combinedPath);
}
}
......@@ -107,7 +107,7 @@ void KoPathCombineCommand::undo()
if (d->controller) {
d->controller->removeShape(d->combinedPath);
if (d->combinedPath->parent())
d->combinedPath->parent()->removeChild(d->combinedPath);
d->combinedPath->parent()->removeShape(d->combinedPath);
QList<KoShapeContainer*>::iterator parentIt = d->oldParents.begin();
foreach(KoPathShape* p, d->paths) {
d->controller->addShape(p);
......
......@@ -63,7 +63,7 @@ void KoShapeCreateCommand::redo()
Q_ASSERT(d->shape);
Q_ASSERT(d->controller);
if (d->shapeParent)
d->shapeParent->addChild(d->shape);
d->shapeParent->addShape(d->shape);
// the parent has to be there when it is added to the KoShapeControllerBase