1
/* This file is part of the KDE project
2
Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License version 2 as published by the Free Software Foundation.
8
This library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Library General Public License for more details.
13
You should have received a copy of the GNU Library General Public License
14
along with this library; see the file COPYING.LIB. If not, write to
15
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16
Boston, MA 02110-1301, USA.
19
#ifndef DOCUMENTMANAGER_H
20
#define DOCUMENTMANAGER_H
22
#include <kate_export.h>
24
#include <QtCore/QObject>
35
* \brief Interface for the document manager.
37
* This interface provides access to Kate's document manager. The document
38
* manager manages all documents. Use document() get a given document,
39
* activeDocument() to retrieve the active document. Check with isOpen()
40
* whether an URL is opened and use findDocument() to get it. To get the
41
* number of managed documents use documents().
43
* Open new documents with openUrl() and close a document with closeDocument()
44
* or closeAllDocuments(). Several signals are provided, documentChanged() is
45
* emitted whenever the document's content changed, documentCreated() when a
46
* new document was created and documentDeleted() when a document was closed.
48
* To access the document manager use the global accessor function
49
* documentManager() or Application::documentManager(). You should never have
50
* to create an instance of this class yourself.
52
* \author Christoph Cullmann \<cullmann@kde.org\>
54
class KATEINTERFACES_EXPORT DocumentManager : public QObject
56
friend class PrivateDocumentManager;
64
* The constructor is internally used by the Kate application, so it is
65
* of no interest for plugin developers. Plugin developers should use the
66
* global accessor pluginManager() instead.
68
* \param documentManager internal usage
72
DocumentManager ( void *documentManager );
76
virtual ~DocumentManager ();
80
* Get a list of all documents.
81
* @return all documents
83
const QList<KTextEditor::Document*> &documents () const;
86
* Get the document with the URL \p url.
87
* if multiple documents match the searched url, return the first found one...
88
* \param url the document's URL
89
* \return the document with the given \p url or NULL, if no such document
90
* is in the document manager's internal list.
92
KTextEditor::Document *findUrl (const KUrl &url) const;
95
* Open the document \p url with the given \p encoding.
96
* if the url is empty, a new empty document will be created
97
* \param url the document's url
98
* \param encoding the preferred encoding. If encoding is QString() the
99
* encoding will be guessed or the default encoding will be used.
100
* \return a pointer to the created document
102
KTextEditor::Document *openUrl (const KUrl &url, const QString &encoding = QString());
105
* Close the given \p document.
106
* \param document the document to be closed
107
* \return \e true on success, otherwise \e false
109
bool closeDocument (KTextEditor::Document *document);
116
#define signals public
121
#define signals protected
125
* This signal is emitted when the \p document was created.
127
void documentCreated (KTextEditor::Document *document);
130
* This signal is emitted before a \p document which should be closed is deleted
131
* The document is still accessible and usable, but it will be deleted
132
* after this signal was send.
134
void documentWillBeDeleted (KTextEditor::Document *document);
137
* This signal is emitted when the \p document was deleted.
139
void documentDeleted (KTextEditor::Document *document);
142
class PrivateDocumentManager *d;
146
* Global accessor to the document manager object.
147
* \return document manager object
149
KATEINTERFACES_EXPORT DocumentManager *documentManager ();
153
#endif // DOCUMENTMANAGER_H
155
// kate: space-indent on; indent-width 2; replace-tabs on;