File indexing completed on 2024-05-19 04:36:20
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_CREATE_ENTITY_H 0021 #define TIKZ_UNDO_CREATE_ENTITY_H 0022 0023 #include "UndoItem.h" 0024 #include "Uid.h" 0025 0026 namespace tikz { 0027 namespace core { 0028 0029 class Document; 0030 0031 class UndoCreateEntity : public UndoItem 0032 { 0033 public: 0034 /** 0035 * Constructor. 0036 */ 0037 UndoCreateEntity(Document * doc); 0038 0039 /** 0040 * Constructor. 0041 */ 0042 UndoCreateEntity(const Uid & uid, EntityType type, Document * doc); 0043 0044 /** 0045 * Destructor. 0046 */ 0047 virtual ~UndoCreateEntity(); 0048 0049 /** 0050 * Undo: delete node again. 0051 */ 0052 void undo() override; 0053 0054 /** 0055 * Redo: create node again. 0056 */ 0057 void redo() override; 0058 0059 protected: 0060 /** 0061 * Load the undo item state from the @p json object. 0062 */ 0063 void loadData(const QJsonObject & json) override; 0064 0065 /** 0066 * Serializie to JSON object. 0067 */ 0068 QJsonObject saveData() const override; 0069 0070 private: 0071 /** 0072 * The entity's uid. 0073 */ 0074 Uid m_uid; 0075 0076 /** 0077 * The entity type of the deleted entity. 0078 */ 0079 EntityType m_entityType; 0080 }; 0081 0082 } 0083 } 0084 0085 #endif // TIKZ_UNDO_CREATE_ENTITY_H 0086 0087 // kate: indent-width 4; replace-tabs on;