edbee - Qt Editor Library
chartextdocument.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <QObject>
9 #include <QHash>
10 
12 
13 
14 namespace edbee {
15 
16 class TextCodec;
17 class TextDocumentFilter;
18 class TextDocumentScopes;
19 class TextEditorConfig;
20 class TextLineDataManager;
21 class TextBufferChange;
22 
25 {
26 Q_OBJECT
27 
28 public:
29  CharTextDocument( QObject* object=0 );
30  virtual ~CharTextDocument();
31 
32 
34  virtual TextBuffer* buffer() const;
35 
37  virtual TextLineDataManager* lineDataManager() { return textLineDataManager_; }
38 
39 
41  virtual TextDocumentScopes* scopes() { return textScopes_; }
42 
44  virtual TextCodec* encoding() { return textCodecRef_; }
45 
47  virtual void setEncoding( TextCodec* codec ) {
48  Q_ASSERT(codec);
49  textCodecRef_ = codec;
50  }
51 
53  virtual const edbee::LineEnding* lineEnding() { return lineEndingRef_; }
54 
56  virtual void setLineEnding( const edbee::LineEnding* lineEnding ) {
57  Q_ASSERT(lineEnding);
58  lineEndingRef_ = lineEnding;
59  }
60 
61 
63  virtual TextLexer* textLexer() { return textLexer_; }
64 
66  virtual TextGrammar* languageGrammar();
67  virtual void setLanguageGrammar( TextGrammar* grammar );
68 
70  virtual TextUndoStack* textUndoStack() { return textUndoStack_; }
71 
72  virtual TextEditorConfig* config() const;
73 
74  virtual Change* giveChangeWithoutFilter(Change* change, int coalesceId );
75 
76 
77 protected slots:
78 // virtual void textReplaced( int offset, int length, const QChar* data, int dataLength );
79 // virtual void linesReplaced( int line, int lineCount, int newLineCount );
80  virtual void textBufferChanged( const edbee::TextBufferChange& change );
81 
82 private:
83  TextEditorConfig* config_;
84  TextBuffer* textBuffer_;
85 
86  TextLineDataManager* textLineDataManager_;
87  TextDocumentScopes* textScopes_;
88  TextLexer* textLexer_;
89 
90  TextCodec* textCodecRef_;
91  const edbee::LineEnding* lineEndingRef_;
92 
93  TextUndoStack* textUndoStack_;
94 
95 
96 };
97 
98 } // edbee
This is the base and abstract class of a text document A TextDocument is the model part of the editor...
Definition: textdocument.h:40
virtual TextEditorConfig * config() const
This method returns the configuration.
Definition: chartextdocument.cpp:106
This clas represents a text buffer change and is used to pass around between events This is a sharedd...
Definition: textbuffer.h:45
virtual void textBufferChanged(const edbee::TextBufferChange &change)
This method replaces the given text via the undo-button.
Definition: chartextdocument.cpp:136
virtual TextCodec * encoding()
This method returns the current encoding.
Definition: chartextdocument.h:44
A plain textdocument. A document with simple character-buffer implementation.
Definition: chartextdocument.h:24
virtual TextDocumentScopes * scopes()
Should return the document-scopes of this document.
Definition: chartextdocument.h:41
This manager manages all line definitions.
Definition: textlinedata.h:75
virtual void setLineEnding(const edbee::LineEnding *lineEnding)
Set the used line ending.
Definition: chartextdocument.h:56
CharTextDocument(QObject *object=0)
The main contstructor of the chartext document.
Definition: chartextdocument.cpp:29
virtual ~CharTextDocument()
The default constructor.
Definition: chartextdocument.cpp:69
This class represents a single text codec The codec has a name and contains methods to create encoder...
Definition: textcodec.h:37
virtual TextUndoStack * textUndoStack()
returns the text undo stack
Definition: chartextdocument.h:70
General configuration settings of the text editor.
Definition: texteditorconfig.h:17
virtual void setEncoding(TextCodec *codec)
Sets the encoding.
Definition: chartextdocument.h:47
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
This class defines a single language grammar.
Definition: textgrammar.h:125
A basic change.
Definition: change.h:18
virtual TextGrammar * languageGrammar()
This method should return the current language grammar.
Definition: chartextdocument.cpp:88
This class represents the textbuffer of the editor.
Definition: textbuffer.h:68
This class is used to &#39;contain&#39; all document scope information.
Definition: textdocumentscopes.h:325
virtual TextBuffer * buffer() const
This method should return the active textbuffer.
Definition: chartextdocument.cpp:81
This is the undo stack for the texteditor. This stack is SHARED by all views of the document The stac...
Definition: textundostack.h:50
virtual void setLanguageGrammar(TextGrammar *grammar)
Sets the language grammar.
Definition: chartextdocument.cpp:95
This is a single lexer.
Definition: textlexer.h:17
virtual TextLexer * textLexer()
Should return the current document lexer.
Definition: chartextdocument.h:63
A special class to perform line-ending detection.
Definition: lineending.h:12
virtual Change * giveChangeWithoutFilter(Change *change, int coalesceId)
Gives a change to the undo stack without invoking the filter.
Definition: chartextdocument.cpp:122
virtual TextLineDataManager * lineDataManager()
this method can be used to give a &#39;custom&#39; line data item to a given line
Definition: chartextdocument.h:37
virtual const edbee::LineEnding * lineEnding()
This method should return the current line ending.
Definition: chartextdocument.h:53