kate Library API Documentation

katetemplatehandler.h

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., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 00017 */ 00018 #ifndef _KATE_TEMPLATE_HANDLER_H_ 00019 #define _KATE_TEMPLATE_HANDLER_H_ 00020 00021 #include "katesupercursor.h" 00022 #include "katekeyinterceptorfunctor.h" 00023 #include <qobject.h> 00024 #include <qmap.h> 00025 #include <qdict.h> 00026 #include <qptrlist.h> 00027 #include <qstring.h> 00028 00029 class KateDocument; 00030 00031 class KateTemplateHandler: public QObject, public KateKeyInterceptorFunctor { 00032 Q_OBJECT 00033 public: 00034 KateTemplateHandler(KateDocument *doc,uint line,uint column, const QString &templateString, const QMap<QString,QString> &initialValues); 00035 virtual ~KateTemplateHandler(); 00036 inline bool initOk() {return m_initOk;} 00037 virtual bool operator()(KKey key); 00038 private: 00039 struct KateTemplatePlaceHolder { 00040 KateSuperRangeList ranges; 00041 bool isCursor; 00042 bool isInitialValue; 00043 }; 00044 class KateTemplateHandlerPlaceHolderInfo{ 00045 public: 00046 KateTemplateHandlerPlaceHolderInfo():begin(0),len(0),placeholder(""){}; 00047 KateTemplateHandlerPlaceHolderInfo(uint begin_,uint len_,const QString& placeholder_):begin(begin_),len(len_),placeholder(placeholder_){} 00048 uint begin; 00049 uint len; 00050 QString placeholder; 00051 }; 00052 class KateSuperRangeList *m_ranges; 00053 class KateDocument *m_doc; 00054 QPtrList<KateTemplatePlaceHolder> m_tabOrder; 00055 QDict<KateTemplatePlaceHolder> m_dict; 00056 void generateRangeTable(uint insertLine,uint insertCol, const QString& insertString, const QValueList<KateTemplateHandlerPlaceHolderInfo> &buildList); 00057 int m_currentTabStop; 00058 KateSuperRange *m_currentRange; 00059 void locateRange(const KateTextCursor &cursor ); 00060 bool m_initOk; 00061 bool m_recursion; 00062 private slots: 00063 void slotTextInserted(int,int); 00064 void slotDocumentDestroyed(); 00065 void slotAboutToRemoveText(const KateTextRange &range); 00066 void slotTextRemoved(); 00067 }; 00068 #endif
KDE Logo
This file is part of the documentation for kate Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Apr 12 23:40:02 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003