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

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 KOSHAPEALIGNCOMMAND_H
0009 #define KOSHAPEALIGNCOMMAND_H
0010 
0011 #include "kritaflake_export.h"
0012 
0013 #include <kundo2command.h>
0014 #include <QList>
0015 
0016 class KoShape;
0017 class QRectF;
0018 
0019 /// The undo / redo command for aligning shapes
0020 class KRITAFLAKE_EXPORT KoShapeAlignCommand : public KUndo2Command
0021 {
0022 public:
0023     /// The different alignment options for this command
0024     enum Align {
0025         HorizontalLeftAlignment,    ///< Align left
0026         HorizontalCenterAlignment,  ///< Align Centered horizontally
0027         HorizontalRightAlignment,   ///< Align Right
0028         VerticalBottomAlignment,    ///< Align bottom
0029         VerticalCenterAlignment,    ///< Align centered vertically
0030         VerticalTopAlignment        ///< Align top
0031     };
0032     /**
0033      * Command to align a set of shapes in a rect
0034      * @param shapes a set of all the shapes that should be aligned
0035      * @param align the alignment type
0036      * @param boundingRect the rect the shape will be aligned in
0037      * @param parent the parent command used for macro commands
0038      */
0039     KoShapeAlignCommand(const QList<KoShape*> &shapes, Align align, const QRectF &boundingRect, KUndo2Command *parent = 0);
0040     ~KoShapeAlignCommand() override;
0041     /// redo the command
0042     void redo() override;
0043     /// revert the actions done in redo
0044     void undo() override;
0045 private:
0046     class Private;
0047     Private * const d;
0048 };
0049 
0050 #endif