1 /***********************************************************************************************
2     Copyright (C) 2004 by Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
3                   2008-2019 by Michel Ludwig (michel.ludwig@kdemail.net)
4  ***********************************************************************************************/
5 
6 /***************************************************************************
7  *                                                                         *
8  *   This program is free software; you can redistribute it and/or modify  *
9  *   it under the terms of the GNU General Public License as published by  *
10  *   the Free Software Foundation; either version 2 of the License, or     *
11  *   (at your option) any later version.                                   *
12  *                                                                         *
13  ***************************************************************************/
14 
15 #ifndef EVENTFILTER_H
16 #define EVENTFILTER_H
17 
18 #include <QEvent>
19 #include <QObject>
20 #include <QRegExp>
21 
22 class KModifierKeyInfo;
23 
24 namespace KTextEditor {
25 class View;
26 }
27 namespace KileDocument {
28 class EditorExtension;
29 }
30 
31 /**
32  * This class is capable of intercepting key-strokes from the editor. It can complete a \begin{env}
33  * with a \end{env} when enter is pressed.
34  **/
35 class LaTeXEventFilter : public QObject
36 {
37     Q_OBJECT
38 
39 public:
40     LaTeXEventFilter(KTextEditor::View *view, KileDocument::EditorExtension *edit);
41 
42 public Q_SLOTS:
43     void readConfig();
44 
45 protected:
46     bool eventFilter(QObject *o, QEvent *e) override;
47     bool isCapsLockEnabled();
48 
49 private:
50     bool m_bCompleteEnvironment;
51     KTextEditor::View *m_view;
52     KileDocument::EditorExtension *m_edit;
53     KModifierKeyInfo *m_modifierKeyInfo;
54 
55 };
56 
57 #endif
58