50 int newIndex =
d->textShape->shapesInside().indexOf(
d->shapes.first());
51 const int max = (
d->textShape->shapesInside().size() -1);
54 newIndex = qMax(0, newIndex - 1);
58 Q_FOREACH(
KoShape *shape,
d->shapes) {
59 const int index =
d->textShape->shapesInside().indexOf(shape);
60 if (index == newIndex)
continue;
62 d->textShape->moveShapeInsideToIndex(shape, newIndex);
67 newIndex = qMin(max, newIndex +
d->shapes.size());
71 auto end = std::make_reverse_iterator(
d->shapes.begin());
72 auto begin = std::make_reverse_iterator(
d->shapes.end());
73 for (
auto it = begin; it != end; it++) {
76 const int index =
d->textShape->shapesInside().indexOf(shape);
77 if (index == newIndex)
continue;
78 if (newIndex < 0)
continue;
80 d->textShape->moveShapeInsideToIndex(shape, newIndex);
KoSvgTextReorderShapeInsideCommand(KoSvgTextShape *textShape, QList< KoShape * > shape, MoveShapeType type, KUndo2Command *parent=nullptr)
QScopedPointer< Private > d
QList< KoShape * > shapesInside
KoSvgTextShapeMementoSP memento
KoSvgTextReorderShapeInsideCommand::MoveShapeType type
Private(KoSvgTextShape *_text, QList< KoShape * > _shapes, KoSvgTextReorderShapeInsideCommand::MoveShapeType _type)