
| QDocument (QObject *p=0) | |
| ctor | |
| virtual | ~QDocument () |
| dtor | |
| QString | text (int mode) const |
| QString | text (bool removeTrailing=false, bool preserveIndent=true) const |
| void | setText (const QString &s) |
| Set the content of the document. | |
| void | startChunkLoading () |
| Start a chunk loading. | |
| void | stopChunkLoading () |
| Stop chunk loading. | |
| void | addChunk (const QString &txt) |
| Add a chunk of text to the document. | |
| LineEnding | lineEnding () const |
| LineEnding | originalLineEnding () const |
| void | setLineEnding (LineEnding le) |
| Set the line ending policy of the document. | |
| bool | canUndo () const |
| bool | canRedo () const |
| int | width () const |
| int | height () const |
| int | widthConstraint () const |
| int | lines () const |
| int | visualLines () const |
| int | visualLineNumber (int textLineNumber) const |
| Convert a text (logical) line number int a visual line number. | |
| int | textLineNumber (int visualLineNumber) const |
| Convert a visual line number int a text (logical) line number. | |
| int | y (int line) const |
| int | lineNumber (int ypos, int *wrap=0) const |
| int | y (const QDocumentLine &l) const |
| QRect | lineRect (int line) const |
| QRect | lineRect (const QDocumentLine &l) const |
| QDocumentCursor * | editCursor () const |
| Set the edit cursor. | |
| void | setEditCursor (QDocumentCursor *c) |
| Set the edit cursor. | |
| QLanguageDefinition * | languageDefinition () const |
| void | setLanguageDefinition (QLanguageDefinition *l) |
| Set the language definition. | |
| int | maxMarksPerLine () const |
| int | findNextMark (int id, int from=0, int until=-1) const |
| Find the next mark of a given type. | |
| int | findPreviousMark (int id, int from=-1, int until=0) const |
| Find the previous mark of a given type. | |
| QDocumentLine | lineAt (const QPoint &p) const |
| void | cursorForDocumentPosition (const QPoint &p, int &line, int &column) const |
| Convert a document (or viewport) (x, y) position to a (line, column) cursor position. | |
| QDocumentCursor | cursorAt (const QPoint &p) const |
| QDocumentLine | line (int line) const |
| QDocumentLine | line (QDocumentConstIterator iterator) const |
| QDocumentCursor | cursor (int line, int column=0) const |
| QDocumentLine | findLine (int &position) const |
| bool | isLineModified (const QDocumentLine &l) const |
| bool | hasLineEverBeenModified (const QDocumentLine &l) const |
| virtual void | draw (QPainter *p, PaintContext &cxt) |
| Draw the contents of the document. | |
| void | execute (QDocumentCommand *cmd) |
| Execute a document command (editing operation). | |
| QDocumentConstIterator | begin () const |
| QDocumentConstIterator | end () const |
| QDocumentConstIterator | iterator (int ln) const |
| QDocumentConstIterator | iterator (const QDocumentLine &l) const |
| void | beginMacro () |
| Begin a macro. | |
| void | endMacro () |
| End a macro. | |
| QFormatScheme * | formatScheme () const |
| void | setFormatScheme (QFormatScheme *f) |
| Set the format scheme used by the document. | |
| int | getNextGroupId () |
| Get an available group id for matches. | |
| void | releaseGroupId (int groupId) |
| void | clearMatches (int groupId) |
| Clear matches. | |
| void | flushMatches (int groupId) |
| void | addMatch (int groupId, int line, int pos, int len, int format) |
| Highlight the matched sequences. | |
| bool | isClean () const |
| static QFont | font () |
| static void | setFont (const QFont &f) |
| Set the font of ALL documents. | |
| static const QFontMetrics & | fontMetrics () |
| static LineEnding | defaultLineEnding () |
| static void | setDefaultLineEnding (LineEnding le) |
| Set the default line ending policy. | |
| static int | tabStop () |
| static void | setTabStop (int n) |
| Set the default tab stop common to all documents. | |
| static WhiteSpaceMode | showSpaces () |
| static void | setShowSpaces (WhiteSpaceMode y) |
| Set the whitespace display mode. | |
| static QFormatScheme * | defaultFormatScheme () |
| static void | setDefaultFormatScheme (QFormatScheme *f) |
| Set the default format scheme. | |
| static QFormatScheme * | formatFactory () |
| Compatibility alias for defaultFormatScheme(). | |
| static void | setFormatFactory (QFormatScheme *f) |
| Compatibility alias for setDefaultFormatScheme(). | |
| static int | screenLength (const QChar *d, int l, int tabStop) |
| static QString | screenable (const QChar *d, int l, int tabStop) |
| void | clear () |
| Clear the content of the document. | |
| void | undo () |
| Undo the last editing operation. | |
| void | redo () |
| Redo the last undone editing operation. | |
| void | setClean () |
| Set the document to clean state. | |
| void | highlight () |
| Update the formatting of the whole document This function is only useful when changing the language definition of a non-empty document. Make sure you do not call it more often than needed. | |
| void | print (QPrinter *p) |
| Print the content of the document. | |
| void | clearWidthConstraint () |
| Clear the width constraint, if any. | |
| void | setWidthConstraint (int width) |
| Set a new width constraint. | |
Classes | |
| struct | PaintContext |
Public Types | |
| enum | LineEnding { Conservative, Local, Unix, Windows, Mac } |
| enum | TextProcessing { RemoveTrailingWS = 1, PreserveIndent = 2, RestoreTrailingIndent = 4 } |
| enum | WhiteSpaceFlag { ShowNone = 0x00, ShowTrailing = 0x01, ShowLeading = 0x02, ShowTabs = 0x04 } |
Signals | |
| void | cleanChanged (bool m) |
| void | undoAvailable (bool y) |
| void | redoAvailable (bool y) |
| void | formatsChanged () |
| void | contentsChanged () |
| void | formatsChange (int line, int lines) |
| void | contentsChange (int line, int lines) |
| void | widthChanged (int width) |
| void | heightChanged (int height) |
| void | sizeChanged (const QSize &s) |
| void | lineDeleted (QDocumentLineHandle *h) |
| void | markChanged (QDocumentLineHandle *l, int m, bool on) |
| void | lineEndingChanged (int lineEnding) |
Public Member Functions | |
| QDocumentPrivate * | impl () |
| void | markViewDirty () |
Friends | |
| class | QMatcher |
| class | QDocumentPrivate |
| class | QDocumentCommand |
QCE uses an architecture very similar to that of QTextEdit/QTextDocument which closely ressembles model/view. The document holds all the textual and formatting data. It offers some (mostly indirect) ways of modifying its content and is usable without any GUI.
In QCE, a document is merely a list of QDocumentLine objects on which some extra formatting can be applied and which can be wrapped/hidden in various ways.
The document model has been designed with three goals in mind :
QDocument supports Bidi by using QTextLayout on lines that require it and prefers custom rendering in other cases to achieve the above goals.
All the actual text editing is done through QDocumentCursor objects.
| void QDocument::addMatch | ( | int | gid, | |
| int | line, | |||
| int | pos, | |||
| int | len, | |||
| int | format | |||
| ) |
Highlight the matched sequences.
Referenced by QDocumentSearch::next(), and QDocumentSearch::setOption().
| QDocumentConstIterator QDocument::begin | ( | ) | const |
| void QDocument::beginMacro | ( | ) |
Begin a macro.
Macro in QDocument map directly to macro in the underlying undo stack
Referenced by QEditor::commentSelection(), QEditor::cut(), QEditor::indentSelection(), QEditor::insertFromMimeData(), QEditor::uncommentSelection(), QEditor::unindentSelection(), and QEditor::write().
| bool QDocument::canRedo | ( | ) | const |
| bool QDocument::canUndo | ( | ) | const |
| QDocumentCursor QDocument::cursor | ( | int | line, | |
| int | column = 0 | |||
| ) | const |
| line | target line number (text line) | |
| column | target text column |
| QDocumentCursor QDocument::cursorAt | ( | const QPoint & | p | ) | const |
References cursorForDocumentPosition().
Referenced by QEditor::cursorForPosition().
| void QDocument::cursorForDocumentPosition | ( | const QPoint & | p, | |
| int & | line, | |||
| int & | column | |||
| ) | const |
Convert a document (or viewport) (x, y) position to a (line, column) cursor position.
| p | document position | |
| line | where the line number will be stored | |
| column | where the column (text position within line) will be stored |
References line(), and lineNumber().
Referenced by cursorAt().
| QFormatScheme * QDocument::defaultFormatScheme | ( | ) | [static] |
| QDocument::LineEnding QDocument::defaultLineEnding | ( | ) | [static] |
| void QDocument::draw | ( | QPainter * | p, | |
| PaintContext & | cxt | |||
| ) | [virtual] |
Draw the contents of the document.
| p | painter to use | |
| cxt | paint context (specifies what part of the document to draw, among other things) |
Referenced by print().
| QDocumentCursor * QDocument::editCursor | ( | ) | const |
Set the edit cursor.
Archaic concept designed for use in QEditor (is it still used???)
| QDocumentConstIterator QDocument::end | ( | ) | const |
| QDocumentLine QDocument::findLine | ( | int & | position | ) | const |
| int QDocument::findNextMark | ( | int | id, | |
| int | from = 0, |
|||
| int | until = -1 | |||
| ) | const |
Find the next mark of a given type.
| id | mark identifier to find | |
| from | line from which to start search | |
| until | line until which to search |
If until is inferior to from and no matching mark is found in the [from, end] range then the [0, until] range will also be searched.
| int QDocument::findPreviousMark | ( | int | id, | |
| int | from = -1, |
|||
| int | until = 0 | |||
| ) | const |
Find the previous mark of a given type.
| id | mark identifier to find | |
| from | line from which to start search | |
| until | line until which to search |
If until is superior to from and no matching mark is found in the [0, from] range then the [until, end] range will also be searched (both range being searched backward, of course).
| void QDocument::flushMatches | ( | int | gid | ) |
\
Referenced by QDocumentSearch::setOption().
| QFont QDocument::font | ( | ) | [static] |
Referenced by QEditConfig::cancel(), and QEditor::zoom().
| const QFontMetrics & QDocument::fontMetrics | ( | ) | [static] |
Referenced by QEditor::ensureCursorVisible(), QEditor::ensureVisible(), QEditor::isCursorVisible(), QEditor::pageDown(), and QEditor::pageUp().
| QFormatScheme * QDocument::formatFactory | ( | ) | [static] |
| QFormatScheme * QDocument::formatScheme | ( | ) | const |
Referenced by QDocumentSearch::next(), and QDocumentSearch::setOption().
| bool QDocument::hasLineEverBeenModified | ( | const QDocumentLine & | l | ) | const |
| int QDocument::height | ( | ) | const |
Referenced by QEditor::load(), and QEditor::setText().
| bool QDocument::isClean | ( | ) | const |
Referenced by QEditor::isContentModified().
| bool QDocument::isLineModified | ( | const QDocumentLine & | l | ) | const |
References QDocumentLine::handle().
| QDocumentConstIterator QDocument::iterator | ( | const QDocumentLine & | l | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References begin(), end(), and QDocumentLine::handle().
| QDocumentConstIterator QDocument::iterator | ( | int | ln | ) | const |
| QLanguageDefinition * QDocument::languageDefinition | ( | ) | const |
| QDocumentLine QDocument::line | ( | QDocumentConstIterator | iterator | ) | const |
| QDocumentLine QDocument::line | ( | int | line | ) | const |
| line | Text line to acces |
Referenced by QLineMarksInfoCenter::addLineMark(), cursorForDocumentPosition(), lineAt(), lineRect(), QDocumentInsertCommand::QDocumentInsertCommand(), QLineMarksInfoCenter::removeLineMark(), QEditor::text(), text(), QLineMarksInfoCenter::toggleLineMark(), and QDocumentCommand::updateTarget().
| QDocumentLine QDocument::lineAt | ( | const QPoint & | p | ) | const |
References line(), and lineNumber().
Referenced by QEditor::lineAtPosition().
| QDocument::LineEnding QDocument::lineEnding | ( | ) | const |
It can either be conservative (auto detect upon loading and do not modify when saving later on) or enforce a particular line ending (either local line ending or a specific value).
Referenced by setText(), and stopChunkLoading().
| int QDocument::lineNumber | ( | int | ypos, | |
| int * | wrap = 0 | |||
| ) | const |
| ypos | Y document coordinate of the target | |
| wrap | if not null, will be set to the wrap offset (position of the visual line among the sublines of the wrapped text line). |
Referenced by cursorForDocumentPosition(), and lineAt().
| QRect QDocument::lineRect | ( | const QDocumentLine & | l | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Significantly slower than the line number based version.
| QRect QDocument::lineRect | ( | int | line | ) | const |
| line | textual line number |
References line(), width(), and y().
Referenced by QEditor::lineRect(), and QEditor::selectionRect().
| int QDocument::lines | ( | ) | const |
Referenced by QLineNumberPanel::editorChange(), highlight(), print(), and QDocumentCommand::updateTarget().
| int QDocument::maxMarksPerLine | ( | ) | const |
| QDocument::LineEnding QDocument::originalLineEnding | ( | ) | const |
Referenced by QEditor::load().
| void QDocument::print | ( | QPrinter * | pr | ) | [slot] |
Print the content of the document.
| pr | printer to use |
References draw(), lines(), and width().
Referenced by QEditor::print().
| void QDocument::setClean | ( | ) | [slot] |
Set the document to clean state.
This method does not go back to clean state but tell the stack that the current state is to be considered as the clean state.
References iterator().
Referenced by QEditor::save().
| void QDocument::setDefaultFormatScheme | ( | QFormatScheme * | f | ) | [static] |
Set the default format scheme.
Referenced by setFormatFactory().
| void QDocument::setDefaultLineEnding | ( | QDocument::LineEnding | le | ) | [static] |
Set the default line ending policy.
Referenced by QEditConfig::apply().
| void QDocument::setEditCursor | ( | QDocumentCursor * | c | ) |
| void QDocument::setFont | ( | const QFont & | f | ) | [static] |
Set the font of ALL documents.
Referenced by QEditConfig::apply(), QEditConfig::loadKeys(), QDocument(), and QEditor::zoom().
| void QDocument::setFormatFactory | ( | QFormatScheme * | f | ) | [static] |
| void QDocument::setTabStop | ( | int | n | ) | [static] |
Set the default tab stop common to all documents.
Referenced by QEditConfig::apply().
| void QDocument::setWidthConstraint | ( | int | width | ) | [slot] |
Set a new width constraint.
| width | maximum width to allow |
Referenced by QEditor::setDefaultFlags(), QEditor::setFlag(), and QEditor::setPanelMargins().
| QDocument::WhiteSpaceMode QDocument::showSpaces | ( | ) | [static] |
| void QDocument::startChunkLoading | ( | ) |
Start a chunk loading.
It is possible to load document contents in one piece or by chunks. To achieve the later you have to proceed as follows :
QDocument doc; doc.startChunkLoading(); // fetch data and add it using doc.addChunk(); doc.stopChunkLoading();
References QDocumentLineHandle::deref(), and QDocumentLineHandle::m_doc.
Referenced by QEditor::load().
| void QDocument::stopChunkLoading | ( | ) |
Stop chunk loading.
References lineEnding(), and setLineEnding().
Referenced by QEditor::load().
| int QDocument::tabStop | ( | ) | [static] |
Referenced by QEditConfig::cancel(), and QEditor::insertText().
| QString QDocument::text | ( | bool | removeTrailing = false, |
|
| bool | preserveIndent = true | |||
| ) | const |
| removeTrailing | whether to remove trailing whitespaces | |
| preserveIndent | whether to keep trailing whitespaces when they are indent |
References text().
| QString QDocument::text | ( | int | mode | ) | const |
| mode | extra processing to perform on text |
References line(), and QDocumentLineHandle::text().
Referenced by QEditor::save(), QEditor::text(), and text().
| int QDocument::textLineNumber | ( | int | visualLineNumber | ) | const |
Convert a visual line number int a text (logical) line number.
| int QDocument::visualLineNumber | ( | int | textLineNumber | ) | const |
Convert a text (logical) line number int a visual line number.
| int QDocument::visualLines | ( | ) | const |
| int QDocument::width | ( | ) | const |
Referenced by lineRect(), QEditor::load(), print(), and QEditor::setText().
| int QDocument::widthConstraint | ( | ) | const |
| int QDocument::y | ( | const QDocumentLine & | l | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| l | line object |
References QDocumentLine::lineNumber(), and y().
| int QDocument::y | ( | int | ln | ) | const |
| ln | textual line number |
Referenced by QEditor::ensureVisible(), lineRect(), QEditor::selectionRect(), and y().
1.5.7.1