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

Kate

kateautoindent.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2003 Jesse Yurkovich <yurkjes@iit.edu>
00003    Copyright (C) 2004 >Anders Lund <anders@alweb.dk> (KateVarIndent class)
00004    Copyright (C) 2005 Dominik Haumann <dhdev@gmx.de> (basic support for config page)
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License version 2 as published by the Free Software Foundation.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef __KATE_AUTO_INDENT_H__
00022 #define __KATE_AUTO_INDENT_H__
00023 
00024 #include "katecursor.h"
00025 #include "kateconfig.h"
00026 
00027 #include <kactionmenu.h>
00028 
00029 class KateDocument;
00030 class KateIndentScript;
00031 
00037 class KateAutoIndent
00038 {
00039   /*
00040    * Static methods to list indention modes
00041    */
00042   public:
00047     static QStringList listModes ();
00048 
00054     static QString modeName (int mode);
00055 
00061     static QString modeDescription (int mode);
00062     
00068     static QString modeRequiredStyle(int mode);
00069 
00075     static uint modeNumber (const QString &name);
00076 
00081     static int modeCount ();
00082 
00083   /*
00084    * Construction + Destruction
00085    */
00086   public:
00091     explicit KateAutoIndent (KateDocument *doc);
00092 
00096     ~KateAutoIndent ();
00097 
00098   /*
00099    * Internal helper for the subclasses and itself
00100    */
00101   private:
00109     QString tabString (int length, int align) const;
00110 
00118     bool doIndent(int line, int indentDepth, int align = 0);
00119     
00127     bool doIndentRelative(int line, int change);
00128 
00133     void keepIndent ( int line );
00134 
00141     void scriptIndent (KateView *view, const KTextEditor::Cursor &position, QChar typedChar);
00142 
00147     bool isStyleProvided(KateIndentScript *script);
00148 
00149   public:
00156     void setMode (const QString &name);
00157 
00163     void checkRequiredStyle();
00164 
00168     const QString &modeName () const { return m_mode; }
00169 
00174     void updateConfig ();
00175 
00185     bool changeIndent (const KTextEditor::Range &range, int change);
00186 
00195     void indent (KateView *view, const KTextEditor::Range &range);
00196 
00204     void userTypedChar (KateView *view, const KTextEditor::Cursor &position, QChar typedChar);
00205 
00206   /*
00207    * needed data
00208    */
00209   private:
00210     KateDocument *doc; 
00211     int  tabWidth;     
00212     int  indentWidth;  
00213     bool  useSpaces;    
00214     bool  keepExtra;    
00215     QString m_mode;
00216     bool m_normal;
00217     KateIndentScript *m_script;
00218 };
00219 
00224 class KateViewIndentationAction : public KActionMenu
00225 {
00226   Q_OBJECT
00227 
00228   public:
00229     KateViewIndentationAction(KateDocument *_doc, const QString& text, QObject *parent);
00230 
00231   private:
00232     KateDocument* doc;
00233     QActionGroup *actionGroup;
00234 
00235   public  Q_SLOTS:
00236     void slotAboutToShow();
00237 
00238   private Q_SLOTS:
00239     void setMode (QAction*);
00240 };
00241 
00242 #endif
00243 
00244 // 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