File indexing completed on 2024-12-22 04:16:41

0001 /*
0002  * SPDX-FileCopyrightText: 2023 Alvin Wong <alvin@alvinhc.com>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #ifndef SVG_MOVE_TEXT_COMMAND_H
0008 #define SVG_MOVE_TEXT_COMMAND_H
0009 
0010 #include <kundo2command.h>
0011 
0012 class KoSvgTextShape;
0013 
0014 class SvgMoveTextCommand : public KUndo2Command
0015 {
0016 public:
0017     SvgMoveTextCommand(KoSvgTextShape *shape,
0018                        const QPointF &newPosition,
0019                        const QPointF &oldPosition,
0020                        KUndo2Command *parent = nullptr);
0021     ~SvgMoveTextCommand() override = default;
0022 
0023     void redo() override;
0024     void undo() override;
0025 
0026     int id() const override;
0027     bool mergeWith(const KUndo2Command *other) override;
0028 
0029 private:
0030     void applyPosition(const QPointF &position);
0031 
0032 private:
0033     KoSvgTextShape *m_shape;
0034     QPointF m_newPosition;
0035     QPointF m_oldPosition;
0036 };
0037 
0038 #endif /* SVG_MOVE_TEXT_COMMAND_H */