Editors: Continue refactoring indenters out of the editors.

This is pretty much a complement of commit 3a684586fa,
which is an attempt to make editors and indenters a bit more decoupled.

Reviewed-by: Thorbjorn Lindeijer
This commit is contained in:
Leandro Melo
2010-11-09 10:36:02 +01:00
parent 36fa1de4c6
commit c8a53a66ad
5 changed files with 33 additions and 30 deletions

View File

@@ -50,15 +50,20 @@ public:
Indenter();
virtual ~Indenter();
// Returns true if key triggers an indent.
bool isElectricCharacter(const QChar &ch) const;
// Indent a text block based on previous line. Default does nothing
void indentBlock(QTextDocument *doc,
const QTextBlock &block,
const QChar &typedChar,
BaseTextEditor *editor);
// Indent at cursor. Calls indentBlock for selection or current line.
void indent(QTextDocument *doc,
const QTextCursor &cursor,
const QChar &typedChar,
BaseTextEditor *editor);
// Reindent at cursor. Selection will be adjusted according to the indentation
// change of the first block.
void reindent(QTextDocument *doc, const QTextCursor &cursor, BaseTextEditor *editor);
private:
@@ -66,7 +71,7 @@ private:
virtual void doIndentBlock(QTextDocument *doc,
const QTextBlock &block,
const QChar &typedChar,
BaseTextEditor *editor) = 0;
BaseTextEditor *editor);
virtual void doIndent(QTextDocument *doc,
const QTextCursor &cursor,
const QChar &typedChar,