• Skip to content
  • Skip to link menu
KDE 4.3 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 <QtCore/QPointer>
00023 #include <QtCore/QObject>
00024 #include <QtCore/QMap>
00025 #include <QtCore/QHash>
00026 #include <QtCore/QString>
00027 #include <QtCore/QList>
00028 
00029 class KateDocument;
00030 
00031 namespace KTextEditor {
00032   class SmartRange;
00033 }
00034 
00035 class KateTemplateHandler: public QObject {
00036         Q_OBJECT
00037     public:
00038         KateTemplateHandler(KateDocument *doc,const KTextEditor::Cursor& position, const QString &templateString, const QMap<QString,QString> &initialValues);
00039         virtual ~KateTemplateHandler();
00040         inline bool initOk() {return m_initOk;}
00041         virtual bool operator()(int key);
00042     private:
00043         class KateTemplatePlaceHolder {
00044                 public:
00045                         KateTemplatePlaceHolder(bool isCursor,bool isInitialValue, bool isReplacableSpace) {
00046                           this->isCursor=isCursor;
00047                           this->isInitialValue=isInitialValue;
00048                           this->isReplacableSpace=isReplacableSpace;
00049                         }
00050                         QList<KTextEditor::SmartRange*> ranges;
00051             bool isCursor;
00052             bool isInitialValue;
00053                         bool isReplacableSpace;
00054         };
00055         class KateTemplateHandlerPlaceHolderInfo{
00056             public:
00057                 KateTemplateHandlerPlaceHolderInfo():begin(0),len(0),placeholder(""){}
00058                 KateTemplateHandlerPlaceHolderInfo(uint begin_,uint len_,const QString& placeholder_):begin(begin_),len(len_),placeholder(placeholder_){}
00059                 uint begin;
00060                 uint len;
00061                 QString placeholder;
00062         };
00063         class KateDocument *const m_doc;
00064 
00065                 // looks like this is leaking objects (was before too)
00066         QList<KateTemplatePlaceHolder*> m_tabOrder;
00067 
00068                 // looks like this is leaking objects (was before too)
00069                 QHash<QString, KateTemplatePlaceHolder*> m_dict;
00070 
00071         void generateRangeTable(const KTextEditor::Cursor& insertPosition, const QString& insertString, const QList<KateTemplateHandlerPlaceHolderInfo> &buildList);
00072         int m_currentTabStop;
00073         KTextEditor::SmartRange *m_currentRange;
00074         void locateRange(const KTextEditor::Cursor &cursor, const KTextEditor::Cursor &cursor2 );
00075         bool m_initOk;
00076         bool m_recursion;
00077                 KTextEditor::SmartRange* m_templateRange;
00078     private Q_SLOTS:
00079         void slotTextInserted(KTextEditor::Document*, const KTextEditor::Range&);
00080         void slotAboutToRemoveText(const KTextEditor::Range& range);
00081         void slotTextRemoved();
00082                 void slotRangeDeleted(KTextEditor::SmartRange*);
00083 };
00084 #endif
00085 
00086 // 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
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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