KTextEditor

kateglobal.h
1 /* SPDX-License-Identifier: LGPL-2.0-or-later
2 
3  Copyright (C) 2001-2010 Christoph Cullmann <[email protected]>
4  Copyright (C) 2009 Erlend Hamberg <[email protected]>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef KATE_GLOBAL_H
23 #define KATE_GLOBAL_H
24 
25 #include "katescript.h"
26 #include "variable.h"
27 #include <ktexteditor_export.h>
28 
29 #include "ktexteditor/view.h"
30 #include <ktexteditor/editor.h>
31 
32 #include <KAboutData>
33 #include <KSharedConfig>
34 
35 #include <KTextEditor/Application>
36 #include <KTextEditor/Command>
37 #include <KTextEditor/MainWindow>
38 
39 #include <QList>
40 #include <QMap>
41 #include <QPointer>
42 #include <QScopedPointer>
43 
44 class QStringListModel;
45 
46 class KateCmd;
47 class KateModeManager;
48 class KateSchemaManager;
49 class KateGlobalConfig;
50 class KateDocumentConfig;
51 class KateViewConfig;
52 class KateRendererConfig;
53 namespace KTextEditor
54 {
55 class DocumentPrivate;
56 }
57 namespace KTextEditor
58 {
59 class ViewPrivate;
60 }
61 class KateScriptManager;
62 class KDirWatch;
63 class KateHlManager;
64 class KateSpellCheckManager;
65 class KateWordCompletionModel;
66 class KateAbstractInputModeFactory;
68 class KateDefaultColors;
70 
71 namespace KTextEditor
72 {
80 class KTEXTEDITOR_EXPORT EditorPrivate : public KTextEditor::Editor
81 {
82  Q_OBJECT
83 
84  friend class KTextEditor::Editor;
85 
86  // unit testing support
87 public:
92  static void enableUnitTestMode();
93 
98  static bool unitTestMode();
99 
100  // for setDefaultEncoding
101  friend class KateDocumentConfig;
102 
103 private:
108  explicit EditorPrivate(QPointer<KTextEditor::EditorPrivate> &staticInstance);
109 
110 public:
114  ~EditorPrivate();
115 
121  KTextEditor::Document *createDocument(QObject *parent) override;
122 
128  {
129  return m_documents.keys();
130  }
131 
138  void setApplication(KTextEditor::Application *application) override
139  {
140  // switch back to dummy application?
141  m_application = application ? application : &m_dummyApplication;
142  }
143 
149  {
150  return m_application;
151  }
152 
156 public:
161  const KAboutData &aboutData() const override
162  {
163  return m_aboutData;
164  }
165 
169 public:
175  void configDialog(QWidget *parent) override;
176 
183  int configPages() const override;
184 
190  KTextEditor::ConfigPage *configPage(int number, QWidget *parent) override;
191 
195 public:
200  static KTextEditor::EditorPrivate *self();
201 
207  void registerDocument(KTextEditor::DocumentPrivate *doc);
208 
213  void deregisterDocument(KTextEditor::DocumentPrivate *doc);
214 
220  void registerView(KTextEditor::ViewPrivate *view);
221 
226  void deregisterView(KTextEditor::ViewPrivate *view);
227 
233  {
234  return m_views.values();
235  }
236 
242  {
243  return m_dirWatch;
244  }
245 
250  static KSharedConfigPtr config();
251 
257  KateModeManager *modeManager()
258  {
259  return m_modeManager;
260  }
261 
266  KateSchemaManager *schemaManager()
267  {
268  return m_schemaManager;
269  }
270 
275  KateDocumentConfig *documentConfig()
276  {
277  return m_documentConfig;
278  }
279 
284  KateViewConfig *viewConfig()
285  {
286  return m_viewConfig;
287  }
288 
293  KateRendererConfig *rendererConfig()
294  {
295  return m_rendererConfig;
296  }
297 
302  {
303  return m_scriptManager;
304  }
305 
310  KateHlManager *hlManager()
311  {
312  return m_hlManager;
313  }
314 
319  KateCmd *cmdManager()
320  {
321  return m_cmdManager;
322  }
323 
328  KateSpellCheckManager *spellCheckManager()
329  {
330  return m_spellCheckManager;
331  }
332 
337  KateWordCompletionModel *wordCompletionModel()
338  {
339  return m_wordCompletionModel;
340  }
341 
347  {
348  return m_keywordCompletionModel;
349  }
350 
356  KTextEditor::Command *queryCommand(const QString &cmd) const override;
357 
362  QList<KTextEditor::Command *> commands() const override;
363 
368  QStringList commandList() const override;
369 
374  void copyToClipboard(const QString &text);
375 
381  {
382  return m_clipboardHistory;
383  }
384 
390  {
391  return m_documents.values();
392  }
393 
399  {
400  return &m_dummyMainWindow;
401  }
402 
406  QList<KateAbstractInputModeFactory *> inputModeFactories();
407 
412  const KateDefaultColors &defaultColors() const
413  {
414  return *m_defaultColors;
415  }
416 
420  QStringListModel *searchHistoryModel();
421 
425  QStringListModel *replaceHistoryModel();
426 
430  void saveSearchReplaceHistoryModels();
431 
435  KateVariableExpansionManager *variableExpansionManager();
436 
437 Q_SIGNALS:
441  void clipboardHistoryChanged();
442 
443 protected:
444  bool eventFilter(QObject *, QEvent *) override;
445 
446 private Q_SLOTS:
447  void updateColorPalette();
448 
449 private:
453  KAboutData m_aboutData;
454 
459 
464 
468  KDirWatch *m_dirWatch;
469 
473  KateModeManager *m_modeManager;
474 
478  KateSchemaManager *m_schemaManager;
479 
483  KateGlobalConfig *m_globalConfig;
484 
488  KateDocumentConfig *m_documentConfig;
489 
493  KateViewConfig *m_viewConfig;
494 
498  KateRendererConfig *m_rendererConfig;
499 
504 
508  KateScriptManager *m_scriptManager;
509 
513  KateHlManager *m_hlManager;
514 
518  KateCmd *m_cmdManager;
519 
523  KateVariableExpansionManager *m_variableExpansionManager;
524 
528  KateSpellCheckManager *m_spellCheckManager;
529 
533  KateWordCompletionModel *m_wordCompletionModel;
534 
538  KateKeywordCompletionModel *m_keywordCompletionModel;
539 
543  QStringList m_clipboardHistory;
544 
548  KTextEditor::Application m_dummyApplication;
549 
554 
558  KTextEditor::MainWindow m_dummyMainWindow;
559 
564 
568  QScopedPointer<KateDefaultColors> m_defaultColors;
569 
573  QStringListModel *m_searchHistoryModel;
574  QStringListModel *m_replaceHistoryModel;
575 };
576 
577 }
578 
579 #endif
QList< KTextEditor::Document * > documents() override
Returns a list of all documents of this editor.
Definition: kateglobal.h:127
Manage the scripts on disks – find them and query them.
KateViewConfig * viewConfig()
fallback view config
Definition: kateglobal.h:284
KTextEditor::Application * application() const override
Current hosting application, if any set.
Definition: kateglobal.h:148
KateWordCompletionModel * wordCompletionModel()
global instance of the simple word completion mode
Definition: kateglobal.h:337
KateSchemaManager * schemaManager()
manager for the katepart schemas
Definition: kateglobal.h:266
KateModeManager * modeManager()
global mode manager used to manage the modes centrally
Definition: kateglobal.h:257
KateCmd * cmdManager()
command manager
Definition: kateglobal.h:319
QList< KTextEditor::ViewPrivate * > views()
return a list of all registered views
Definition: kateglobal.h:232
const KateDefaultColors & defaultColors() const
Default colors, once constructed, as expensive.
Definition: kateglobal.h:412
A KParts derived class representing a text document.
Definition: document.h:199
KateRendererConfig * rendererConfig()
fallback renderer config
Definition: kateglobal.h:293
Manager class for variable expansion.
KateDocumentConfig * documentConfig()
fallback document config
Definition: kateglobal.h:275
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:389
KateDocumentConfig * config()
Configuration.
KateHlManager * hlManager()
hl manager
Definition: kateglobal.h:310
KTextEditor::MainWindow * dummyMainWindow()
Dummy main window to be null safe.
Definition: kateglobal.h:398
An Editor command line command.
This class allows the application that embeds the KTextEditor component to allow it access to applica...
Definition: application.h:55
KateKeywordCompletionModel * keywordCompletionModel()
Global instance of the language-aware keyword completion model.
Definition: kateglobal.h:346
KateScriptManager * scriptManager()
Global script collection.
Definition: kateglobal.h:301
Config page interface for the Editor and Plugins.
Definition: configpage.h:57
void setApplication(KTextEditor::Application *application) override
Set the global application object.
Definition: kateglobal.h:138
Accessor interface for the KTextEditor framework.
Definition: editor.h:96
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:80
KateSpellCheckManager * spellCheckManager()
spell check manager
Definition: kateglobal.h:328
KDirWatch * dirWatch()
global dirwatch
Definition: kateglobal.h:241
const KAboutData & aboutData() const override
General Information about this editor.
Definition: kateglobal.h:161
const QStringList & clipboardHistory() const
Clipboard history, filled with text we ever copied to clipboard via copyToClipboard.
Definition: kateglobal.h:380
This class allows the application that embeds the KTextEditor component to allow it to access parts o...
Definition: mainwindow.h:57
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun May 31 2020 23:13:19 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.