edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
chartextdocument.h
Go to the documentation of this file.
1// edbee - Copyright (c) 2012-2025 by Rick Blommers and contributors
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "edbee/exports.h"
7
8#include <QObject>
9#include <QHash>
10
13
14namespace edbee {
15
16class TextCodec;
22
25{
26Q_OBJECT
27
28public:
29 CharTextDocument( QObject* object );
30 CharTextDocument( TextEditorConfig *config = new TextEditorConfig(), QObject* object = nullptr );
31 virtual ~CharTextDocument();
32
33
35 virtual TextBuffer* buffer() const;
36
37
39 virtual TextDocumentScopes* scopes() { return textScopes_; }
40
42 virtual TextCodec* encoding() { return textCodecRef_; }
43
45 virtual void setEncoding( TextCodec* codec ) {
46 Q_ASSERT(codec);
47 textCodecRef_ = codec;
48 }
49
51 virtual const edbee::LineEnding* lineEnding() { return lineEndingRef_; }
52
55 Q_ASSERT(lineEnding);
56 lineEndingRef_ = lineEnding;
57 }
58
59
61 virtual TextLexer* textLexer() { return textLexer_; }
62
64 virtual TextGrammar* languageGrammar();
65 virtual void setLanguageGrammar( TextGrammar* grammar );
66
68 virtual TextAutoCompleteProviderList* autoCompleteProviderList();
69
71 virtual TextUndoStack* textUndoStack() { return textUndoStack_; }
72
73 virtual TextEditorConfig* config() const;
74
75 virtual Change* giveChangeWithoutFilter(Change* change, int coalesceId );
76
77
78protected slots:
79// virtual void textReplaced( int offset, int length, const QChar* data, int dataLength );
80// virtual void linesReplaced( int line, int lineCount, int newLineCount );
81 virtual void textBufferChanged( const edbee::TextBufferChange& change, QString oldText = QString() );
82
83private:
84 TextEditorConfig* config_;
85 TextBuffer* textBuffer_;
86
87 TextDocumentScopes* textScopes_;
88 TextLexer* textLexer_;
89
90 TextCodec* textCodecRef_;
91 const edbee::LineEnding* lineEndingRef_;
92
93 TextUndoStack* textUndoStack_;
94 TextAutoCompleteProviderList* autoCompleteProviderList_;
95};
96
97} // edbee
A basic change.
Definition change.h:18
virtual TextLexer * textLexer()
Should return the current document lexer.
Definition chartextdocument.h:61
virtual TextEditorConfig * config() const
This method returns the configuration.
Definition chartextdocument.cpp:121
virtual TextCodec * encoding()
This method returns the current encoding.
Definition chartextdocument.h:42
virtual TextDocumentScopes * scopes()
Should return the document-scopes of this document.
Definition chartextdocument.h:39
virtual TextUndoStack * textUndoStack()
returns the text undo stack
Definition chartextdocument.h:71
virtual void setEncoding(TextCodec *codec)
Sets the encoding.
Definition chartextdocument.h:45
CharTextDocument(QObject *object)
The main contstructor of the chartext document.
Definition chartextdocument.cpp:28
virtual const edbee::LineEnding * lineEnding()
This method should return the current line ending.
Definition chartextdocument.h:51
virtual void setLineEnding(const edbee::LineEnding *lineEnding)
Set the used line ending.
Definition chartextdocument.h:54
virtual TextBuffer * buffer() const
This method should return the active textbuffer.
Definition chartextdocument.cpp:89
A special class to perform line-ending detection.
Definition lineending.h:12
The instance autocomplete provider, managers which autocompleters are available for the given editor.
Definition textautocompleteprovider.h:115
This clas represents a text buffer change and is used to pass around between events This is a sharedd...
Definition textbuffer.h:45
This class represents the textbuffer of the editor.
Definition textbuffer.h:68
This class represents a single text codec The codec has a name and contains methods to create encoder...
Definition textcodec.h:38
Definition textdocumentfilter.h:22
TextDocument(QObject *parent=0)
Constructs the textdocument.
Definition textdocument.cpp:25
This class is used to 'contain' all document scope information.
Definition textdocumentscopes.h:322
General configuration settings of the text editor.
Definition texteditorconfig.h:18
This class defines a single language grammar.
Definition textgrammar.h:124
This is a single lexer.
Definition textlexer.h:17
This manager manages all line definitions.
Definition textlinedata.h:77
This is the undo stack for the texteditor. This stack is SHARED by all views of the document The stac...
Definition textundostack.h:51
#define EDBEE_EXPORT
Definition exports.h:15
QT Acessibility has an issue with reporting blank lines between elements lines. defining 'WINDOWS_EMP...
Definition commentcommand.cpp:20