File indexing completed on 2024-04-21 15:55:35

0001 /***********************************************************************************************
0002     Copyright (C) 2004 by Jeroen Wijnhout <Jeroen.Wijnhout@kdemail.net>
0003                   2008-2019 by Michel Ludwig (michel.ludwig@kdemail.net)
0004  ***********************************************************************************************/
0005 
0006 /***************************************************************************
0007  *                                                                         *
0008  *   This program is free software; you can redistribute it and/or modify  *
0009  *   it under the terms of the GNU General Public License as published by  *
0010  *   the Free Software Foundation; either version 2 of the License, or     *
0011  *   (at your option) any later version.                                   *
0012  *                                                                         *
0013  ***************************************************************************/
0014 
0015 #ifndef EVENTFILTER_H
0016 #define EVENTFILTER_H
0017 
0018 #include <QEvent>
0019 #include <QObject>
0020 #include <QRegExp>
0021 
0022 class KModifierKeyInfo;
0023 
0024 namespace KTextEditor {
0025 class View;
0026 }
0027 namespace KileDocument {
0028 class EditorExtension;
0029 }
0030 
0031 /**
0032  * This class is capable of intercepting key-strokes from the editor. It can complete a \begin{env}
0033  * with a \end{env} when enter is pressed.
0034  **/
0035 class LaTeXEventFilter : public QObject
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040     LaTeXEventFilter(KTextEditor::View *view, KileDocument::EditorExtension *edit);
0041 
0042 public Q_SLOTS:
0043     void readConfig();
0044 
0045 protected:
0046     bool eventFilter(QObject *o, QEvent *e) override;
0047     bool isCapsLockEnabled();
0048 
0049 private:
0050     bool m_bCompleteEnvironment;
0051     KTextEditor::View *m_view;
0052     KileDocument::EditorExtension *m_edit;
0053     KModifierKeyInfo *m_modifierKeyInfo;
0054 
0055 };
0056 
0057 #endif