• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Kate

katetemplatehandler.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2004 Joseph Wenninger <jowenn@kde.org>
00003    Copyright (C) 2009 Milian Wolff <mail@milianw.de>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 #ifndef _KATE_TEMPLATE_HANDLER_H_
00020 #define _KATE_TEMPLATE_HANDLER_H_
00021 
00022 #include "katesmartrange.h"
00023 #include <QtCore/QPointer>
00024 #include <QtCore/QObject>
00025 #include <QtCore/QMap>
00026 #include <QtCore/QHash>
00027 #include <QtCore/QString>
00028 #include <QtCore/QList>
00029 
00030 class KateDocument;
00031 class KateUndoManager;
00032 
00033 namespace KTextEditor {
00034   class SmartRange;
00035 }
00036 
00060 class KateTemplateHandler: public QObject
00061 {
00062     Q_OBJECT
00063   public:
00070     KateTemplateHandler(KateDocument *doc, const KTextEditor::Cursor& position,
00071                         const QString &templateString, const QMap<QString, QString> &initialValues,
00072                         KateUndoManager* undoManager);
00073 
00077     virtual ~KateTemplateHandler();
00078 
00079   protected:
00095     virtual bool eventFilter(QObject* object, QEvent* event);
00096 
00097   private:
00101     void insertText(const KTextEditor::Cursor& position, const QString& text);
00102 
00110     void handleTemplateString(const KTextEditor::Cursor &position, QString templateString,
00111                               const QMap<QString, QString> &initialValues);
00112 
00119     void setupEventHandler(KTextEditor::View* view);
00120 
00126     void jumpToPreviousRange();
00127 
00133     void jumpToNextRange();
00134 
00138     void setCurrentRange(KTextEditor::SmartRange* range);
00139 
00146     void syncMirroredRanges(KTextEditor::SmartRange* range);
00147 
00155     void cleanupAndExit();
00156 
00161     void jumpToFinalCursorPosition();
00162 
00163   private Q_SLOTS:
00167     void slotViewCreated(KTextEditor::Document* document, KTextEditor::View* view);
00168 
00175     void slotTextChanged(KTextEditor::Document* document, const KTextEditor::Range& oldRange);
00176 
00180     void setEditWithUndo(const bool &enabled);
00181 
00182   private:
00184     KateDocument *m_doc;
00194     QList<KTextEditor::SmartRange*> m_templateRanges;
00197     KTextEditor::SmartRange* m_wholeTemplateRange;
00199     KTextEditor::SmartCursor* m_finalCursorPosition;
00201     KTextEditor::Cursor m_lastCaretPosition;
00205     QList<KTextEditor::SmartRange*> m_uneditedRanges;
00208     QList<KTextEditor::SmartRange*> m_AllRangesSorted;
00210     bool m_isMirroring;
00212     bool m_editWithUndo;
00214     bool m_jumping;
00215 };
00216 
00217 #endif
00218 
00219 // kate: space-indent on; indent-width 2; replace-tabs on;

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  •     Sodep
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.9-20090814
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal