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
|
2019-01-16 09:37:54 +01:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "texteditor_global.h"
|
|
|
|
|
|
|
|
|
|
#include "indenter.h"
|
|
|
|
|
#include "tabsettings.h"
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QTextDocument;
|
|
|
|
|
class QTextCursor;
|
|
|
|
|
class QChar;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace TextEditor {
|
|
|
|
|
|
|
|
|
|
class TEXTEDITOR_EXPORT TextIndenter : public Indenter
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit TextIndenter(QTextDocument *doc);
|
|
|
|
|
~TextIndenter() override;
|
|
|
|
|
|
2020-02-28 13:17:08 +01:00
|
|
|
int indentFor(const QTextBlock &block,
|
|
|
|
|
const TabSettings &tabSettings,
|
|
|
|
|
int cursorPositionInEditor = -1) override;
|
|
|
|
|
|
2019-01-16 09:37:54 +01:00
|
|
|
IndentationForBlock indentationForBlocks(const QVector<QTextBlock> &blocks,
|
2019-01-28 08:11:20 +01:00
|
|
|
const TabSettings &tabSettings,
|
|
|
|
|
int cursorPositionInEditor = -1) override;
|
2019-01-16 09:37:54 +01:00
|
|
|
void indentBlock(const QTextBlock &block,
|
|
|
|
|
const QChar &typedChar,
|
2019-01-28 08:11:20 +01:00
|
|
|
const TabSettings &tabSettings,
|
|
|
|
|
int cursorPositionInEditor = -1) override;
|
2019-01-16 09:37:54 +01:00
|
|
|
|
|
|
|
|
void indent(const QTextCursor &cursor,
|
|
|
|
|
const QChar &typedChar,
|
2019-01-28 08:11:20 +01:00
|
|
|
const TabSettings &tabSettings,
|
|
|
|
|
int cursorPositionInEditor = -1) override;
|
2019-01-16 09:37:54 +01:00
|
|
|
|
2019-01-28 08:11:20 +01:00
|
|
|
void reindent(const QTextCursor &cursor,
|
|
|
|
|
const TabSettings &tabSettings,
|
|
|
|
|
int cursorPositionInEditor = -1) override;
|
2022-08-26 10:30:00 +02:00
|
|
|
std::optional<TabSettings> tabSettings() const override;
|
2019-01-16 09:37:54 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace TextEditor
|