File indexing completed on 2024-05-12 16:35:13
0001 /* This file is part of the KDE project 0002 Copyright 2004 Ariya Hidayat <ariya@kde.org> 0003 Copyright 2004 Laurent Montel <montel@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef CALLIGRA_SHEETS_SHEET_COMMANDS 0022 #define CALLIGRA_SHEETS_SHEET_COMMANDS 0023 0024 #include <QString> 0025 #include <kundo2command.h> 0026 0027 namespace Calligra 0028 { 0029 namespace Sheets 0030 { 0031 class Map; 0032 class Sheet; 0033 0034 /** 0035 * \ingroup Commands 0036 * \brief Renames a sheet. 0037 */ 0038 class RenameSheetCommand : public KUndo2Command 0039 { 0040 public: 0041 RenameSheetCommand(Sheet* sheet, const QString &name); 0042 0043 void redo() override; 0044 void undo() override; 0045 0046 protected: 0047 Sheet* sheet; 0048 QString oldName; 0049 QString newName; 0050 }; 0051 0052 0053 /** 0054 * \ingroup Commands 0055 * \brief Hides a sheet. 0056 */ 0057 class HideSheetCommand : public KUndo2Command 0058 { 0059 public: 0060 explicit HideSheetCommand(Sheet* sheet); 0061 0062 void redo() override; 0063 void undo() override; 0064 0065 protected: 0066 Map* map; 0067 QString sheetName; 0068 }; 0069 0070 0071 /** 0072 * \ingroup Commands 0073 * \brief Shows a hidden sheet. 0074 */ 0075 class ShowSheetCommand : public KUndo2Command 0076 { 0077 public: 0078 explicit ShowSheetCommand(Sheet* sheet, KUndo2Command* parent = 0); 0079 0080 void redo() override; 0081 void undo() override; 0082 0083 protected: 0084 Map* map; 0085 QString sheetName; 0086 }; 0087 0088 0089 /** 0090 * \ingroup Commands 0091 * \brief Adds a sheet. 0092 */ 0093 class AddSheetCommand : public KUndo2Command 0094 { 0095 public: 0096 explicit AddSheetCommand(Sheet* sheet); 0097 0098 void redo() override; 0099 void undo() override; 0100 0101 protected: 0102 Sheet* m_sheet; 0103 bool m_firstrun; 0104 }; 0105 0106 0107 /** 0108 * \ingroup Commands 0109 * \brief Duplicates a sheet. 0110 */ 0111 class DuplicateSheetCommand : public KUndo2Command 0112 { 0113 public: 0114 explicit DuplicateSheetCommand(); 0115 0116 void setSheet(Sheet* sheet); 0117 0118 void redo() override; 0119 void undo() override; 0120 0121 protected: 0122 Sheet* m_oldSheet; 0123 Sheet* m_newSheet; 0124 bool m_firstrun; 0125 }; 0126 0127 0128 /** 0129 * \ingroup Commands 0130 * \brief Removes a sheet. 0131 */ 0132 class RemoveSheetCommand : public KUndo2Command 0133 { 0134 public: 0135 explicit RemoveSheetCommand(Sheet* sheet); 0136 0137 void redo() override; 0138 void undo() override; 0139 0140 protected: 0141 Sheet* sheet; 0142 Map* map; 0143 }; 0144 0145 0146 /** 0147 * \ingroup Commands 0148 * \brief Changes sheet properties. 0149 */ 0150 class SheetPropertiesCommand : public KUndo2Command 0151 { 0152 public: 0153 explicit SheetPropertiesCommand(Sheet *sheet); 0154 void setLayoutDirection(Qt::LayoutDirection direction); 0155 void setAutoCalculationEnabled(bool b); 0156 void setShowGrid(bool b); 0157 void setShowPageOutline(bool b); 0158 void setShowFormula(bool b); 0159 void setHideZero(bool b); 0160 void setShowFormulaIndicator(bool b); 0161 void setShowCommentIndicator(bool b); 0162 void setColumnAsNumber(bool b); 0163 void setLcMode(bool b); 0164 void setCapitalizeFirstLetter(bool b); 0165 0166 void redo() override; 0167 void undo() override; 0168 0169 protected: 0170 Sheet* sheet; 0171 Map* map; 0172 Qt::LayoutDirection oldDirection, newDirection; 0173 bool oldAutoCalc, newAutoCalc; 0174 bool oldShowGrid, newShowGrid; 0175 bool oldShowPageOutline, newShowPageOutline; 0176 bool oldShowFormula, newShowFormula; 0177 bool oldHideZero, newHideZero; 0178 bool oldShowFormulaIndicator, newShowFormulaIndicator; 0179 bool oldShowCommentIndicator, newShowCommentIndicator; 0180 bool oldColumnAsNumber, newColumnAsNumber; 0181 bool oldLcMode, newLcMode; 0182 bool oldCapitalizeFirstLetter, newCapitalizeFirstLetter; 0183 }; 0184 0185 } // namespace Sheets 0186 } // namespace Calligra 0187 0188 #endif // CALLIGRA_SHEETS_SHEET_COMMANDS