14#include <klocalizedstring.h>
22 : controller(c), executed(false) {
27 qDeleteAll(oldClipPaths);
29 qDeleteAll(newClipPaths);
45 d->shapesToClip = shapes;
48 Q_FOREACH (
KoShape *shape,
d->shapesToClip) {
49 d->oldClipPaths.append(shape->
clipPath());
54 d->oldParents.append(path->parent());
63 d->shapesToClip.append(shape);
65 d->oldClipPaths.append(shape->
clipPath());
69 d->oldParents.append(path->parent());
82 const uint shapeCount =
d->shapesToClip.count();
83 for (
uint i = 0; i < shapeCount; ++i) {
84 d->shapesToClip[i]->setClipPath(
d->newClipPaths[i]);
85 d->shapesToClip[i]->update();
88 const uint clipPathCount =
d->clipPathShapes.count();
89 for (
uint i = 0; i < clipPathCount; ++i) {
90 if (
d->oldParents.at(i)) {
91 d->oldParents.at(i)->removeShape(
d->clipPathShapes[i]);
104 const uint shapeCount =
d->shapesToClip.count();
105 for (
uint i = 0; i < shapeCount; ++i) {
106 d->shapesToClip[i]->setClipPath(
d->oldClipPaths[i]);
107 d->shapesToClip[i]->update();
110 const uint clipPathCount =
d->clipPathShapes.count();
111 for (
uint i = 0; i < clipPathCount; ++i) {
112 if (
d->oldParents.at(i)) {
113 d->oldParents.at(i)->addShape(
d->clipPathShapes[i]);
void setText(const KUndo2MagicString &text)
Clip path used to clip shapes.
The position of a path point within a path shape.
The undo / redo command for setting the shape clip path.
QList< KoShape * > shapesToClip
QList< KoClipPath * > oldClipPaths
~KoShapeClipCommand() override
Destroys the command.
QList< KoShapeContainer * > oldParents
KoShapeClipCommand(KoShapeControllerBase *controller, const QList< KoShape * > &shapes, const QList< KoPathShape * > &clipPathShapes, KUndo2Command *parent=0)
void undo() override
revert the actions done in redo
QList< KoClipPath * > newClipPaths
void redo() override
redo the command
QList< KoPathShape * > clipPathShapes
Private(KoShapeControllerBase *c)
KoShapeControllerBase * controller
KoClipPath * clipPath() const
Returns the currently set clip path or 0 if there is no clip path set.
KUndo2MagicString kundo2_i18n(const char *text)