Kate
kateautoindent.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
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
00085
00086 public:
00091 explicit KateAutoIndent (KateDocument *doc);
00092
00096 ~KateAutoIndent ();
00097
00098
00099
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
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