1 /* This file is part of the KDE project 2 * Copyright (C) 2007-2008 Thorsten Zachmann <zachmann@kde.org> 3 * Copyright (C) 2011 Paul Mendez <paulestebanms@gmail.com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef KPRDELETESLIDESCOMMAND_H 22 #define KPRDELETESLIDESCOMMAND_H 23 24 #include <kundo2command.h> 25 #include <QMap> 26 27 class KPrDocument; 28 class KoPAPageBase; 29 30 #include "stage_export.h" 31 32 /** 33 * Command for deleting a slide from a document 34 * It deletes also a slide from all custom shows 35 */ 36 class STAGE_TEST_EXPORT KPrDeleteSlidesCommand : public KUndo2Command 37 { 38 public: 39 /** 40 * Command to delete a single page. 41 * @param document the document to delete the page from 42 * @param page the page to delete 43 * @param parent the parent command used for macro commands 44 */ 45 KPrDeleteSlidesCommand(KPrDocument *document, KoPAPageBase *page, KUndo2Command *parent = 0 ); 46 47 /** 48 * Command to delete multiple pages. 49 * @param document the document to delete the pages from 50 * @param pages a list of pages to delete 51 * @param parent the parent command used for macro commands 52 */ 53 KPrDeleteSlidesCommand(KPrDocument *document, const QList<KoPAPageBase*> &pages, KUndo2Command *parent = 0); 54 55 ~KPrDeleteSlidesCommand() override; 56 57 /// redo the command 58 void redo() override; 59 /// revert the actions done in redo 60 void undo() override; 61 62 private: 63 KPrDocument *m_document; //< the document to delete the pages from 64 QMap<int, KoPAPageBase*> m_pages; //< a map of pages to delete, with document index as key 65 QMap<QString, QList<KoPAPageBase*> > m_customSlideShows; 66 bool m_deletePages; //< shows if pages should be deleted when deleting the command 67 }; 68 69 #endif // KPRDELETESLIDESCOMMAND_H 70