File indexing completed on 2024-12-01 06:51:42
0001 /*************************************************************************** 0002 cmapclipboard.h 0003 ------------------- 0004 begin : Wed Jul 3 2002 0005 copyright : (C) 2002 by Kmud Developer Team 0006 email : kmud-devel@kmud.de 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 ***************************************************************************/ 0017 0018 #ifndef CMAPCLIPBOARD_H 0019 #define CMAPCLIPBOARD_H 0020 0021 #include <qobject.h> 0022 #include <kconfiggroup.h> 0023 0024 class QAction; 0025 class CMapManager; 0026 class KMemConfig; 0027 class CMapZone; 0028 class CMapPath; 0029 class CMapView; 0030 0031 /**This class contains all the mapper clipboard code 0032 *@author Kmud Developer Team 0033 */ 0034 0035 class CMapClipboard : public QObject 0036 { 0037 Q_OBJECT 0038 public: 0039 CMapClipboard(CMapManager *mapManager, CMapView *view, QObject *parent=nullptr); 0040 ~CMapClipboard() override; 0041 0042 public: 0043 /** This method is used to set the enabled start of the actions */ 0044 void enableActions(bool enabled); 0045 0046 public slots: 0047 /** This method is called to copy the selected elements into the clipboard */ 0048 void slotCopy(); 0049 /** This method is called to copy the selected elements into the clipboard, then delete them */ 0050 void slotCut(); 0051 /** This method is called to paste the elements in the clipboard onto the current map */ 0052 void slotPaste(); 0053 /** This slot is called to delete all the selected objects in the current view */ 0054 void slotDelete(void); 0055 /** This slot is called when the select all menu option is selected */ 0056 void slotSelectAll(void); 0057 /** This slot is called when the unselect all menu option is selected */ 0058 void slotUnselectAll(void); 0059 /** This slot is called when the invert selection menu option is called */ 0060 void slotInvertSelection(void); 0061 0062 private: 0063 /** This is used to create the clipboard actions */ 0064 void initActions(void); 0065 /** This method is used to copy a path to the clipboard */ 0066 void copyPath(int *pathGroup,CMapPath *path); 0067 /** This method is used to paste elements that are not paths or linked text elements */ 0068 void pasteElements(); 0069 /** This method is used to paste path elements */ 0070 void pastePaths(); 0071 /** This method is used to update linked text elements with the correct properties from the clibboard */ 0072 void pasteLinks(); 0073 0074 0075 private: 0076 KMemConfig *m_clipboard; 0077 CMapManager *m_mapManager; 0078 CMapView *m_view; 0079 QObject *m_parent; 0080 0081 QAction *m_editSelectAll; 0082 QAction *m_editUnselectAll; 0083 QAction *m_editSelectInvert; 0084 QAction *m_editDelete; 0085 QAction *m_editCopy; 0086 QAction *m_editCut; 0087 QAction *m_editPaste; 0088 0089 }; 0090 0091 #endif