• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdevelop API Reference
  • KDE Home
  • Contact Us
 

kdevplatform/interfaces

  • sources
  • kfour-appscomplete
  • kdevelop
  • kdevplatform
  • interfaces
idocumentcontroller.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright 2007 Alexander Dymo <[email protected]> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU Library General Public License as *
6  * published by the Free Software Foundation; either version 2 of the *
7  * License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU Library General Public *
15  * License along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18  ***************************************************************************/
19 #ifndef KDEVPLATFORM_IDOCUMENTCONTROLLER_H
20 #define KDEVPLATFORM_IDOCUMENTCONTROLLER_H
21 
22 #include <QObject>
23 #include <QList>
24 #include <QUrl>
25 
26 #include <KTextEditor/Range>
27 
28 #include "interfacesexport.h"
29 
30 #include "idocument.h"
31 
32 namespace KTextEditor {
33  class View;
34 }
35 
36 namespace KDevelop {
37 
38 class ICore;
39 
40 class KDEVPLATFORMINTERFACES_EXPORT IDocumentFactory {
41 public:
42  virtual ~IDocumentFactory() {}
43  virtual IDocument* create(const QUrl&, ICore* ) = 0;
44 };
45 
52 class KDEVPLATFORMINTERFACES_EXPORT IDocumentController: public QObject {
53  Q_OBJECT
54 public:
55  enum DocumentActivation
56  {
57  DefaultMode = 0,
58  DoNotActivate = 1,
59  DoNotCreateView = 2,
60  DoNotFocus = 4,
61  DoNotAddToRecentOpen = 8,
62  };
63  Q_DECLARE_FLAGS(DocumentActivationParams, DocumentActivation)
64 
65  explicit IDocumentController(QObject *parent);
66 
73  virtual KDevelop::IDocument* documentForUrl( const QUrl & url ) const = 0;
74 
76  virtual QList<KDevelop::IDocument*> openDocuments() const = 0;
77 
83  virtual KDevelop::IDocument* activeDocument() const = 0;
84 
85  virtual void activateDocument( KDevelop::IDocument * document, const KTextEditor::Range& range = KTextEditor::Range::invalid() ) = 0;
86 
87  virtual void registerDocumentForMimetype( const QString&, KDevelop::IDocumentFactory* ) = 0;
88 
89  virtual bool saveAllDocuments(KDevelop::IDocument::DocumentSaveMode mode = KDevelop::IDocument::Default) = 0;
90  virtual bool saveSomeDocuments(const QList<IDocument*>& list, KDevelop::IDocument::DocumentSaveMode mode = KDevelop::IDocument::Default) = 0;
91  virtual bool saveAllDocumentsForWindow(KParts::MainWindow* mw, IDocument::DocumentSaveMode mode, bool currentAreaOnly = false) = 0;
92 
94  virtual KDevelop::IDocument* openDocumentFromText( const QString& data ) = 0;
95 
96  virtual IDocumentFactory* factory(const QString& mime) const = 0;
97 
101  virtual KTextEditor::View* activeTextDocumentView() const = 0;
102 
103 public Q_SLOTS:
114  KDevelop::IDocument* openDocument( const QUrl &url,
115  const KTextEditor::Cursor& cursor,
116  DocumentActivationParams activationParams = {},
117  const QString& encoding = {});
118 
135  virtual KDevelop::IDocument* openDocument( const QUrl &url,
136  const KTextEditor::Range& range = KTextEditor::Range::invalid(),
137  DocumentActivationParams activationParams = {},
138  const QString& encoding = {},
139  IDocument* buddy = nullptr) = 0;
140 
152  virtual bool openDocument(IDocument* doc,
153  const KTextEditor::Range& range = KTextEditor::Range::invalid(),
154  DocumentActivationParams activationParams = {},
155  IDocument* buddy = nullptr) = 0;
156 
163  virtual KDevelop::IDocument* openDocument( const QUrl &url, const QString& prefName ) = 0;
164 
165  virtual bool closeAllDocuments() = 0;
166 
167 Q_SIGNALS:
169  void documentActivated( KDevelop::IDocument* document );
170 
177  void documentJumpPerformed( KDevelop::IDocument* newDocument, KTextEditor::Cursor newCursor,
178  KDevelop::IDocument* previousDocument, KTextEditor::Cursor previousCursor);
179 
181  void documentSaved( KDevelop::IDocument* document );
182 
189  void documentOpened( KDevelop::IDocument* document );
190 
196  void documentLoaded( KDevelop::IDocument* document );
197 
203  void textDocumentCreated( KDevelop::IDocument* document );
204 
206  void documentClosed( KDevelop::IDocument* document );
207 
212  void documentStateChanged( KDevelop::IDocument* document );
213 
215  void documentContentChanged( KDevelop::IDocument* document );
216 
223  void documentLoadedPrepare( KDevelop::IDocument* document );
224 
226  void documentUrlChanged( KDevelop::IDocument* document );
227 
228  friend class IDocument;
229 };
230 
231 #if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
232 Q_DECLARE_OPERATORS_FOR_FLAGS(IDocumentController::DocumentActivationParams)
233 #endif
234 
235 } // namespace KDevelop
236 
237 #if QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
238 Q_DECLARE_OPERATORS_FOR_FLAGS(KDevelop::IDocumentController::DocumentActivationParams)
239 #endif
240 
241 #endif
QUrl
KDevelop::IDocument::DocumentSaveMode
DocumentSaveMode
Definition: idocument.h:70
KDevelop::IDocument
A single document being edited by the IDE.
Definition: idocument.h:57
QList
Definition: context.h:40
KDevelop::IDocumentController
Allows to access the open documents and also open new ones.
Definition: idocumentcontroller.h:51
QObject
QString
idocument.h
KTextEditor
Definition: idocument.h:30
KDevelop::ICore
ICore is the container class for all the various objects in use by KDevelop.
Definition: icore.h:70
KDevelop::IDocumentFactory
Definition: idocumentcontroller.h:39
KDevelop::IDocumentController::DocumentActivation
DocumentActivation
Definition: idocumentcontroller.h:54
KDevelop
The KDevelop namespace contains all classes provided by the KDevelop platform libraries.
Definition: configpage.cpp:26
KDevelop::IDocument::Default
standard save mode, gives a warning message if the file was modified outside the editor
Definition: idocument.h:72
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Jan 21 2021 23:35:21 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kdevplatform/interfaces

Skip menu "kdevplatform/interfaces"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdevelop API Reference

Skip menu "kdevelop API Reference"
  • kdevplatform
  •   debugger
  •   documentation
  •   interfaces
  •   language
  •     assistant
  •     backgroundparser
  •     checks
  •     classmodel
  •     codecompletion
  •     codegen
  •     duchain
  •     editor
  •     highlighting
  •     interfaces
  •     util
  •   outputview
  •   project
  •   serialization
  •   shell
  •   sublime
  •   tests
  •   util
  •   vcs

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal