forked from qt-creator/qt-creator
Editors: Refactor indenters out of the editors for better reusability.
Reviewed-by: ckamm
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user