Warning, file /graphics/tikzkit/src/app/DocumentManager.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* This file is part of the TikZKit project 0002 * 0003 * Copyright (C) 2014 Dominik Haumann <dhaumann@kde.org> 0004 * Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> 0005 * 0006 * This program is free software; you can redistribute it and/or modify 0007 * it under the terms of the GNU General Public License as published by 0008 * the Free Software Foundation, either version 2 or the License, or 0009 * (at your option) any later version. 0010 * 0011 * This program is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Library General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU General Public License 0017 * along with this program; If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef TIKZKIT_DOCUMENT_MANAGER_H 0021 #define TIKZKIT_DOCUMENT_MANAGER_H 0022 0023 #include <tikz/ui/Document.h> 0024 #include <tikz/ui/Editor.h> 0025 0026 #include <QList> 0027 #include <QVector> 0028 #include <QObject> 0029 #include <QByteArray> 0030 #include <QHash> 0031 #include <QMap> 0032 0033 class MainWindow; 0034 0035 class DocumentManager : public QObject 0036 { 0037 Q_OBJECT 0038 0039 public: 0040 DocumentManager(QObject *parent); 0041 virtual ~DocumentManager(); 0042 0043 tikz::ui::Document * createDocument(); 0044 0045 /** Returns the document with @p url or \e nullptr if no such doc is found */ 0046 tikz::ui::Document * findDocument(const QUrl &url) const; 0047 0048 const QVector<tikz::ui::Document *> & documentList() const { 0049 return m_documents; 0050 } 0051 0052 tikz::ui::Document *openUrl(const QUrl & url); 0053 0054 bool closeDocument(tikz::ui::Document * doc, bool closeUrl = true); 0055 bool closeAllDocuments(bool closeUrl = true); 0056 0057 QVector<tikz::ui::Document *> modifiedDocumentList(); 0058 bool queryCloseDocuments(MainWindow * w); 0059 0060 public Q_SLOTS: 0061 /** 0062 * saves all documents that has at least one view. 0063 * documents with no views are ignored :P 0064 */ 0065 void saveAll(); 0066 0067 /** 0068 * reloads all documents that has at least one view. 0069 * documents with no views are ignored :P 0070 */ 0071 void reloadAll(); 0072 0073 Q_SIGNALS: 0074 /** 0075 * This signal is emitted when the \p document was created. 0076 */ 0077 void documentCreated(tikz::ui::Document *document); 0078 0079 /** 0080 * This signal is emitted before a \p document which should be closed is deleted 0081 * The document is still accessible and usable, but it will be deleted 0082 * after this signal was send. 0083 * 0084 * @param document document that will be deleted 0085 */ 0086 void aboutToDeleteDocument(tikz::ui::Document *document); 0087 0088 /** 0089 * This signal is emitted when the \p document has been deleted. 0090 * 0091 * Warning !!! DO NOT ACCESS THE DATA REFERENCED BY THE POINTER, IT IS ALREADY INVALID 0092 * Use the pointer only to remove mappings in hash or maps 0093 */ 0094 void documentDeleted(tikz::ui::Document *document); 0095 0096 private: 0097 QVector<tikz::ui::Document *> m_documents; 0098 }; 0099 0100 #endif 0101 0102 // kate: indent-width 4; replace-tabs on;