File indexing completed on 2024-05-12 04:35:03
0001 /* This file is part of the TikZKit project. 0002 * 0003 * Copyright (C) 2018 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This library is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU Library General Public License as published 0007 * by the Free Software Foundation, either version 2 of the License, or 0008 * (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 0013 * GNU 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, see 0017 * <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef TIKZ_UNDO_DELETE_ENTITY_H 0021 #define TIKZ_UNDO_DELETE_ENTITY_H 0022 0023 #include "UndoItem.h" 0024 #include "Uid.h" 0025 0026 namespace tikz { 0027 namespace core { 0028 0029 class Node; 0030 class Document; 0031 0032 class UndoDeleteEntity : public UndoItem 0033 { 0034 public: 0035 /** 0036 * Constructor. 0037 */ 0038 UndoDeleteEntity(Document * doc); 0039 0040 /** 0041 * Constructor. 0042 */ 0043 UndoDeleteEntity(const Uid & uid, Document * doc); 0044 0045 /** 0046 * Destructor 0047 */ 0048 virtual ~UndoDeleteEntity(); 0049 0050 /** 0051 * Undo: add node again. 0052 */ 0053 void undo() override; 0054 0055 /** 0056 * Redo: delete node again. 0057 */ 0058 void redo() override; 0059 0060 protected: 0061 /** 0062 * Load the undo item state from the @p json object. 0063 */ 0064 void loadData(const QJsonObject & json) override; 0065 0066 /** 0067 * Serializie to JSON object. 0068 */ 0069 QJsonObject saveData() const override; 0070 0071 private: 0072 /** 0073 * The entity's uid. 0074 */ 0075 Uid m_uid; 0076 0077 /** 0078 * The entity type of the deleted entity. 0079 */ 0080 EntityType m_entityType; 0081 0082 /** 0083 * The entity serialized to json. 0084 */ 0085 QJsonObject m_data; 0086 }; 0087 0088 } 0089 } 0090 0091 #endif // TIKZ_UNDO_DELETE_ENTITY_H 0092 0093 // kate: indent-width 4; replace-tabs on;