File indexing completed on 2024-05-12 04:35:05

0001 /* This file is part of the TikZKit project.
0002  *
0003  * Copyright (C) 2015 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_FACTORY_H
0021 #define TIKZ_UNDO_FACTORY_H
0022 
0023 #include <QString>
0024 
0025 class QJsonObject;
0026 
0027 namespace tikz {
0028 namespace core {
0029 
0030 class Document;
0031 class UndoItem;
0032 class UndoFactoryPrivate;
0033 
0034 /**
0035  * Base class for undo/redo items.
0036  */
0037 class UndoFactory
0038 {
0039 public:
0040     /**
0041      * Constructor, setting the undo item's description to @p text,
0042      * and the associated tikz::core::document to @p doc.
0043      */
0044     UndoFactory(Document* doc);
0045 
0046     /**
0047      * Virtual destructor.
0048      */
0049     ~UndoFactory();
0050 
0051     /**
0052      * Accessor to the tikz Document.
0053      */
0054     Document* document();
0055 
0056     /**
0057      * Creates an undo item from the @p json object.
0058      */
0059     UndoItem * createItem(const QString & type);
0060 
0061 private:
0062     /**
0063      * Pimpl pointer to the held data.
0064      */
0065     UndoFactoryPrivate * const d;
0066 };
0067 
0068 }
0069 }
0070 
0071 #endif // TIKZ_UNDO_FACTORY_H
0072 
0073 // kate: indent-width 4; replace-tabs on;