KTextEditor
katedocument.h
67class KTEXTEDITOR_EXPORT KTextEditor::DocumentPrivate final : public KTextEditor::Document, private KTextEditor::MovingRangeFeedback
81 explicit DocumentPrivate(bool bSingleViewMode = false, bool bReadOnly = false, QWidget *parentWidget = nullptr, QObject * = nullptr)
125 KTextEditor::View *createView(QWidget *parent, KTextEditor::MainWindow *mainWindow = nullptr) override;
149 bool insertText(KTextEditor::Cursor position, const QStringList &text, bool block = false) override;
206 void textRemoved(KTextEditor::Document *document, KTextEditor::Range range, const QString &oldText);
269 bool editWrapLine(int line, int col, bool newLine = true, bool *newLineAdded = nullptr, bool notify = true);
341 *Returns the next or previous position cursor in this document from the stack depending on the argument passed.
344 KTextEditor::Cursor lastEditingPosition(EditingPositionKind nextOrPrevious, KTextEditor::Cursor);
387 QList<KTextEditor::Range> searchText(KTextEditor::Range range, const QString &pattern, const KTextEditor::SearchOptions options) const;
412 KSyntaxHighlighting::Theme::TextStyle defaultStyleAt(KTextEditor::Cursor position) const override;
498 void readSessionConfig(const KConfigGroup &config, const QSet<QString> &flags = QSet<QString>()) override;
508 void writeSessionConfig(KConfigGroup &config, const QSet<QString> &flags = QSet<QString>()) override;
612 KTextEditor::MovingCursor::InsertBehavior insertBehavior = KTextEditor::MovingCursor::MoveOnInsert) override;
622 KTextEditor::MovingRange::InsertBehaviors insertBehaviors = KTextEditor::MovingRange::DoNotExpand,
623 KTextEditor::MovingRange::EmptyBehavior emptyBehavior = KTextEditor::MovingRange::AllowEmpty) override;
671 transformCursor(int &line, int &column, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision = -1) override;
805 void newLine(KTextEditor::ViewPrivate *view, NewLineIndent indent = NewLineIndent::Indent, NewLinePos newLinePos = Normal); // Changes input
824 void commentSelection(KTextEditor::Range selection, KTextEditor::Cursor c, bool blockSelect, CommentType changeType);
857 void transformCursorOrRange(KTextEditor::ViewPrivate *view, const KTextEditor::Cursor, KTextEditor::Range selection, TextTransform);
921 bool removeStartStopCommentFromRegion(const KTextEditor::Cursor start, const KTextEditor::Cursor end, int attrib = 0);
virtual bool openUrl(const QUrl &url)
virtual void setReadWrite(bool readwrite=true)
virtual bool queryClose()
virtual bool saveAs(const QUrl &url)
virtual bool save()
bool closeUrl() override
void setModified()
An model for providing line annotation information.
Definition annotationinterface.h:42
Backend of KTextEditor::Document related public KTextEditor interfaces.
Definition katedocument.h:68
bool setEncoding(const QString &e) override
Set the encoding for this document.
Definition katedocument.cpp:5041
bool saveFile() override
save the file obtained by the kparts framework the framework abstracts the uploading of remote files
Definition katedocument.cpp:2444
void userSetEncodingForNextReload()
User did set encoding for next reload => enforce it!
Definition katedocument.h:1116
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.
Definition katedocument.cpp:5898
void lockRevision(qint64 revision) override
Lock a revision, this will keep it around until released again.
Definition katedocument.cpp:5868
void recoverData() override
If recover data is available, calling recoverData() will trigger the recovery of the data.
Definition katedocument.cpp:2892
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...
Definition katedocument.cpp:1862
bool handleMarkContextMenu(int line, QPoint position)
Returns true if the context-menu event should not further be processed.
Definition katedocument.cpp:2144
void readSessionConfig(const KConfigGroup &config, const QSet< QString > &flags=QSet< QString >()) override
Read session settings from the given config.
Definition katedocument.cpp:1895
QStringList highlightingModes() const override
Return a list of the names of all possible modes.
Definition katedocument.cpp:1851
bool documentReload() override
Reloads the current document from disk if possible.
Definition katedocument.cpp:4850
void setModifiedOnDisk(ModifiedOnDiskReason reason) override
Set the document's modified-on-disk state to reason.
Definition katedocument.cpp:4831
KTextEditor::Cursor documentEnd() const override
End position of the document.
Definition katedocument.cpp:5797
QStringList configKeys() const override
Get a list of all available keys.
Definition katedocument.cpp:5777
bool postMessage(KTextEditor::Message *message) override
Post message to the Document and its Views.
Definition katedocument.cpp:6514
int lineLengthLimit() const
reads the line length limit from config, if it is not overridden
Definition katedocument.cpp:2304
virtual void slotModifiedOnDisk(KTextEditor::View *v=nullptr)
Ask the user what to do, if the file has been modified on disk.
Definition katedocument.cpp:4697
KTextEditor::MovingRange * newMovingRange(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.
Definition katedocument.cpp:5851
virtual QString variable(const QString &name) const
Returns the value for the variable name.
Definition katedocument.cpp:5456
bool setHighlightingMode(const QString &name) override
Set the current mode of the document by giving its name.
Definition katedocument.cpp:1836
QStringList textLines(KTextEditor::Range range, bool block=false) const override
Get the document content within the given range.
Definition katedocument.cpp:541
void editLineUnWrapped(int line, int col)
Emitted each time text from nextLine was upwrapped onto line.
void clearEditingPosStack()
Removes all the elements in m_editingStack of the respective document.
Definition katedocument.cpp:373
void transform(KTextEditor::ViewPrivate *view, KTextEditor::Cursor, TextTransform)
Handling uppercase, lowercase and capitalize for the view.
Definition katedocument.cpp:4398
void rangeInvalid(KTextEditor::MovingRange *movingRange) override
The range is now invalid (ie.
Definition katedocument.cpp:6285
void discardDataRecovery() override
If recover data is available, calling discardDataRecovery() will discard the recover data and the rec...
Definition katedocument.cpp:2899
bool updateFileType(const QString &newType, bool user=false)
Definition katedocument.cpp:5691
bool isLineModified(int line) const override
Check whether line currently contains unsaved data.
Definition katedocument.cpp:936
bool setMode(const QString &name) override
Set the current mode of the document by giving its name.
Definition katedocument.cpp:1808
qsizetype totalCharacters() const override
Get the count of characters in the document.
Definition katedocument.cpp:907
QString highlightingMode() const override
Return the name of the currently used mode.
Definition katedocument.cpp:1846
KTextEditor::AnnotationModel * annotationModel() const override
returns the currently set AnnotationModel or 0 if there's none set
Definition katedocument.cpp:5917
QString markDescription(Document::MarkTypes) const override
Get the mark's description to text.
Definition katedocument.cpp:2191
QString mimeType() override
Tries to detect mime-type based on file name and content of buffer.
Definition katedocument.cpp:2230
KTextEditor::MovingCursor * newMovingCursor(KTextEditor::Cursor position, KTextEditor::MovingCursor::InsertBehavior insertBehavior=KTextEditor::MovingCursor::MoveOnInsert) override
Create a new moving cursor for this document.
Definition katedocument.cpp:5846
QChar characterAt(KTextEditor::Cursor position) const override
Get the character at text position cursor.
Definition katedocument.cpp:483
qsizetype cursorToOffset(KTextEditor::Cursor c) const override
Retrives the offset for the given cursor position NOTE: It will return -1 if the cursor was invalid o...
Definition katedocument.cpp:926
QStringList modes() const override
Return a list of the names of all possible modes.
Definition katedocument.cpp:1823
void setAnnotationModel(KTextEditor::AnnotationModel *model) override
Sets a new AnnotationModel for this document to provide annotation information for each line.
Definition katedocument.cpp:5910
bool editUnWrapLine(int line, bool removeLine=true, int length=0)
Unwrap line.
Definition katedocument.cpp:1451
bool editInsertText(int line, int col, const QString &s, bool notify=true)
Add a string in the given line/column.
Definition katedocument.cpp:1257
KTextEditor::Cursor offsetToCursor(qsizetype offset) const override
Retrives the cursor position for given offset NOTE: It will return an invalid cursor(-1,...
Definition katedocument.cpp:931
bool openFile() override
open the file obtained by the kparts framework the framework abstracts the loading of remote files
Definition katedocument.cpp:2310
bool isLineSaved(int line) const override
Check whether line currently contains only saved text.
Definition katedocument.cpp:946
void writeSessionConfig(KConfigGroup &config, const QSet< QString > &flags=QSet< QString >()) override
Write session settings to the config.
Definition katedocument.cpp:1949
void editLineWrapped(int line, int col, int len)
Emitted when text from line was wrapped at position pos onto line nextLine.
QByteArray checksum() const override
Returns a git compatible sha1 checksum of this document on disk.
Definition katedocument.cpp:5557
bool isLineTouched(int line) const override
Check whether line was touched since the file was opened.
Definition katedocument.cpp:956
void rangeEmpty(KTextEditor::MovingRange *movingRange) override
The range is now empty (ie.
Definition katedocument.cpp:6290
bool handleMarkClick(int line)
Returns true if the click on the mark should not be further processed.
Definition katedocument.cpp:2131
KTextEditor::View * createView(QWidget *parent, KTextEditor::MainWindow *mainWindow=nullptr) override
Create a new view attached to parent.
Definition katedocument.cpp:402
bool isDataRecoveryAvailable() const override
Returns whether a recovery is available for the current document.
Definition katedocument.cpp:2887
void bomSetByUser()
Set that the BOM marker is forced via the tool menu.
Definition katedocument.cpp:1888
void textRemoved(KTextEditor::Document *document, KTextEditor::Range range, const QString &oldText)
The document emits this signal whenever range was removed, i.e.
bool editStart()
Enclose editor actions with editStart() and editEnd() to group them.
Definition katedocument.cpp:971
KTextEditor::Cursor lastEditingPosition(EditingPositionKind nextOrPrevious, KTextEditor::Cursor)
Returns the next or previous position cursor in this document from the stack depending on the argumen...
Definition katedocument.cpp:356
void setConfigValue(const QString &key, const QVariant &value) override
Set a the key's value to value.
Definition katedocument.cpp:5789
KSyntaxHighlighting::Theme::TextStyle defStyleNum(int line, int column)
Definition katedocument.cpp:6459
void setModifiedOnDiskWarning(bool on) override
Control, whether the editor should show a warning dialog whenever a file was modified on disk.
Definition katedocument.cpp:4845
QIcon markIcon(Document::MarkTypes markType) const override
Get the mark's icon.
Definition katedocument.cpp:2212
KSyntaxHighlighting::Theme::TextStyle defaultStyleAt(KTextEditor::Cursor position) const override
Get the default style of the character located at position.
Definition katedocument.cpp:1813
bool editWrapLine(int line, int col, bool newLine=true, bool *newLineAdded=nullptr, bool notify=true)
Wrap line.
Definition katedocument.cpp:1379
void typeChars(KTextEditor::ViewPrivate *view, QString chars)
Type chars in a view.
Definition katedocument.cpp:3060
QString highlightingModeAt(KTextEditor::Cursor position) override
Get the highlight mode used at a given position in the document.
Definition katedocument.cpp:6445
QVariant configValue(const QString &key) override
Get a value for the key.
Definition katedocument.cpp:5783
bool editRemoveText(int line, int col, int len)
Remove a string in the given line/column.
Definition katedocument.cpp:1306
qint64 lastSavedRevision() const override
Last revision the buffer got successful saved.
Definition katedocument.cpp:5863
void setDontChangeHlOnSave()
allow to mark, that we changed hl on user wish and should not reset it atm used for the user visible ...
Definition katedocument.cpp:1883
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.
Definition katedocument.cpp:6350
void saveEditingPositions(const KTextEditor::Cursor cursor)
Saves the editing positions into the stack.
Definition katedocument.cpp:319
uint editableMarks() const override
Get, which marks can be toggled by the user.
Definition katedocument.cpp:2201
QString mode() const override
Return the name of the currently used mode.
Definition katedocument.cpp:1818
bool isValidTextPosition(KTextEditor::Cursor cursor) const override
Get whether cursor is a valid text position.
Definition katedocument.cpp:519
void removeAllTrailingSpaces()
This function doesn't check for config and is available for use all the time via an action.
Definition katedocument.cpp:5676
void transformCursor(KTextEditor::Cursor &cursor, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision=-1) override
Transform a cursor from one revision to an other.
Definition katedocument.cpp:5887
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...
Definition katedocument.cpp:1867
bool editMarkLineAutoWrapped(int line, bool autowrapped)
Mark line as autowrapped.
Definition katedocument.cpp:1353
bool editInsertLine(int line, const QString &s, bool notify=true)
Insert a string at the given line.
Definition katedocument.cpp:1517
QStringList embeddedHighlightingModes() const override
Get all available highlighting modes for the current document.
Definition katedocument.cpp:6440
void textInsertedRange(KTextEditor::Document *document, KTextEditor::Range range)
The document emits this signal whenever text was inserted.
bool isEditingTransactionRunning() const override
Check whether an editing transaction is currently running.
Definition katedocument.cpp:432
Kate::TextLine kateTextLine(int i)
Same as plainKateTextLine(), except that it is made sure the line is highlighted.
Definition katedocument.cpp:5817
virtual void setVariable(const QString &name, const QString &value)
Set the variable name to value.
Definition katedocument.cpp:5465
int findTouchedLine(int startLine, bool down)
Find the next modified/saved line, starting at startLine.
Definition katedocument.cpp:6491
QList< KTextEditor::View * > views() const override
Returns the views pre-casted to KTextEditor::Views.
Definition katedocument.h:127
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:1108
QString wordAt(KTextEditor::Cursor cursor) const override
Get the word at the text position cursor.
Definition katedocument.cpp:489
int lineLength(int line) const override
Get the length of a given line in characters.
Definition katedocument.cpp:921
KTextEditor::Range wordRangeAt(KTextEditor::Cursor cursor) const override
Get the text range for the word located under the text position cursor.
Definition katedocument.cpp:494
const QHash< int, KTextEditor::Mark * > & marks() override
Get a hash holding all marks in the document.
Definition katedocument.cpp:2115
void removeView(KTextEditor::View *)
removes the view from the list of views.
Definition katedocument.cpp:2983
bool wrapParagraph(int first, int last)
Wrap lines touched by the selection with respect of existing paragraphs.
Definition katedocument.cpp:1196
virtual bool documentSaveAs()=0
Save the current file to another location.
virtual bool insertLine(int line, const QString &text)=0
Insert line(s) at the given line number.
virtual bool setText(const QString &text)=0
Set the given text as new document content.
virtual void setMarkDescription(MarkTypes mark, const QString &text)=0
Set the mark's description to text.
virtual bool insertLines(int line, const QStringList &text)=0
Insert line(s) at the given line number.
virtual void setMarkIcon(MarkTypes markType, const QIcon &icon)=0
Set the mark's icon to icon.
virtual bool removeText(Range range, bool block=false)=0
Remove the text specified in range.
virtual void setEditableMarks(uint markMask)=0
Set the mark mask the user is allowed to toggle to markMask.
QList< KTextEditor::Range > searchText(KTextEditor::Range range, const QString &pattern, const SearchOptions options=Default) const
Searches the given input range for a text pattern.
Definition document.cpp:108
virtual void addMark(int line, uint markType)=0
Add marks of type markType to line.
virtual bool insertText(KTextEditor::Cursor position, const QString &text, bool block=false)=0
Insert text at position.
virtual bool replaceText(Range range, const QString &text, bool block=false)
Replace text from range with specified text.
Definition document.cpp:85
virtual void removeMark(int line, uint markType)=0
Remove the mark mask of type markType from line.
virtual void setMark(int line, uint markType)=0
Set the line's mark types to markType.
An object representing lines from a start line to an end line.
Definition linerange.h:41
This class allows the application that embeds the KTextEditor component to allow it to access parts o...
Definition mainwindow.h:47
A Cursor which is bound to a specific Document, and maintains its position.
Definition movingcursor.h:55
InsertBehavior
Insert behavior of this cursor, should it stay if text is insert at its position or should it move.
Definition movingcursor.h:64
A class which provides notifications of state changes to a MovingRange.
Definition movingrangefeedback.h:36
A range that is bound to a specific Document, and maintains its position.
Definition movingrange.h:133
@ DoNotExpand
Don't expand to encapsulate new characters in either direction. This is the default.
Definition movingrange.h:142
An object representing a section of text, from one Cursor to another.
Definition include/ktexteditor/range.h:49
static constexpr Range invalid() noexcept
Returns an invalid range.
Definition include/ktexteditor/range.h:121
This dialog will prompt the user for what do with a file that is modified on disk.
Definition katedialogs.h:328
Inserts a template and offers advanced snippet features, like navigation and mirroring.
Definition katetemplatehandler.h:54
Q_SCRIPTABLE Q_NOREPLY void start()
KIOCORE_EXPORT DeleteJob * del(const QList< QUrl > &src, JobFlags flags=DefaultFlags)
const QList< QKeySequence > & paste()
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Definition katetextblock.h:18
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:11:26 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.