summaryrefslogtreecommitdiff
path: root/src/plugins/texteditor/indenter.h
diff options
context:
space:
mode:
authorLeandro Melo <leandro.melo@nokia.com>2010-11-05 14:27:16 +0100
committerLeandro Melo <leandro.melo@nokia.com>2010-11-05 14:28:38 +0100
commit3a684586fabf103b8e09cef31a18ffae1fd9f0c7 (patch)
treeffa3f74bd66d01f3ed1aca89c5e0ed0e65b936b0 /src/plugins/texteditor/indenter.h
parent1afea78c7d0f6c37f5ff6c06bfc19f0445a34875 (diff)
downloadqt-creator-3a684586fabf103b8e09cef31a18ffae1fd9f0c7.tar.gz
Editors: Refactor indenters out of the editors for better reusability.
Reviewed-by: ckamm
Diffstat (limited to 'src/plugins/texteditor/indenter.h')
-rw-r--r--src/plugins/texteditor/indenter.h26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/plugins/texteditor/indenter.h b/src/plugins/texteditor/indenter.h
index 51b2131b28..3a58f56912 100644
--- a/src/plugins/texteditor/indenter.h
+++ b/src/plugins/texteditor/indenter.h
@@ -37,11 +37,12 @@
QT_BEGIN_NAMESPACE
class QTextDocument;
+class QTextCursor;
QT_END_NAMESPACE
namespace TextEditor {
-class TabSettings;
+class BaseTextEditor;
class TEXTEDITOR_EXPORT Indenter
{
@@ -49,13 +50,28 @@ public:
Indenter();
virtual ~Indenter();
- void indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar, const TabSettings &ts);
+ bool isElectricCharacter(const QChar &ch) const;
+ void indentBlock(QTextDocument *doc,
+ const QTextBlock &block,
+ const QChar &typedChar,
+ BaseTextEditor *editor);
+ void indent(QTextDocument *doc,
+ const QTextCursor &cursor,
+ const QChar &typedChar,
+ BaseTextEditor *editor);
+ void reindent(QTextDocument *doc, const QTextCursor &cursor, BaseTextEditor *editor);
private:
+ virtual bool doIsElectricalCharacter(const QChar &ch) const;
virtual void doIndentBlock(QTextDocument *doc,
- QTextBlock block,
- QChar typedChar,
- const TabSettings &ts) = 0;
+ const QTextBlock &block,
+ const QChar &typedChar,
+ BaseTextEditor *editor) = 0;
+ virtual void doIndent(QTextDocument *doc,
+ const QTextCursor &cursor,
+ const QChar &typedChar,
+ BaseTextEditor *editor);
+ virtual void doReindent(QTextDocument *doc, const QTextCursor &cursor, BaseTextEditor *editor);
};
} // namespace TextEditor