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, 2008 Jan Hambrecht <jaham@gmx.net>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 #ifndef KOSHAPEBACKGROUNDCOMMAND_H
0009 #define KOSHAPEBACKGROUNDCOMMAND_H
0010 
0011 #include "kritaflake_export.h"
0012 
0013 #include <kundo2command.h>
0014 #include <QList>
0015 #include <QSharedPointer>
0016 
0017 class KoShape;
0018 class KoShapeBackground;
0019 
0020 /// The undo / redo command for setting the shape background
0021 class KRITAFLAKE_EXPORT KoShapeBackgroundCommand : public KUndo2Command
0022 {
0023 public:
0024     /**
0025      * Command to set a new shape background.
0026      * @param shapes a set of all the shapes that should get the new background.
0027      * @param fill the new shape background
0028      * @param parent the parent command used for macro commands
0029      */
0030     KoShapeBackgroundCommand(const QList<KoShape*> &shapes, QSharedPointer<KoShapeBackground> fill, KUndo2Command *parent = 0);
0031 
0032     /**
0033     * Command to set a new shape background.
0034     * @param shape a single shape that should get the new background.
0035     * @param fill the new shape background
0036     * @param parent the parent command used for macro commands
0037     */
0038     KoShapeBackgroundCommand(KoShape *shape, QSharedPointer<KoShapeBackground> fill, KUndo2Command *parent = 0);
0039 
0040     /**
0041      * Command to set new shape backgrounds.
0042      * @param shapes a set of all the shapes that should get a new background.
0043      * @param fills the new backgrounds, one for each shape
0044      * @param parent the parent command used for macro commands
0045      */
0046     KoShapeBackgroundCommand(const QList<KoShape*> &shapes, const QList<QSharedPointer<KoShapeBackground> > &fills, KUndo2Command *parent = 0);
0047 
0048     ~KoShapeBackgroundCommand() override;
0049     /// redo the command
0050     void redo() override;
0051     /// revert the actions done in redo
0052     void undo() override;
0053 
0054     int id() const override;
0055     bool mergeWith(const KUndo2Command *command) override;
0056 
0057 private:
0058     class Private;
0059     Private * const d;
0060 };
0061 
0062 #endif