• Skip to content
  • Skip to link menu
KDE 4.2 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 
00119     bool doIndent(KateView *view, int line, int indentDepth, int align = 0);
00120     
00129     bool doIndentRelative(KateView *view, int line, int change);
00130 
00136     void keepIndent ( KateView *view, int line );
00137 
00144     void scriptIndent (KateView *view, const KTextEditor::Cursor &position, QChar typedChar);
00145 
00150     bool isStyleProvided(KateIndentScript *script);
00151 
00152   public:
00159     void setMode (const QString &name);
00160 
00166     void checkRequiredStyle();
00167 
00171     const QString &modeName () const { return m_mode; }
00172 
00177     void updateConfig ();
00178 
00189     bool changeIndent (KateView *view, const KTextEditor::Range &range, int change);
00190 
00199     void indent (KateView *view, const KTextEditor::Range &range);
00200 
00208     void userTypedChar (KateView *view, const KTextEditor::Cursor &position, QChar typedChar);
00209 
00210   /*
00211    * needed data
00212    */
00213   private:
00214     KateDocument *doc; 
00215     int  tabWidth;     
00216     int  indentWidth;  
00217     bool  useSpaces;    
00218     bool  keepExtra;    
00219     QString m_mode;
00220     bool m_normal;
00221     KateIndentScript *m_script;
00222 };
00223 
00228 class KateViewIndentationAction : public KActionMenu
00229 {
00230   Q_OBJECT
00231 
00232   public:
00233     KateViewIndentationAction(KateDocument *_doc, const QString& text, QObject *parent);
00234 
00235   private:
00236     KateDocument* doc;
00237 
00238   public  Q_SLOTS:
00239     void slotAboutToShow();
00240 
00241   private Q_SLOTS:
00242     void setMode (QAction*);
00243 };
00244 
00245 #endif
00246 
00247 // 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
  • 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