• Skip to content
  • Skip to link menu
KDE 4.2 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 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 #ifndef _KATE_TEMPLATE_HANDLER_H_
00019 #define _KATE_TEMPLATE_HANDLER_H_
00020 
00021 #include "katesmartrange.h"
00022 #include "katekeyinterceptorfunctor.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 
00032 namespace KTextEditor {
00033   class SmartRange;
00034 }
00035 
00036 class KateTemplateHandler: public QObject, public KateKeyInterceptorFunctor {
00037         Q_OBJECT
00038     public:
00039         KateTemplateHandler(KateDocument *doc,const KTextEditor::Cursor& position, const QString &templateString, const QMap<QString,QString> &initialValues);
00040         virtual ~KateTemplateHandler();
00041         inline bool initOk() {return m_initOk;}
00042         virtual bool operator()(int key);
00043     private:
00044         class KateTemplatePlaceHolder {
00045                 public:
00046                         KateTemplatePlaceHolder(bool isCursor,bool isInitialValue, bool isReplacableSpace) {
00047                           this->isCursor=isCursor;
00048                           this->isInitialValue=isInitialValue;
00049                           this->isReplacableSpace=isReplacableSpace;
00050                         }
00051                         QList<KTextEditor::SmartRange*> ranges;
00052             bool isCursor;
00053             bool isInitialValue;
00054                         bool isReplacableSpace;
00055         };
00056         class KateTemplateHandlerPlaceHolderInfo{
00057             public:
00058                 KateTemplateHandlerPlaceHolderInfo():begin(0),len(0),placeholder(""){}
00059                 KateTemplateHandlerPlaceHolderInfo(uint begin_,uint len_,const QString& placeholder_):begin(begin_),len(len_),placeholder(placeholder_){}
00060                 uint begin;
00061                 uint len;
00062                 QString placeholder;
00063         };
00064         class KateDocument *m_doc;
00065 
00066                 // looks like this is leaking objects (was before too)
00067         QList<KateTemplatePlaceHolder*> m_tabOrder;
00068 
00069                 // looks like this is leaking objects (was before too)
00070                 QHash<QString, KateTemplatePlaceHolder*> m_dict;
00071 
00072         void generateRangeTable(const KTextEditor::Cursor& insertPosition, const QString& insertString, const QList<KateTemplateHandlerPlaceHolderInfo> &buildList);
00073         int m_currentTabStop;
00074         KTextEditor::SmartRange *m_currentRange;
00075         void locateRange(const KTextEditor::Cursor &cursor, const KTextEditor::Cursor &cursor2 );
00076         bool m_initOk;
00077         bool m_recursion;
00078                 KTextEditor::SmartRange* m_templateRange;
00079     private Q_SLOTS:
00080         void slotTextInserted(KTextEditor::Document*, const KTextEditor::Range&);
00081         void slotDocumentDestroyed();
00082         void slotAboutToRemoveText(const KTextEditor::Range& range);
00083         void slotTextRemoved();
00084                 void slotRangeDeleted(KTextEditor::SmartRange*);
00085 };
00086 #endif

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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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