kdevplatform/interfaces
#include <idocument.h>
Public Types | |
enum | DocumentSaveMode { Default = 0x0, Silent = 0x1, Discard = 0x2 } |
enum | DocumentState { Clean, Modified, Dirty, DirtyAndModified } |
Public Member Functions | |
virtual | ~IDocument () |
virtual void | activate (Sublime::View *activeView, KParts::MainWindow *mainWindow)=0 |
virtual KTextEditor::View * | activeTextView () const |
virtual bool | close (DocumentSaveMode mode=Default)=0 |
virtual KTextEditor::Cursor | cursorPosition () const =0 |
virtual bool | isActive () const =0 |
virtual bool | isTextDocument () const |
virtual QMimeType | mimeType () const =0 |
virtual KParts::Part * | partForView (QWidget *view) const =0 |
virtual QString | prettyName () const |
virtual void | reload ()=0 |
virtual bool | save (DocumentSaveMode mode=Default)=0 |
virtual void | setCursorPosition (const KTextEditor::Cursor &cursor)=0 |
virtual void | setPrettyName (const QString &name) |
virtual void | setTextSelection (const KTextEditor::Range &range)=0 |
virtual DocumentState | state () const =0 |
virtual QString | text (const KTextEditor::Range &range) const |
virtual KTextEditor::Document * | textDocument () const =0 |
virtual QString | textLine () const |
virtual KTextEditor::Range | textSelection () const |
virtual QString | textWord () const |
virtual QUrl | url () const =0 |
Protected Member Functions | |
IDocument (ICore *) | |
ICore * | core () |
void | notifyActivated () |
void | notifyContentChanged () |
void | notifyLoaded () |
void | notifySaved () |
void | notifyStateChanged () |
void | notifyTextDocumentCreated () |
void | notifyUrlChanged () |
Detailed Description
A single document being edited by the IDE.
The base class for tracking a document. It contains the URL, the part, and any associated metadata for the document.
The advantages are:
- an easier key for use in maps and the like
- a value which does not change when the filename changes
- clearer distinction in the code between an open document and a url (which may or may not be open)
Definition at line 57 of file idocument.h.
Member Enumeration Documentation
◆ DocumentSaveMode
Definition at line 70 of file idocument.h.
◆ DocumentState
Document state.
Definition at line 62 of file idocument.h.
Constructor & Destructor Documentation
◆ ~IDocument()
|
virtual |
Definition at line 73 of file idocument.cpp.
◆ IDocument()
|
explicitprotected |
Definition at line 68 of file idocument.cpp.
Member Function Documentation
◆ activate()
|
pure virtual |
Performs document activation actions if any.
This needs to call notifyActivated()
◆ activeTextView()
|
virtual |
- Returns
- the active text view in case it's a text document and it has one.
Definition at line 157 of file idocument.cpp.
◆ close()
|
pure virtual |
Requests that the document be closed.
- Returns
- whether the document was successfully closed.
◆ core()
|
protected |
Definition at line 80 of file idocument.cpp.
◆ cursorPosition()
|
pure virtual |
Access the current text cursor position, if possible.
- Returns
- the current text cursor position, or an invalid cursor otherwise.
◆ isActive()
|
pure virtual |
Enquires whether this document is currently active in the currently active mainwindow.
◆ isTextDocument()
|
virtual |
Returns whether this document is a text document.
Definition at line 107 of file idocument.cpp.
◆ mimeType()
|
pure virtual |
Returns the mimetype of the document.
◆ notifyActivated()
|
protected |
Definition at line 97 of file idocument.cpp.
◆ notifyContentChanged()
|
protected |
Definition at line 102 of file idocument.cpp.
◆ notifyLoaded()
|
protected |
Definition at line 151 of file idocument.cpp.
◆ notifySaved()
|
protected |
Definition at line 87 of file idocument.cpp.
◆ notifyStateChanged()
|
protected |
Definition at line 92 of file idocument.cpp.
◆ notifyTextDocumentCreated()
|
protected |
Definition at line 112 of file idocument.cpp.
◆ notifyUrlChanged()
|
protected |
Definition at line 146 of file idocument.cpp.
◆ partForView()
|
pure virtual |
Returns the part for given view
if this document is a KPart document or 0 otherwise.
◆ prettyName()
|
virtual |
returns the pretty name of this document that was set through setPrettyName(...).
If no pretty name was set, an empty string is returned.
Definition at line 132 of file idocument.cpp.
◆ reload()
|
pure virtual |
Reloads the document.
◆ save()
|
pure virtual |
Saves the document.
- Returns
- true if the document was saved, false otherwise
◆ setCursorPosition()
|
pure virtual |
Set the current text cursor position, if possible.
- Parameters
-
cursor new cursor position.
◆ setPrettyName()
|
virtual |
Set a 'pretty' name for this document.
That name will be used when displaying the document in the UI, instead of the filename and/or path.
- Parameters
-
name The pretty name to use. Give an empty name to reset.
Definition at line 139 of file idocument.cpp.
◆ setTextSelection()
|
pure virtual |
Set the current text selection, if possible.
- Parameters
-
range new cursor position.
◆ state()
|
pure virtual |
Checks the state of this document.
- Returns
- The document state.
◆ text()
|
virtual |
- Returns
- the text in a given range
Definition at line 162 of file idocument.cpp.
◆ textDocument()
|
pure virtual |
Returns the text editor, if this is a text document or 0 otherwise.
◆ textLine()
|
virtual |
Retrieve the current text line, if one exists.
- Returns
- the current text line
Definition at line 122 of file idocument.cpp.
◆ textSelection()
|
virtual |
Retrieve the current text selection, if one exists.
- Returns
- the current text selection
Definition at line 117 of file idocument.cpp.
◆ textWord()
|
virtual |
Retrieve the current text word, if one exists.
- Returns
- the current text word
Definition at line 127 of file idocument.cpp.
◆ url()
|
pure virtual |
Returns the URL of this document.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 20 2021 23:38:10 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.