File indexing completed on 2025-02-02 04:14:49
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2006 Thomas Zander <zander@kde.org> 0003 * SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KOSHAPEMOVECOMMAND_H 0009 #define KOSHAPEMOVECOMMAND_H 0010 0011 #include "kritaflake_export.h" 0012 0013 #include <kundo2command.h> 0014 #include <QList> 0015 #include <QPointF> 0016 #include <KoFlake.h> 0017 0018 class KoShape; 0019 0020 /// The undo / redo command for shape moving. 0021 class KRITAFLAKE_EXPORT KoShapeMoveCommand : public KUndo2Command 0022 { 0023 public: 0024 /** 0025 * Constructor. 0026 * @param shapes the set of objects that are moved. 0027 * @param previousPositions the known set of previous positions for each of the objects. 0028 * this list naturally must have the same amount of items as the shapes set. 0029 * @param newPositions the new positions for the shapes. 0030 * this list naturally must have the same amount of items as the shapes set. 0031 * @param parent the parent command used for macro commands 0032 */ 0033 KoShapeMoveCommand(const QList<KoShape*> &shapes, QList<QPointF> &previousPositions, QList<QPointF> &newPositions, 0034 KoFlake::AnchorPosition anchor = KoFlake::Center, KUndo2Command *parent = 0); 0035 0036 KoShapeMoveCommand(const QList<KoShape*> &shapes, const QPointF &offset, KUndo2Command *parent = 0); 0037 0038 ~KoShapeMoveCommand() override; 0039 /// redo the command 0040 void redo() override; 0041 /// revert the actions done in redo 0042 void undo() override; 0043 0044 int id() const override; 0045 bool mergeWith(const KUndo2Command *command) override; 0046 0047 private: 0048 class Private; 0049 Private * const d; 0050 }; 0051 0052 #endif