KTextEditor
katedocument.h
92 explicit DocumentPrivate(bool bSingleViewMode = false, bool bReadOnly = false, QWidget *parentWidget = nullptr, QObject * = nullptr);
135 KTextEditor::View *createView(QWidget *parent, KTextEditor::MainWindow *mainWindow = nullptr) override;
159 bool insertText(const KTextEditor::Cursor &position, const QString &s, bool block = false) override;
160 bool insertText(const KTextEditor::Cursor &position, const QStringList &text, bool block = false) override;
168 bool replaceText(const KTextEditor::Range &range, const QString &s, bool block = false) override;
195 void charactersSemiInteractivelyInserted(const KTextEditor::Cursor &position, const QString &text);
215 void textRemoved(KTextEditor::Document *document, const KTextEditor::Range &range, const QString &oldText);
364 *Returns the next or previous position cursor in this document from the stack depending on the argument passed.
367 KTextEditor::Cursor lastEditingPosition(EditingPositionKind nextOrPrevious, KTextEditor::Cursor);
413 QVector<KTextEditor::Range> searchText(KTextEditor::Range range, const QString &pattern, const KTextEditor::SearchOptions options) const;
524 void readSessionConfig(const KConfigGroup &config, const QSet<QString> &flags = QSet<QString>()) override;
534 void writeSessionConfig(KConfigGroup &config, const QSet<QString> &flags = QSet<QString>()) override;
571 void markToolTipRequested(KTextEditor::Document *document, KTextEditor::Mark mark, QPoint position, bool &handled);
573 void markContextMenuRequested(KTextEditor::Document *document, KTextEditor::Mark mark, QPoint pos, bool &handled);
578 void markChanged(KTextEditor::Document *, KTextEditor::Mark, KTextEditor::MarkInterface::MarkChangeAction) override;
657 KTextEditor::MovingCursor::InsertBehavior insertBehavior = KTextEditor::MovingCursor::MoveOnInsert) override;
667 KTextEditor::MovingRange::InsertBehaviors insertBehaviors = KTextEditor::MovingRange::DoNotExpand,
668 KTextEditor::MovingRange::EmptyBehavior emptyBehavior = KTextEditor::MovingRange::AllowEmpty) override;
716 transformCursor(int &line, int &column, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision = -1) override;
737 * This signal is emitted before the cursors/ranges/revisions of a document are destroyed as the document is deleted.
738 * @param document the document which the interface belongs too which is in the process of being deleted
743 * This signal is emitted before the ranges of a document are invalidated and the revisions are deleted as the document is cleared (for example on
744 * load/reload). While this signal is emitted, still the old document content is around before the clear.
860 void newLine(KTextEditor::ViewPrivate *view, NewLineIndent indent = NewLineIndent::Indent, NewLinePos newLinePos = Normal); // Changes input
879 void commentSelection(KTextEditor::Range selection, KTextEditor::Cursor c, bool blockSelect, CommentType changeType);
908 void transformCursorOrRange(KTextEditor::ViewPrivate *view, const KTextEditor::Cursor, KTextEditor::Range selection, TextTransform);
972 bool removeStartStopCommentFromRegion(const KTextEditor::Cursor start, const KTextEditor::Cursor end, int attrib = 0);
1057 void modifiedOnDisk(KTextEditor::Document *doc, bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason) override;
virtual bool setText(const QString &text)=0
Set the given text as new document content.
qint64 lastSavedRevision() const override
Last revision the buffer got successful saved.
virtual void setMarkIcon(MarkTypes markType, const QIcon &icon)=0
Set the mark's icon to icon.
QIcon markIcon(MarkInterface::MarkTypes markType) const override
Get the mark's icon.
QVector< KTextEditor::Range > searchText(const KTextEditor::Range &range, const QString &pattern, const SearchOptions options=Default) const
Searches the given input range for a text pattern.
QPixmap markPixmap(MarkInterface::MarkTypes) const override
Get the mark's pixmap.
QAction * undo(const QObject *recvr, const char *slot, QObject *parent)
virtual QStringList embeddedHighlightingModes() const =0
Get all available highlighting modes for the current document.
virtual void marksChanged(KTextEditor::Document *document)=0
The document emits this signal whenever a mark mask changed.
void typeChars(KTextEditor::ViewPrivate *view, QString chars)
Type chars in a view.
bool updateFileType(const QString &newType, bool user=false)
void saveEditingPositions(const KTextEditor::Cursor cursor)
Saves the editing positions into the stack.
QString decodeCharacters(KTextEditor::Range range, KTextEditor::DocumentPrivate::OffsetList &decToEncOffsetList, KTextEditor::DocumentPrivate::OffsetList &encToDecOffsetList)
The first OffsetList is from decoded to encoded, and the second OffsetList from encoded to decoded.
virtual bool postMessage(Message *message)=0
Post message to the Document and its Views.
bool editStart()
Enclose editor actions with editStart() and editEnd() to group them.
virtual QString highlightingModeAt(const Cursor &position)=0
Get the highlight mode used at a given position in the document.
QString modeSection(int index) const override
Returns the name of the section for a mode given its index in the highlight list (as returned by mode...
virtual QString wordAt(const KTextEditor::Cursor &cursor) const =0
Get the word at the text position cursor.
virtual bool insertLines(int line, const QStringList &text)=0
Insert line(s) at the given line number.
bool wrapParagraph(int first, int last)
Wrap lines touched by the selection with respect of existing paragraphs.
void editLineUnWrapped(int line, int col)
Emitted each time text from nextLine was upwrapped onto line.
virtual QStringList textLines(const Range &range, bool block=false) const =0
Get the document content within the given range.
virtual bool documentSaveAs()=0
Save the current file to another location.
void setDontChangeHlOnSave()
allow to mark, that we changed hl on user wish and should not reset it atm used for the user visible ...
Q_SLOTSQ_SLOTS
bool setHighlightingMode(const QString &name) override
Set the current mode of the document by giving its name.
Mark extension interface for the Document, version 2.
Definition: markinterface.h:425
QWidget * widget() override
void rangeEmpty(KTextEditor::MovingRange *movingRange) override
The range is now empty (ie.
An model for providing line annotation information.
Definition: annotationinterface.h:41
QAction * redo(const QObject *recvr, const char *slot, QObject *parent)
void setModifiedOnDiskWarning(bool on) override
Control, whether the editor should show a warning dialog whenever a file was modified on disk.
QUrl url() const
DefaultStyle
The following lists all valid default styles that are used for the syntax highlighting files in the i...
Definition: attribute.h:28
void rangeInvalid(KTextEditor::MovingRange *movingRange) override
The range is now invalid (ie.
virtual bool isDataRecoveryAvailable() const =0
Returns whether a recovery is available for the current document.
void markToolTipRequested(KTextEditor::Document *document, KTextEditor::Mark mark, QPoint position, bool &handled)
The document emits this signal whenever the mark is hovered using the mouse, and the receiver may sho...
QStringList highlightingModes() const override
Return a list of the names of all possible modes.
Q_SCRIPTABLE Q_NOREPLY void start()
virtual void setAnnotationModel(AnnotationModel *model)=0
Sets a new AnnotationModel for this document to provide annotation information for each line.
bool handleMarkContextMenu(int line, QPoint position)
Returns true if the context-menu event should not further be processed.
void transformRange(KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors, KTextEditor::MovingRange::EmptyBehavior emptyBehavior, qint64 fromRevision, qint64 toRevision=-1) override
Transform a range from one revision to an other.
KTextEditor::MovingRange * newMovingRange(const KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors=KTextEditor::MovingRange::DoNotExpand, KTextEditor::MovingRange::EmptyBehavior emptyBehavior=KTextEditor::MovingRange::AllowEmpty) override
Create a new moving range for this document.
InsertBehavior
Insert behavior of this cursor, should it stay if text is insert at its position or should it move.
Definition: movingcursor.h:64
void setModifiedOnDisk(ModifiedOnDiskReason reason) override
Set the document's modified-on-disk state to reason.
An object representing lines from a start line to an end line.
Definition: linerange.h:37
void clearEditingPosStack()
Removes all the elements in m_editingStack of the respective document.
An object representing a section of text, from one Cursor to another.
Definition: include/ktexteditor/range.h:44
virtual void setEditableMarks(uint markMask)=0
Set the mark mask the user is allowed to toggle to markMask.
bool editRemoveText(int line, int col, int len)
Remove a string in the given line/column.
virtual bool isLineTouched(int line) const =0
Check whether line was touched since the file was opened.
virtual bool insertText(const Cursor &position, const QString &text, bool block=false)=0
Insert text at position.
bool editWrapLine(int line, int col, bool newLine=true, bool *newLineAdded=nullptr)
Wrap line.
virtual void setVariable(const QString &name, const QString &value)
Set the variable name to value.
bool documentReload() override
Reloads the current document from disk if possible.
Document interface for MovingCursors and MovingRanges.
Definition: movinginterface.h:34
QString highlightingMode() const override
Return the name of the currently used mode.
virtual bool isLineSaved(int line) const =0
Check whether line currently contains only saved text.
bool handleMarkClick(int line)
Returns true if the click on the mark should not be further processed.
virtual View * createView(QWidget *parent, KTextEditor::MainWindow *mainWindow=nullptr)=0
Create a new view attached to parent.
bool isModified() const
void writeSessionConfig(KConfigGroup &config, const QSet< QString > &flags=QSet< QString >()) override
Write session settings to the config.
virtual void addMark(int line, uint markType)=0
Add marks of type markType to line.
QAction * paste(const QObject *recvr, const char *slot, QObject *parent)
virtual Cursor documentEnd() const =0
End position of the document.
bool editMarkLineAutoWrapped(int line, bool autowrapped)
Mark line as autowrapped.
void aboutToDeleteMovingInterfaceContent(KTextEditor::Document *document)
This signal is emitted before the cursors/ranges/revisions of a document are destroyed as the documen...
void setModified()
int findTouchedLine(int startLine, bool down)
Find the next modified/saved line, starting at startLine.
virtual int totalCharacters() const =0
Get the count of characters in the document.
This dialog will prompt the user for what do with a file that is modified on disk.
Definition: katedialogs.h:348
virtual void setMarkDescription(MarkTypes mark, const QString &text)=0
Set the mark's description to text.
virtual bool queryClose()
Comment
void transformCursor(KTextEditor::Cursor &cursor, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision=-1) override
Transform a cursor from one revision to an other.
virtual bool saveAs(const QUrl &url)
virtual QString variable(const QString &name) const
Returns the value for the variable name.
virtual void setMarkPixmap(MarkTypes mark, const QPixmap &pixmap)=0
Set the mark's pixmap to pixmap.
void textInsertedRange(KTextEditor::Document *document, const KTextEditor::Range &range)
The document emits this signal whenever text was inserted.
virtual int lineLength(int line) const =0
Get the length of a given line in characters.
void markContextMenuRequested(KTextEditor::Document *document, KTextEditor::Mark mark, QPoint pos, bool &handled)
The document emits this signal whenever the mark is right-clicked to show a context menu.
@ DoNotExpand
Don't expand to encapsulate new characters in either direction. This is the default.
Definition: movingrange.h:154
virtual bool isLineModified(int line) const =0
Check whether line currently contains unsaved data.
virtual void recoverData()=0
If recover data is available, calling recoverData() will trigger the recovery of the data.
void rememberUserDidSetIndentationMode()
set indentation mode by user this will remember that a user did set it and will avoid reset on save
Definition: katedocument.h:1162
const QHash< int, KTextEditor::Mark * > & marks() override
Get a hash holding all marks in the document.
virtual bool insertLine(int line, const QString &text)=0
Insert line(s) at the given line number.
virtual void setReadWrite(bool readwrite=true)
bool editInsertLine(int line, const QString &s)
Insert a string at the given line.
KTextEditor::DefaultStyle defaultStyleAt(const KTextEditor::Cursor &position) const override
Get the default style of the character located at position.
void markClicked(KTextEditor::Document *document, KTextEditor::Mark mark, bool &handled)
The document emits this signal whenever the mark is left-clicked.
ModifiedOnDiskReason
Reasons why a document is modified on disk.
Definition: modificationinterface.h:75
bool closeUrl() override
bool saveFile() override
save the file obtained by the kparts framework the framework abstracts the uploading of remote files
bool editUnWrapLine(int line, bool removeLine=true, int length=0)
Unwrap line.
void userSetEncodingForNextReload()
User did set encoding for next reload => enforce it!
Definition: katedocument.h:1170
virtual bool removeText(const Range &range, bool block=false)=0
Remove the text specified in range.
QByteArray checksum() const override
Returns a git compatible sha1 checksum of this document on disk.
virtual bool openUrl(const QUrl &url)
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Definition: katetextblock.h:22
QStringList modes() const override
Return a list of the names of all possible modes.
void setMetaData(const KPluginMetaData &metaData)
Q_SIGNALSQ_SIGNALS
A Document extension interface for handling Annotations.
Definition: annotationinterface.h:148
void aboutToInvalidateMovingInterfaceContent(KTextEditor::Document *document)
This signal is emitted before the ranges of a document are invalidated and the revisions are deleted ...
uint editableMarks() const override
Get, which marks can be toggled by the user.
QString markDescription(MarkInterface::MarkTypes) const override
Get the mark's description to text.
Inserts a template and offers advanced snippet features, like navigation and mirroring.
Definition: katetemplatehandler.h:54
KGuiItem del()
KTextEditor::Cursor lastEditingPosition(EditingPositionKind nextOrPrevious, KTextEditor::Cursor)
Returns the next or previous position cursor in this document from the stack depending on the argumen...
External modification extension interface for the Document.
Definition: modificationinterface.h:61
void setConfigValue(const QString &key, const QVariant &value) override
Set a the key's value to value.
virtual bool replaceText(const Range &range, const QString &text, bool block=false)
Replace text from range with specified text.
Definition: document.cpp:90
Q_INTERFACES(...)
A class which provides notifications of state changes to a MovingRange.
Definition: movingrangefeedback.h:35
virtual void clearMark(int line)=0
Clear all marks set in the line.
KPluginMetaData metaData() const
void textRemoved(KTextEditor::Document *document, const KTextEditor::Range &range, const QString &oldText)
The document emits this signal whenever range was removed, i.e.
void readSessionConfig(const KConfigGroup &config, const QSet< QString > &flags=QSet< QString >()) override
Read session settings from the given config.
virtual void setMark(int line, uint markType)=0
Set the line's mark types to markType.
Kate::TextLine kateTextLine(int i)
Same as plainKateTextLine(), except that it is made sure the line is highlighted.
QString highlightingModeSection(int index) const override
Returns the name of the section for a highlight given its index in the highlight list (as returned by...
bool editInsertText(int line, int col, const QString &s)
Add a string in the given line/column.
A range that is bound to a specific Document, and maintains its position.
Definition: movingrange.h:144
KTextEditor::MovingCursor * newMovingCursor(const KTextEditor::Cursor &position, KTextEditor::MovingCursor::InsertBehavior insertBehavior=KTextEditor::MovingCursor::MoveOnInsert) override
Create a new moving cursor for this document.
virtual void slotModifiedOnDisk(KTextEditor::View *v=nullptr)
Ask the user what to do, if the file has been modified on disk.
virtual void removeMark(int line, uint markType)=0
Remove the mark mask of type markType from line.
virtual bool isEditingTransactionRunning() const =0
Check whether an editing transaction is currently running.
virtual bool setEncoding(const QString &encoding)=0
Set the encoding for this document.
virtual QChar characterAt(const Cursor &position) const =0
Get the character at text position cursor.
bool openFile() override
open the file obtained by the kparts framework the framework abstracts the loading of remote files
virtual void discardDataRecovery()=0
If recover data is available, calling discardDataRecovery() will discard the recover data and the rec...
QString mimeType() override
Tries to detect mime-type based on file name and content of buffer.
virtual bool isValidTextPosition(const KTextEditor::Cursor &cursor) const =0
Get whether cursor is a valid text position.
virtual QList< View * > views() const =0
Returns the views pre-casted to KTextEditor::Views.
virtual void clearMarks()=0
Clear all marks in the entire document.
void transform(KTextEditor::ViewPrivate *view, KTextEditor::Cursor, TextTransform)
Handling uppercase, lowercase and capitalize for the view.
void modifiedOnDisk(KTextEditor::Document *doc, bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason) override
Indicate this file is modified on disk.
bool setMode(const QString &name) override
Set the current mode of the document by giving its name.
virtual void markChanged(KTextEditor::Document *document, KTextEditor::Mark mark, KTextEditor::MarkInterface::MarkChangeAction action)=0
The document emits this signal whenever the mark changes.
virtual bool save()
constexpr static Range invalid() Q_DECL_NOEXCEPT
Returns an invalid range.
Definition: include/ktexteditor/range.h:115
int lineLengthLimit() const
reads the line length limit from config, if it is not overridden
QObject * parent() const const
A Cursor which is bound to a specific Document, and maintains its position.
Definition: movingcursor.h:54
QString message
virtual KTextEditor::Range wordRangeAt(const KTextEditor::Cursor &cursor) const =0
Get the text range for the word located under the text position cursor.
void editLineWrapped(int line, int col, int len)
Emitted when text from line was wrapped at position pos onto line nextLine.
Config interface extension for the Document and View.
Definition: configinterface.h:105
Definition: mainwindow.h:43
void lockRevision(qint64 revision) override
Lock a revision, this will keep it around until released again.
virtual AnnotationModel * annotationModel() const =0
returns the currently set AnnotationModel or 0 if there's none set
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 9 2023 03:50:14 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 9 2023 03:50:14 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.