File indexing completed on 2025-01-26 04:04:53

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net>
0003  * SPDX-FileCopyrightText: 2006, 2007 Thorsten Zachmann <zachmann@kde.org>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 #ifndef KOPATHPOINTREMOVECOMMAND_H
0009 #define KOPATHPOINTREMOVECOMMAND_H
0010 
0011 #include <kundo2command.h>
0012 #include <QList>
0013 #include "KoPathPointData.h"
0014 #include "kritaflake_export.h"
0015 
0016 class KoShapeController;
0017 class KoPathPointRemoveCommandPrivate;
0018 
0019 /// The undo / redo command for removing path points.
0020 class KRITAFLAKE_EXPORT KoPathPointRemoveCommand : public KUndo2Command
0021 {
0022 public:
0023     /**
0024      * @brief Create command for removing points from path shapes
0025      *
0026      * This will create the command for removing points from path shapes. If all
0027      * points from a path shape are deleted it will delete the path shape. If all
0028      * points from a subpath are deleted it will delete the subpath.
0029      *
0030      * @param pointDataList List of point data to remove
0031      * @param shapeController shape controller in charge
0032      * @param parent the parent command used for macro commands
0033      */
0034     static KUndo2Command *createCommand(const QList<KoPathPointData> &pointDataList, KoShapeController *shapeController, KUndo2Command *parent = 0);
0035 
0036     /**
0037      * @brief Command to remove a points from path shapes
0038      *
0039      * Don't use this directly use createCommand instead.
0040      *
0041      * @param pointDataList List of point data to remove.
0042      * @param parent the parent command used for macro commands
0043      */
0044     explicit KoPathPointRemoveCommand(const QList<KoPathPointData> &pointDataList, KUndo2Command *parent = 0);
0045     ~KoPathPointRemoveCommand() override;
0046 
0047     /// redo the command
0048     void redo() override;
0049     /// revert the actions done in redo
0050     void undo() override;
0051 
0052 private:
0053     KoPathPointRemoveCommandPrivate *d;
0054 };
0055 
0056 #endif // KOPATHPOINTREMOVECOMMAND_H