KTextEditor

kateglobal.h
1 /*
2  SPDX-FileCopyrightText: 2001-2010 Christoph Cullmann <[email protected]>
3  SPDX-FileCopyrightText: 2009 Erlend Hamberg <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KATE_GLOBAL_H
9 #define KATE_GLOBAL_H
10 
11 #include "katescript.h"
12 #include "variable.h"
13 #include <ktexteditor_export.h>
14 
15 #include "ktexteditor/view.h"
16 #include <ktexteditor/editor.h>
17 
18 #include <KAboutData>
19 #include <KSharedConfig>
20 
21 #include <KTextEditor/Application>
22 #include <KTextEditor/Command>
23 #include <KTextEditor/MainWindow>
24 
25 #include <QList>
26 #include <QMap>
27 #include <QPointer>
28 #include <QScopedPointer>
29 
30 class QStringListModel;
31 
32 class KateCmd;
33 class KateModeManager;
34 class KateGlobalConfig;
35 class KateDocumentConfig;
36 class KateViewConfig;
37 class KateRendererConfig;
38 namespace KTextEditor
39 {
40 class DocumentPrivate;
41 }
42 namespace KTextEditor
43 {
44 class ViewPrivate;
45 }
46 class KateScriptManager;
47 class KDirWatch;
48 class KateHlManager;
49 class KateSpellCheckManager;
50 class KateWordCompletionModel;
51 class KateAbstractInputModeFactory;
54 
55 namespace KTextEditor
56 {
64 class KTEXTEDITOR_EXPORT EditorPrivate : public KTextEditor::Editor
65 {
66  Q_OBJECT
67 
68  friend class KTextEditor::Editor;
69 
70  // unit testing support
71 public:
76  static void enableUnitTestMode();
77 
82  static bool unitTestMode();
83 
84  // for setDefaultEncoding
85  friend class KateDocumentConfig;
86 
87 private:
92  explicit EditorPrivate(QPointer<KTextEditor::EditorPrivate> &staticInstance);
93 
94 public:
98  ~EditorPrivate();
99 
105  KTextEditor::Document *createDocument(QObject *parent) override;
106 
112  {
113  return m_documents.keys();
114  }
115 
122  void setApplication(KTextEditor::Application *application) override
123  {
124  // switch back to dummy application?
125  m_application = application ? application : &m_dummyApplication;
126  }
127 
133  {
134  return m_application;
135  }
136 
140 public:
145  const KAboutData &aboutData() const override
146  {
147  return m_aboutData;
148  }
149 
153 public:
159  void configDialog(QWidget *parent) override;
160 
167  int configPages() const override;
168 
174  KTextEditor::ConfigPage *configPage(int number, QWidget *parent) override;
175 
179 public:
184  static KTextEditor::EditorPrivate *self();
185 
191  void registerDocument(KTextEditor::DocumentPrivate *doc);
192 
197  void deregisterDocument(KTextEditor::DocumentPrivate *doc);
198 
204  void registerView(KTextEditor::ViewPrivate *view);
205 
210  void deregisterView(KTextEditor::ViewPrivate *view);
211 
217  {
218  return m_views.values();
219  }
220 
226  {
227  return m_dirWatch;
228  }
229 
234  static KSharedConfigPtr config();
235 
241  KateModeManager *modeManager()
242  {
243  return m_modeManager;
244  }
245 
250  KateDocumentConfig *documentConfig()
251  {
252  return m_documentConfig;
253  }
254 
259  KateViewConfig *viewConfig()
260  {
261  return m_viewConfig;
262  }
263 
268  KateRendererConfig *rendererConfig()
269  {
270  return m_rendererConfig;
271  }
272 
277  {
278  return m_scriptManager;
279  }
280 
285  KateHlManager *hlManager()
286  {
287  return m_hlManager;
288  }
289 
294  KateCmd *cmdManager()
295  {
296  return m_cmdManager;
297  }
298 
303  KateSpellCheckManager *spellCheckManager()
304  {
305  return m_spellCheckManager;
306  }
307 
312  KateWordCompletionModel *wordCompletionModel()
313  {
314  return m_wordCompletionModel;
315  }
316 
322  {
323  return m_keywordCompletionModel;
324  }
325 
331  KTextEditor::Command *queryCommand(const QString &cmd) const override;
332 
337  QList<KTextEditor::Command *> commands() const override;
338 
343  QStringList commandList() const override;
344 
349  void copyToClipboard(const QString &text);
350 
356  {
357  return m_clipboardHistory;
358  }
359 
365  {
366  return m_documents.values();
367  }
368 
374  {
375  return &m_dummyMainWindow;
376  }
377 
381  QList<KateAbstractInputModeFactory *> inputModeFactories();
382 
386  QStringListModel *searchHistoryModel();
387 
391  QStringListModel *replaceHistoryModel();
392 
396  void saveSearchReplaceHistoryModels();
397 
401  KateVariableExpansionManager *variableExpansionManager();
402 
403 Q_SIGNALS:
407  void clipboardHistoryChanged();
408 
409 protected:
410  bool eventFilter(QObject *, QEvent *) override;
411 
412 private Q_SLOTS:
413  void updateColorPalette();
414 
415 private:
419  KAboutData m_aboutData;
420 
425 
430 
434  KDirWatch *m_dirWatch;
435 
439  KateModeManager *m_modeManager;
440 
444  KateGlobalConfig *m_globalConfig;
445 
449  KateDocumentConfig *m_documentConfig;
450 
454  KateViewConfig *m_viewConfig;
455 
459  KateRendererConfig *m_rendererConfig;
460 
465 
469  KateScriptManager *m_scriptManager;
470 
474  KateHlManager *m_hlManager;
475 
479  KateCmd *m_cmdManager;
480 
484  KateVariableExpansionManager *m_variableExpansionManager;
485 
489  KateSpellCheckManager *m_spellCheckManager;
490 
494  KateWordCompletionModel *m_wordCompletionModel;
495 
499  KateKeywordCompletionModel *m_keywordCompletionModel;
500 
504  QStringList m_clipboardHistory;
505 
509  KTextEditor::Application m_dummyApplication;
510 
515 
519  KTextEditor::MainWindow m_dummyMainWindow;
520 
525 
529  QStringListModel *m_searchHistoryModel;
530  QStringListModel *m_replaceHistoryModel;
531 };
532 
533 }
534 
535 #endif
QList< KTextEditor::Document * > documents() override
Returns a list of all documents of this editor.
Definition: kateglobal.h:111
Manage the scripts on disks – find them and query them.
KateViewConfig * viewConfig()
fallback view config
Definition: kateglobal.h:259
KTextEditor::Application * application() const override
Current hosting application, if any set.
Definition: kateglobal.h:132
KateWordCompletionModel * wordCompletionModel()
global instance of the simple word completion mode
Definition: kateglobal.h:312
KateModeManager * modeManager()
global mode manager used to manage the modes centrally
Definition: kateglobal.h:241
KateCmd * cmdManager()
command manager
Definition: kateglobal.h:294
QList< KTextEditor::ViewPrivate * > views()
return a list of all registered views
Definition: kateglobal.h:216
A KParts derived class representing a text document.
Definition: document.h:185
KateRendererConfig * rendererConfig()
fallback renderer config
Definition: kateglobal.h:268
Manager class for variable expansion.
KateDocumentConfig * documentConfig()
fallback document config
Definition: kateglobal.h:250
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
QList< KTextEditor::DocumentPrivate * > kateDocuments()
return a list of all registered docs
Definition: kateglobal.h:364
KateDocumentConfig * config()
Configuration.
KateHlManager * hlManager()
hl manager
Definition: kateglobal.h:285
KTextEditor::MainWindow * dummyMainWindow()
Dummy main window to be null safe.
Definition: kateglobal.h:373
An Editor command line command.
This class allows the application that embeds the KTextEditor component to allow it access to applica...
Definition: application.h:41
KateKeywordCompletionModel * keywordCompletionModel()
Global instance of the language-aware keyword completion model.
Definition: kateglobal.h:321
KateScriptManager * scriptManager()
Global script collection.
Definition: kateglobal.h:276
Config page interface for the Editor and Plugins.
Definition: configpage.h:43
void setApplication(KTextEditor::Application *application) override
Set the global application object.
Definition: kateglobal.h:122
Accessor interface for the KTextEditor framework.
Definition: editor.h:82
Highlighting-file based keyword completion for the editor.
KTextEditor::EditorPrivate One instance of this class is hold alive during a kate part session...
Definition: kateglobal.h:64
KateSpellCheckManager * spellCheckManager()
spell check manager
Definition: kateglobal.h:303
KDirWatch * dirWatch()
global dirwatch
Definition: kateglobal.h:225
const KAboutData & aboutData() const override
General Information about this editor.
Definition: kateglobal.h:145
const QStringList & clipboardHistory() const
Clipboard history, filled with text we ever copied to clipboard via copyToClipboard.
Definition: kateglobal.h:355
This class allows the application that embeds the KTextEditor component to allow it to access parts o...
Definition: mainwindow.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Sep 23 2020 22:58:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.