2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2010-11-05 14:27:16 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-11-05 14:27:16 +01:00
|
|
|
|
2011-02-03 15:48:14 +01:00
|
|
|
#include "qmljstools_global.h"
|
|
|
|
|
|
2019-01-16 09:37:54 +01:00
|
|
|
#include <texteditor/textindenter.h>
|
2010-11-05 14:27:16 +01:00
|
|
|
|
|
|
|
|
namespace QmlJSEditor {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2019-01-16 09:37:54 +01:00
|
|
|
class QMLJSTOOLS_EXPORT Indenter : public TextEditor::TextIndenter
|
2010-11-05 14:27:16 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2019-01-16 09:37:54 +01:00
|
|
|
explicit Indenter(QTextDocument *doc);
|
2016-01-13 14:32:23 +01:00
|
|
|
~Indenter() override;
|
|
|
|
|
|
|
|
|
|
bool isElectricCharacter(const QChar &ch) const override;
|
2019-01-16 09:37:54 +01:00
|
|
|
void indentBlock(const QTextBlock &block,
|
2016-01-13 14:32:23 +01:00
|
|
|
const QChar &typedChar,
|
2019-01-28 08:11:20 +01:00
|
|
|
const TextEditor::TabSettings &tabSettings,
|
|
|
|
|
int cursorPositionInEditor = -1) override;
|
2019-01-16 09:37:54 +01:00
|
|
|
void invalidateCache() override;
|
2016-01-13 14:32:23 +01:00
|
|
|
|
2019-01-28 08:11:20 +01:00
|
|
|
int indentFor(const QTextBlock &block,
|
|
|
|
|
const TextEditor::TabSettings &tabSettings,
|
|
|
|
|
int cursorPositionInEditor = -1) override;
|
2022-10-05 13:48:16 +02:00
|
|
|
int visualIndentFor(const QTextBlock &block,
|
|
|
|
|
const TextEditor::TabSettings &tabSettings) override;
|
2019-01-28 08:11:20 +01:00
|
|
|
TextEditor::IndentationForBlock indentationForBlocks(const QVector<QTextBlock> &blocks,
|
|
|
|
|
const TextEditor::TabSettings &tabSettings,
|
|
|
|
|
int cursorPositionInEditor = -1) override;
|
2010-11-05 14:27:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // Internal
|
|
|
|
|
} // QmlJSEditor
|