20 #ifndef KATE_SCRIPT_DOCUMENT_H
21 #define KATE_SCRIPT_DOCUMENT_H
24 #include <QStringList>
25 #include <QtScript/QScriptable>
29 #include <QtScript/QScriptValue>
31 #include <ktexteditor/cursor.h>
32 #include <ktexteditor/range.h>
61 Q_INVOKABLE
QString highlightingMode();
62 Q_INVOKABLE
QStringList embeddedHighlightingModes();
63 Q_INVOKABLE
QString highlightingModeAt(
const KTextEditor::Cursor& pos);
64 Q_INVOKABLE
bool isModified();
66 Q_INVOKABLE
QString text(
int fromLine,
int fromColumn,
int toLine,
int toColumn);
67 Q_INVOKABLE
QString text(
const KTextEditor::Cursor& from,
const KTextEditor::Cursor& to);
68 Q_INVOKABLE
QString text(
const KTextEditor::Range& range);
69 Q_INVOKABLE
QString line(
int line);
70 Q_INVOKABLE
QString wordAt(
int line,
int column);
71 Q_INVOKABLE
QString wordAt(
const KTextEditor::Cursor& cursor);
72 Q_INVOKABLE KTextEditor::Range wordRangeAt(
int line,
int column);
73 Q_INVOKABLE KTextEditor::Range wordRangeAt(
const KTextEditor::Cursor& cursor);
74 Q_INVOKABLE
QString charAt(
int line,
int column);
75 Q_INVOKABLE
QString charAt(
const KTextEditor::Cursor& cursor);
76 Q_INVOKABLE
QString firstChar(
int line);
77 Q_INVOKABLE
QString lastChar(
int line);
78 Q_INVOKABLE
bool isSpace(
int line,
int column);
79 Q_INVOKABLE
bool isSpace(
const KTextEditor::Cursor& cursor);
80 Q_INVOKABLE
bool matchesAt(
int line,
int column,
const QString &s);
81 Q_INVOKABLE
bool matchesAt(
const KTextEditor::Cursor& cursor,
const QString &s);
82 Q_INVOKABLE
bool setText(
const QString &s);
83 Q_INVOKABLE
bool clear();
84 Q_INVOKABLE
bool truncate(
int line,
int column);
85 Q_INVOKABLE
bool truncate(
const KTextEditor::Cursor& cursor);
86 Q_INVOKABLE
bool insertText(
int line,
int column,
const QString &s);
87 Q_INVOKABLE
bool insertText(
const KTextEditor::Cursor& cursor,
const QString &s);
88 Q_INVOKABLE
bool removeText(
int fromLine,
int fromColumn,
int toLine,
int toColumn);
89 Q_INVOKABLE
bool removeText(
const KTextEditor::Cursor& from,
const KTextEditor::Cursor& to);
90 Q_INVOKABLE
bool removeText(
const KTextEditor::Range& range);
91 Q_INVOKABLE
bool insertLine(
int line,
const QString &s);
92 Q_INVOKABLE
bool removeLine(
int line);
93 Q_INVOKABLE
bool wrapLine(
int line,
int column);
94 Q_INVOKABLE
bool wrapLine(
const KTextEditor::Cursor& cursor);
95 Q_INVOKABLE
void joinLines(
int startLine,
int endLine);
96 Q_INVOKABLE
int lines();
97 Q_INVOKABLE
int length();
98 Q_INVOKABLE
int lineLength(
int line);
99 Q_INVOKABLE
void editBegin();
100 Q_INVOKABLE
void editEnd();
102 Q_INVOKABLE
int lastColumn(
int line);
103 Q_INVOKABLE
int prevNonSpaceColumn(
int line,
int column);
104 Q_INVOKABLE
int prevNonSpaceColumn(
const KTextEditor::Cursor& cursor);
105 Q_INVOKABLE
int nextNonSpaceColumn(
int line,
int column);
106 Q_INVOKABLE
int nextNonSpaceColumn(
const KTextEditor::Cursor& cursor);
107 Q_INVOKABLE
int prevNonEmptyLine(
int line);
108 Q_INVOKABLE
int nextNonEmptyLine(
int line);
110 Q_INVOKABLE
bool canBreakAt(
const QString &character,
int attribute);
111 Q_INVOKABLE
bool canComment(
int startAttribute,
int endAttribute);
112 Q_INVOKABLE
QString commentMarker(
int attribute);
113 Q_INVOKABLE
QString commentStart(
int attribute);
114 Q_INVOKABLE
QString commentEnd(
int attribute);
116 Q_INVOKABLE KTextEditor::Range documentRange();
117 Q_INVOKABLE KTextEditor::Cursor documentEnd();
122 Q_INVOKABLE
int attribute(
int line,
int column);
123 Q_INVOKABLE
int attribute(
const KTextEditor::Cursor& cursor);
128 Q_INVOKABLE
bool isAttribute(
int line,
int column,
int attr);
129 Q_INVOKABLE
bool isAttribute(
const KTextEditor::Cursor& cursor,
int attr);
134 Q_INVOKABLE
QString attributeName(
int line,
int column);
135 Q_INVOKABLE
QString attributeName(
const KTextEditor::Cursor& cursor);
140 Q_INVOKABLE
bool isAttributeName(
int line,
int column,
const QString &name);
141 Q_INVOKABLE
bool isAttributeName(
const KTextEditor::Cursor& cursor,
const QString &name);
147 Q_INVOKABLE
int firstVirtualColumn(
int line);
148 Q_INVOKABLE
int lastVirtualColumn(
int line);
149 Q_INVOKABLE
int toVirtualColumn(
int line,
int column);
150 Q_INVOKABLE
int toVirtualColumn(
const KTextEditor::Cursor& cursor);
151 Q_INVOKABLE KTextEditor::Cursor toVirtualCursor(
const KTextEditor::Cursor& cursor);
152 Q_INVOKABLE
int fromVirtualColumn(
int line,
int virtualColumn);
153 Q_INVOKABLE
int fromVirtualColumn(
const KTextEditor::Cursor& virtualCursor);
154 Q_INVOKABLE KTextEditor::Cursor fromVirtualCursor(
const KTextEditor::Cursor& virtualCursor);
156 Q_INVOKABLE KTextEditor::Cursor anchor(
int line,
int column,
QChar character);
157 Q_INVOKABLE KTextEditor::Cursor anchor(
const KTextEditor::Cursor& cursor,
QChar character);
158 Q_INVOKABLE KTextEditor::Cursor rfind(
int line,
int column,
const QString& text,
int attribute = -1);
159 Q_INVOKABLE KTextEditor::Cursor rfind(
const KTextEditor::Cursor& cursor,
const QString& text,
int attribute = -1);
161 Q_INVOKABLE
int defStyleNum(
int line,
int column);
162 Q_INVOKABLE
int defStyleNum(
const KTextEditor::Cursor& cursor);
163 Q_INVOKABLE
bool isCode(
int line,
int column);
164 Q_INVOKABLE
bool isCode(
const KTextEditor::Cursor& cursor);
165 Q_INVOKABLE
bool isComment(
int line,
int column);
166 Q_INVOKABLE
bool isComment(
const KTextEditor::Cursor& cursor);
167 Q_INVOKABLE
bool isString(
int line,
int column);
168 Q_INVOKABLE
bool isString(
const KTextEditor::Cursor& cursor);
169 Q_INVOKABLE
bool isRegionMarker(
int line,
int column);
170 Q_INVOKABLE
bool isRegionMarker(
const KTextEditor::Cursor& cursor);
171 Q_INVOKABLE
bool isChar(
int line,
int column);
172 Q_INVOKABLE
bool isChar(
const KTextEditor::Cursor& cursor);
173 Q_INVOKABLE
bool isOthers(
int line,
int column);
174 Q_INVOKABLE
bool isOthers(
const KTextEditor::Cursor& cursor);
177 Q_INVOKABLE
bool startsWith (
int line,
const QString &pattern,
bool skipWhiteSpaces);
178 Q_INVOKABLE
bool endsWith (
int line,
const QString &pattern,
bool skipWhiteSpaces);
180 Q_INVOKABLE
void indent(KTextEditor::Range range,
int change);
181 Q_INVOKABLE
void align(
const KTextEditor::Range& range);
184 bool _isCode(
int defaultStyle);
#define KATEPART_TESTS_EXPORT
Thinish wrapping around KateDocument, exposing the methods we want exposed and adding some helper met...
static bool isInWord(const KTextEditor::View *view, const KTextEditor::Cursor &position, QChar c)