File indexing completed on 2024-05-12 15:26:38

0001 /***************************************************************************
0002     File                 : abstractcolumncommands.h
0003     Project              : LabPlot
0004     Description          : Commands to be called by AbstractColumn to modify AbstractColumnPrivate
0005     --------------------------------------------------------------------
0006     Copyright            : (C) 2007-2009 Tilman Benkert (thzs@gmx.net)
0007     Copyright            : (C) 2010 Knut Franke (knut.franke@gmx.de)
0008 
0009  ***************************************************************************/
0010 
0011 /***************************************************************************
0012  *                                                                         *
0013  *  This program is free software; you can redistribute it and/or modify   *
0014  *  it under the terms of the GNU General Public License as published by   *
0015  *  the Free Software Foundation; either version 2 of the License, or      *
0016  *  (at your option) any later version.                                    *
0017  *                                                                         *
0018  *  This program is distributed in the hope that it will be useful,        *
0019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0021  *  GNU General Public License for more details.                           *
0022  *                                                                         *
0023  *   You should have received a copy of the GNU General Public License     *
0024  *   along with this program; if not, write to the Free Software           *
0025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0026  *   Boston, MA  02110-1301  USA                                           *
0027  *                                                                         *
0028  ***************************************************************************/
0029 
0030 #ifndef ABSTRACTCOLUMNCOMMANDS_H
0031 #define ABSTRACTCOLUMNCOMMANDS_H
0032 
0033 #include "AbstractColumnPrivate.h"
0034 #include <QUndoCommand>
0035 
0036 class AbstractColumnClearMasksCmd : public QUndoCommand {
0037 public:
0038     explicit AbstractColumnClearMasksCmd(AbstractColumnPrivate* col, QUndoCommand* parent = nullptr);
0039     ~AbstractColumnClearMasksCmd() override;
0040 
0041     void redo() override;
0042     void undo() override;
0043 
0044 private:
0045     AbstractColumnPrivate *m_col;
0046     IntervalAttribute<bool> m_masking;
0047     bool m_copied;
0048 };
0049 
0050 class AbstractColumnSetMaskedCmd : public QUndoCommand {
0051 public:
0052     explicit AbstractColumnSetMaskedCmd(AbstractColumnPrivate* col, const Interval<int>& interval, bool masked, QUndoCommand* parent = nullptr);
0053     ~AbstractColumnSetMaskedCmd() override;
0054 
0055     void redo() override;
0056     void undo() override;
0057 
0058 private:
0059     AbstractColumnPrivate* m_col;
0060     Interval<int> m_interval;
0061     bool m_masked;
0062     IntervalAttribute<bool> m_masking;
0063     bool m_copied;
0064 };
0065 
0066 class AbstractColumnInsertRowsCmd : public QUndoCommand {
0067 public:
0068     explicit AbstractColumnInsertRowsCmd(AbstractColumn* col, int before, int count, QUndoCommand* parent = nullptr);
0069     ~AbstractColumnInsertRowsCmd() override;
0070 
0071     void redo() override;
0072     void undo() override;
0073 
0074 protected:
0075     AbstractColumnPrivate* m_col;
0076     int m_before;
0077     int m_count;
0078 };
0079 
0080 class AbstractColumnRemoveRowsCmd : public QUndoCommand {
0081 public:
0082     explicit AbstractColumnRemoveRowsCmd(AbstractColumn* col, int first, int count, QUndoCommand* parent = nullptr);
0083     ~AbstractColumnRemoveRowsCmd() override;
0084 
0085     void redo() override;
0086     void undo() override;
0087 
0088 protected:
0089     AbstractColumnPrivate* m_col;
0090     int m_first;
0091     int m_count;
0092     IntervalAttribute<bool> m_masking;
0093 };
0094 
0095 #endif // ifndef ABSTRACTCOLUMNCOMMANDS_H