KTextEditor

Search for usage in LXR

#include <katedocument.h>

Inheritance diagram for KTextEditor:

Public Types

enum class  caretStyles { Line , Block , Underline , Half }
 
enum  CommentType { UnComment = -1 , ToggleComment = 0 , Comment = 1 }
 
enum  EditingPositionKind { Previous , Next }
 
enum  NewLineIndent { Indent , NoIndent }
 
enum  NewLinePos { Normal , Above , Below }
 
typedef QList< QPair< int, int > > OffsetList
 
enum  SearchOption {
  Default = 0 , Regex = 1 << 1 , CaseInsensitive = 1 << 4 , Backwards = 1 << 5 ,
  EscapeSequences = 1 << 10 , WholeWords = 1 << 11 , MaxSearchOption = 1 << 31
}
 
typedef QFlags< SearchOptionSearchOptions
 
enum  TextTransform { Uppercase , Lowercase , Capitalize }
 

Signals

void aboutToRemoveText (KTextEditor::Range)
 
void annotationModelChanged (KTextEditor::AnnotationModel *, KTextEditor::AnnotationModel *)
 
void charactersSemiInteractivelyInserted (KTextEditor::Cursor position, const QString &text)
 
void defaultDictionaryChanged (KTextEditor::DocumentPrivate *document)
 
void dictionaryRangesPresent (bool yesNo)
 
void editLineUnWrapped (int line, int col)
 
void editLineWrapped (int line, int col, int len)
 
void loaded (KTextEditor::DocumentPrivate *document)
 
void textInsertedRange (KTextEditor::Document *document, KTextEditor::Range range)
 
void textRemoved (KTextEditor::Document *document, KTextEditor::Range range, const QString &oldText)
 
void undoChanged ()
 

Public Slots

void addMark (int line, uint markType) override
 
bool clear () override
 
void clearDictionaryRanges ()
 
void clearEditingPosStack ()
 
void clearMark (int line) override
 
void clearMarks () override
 
bool documentReload () override
 
bool documentSave () override
 
bool documentSaveAs () override
 
bool documentSaveAsWithEncoding (const QString &encoding)
 
void documentSaveCopyAs ()
 
bool handleMarkClick (int line)
 
bool handleMarkContextMenu (int line, QPoint position)
 
bool insertLine (int line, const QString &s) override
 
bool insertLines (int line, const QStringList &s) override
 
bool insertText (KTextEditor::Cursor position, const QString &s, bool block=false) override
 
bool insertText (KTextEditor::Cursor position, const QStringList &text, bool block=false) override
 
void messageDestroyed (KTextEditor::Message *message)
 
void onTheFlySpellCheckingEnabled (bool enable)
 
void openWithLineLengthLimitOverride ()
 
bool print () override
 
void printPreview () override
 
void redo ()
 
void refreshOnTheFlyCheck (KTextEditor::Range range=KTextEditor::Range::invalid())
 
bool removeLine (int line) override
 
void removeMark (int line, uint markType) override
 
bool removeText (KTextEditor::Range range, bool block=false) override
 
bool replaceText (KTextEditor::Range r, const QStringList &l, bool b) override
 
bool replaceText (KTextEditor::Range range, const QString &s, bool block=false) override
 
void requestMarkTooltip (int line, QPoint position)
 
bool save () override
 
void saveEditingPositions (const KTextEditor::Cursor cursor)
 
void setDefaultDictionary (const QString &dict)
 
void setDictionary (const QString &dict, KTextEditor::Range range)
 
void setDictionary (const QString &dict, KTextEditor::Range range, bool blockmode)
 
void setEditableMarks (uint markMask) override
 
void setMark (int line, uint markType) override
 
void setMarkDescription (Document::MarkTypes, const QString &) override
 
void setMarkIcon (Document::MarkTypes markType, const QIcon &icon) override
 
void setPageUpDownMovesCursor (bool on)
 
bool setText (const QString &) override
 
bool setText (const QStringList &text) override
 
void setWordWrap (bool on)
 
void setWordWrapAt (uint col)
 
virtual void slotModifiedOnDisk (KTextEditor::View *v=nullptr)
 
void slotQueryClose_save (bool *handled, bool *abortClosing)
 
void tagLine (int line)
 
void tagLines (KTextEditor::LineRange lineRange)
 
void undo ()
 

Public Member Functions

KTextEditor::ViewactiveView () const
 
void addView (KTextEditor::View *)
 
void align (KTextEditor::ViewPrivate *view, KTextEditor::Range range)
 
void alignOn (KTextEditor::Range range, const QString &pattern, bool blockwise)
 
KTextEditor::AnnotationModelannotationModel () const override
 
KToggleActionautoReloadToggleAction ()
 
void backspace (KTextEditor::ViewPrivate *view)
 
void bomSetByUser ()
 
KateBufferbuffer ()
 
void bufferHlChanged ()
 
QChar characterAt (KTextEditor::Cursor position) const override
 
QByteArray checksum () const override
 
void clearMisspellingForWord (const QString &word)
 
bool closeUrl () override
 
void comment (KTextEditor::ViewPrivate *view, uint line, uint column, CommentType change)
 
KateDocumentConfig * config ()
 
KateDocumentConfig * config () const
 
QStringList configKeys () const override
 
QVariant configValue (const QString &key) override
 
bool containsCharacterEncoding (KTextEditor::Range range)
 
KTextEditor::ViewcreateView (QWidget *parent, KTextEditor::MainWindow *mainWindow=nullptr) override
 
qsizetype cursorToOffset (KTextEditor::Cursor c) const override
 
QString decodeCharacters (KTextEditor::Range range, KTextEditor::DocumentPrivate::OffsetList &decToEncOffsetList, KTextEditor::DocumentPrivate::OffsetList &encToDecOffsetList)
 
QString defaultDictionary () const
 
KSyntaxHighlighting::Theme::TextStyle defaultStyleAt (KTextEditor::Cursor position) const override
 
KSyntaxHighlighting::Theme::TextStyle defStyleNum (int line, int column)
 
void del (KTextEditor::ViewPrivate *view, const KTextEditor::Cursor)
 
void delayAutoReload ()
 
QString dictionaryForMisspelledRange (KTextEditor::Range range) const
 
QList< QPair< KTextEditor::MovingRange *, QString > > dictionaryRanges () const
 
void discardDataRecovery () override
 
KTextEditor::Cursor documentEnd () const override
 
QString documentName () const override
 
 DocumentPrivate (bool bSingleViewMode=false, bool bReadOnly=false, QWidget *parentWidget=nullptr, QObject *=nullptr)
 
 DocumentPrivate (const KPluginMetaData &data, bool bSingleViewMode=false, bool bReadOnly=false, QWidget *parentWidget=nullptr, QObject *=nullptr)
 
uint editableMarks () const override
 
bool editEnd ()
 
bool editInsertLine (int line, const QString &s, bool notify=true)
 
bool editInsertText (int line, int col, const QString &s, bool notify=true)
 
bool editMarkLineAutoWrapped (int line, bool autowrapped)
 
bool editRemoveLine (int line)
 
bool editRemoveLines (int from, int to)
 
bool editRemoveText (int line, int col, int len)
 
bool editStart ()
 
bool editUnWrapLine (int line, bool removeLine=true, int length=0)
 
bool editWrapLine (int line, int col, bool newLine=true, bool *newLineAdded=nullptr, bool notify=true)
 
QStringList embeddedHighlightingModes () const override
 
QString encoding () const override
 
QString fileType () const
 
KTextEditor::Range findMatchingBracket (const KTextEditor::Cursor start, int maxLines)
 
int findTouchedLine (int startLine, bool down)
 
int fromVirtualColumn (const KTextEditor::Cursor) const
 
int fromVirtualColumn (int line, int column) const
 
KateHighlighting * highlight () const
 
QString highlightingMode () const override
 
QString highlightingModeAt (KTextEditor::Cursor position) override
 
QStringList highlightingModes () const override
 
QString highlightingModeSection (int index) const override
 
void indent (KTextEditor::Range range, int change)
 
void inputMethodEnd ()
 
void inputMethodStart ()
 
void insertTab (KTextEditor::ViewPrivate *view, const KTextEditor::Cursor)
 
bool isAutoReload ()
 
bool isComment (int line, int column)
 
bool isDataRecoveryAvailable () const override
 
bool isEditingTransactionRunning () const override
 
bool isEditRunning () const
 
bool isLineModified (int line) const override
 
bool isLineSaved (int line) const override
 
bool isLineTouched (int line) const override
 
bool isModifiedOnDisc ()
 
bool isOnTheFlySpellCheckingEnabled () const
 
bool isValidTextPosition (KTextEditor::Cursor cursor) const override
 
void joinLines (uint first, uint last)
 
Kate::TextLine kateTextLine (int i)
 
KTextEditor::Cursor lastEditingPosition (EditingPositionKind nextOrPrevious, KTextEditor::Cursor)
 
int lastLine () const
 
qint64 lastSavedRevision () const override
 
QString line (int line) const override
 
int lineLength (int line) const override
 
int lineLengthLimit () const
 
int lines () const override
 
void lockRevision (qint64 revision) override
 
uint mark (int line) override
 
virtual QColor markColor (Document::MarkTypes) const
 
QString markDescription (Document::MarkTypes) const override
 
QIcon markIcon (Document::MarkTypes markType) const override
 
const QHash< int, KTextEditor::Mark * > & marks () override
 
QString mimeType () override
 
QString mode () const override
 
QStringList modes () const override
 
QString modeSection (int index) const override
 
bool multiPaste (KTextEditor::ViewPrivate *view, const QStringList &texts)
 
void newLine (KTextEditor::ViewPrivate *view, NewLineIndent indent=NewLineIndent::Indent, NewLinePos newLinePos=Normal)
 
KTextEditor::MovingCursornewMovingCursor (KTextEditor::Cursor position, KTextEditor::MovingCursor::InsertBehavior insertBehavior=KTextEditor::MovingCursor::MoveOnInsert) override
 
KTextEditor::MovingRangenewMovingRange (KTextEditor::Range range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors=KTextEditor::MovingRange::DoNotExpand, KTextEditor::MovingRange::EmptyBehavior emptyBehavior=KTextEditor::MovingRange::AllowEmpty) override
 
KTextEditor::Cursor offsetToCursor (qsizetype offset) const override
 
KateOnTheFlyChecker * onTheFlySpellChecker () const
 
bool openFile () override
 
bool openUrl (const QUrl &url) override
 
bool ownedView (KTextEditor::ViewPrivate *)
 
bool pageUpDownMovesCursor () const
 
void paste (KTextEditor::ViewPrivate *view, const QString &text)
 
Kate::TextLine plainKateTextLine (int i)
 
void popEditState ()
 
bool postMessage (KTextEditor::Message *message) override
 
void pushEditState ()
 
bool queryClose () override
 
KTextEditor::Range rangeOnLine (KTextEditor::Range range, int line) const
 
bool readOnly () const
 
void readSessionConfig (const KConfigGroup &config, const QSet< QString > &flags=QSet< QString >()) override
 
void recoverData () override
 
uint redoCount () const
 
void rememberUserDidSetIndentationMode ()
 
void removeAllTrailingSpaces ()
 
void removeView (KTextEditor::View *)
 
void repaintViews (bool paintOnlyDirty=true)
 
void replaceCharactersByEncoding (KTextEditor::Range range)
 
qint64 revision () const override
 
bool saveAs (const QUrl &url) override
 
bool saveFile () override
 
QList< KTextEditor::RangesearchText (KTextEditor::Range range, const QString &pattern, const KTextEditor::SearchOptions options) const
 
void setActiveTemplateHandler (KateTemplateHandler *handler)
 
void setActiveView (KTextEditor::View *)
 
void setAnnotationModel (KTextEditor::AnnotationModel *model) override
 
void setConfigValue (const QString &key, const QVariant &value) override
 
void setDontChangeHlOnSave ()
 
bool setEncoding (const QString &e) override
 
bool setHighlightingMode (const QString &name) override
 
bool setMode (const QString &name) override
 
void setModified (bool m) override
 
void setModifiedOnDisk (ModifiedOnDiskReason reason) override
 
void setModifiedOnDiskWarning (bool on) override
 
void setReadWrite (bool rw=true) override
 
void setUndoMergeAllEdits (bool merge)
 
virtual void setVariable (const QString &name, const QString &value)
 
bool singleViewMode () const
 
Kate::SwapFileswapFile ()
 
void swapTextRanges (KTextEditor::Range firstWord, KTextEditor::Range secondWord)
 
QString text () const override
 
QString text (KTextEditor::Range range, bool blockwise=false) const override
 
QStringList textLines (KTextEditor::Range range, bool block=false) const override
 
qsizetype totalCharacters () const override
 
int toVirtualColumn (const KTextEditor::Cursor) const
 
int toVirtualColumn (int line, int column) const
 
void transform (KTextEditor::ViewPrivate *view, KTextEditor::Cursor, TextTransform)
 
void transformCursor (int &line, int &column, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision=-1) override
 
void transformCursor (KTextEditor::Cursor &cursor, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision=-1) override
 
void transformRange (KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors, KTextEditor::MovingRange::EmptyBehavior emptyBehavior, qint64 fromRevision, qint64 toRevision=-1) override
 
void transpose (const KTextEditor::Cursor)
 
void typeChars (KTextEditor::ViewPrivate *view, QString chars)
 
uint undoCount () const
 
KateUndoManagerundoManager ()
 
void unlockRevision (qint64 revision) override
 
void updateConfig ()
 
bool updateFileType (const QString &newType, bool user=false)
 
void userSetEncodingForNextReload ()
 
virtual QString variable (const QString &name) const
 
QList< KTextEditor::View * > views () const override
 
QWidgetwidget () override
 
QString wordAt (KTextEditor::Cursor cursor) const override
 
KTextEditor::Range wordRangeAt (KTextEditor::Cursor cursor) const override
 
bool wordWrap () const
 
uint wordWrapAt () const
 
bool wrapParagraph (int first, int last)
 
bool wrapText (int startLine, int endLine)
 
void writeSessionConfig (KConfigGroup &config, const QSet< QString > &flags=QSet< QString >()) override
 

Static Public Member Functions

static int computePositionWrtOffsets (const OffsetList &offsetList, int pos)
 

Protected Member Functions

void deleteDictionaryRange (KTextEditor::MovingRange *movingRange)
 
void rangeEmpty (KTextEditor::MovingRange *movingRange) override
 
void rangeInvalid (KTextEditor::MovingRange *movingRange) override
 

Protected Attributes

QString m_defaultDictionary
 
QList< QPair< KTextEditor::MovingRange *, QString > > m_dictionaryRanges
 
KateOnTheFlyChecker * m_onTheFlyChecker = nullptr
 
KateUndoManager *const m_undoManager
 

Detailed Description

Backend of KTextEditor::Document related public KTextEditor interfaces.

Warning
This file is private API and not part of the public KTextEditor interfaces.

Definition at line 65 of file katedocument.h.

Member Typedef Documentation

◆ OffsetList

typedef QList<QPair<int, int> > KTextEditor::OffsetList

Definition at line 1284 of file katedocument.h.

◆ SearchOptions

typedef QFlags< SearchOption > KTextEditor::SearchOptions

Stores a combination of #SearchOption values.

Definition at line 65 of file document.h.

Member Enumeration Documentation

◆ caretStyles

enum class KTextEditor::caretStyles
strong

Definition at line 42 of file katerenderer.h.

◆ CommentType

enum KTextEditor::CommentType

Definition at line 805 of file katedocument.h.

◆ EditingPositionKind

enum KTextEditor::EditingPositionKind

Definition at line 333 of file katedocument.h.

◆ NewLineIndent

enum KTextEditor::NewLineIndent

Definition at line 793 of file katedocument.h.

◆ NewLinePos

enum KTextEditor::NewLinePos

Definition at line 794 of file katedocument.h.

◆ SearchOption

enum KTextEditor::SearchOption

Search flags for use with searchText.

Modifies the behavior of searchText. By default it is searched for a case-sensitive plaintext pattern, without processing of escape sequences, with "whole words" off, in forward direction, within a non-block-mode text range.

See also
SearchOptions
Author
Sebastian Pipping <webma.nosp@m.ster.nosp@m.@hart.nosp@m.work.nosp@m..org>
Enumerator
Default 

Default settings.

Regex 

Treats the pattern as a regular expression.

CaseInsensitive 

Ignores cases, e.g. "a" matches "A".

Backwards 

Searches in backward direction.

EscapeSequences 

Plaintext mode: Processes escape sequences.

WholeWords 

Plaintext mode: Whole words only, e.g. not "amp" in "example".

MaxSearchOption 

Placeholder for binary compatibility.

Definition at line 47 of file document.h.

◆ TextTransform

enum KTextEditor::TextTransform

Definition at line 827 of file katedocument.h.

Member Function Documentation

◆ activeView()

KTextEditor::View * KTextEditor::activeView ( ) const
inline

Definition at line 130 of file katedocument.h.

◆ autoReloadToggleAction()

KToggleAction * KTextEditor::autoReloadToggleAction ( )
inline

Definition at line 721 of file katedocument.h.

◆ bomSetByUser()

void KTextEditor::bomSetByUser ( )

Set that the BOM marker is forced via the tool menu.

◆ buffer()

KateBuffer & KTextEditor::buffer ( )
inline

Get access to buffer of this document.

Is needed to create cursors and ranges for example.

Returns
document buffer

Definition at line 1086 of file katedocument.h.

◆ checksum()

QByteArray KTextEditor::checksum ( ) const
override

Returns a git compatible sha1 checksum of this document on disk.

Returns
checksum for this document on disk

◆ clearEditingPosStack

void KTextEditor::clearEditingPosStack ( )
slot

Removes all the elements in m_editingStack of the respective document.

◆ config() [1/2]

KateDocumentConfig * KTextEditor::config ( )
inline

Configuration.

Definition at line 1151 of file katedocument.h.

◆ config() [2/2]

KateDocumentConfig * KTextEditor::config ( ) const
inline

Definition at line 1155 of file katedocument.h.

◆ decodeCharacters()

QString KTextEditor::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.

◆ defaultStyleAt()

KSyntaxHighlighting::Theme::TextStyle KTextEditor::defaultStyleAt ( KTextEditor::Cursor position) const
override

Get the default style of the character located at position.

If position is not a valid text position, the default style KSyntaxHighlighting::Theme::TextStyle::Normal is returned.

Note
Further information about the colors of default styles depend on the currently chosen schema. Since each View may have a different color schema, the color information can be obtained through View::defaultStyleAttribute() and View::lineAttributes().
Parameters
positiontext position
Returns
default style, see enum KSyntaxHighlighting::Theme::TextStyle
See also
View::defaultStyleAttribute(), View::lineAttributes()

◆ documentName()

QString KTextEditor::documentName ( ) const
inlineoverride

Definition at line 940 of file katedocument.h.

◆ DocumentPrivate()

KTextEditor::DocumentPrivate ( bool bSingleViewMode = false,
bool bReadOnly = false,
QWidget * parentWidget = nullptr,
QObject * = nullptr )
inlineexplicit

Definition at line 79 of file katedocument.h.

◆ documentReload

bool KTextEditor::documentReload ( )
overrideslot

Reloads the current document from disk if possible.

◆ editEnd()

bool KTextEditor::editEnd ( )

End a editor operation.

See also
editStart()

◆ editInsertLine()

bool KTextEditor::editInsertLine ( int line,
const QString & s,
bool notify = true )

Insert a string at the given line.

Parameters
lineline number
sstring to insert
Returns
true on success

◆ editInsertText()

bool KTextEditor::editInsertText ( int line,
int col,
const QString & s,
bool notify = true )

Add a string in the given line/column.

Parameters
lineline number
colcolumn
sstring to be inserted
Returns
true on success

◆ editLineUnWrapped

void KTextEditor::editLineUnWrapped ( int line,
int col )
signal

Emitted each time text from nextLine was upwrapped onto line.

◆ editLineWrapped

void KTextEditor::editLineWrapped ( int line,
int col,
int len )
signal

Emitted when text from line was wrapped at position pos onto line nextLine.

◆ editMarkLineAutoWrapped()

bool KTextEditor::editMarkLineAutoWrapped ( int line,
bool autowrapped )

Mark line as autowrapped.

This is necessary if static word warp is enabled, because we have to know whether to insert a new line or add the wrapped words to the following line.

Parameters
lineline number
autowrappedautowrapped?
Returns
true on success

◆ editRemoveLine()

bool KTextEditor::editRemoveLine ( int line)

Remove a line.

Parameters
lineline number
Returns
true on success

◆ editRemoveText()

bool KTextEditor::editRemoveText ( int line,
int col,
int len )

Remove a string in the given line/column.

Parameters
lineline number
colcolumn
lenlength of text to be removed
Returns
true on success

◆ editStart()

bool KTextEditor::editStart ( )

Enclose editor actions with editStart() and editEnd() to group them.

◆ editUnWrapLine()

bool KTextEditor::editUnWrapLine ( int line,
bool removeLine = true,
int length = 0 )

Unwrap line.

If removeLine is true, we force to join the lines. If removeLine is true, length is ignored (eg not needed).

Parameters
lineline number
removeLineif true, force to remove the next line
Returns
true on success

◆ editWrapLine()

bool KTextEditor::editWrapLine ( int line,
int col,
bool newLine = true,
bool * newLineAdded = nullptr,
bool notify = true )

Wrap line.

If newLine is true, ignore the textline's flag KateTextLine::flagAutoWrapped and force a new line. Whether a new line was needed/added you can grab with newLineAdded.

Parameters
lineline number
colcolumn
newLineif true, force a new line
newLineAddedreturn value is true, if new line was added (may be 0)
Returns
true on success

◆ fileType()

QString KTextEditor::fileType ( ) const
inline

Definition at line 1076 of file katedocument.h.

◆ findTouchedLine()

int KTextEditor::findTouchedLine ( int startLine,
bool down )

Find the next modified/saved line, starting at startLine.

If down is true, the search is performed downwards, otherwise upwards.

Returns
the touched line in the requested search direction, or -1 if not found

◆ handleMarkClick

bool KTextEditor::handleMarkClick ( int line)
slot

Returns true if the click on the mark should not be further processed.

◆ handleMarkContextMenu

bool KTextEditor::handleMarkContextMenu ( int line,
QPoint position )
slot

Returns true if the context-menu event should not further be processed.

◆ highlightingMode()

QString KTextEditor::highlightingMode ( ) const
override

Return the name of the currently used mode.

Returns
name of the used mode

◆ highlightingModes()

QStringList KTextEditor::highlightingModes ( ) const
override

Return a list of the names of all possible modes.

Returns
list of mode names

◆ highlightingModeSection()

QString KTextEditor::highlightingModeSection ( int index) const
override

Returns the name of the section for a highlight given its index in the highlight list (as returned by highlightModes()).

You can use this function to build a tree of the highlight names, organized in sections.

Parameters
indexin the highlight list for which to find the section name.

◆ isModifiedOnDisc()

bool KTextEditor::isModifiedOnDisc ( )
inline
Returns
whether the document is modified on disk since last saved

Definition at line 955 of file katedocument.h.

◆ joinLines()

void KTextEditor::joinLines ( uint first,
uint last )

Unwrap a range of lines.

◆ kateTextLine()

Kate::TextLine KTextEditor::kateTextLine ( int i)

Same as plainKateTextLine(), except that it is made sure the line is highlighted.

◆ lastEditingPosition()

KTextEditor::Cursor KTextEditor::lastEditingPosition ( EditingPositionKind nextOrPrevious,
KTextEditor::Cursor  )

Returns the next or previous position cursor in this document from the stack depending on the argument passed.

Returns
cursor invalid if m_editingStack empty

◆ lastLine()

int KTextEditor::lastLine ( ) const
inline

gets the last line number (lines() - 1)

Definition at line 758 of file katedocument.h.

◆ lastSavedRevision()

qint64 KTextEditor::lastSavedRevision ( ) const
override

Last revision the buffer got successful saved.

Returns
last revision buffer got saved, -1 if none

◆ lineLengthLimit()

int KTextEditor::lineLengthLimit ( ) const

reads the line length limit from config, if it is not overridden

◆ lockRevision()

void KTextEditor::lockRevision ( qint64 revision)
override

Lock a revision, this will keep it around until released again.

But all revisions will always be cleared on buffer clear() (and therefor load())

Parameters
revisionrevision to lock

◆ mimeType()

QString KTextEditor::mimeType ( )
override

Tries to detect mime-type based on file name and content of buffer.

Returns
the name of the mimetype for the document.

◆ mode()

QString KTextEditor::mode ( ) const
override

Return the name of the currently used mode.

Returns
name of the used mode

◆ modes()

QStringList KTextEditor::modes ( ) const
override

Return a list of the names of all possible modes.

Returns
list of mode names

◆ modeSection()

QString KTextEditor::modeSection ( int index) const
override

Returns the name of the section for a mode given its index in the highlight list (as returned by modes()).

You can use this function to build a tree of the mode names, organized in sections.

Parameters
indexindex in the highlight list for which to find the section name.

◆ newMovingCursor()

Create a new moving cursor for this document.

Parameters
positionposition of the moving cursor to create
insertBehaviorinsertion behavior
Returns
new moving cursor for the document

◆ newMovingRange()

Create a new moving range for this document.

Parameters
rangerange of the moving range to create
insertBehaviorsinsertion behaviors
emptyBehaviorbehavior on becoming empty
Returns
new moving range for the document

◆ onTheFlySpellChecker()

KateOnTheFlyChecker * KTextEditor::onTheFlySpellChecker ( ) const
inline

Definition at line 1261 of file katedocument.h.

◆ openFile()

bool KTextEditor::openFile ( )
override

open the file obtained by the kparts framework the framework abstracts the loading of remote files

Returns
success

◆ plainKateTextLine()

Kate::TextLine KTextEditor::plainKateTextLine ( int i)

Return line lineno.

Highlighting of returned line might be out-dated, which may be sufficient for pure text manipulation functions, like search/replace. If you require highlighting to be up to date, call ensureHighlighted prior to this method.

◆ rangeEmpty()

void KTextEditor::rangeEmpty ( KTextEditor::MovingRange * range)
overrideprotectedvirtual

The range is now empty (ie.

the start and end cursors are the same). If the range has invalidateIfEmpty set, this will never be emitted, but instead rangeInvalid is triggered. You may delete the range inside this method, but don't alter the range here (for example by using setRange).

Parameters
rangepointer to the range which generated the notification.

Reimplemented from KTextEditor::MovingRangeFeedback.

◆ rangeInvalid()

void KTextEditor::rangeInvalid ( KTextEditor::MovingRange * range)
overrideprotectedvirtual

The range is now invalid (ie.

the start and end cursors are invalid). You may delete the range inside this method, but don't alter the range here (for example by using setRange).

Parameters
rangepointer to the range which generated the notification.

Reimplemented from KTextEditor::MovingRangeFeedback.

◆ readOnly()

bool KTextEditor::readOnly ( ) const
inline

Definition at line 105 of file katedocument.h.

◆ readSessionConfig()

void KTextEditor::readSessionConfig ( const KConfigGroup & config,
const QSet< QString > & flags = QSetQString >() )
override

Read session settings from the given config.

Known flags: "SkipUrl" => don't save/restore the file "SkipMode" => don't save/restore the mode "SkipHighlighting" => don't save/restore the highlighting "SkipEncoding" => don't save/restore the encoding

Parameters
configread the session settings from this KConfigGroup
flagsadditional flags
See also
writeSessionConfig()

◆ rememberUserDidSetIndentationMode()

void KTextEditor::rememberUserDidSetIndentationMode ( )
inline

set indentation mode by user this will remember that a user did set it and will avoid reset on save

Definition at line 1095 of file katedocument.h.

◆ removeAllTrailingSpaces()

void KTextEditor::removeAllTrailingSpaces ( )

This function doesn't check for config and is available for use all the time via an action.

◆ removeView()

void KTextEditor::removeView ( KTextEditor::View * )

removes the view from the list of views.

The view is not deleted. That's your job. Or, easier, just delete the view in the first place. It will remove itself. TODO: this could be converted to a private slot connected to the view's destroyed() signal. It is not currently called anywhere except from the KTextEditor::ViewPrivate destructor.

◆ replaceText

bool KTextEditor::replaceText ( KTextEditor::Range r,
const QStringList & l,
bool b )
inlineoverrideslot

Definition at line 158 of file katedocument.h.

◆ revision()

qint64 KTextEditor::revision ( ) const
override

Current revision.

Returns
current revision

◆ saveEditingPositions

void KTextEditor::saveEditingPositions ( const KTextEditor::Cursor cursor)
slot

Saves the editing positions into the stack.

If the consecutive editings happens in the same line, then remove the previous and add the new one with updated column no.

◆ saveFile()

bool KTextEditor::saveFile ( )
override

save the file obtained by the kparts framework the framework abstracts the uploading of remote files

Returns
success

◆ setDontChangeHlOnSave()

void KTextEditor::setDontChangeHlOnSave ( )

allow to mark, that we changed hl on user wish and should not reset it atm used for the user visible menu to select highlightings

◆ setHighlightingMode()

bool KTextEditor::setHighlightingMode ( const QString & name)
override

Set the current mode of the document by giving its name.

Parameters
namename of the mode to use for this document
Returns
true on success, otherwise false

◆ setMode()

bool KTextEditor::setMode ( const QString & name)
override

Set the current mode of the document by giving its name.

Parameters
namename of the mode to use for this document
Returns
true on success, otherwise false

◆ setVariable()

virtual void KTextEditor::setVariable ( const QString & name,
const QString & value )
virtual

Set the variable name to value.

Setting and changing a variable has immediate effect on the Document. For instance, setting the variable indent-mode to cstyle will immediately cause the Document to load the C Style indenter.

// TODO KF6: expose in KTextEditor::Document?

Parameters
namethe variable name
valuethe value to be set
See also
variable()

◆ singleViewMode()

bool KTextEditor::singleViewMode ( ) const
inline

Definition at line 109 of file katedocument.h.

◆ slotModifiedOnDisk

virtual void KTextEditor::slotModifiedOnDisk ( KTextEditor::View * v = nullptr)
virtualslot

Ask the user what to do, if the file has been modified on disk.

Reimplemented from KTextEditor::Document.

◆ textInsertedRange

void KTextEditor::textInsertedRange ( KTextEditor::Document * document,
KTextEditor::Range range )
signal

The document emits this signal whenever text was inserted.

The insertion occurred at range.start(), and new text now occupies up to range.end().

Parameters
documentdocument which emitted this signal
rangerange that the newly inserted text occupies
See also
insertText(), insertLine()

◆ textRemoved

void KTextEditor::textRemoved ( KTextEditor::Document * document,
KTextEditor::Range range,
const QString & oldText )
signal

The document emits this signal whenever range was removed, i.e.

text was removed.

Parameters
documentdocument which emitted this signal
rangerange that the removed text previously occupied
oldTextthe text that has been removed
See also
removeText(), removeLine(), clear()

◆ transform()

void KTextEditor::transform ( KTextEditor::ViewPrivate * view,
KTextEditor::Cursor ,
TextTransform  )

Handling uppercase, lowercase and capitalize for the view.

If there is a selection, that is transformed, otherwise for uppercase or lowercase the character right of the cursor is transformed, for capitalize the word under the cursor is transformed.

◆ transformCursor() [1/2]

void KTextEditor::transformCursor ( int & line,
int & column,
KTextEditor::MovingCursor::InsertBehavior insertBehavior,
qint64 fromRevision,
qint64 toRevision = -1 )
override

Transform a cursor from one revision to an other.

Parameters
lineline number of the cursor to transform
columncolumn number of the cursor to transform
insertBehaviorbehavior of this cursor on insert of text at its position
fromRevisionfrom this revision we want to transform
toRevisionto this revision we want to transform, default of -1 is current revision

◆ transformCursor() [2/2]

void KTextEditor::transformCursor ( KTextEditor::Cursor & cursor,
KTextEditor::MovingCursor::InsertBehavior insertBehavior,
qint64 fromRevision,
qint64 toRevision = -1 )
override

Transform a cursor from one revision to an other.

Parameters
cursorcursor to transform
insertBehaviorbehavior of this cursor on insert of text at its position
fromRevisionfrom this revision we want to transform
toRevisionto this revision we want to transform, default of -1 is current revision

◆ transformRange()

void KTextEditor::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.

Parameters
rangerange to transform
insertBehaviorsbehavior of this range on insert of text at its position
emptyBehaviorbehavior on becoming empty
fromRevisionfrom this revision we want to transform
toRevisionto this revision we want to transform, default of -1 is current revision

◆ typeChars()

void KTextEditor::typeChars ( KTextEditor::ViewPrivate * view,
QString chars )

Type chars in a view.

Characters are filtered in KateViewInternal::isAcceptableInput() before calling typeChars.

Parameters
viewview that received the input
charscharacters to type

◆ undoManager()

KateUndoManager * KTextEditor::undoManager ( )
inline

Definition at line 373 of file katedocument.h.

◆ unlockRevision()

void KTextEditor::unlockRevision ( qint64 revision)
override

Release a revision.

Parameters
revisionrevision to release

◆ updateFileType()

bool KTextEditor::updateFileType ( const QString & newType,
bool user = false )
Returns
false if newType is an invalid mode.

◆ userSetEncodingForNextReload()

void KTextEditor::userSetEncodingForNextReload ( )
inline

User did set encoding for next reload => enforce it!

Definition at line 1103 of file katedocument.h.

◆ variable()

virtual QString KTextEditor::variable ( const QString & name) const
virtual

Returns the value for the variable name.

If the Document does not have a variable called name, an empty QString() is returned.

// TODO KF6: expose in KTextEditor::Document?

Parameters
namevariable to query
Returns
value of the variable name
See also
setVariable()

◆ views()

QList< KTextEditor::View * > KTextEditor::views ( ) const
inlineoverride

Definition at line 125 of file katedocument.h.

◆ widget()

QWidget * KTextEditor::widget ( )
override
Returns
The widget defined by this part, set by setWidget().

◆ wrapParagraph()

bool KTextEditor::wrapParagraph ( int first,
int last )

Wrap lines touched by the selection with respect of existing paragraphs.

To do so will the paragraph prior to the wrap joined as one single line which cause an almost perfect wrapped paragraph as long as there are no unneeded spaces exist or some formatting like this comment block. Without any selection the current line is wrapped. Empty lines around each paragraph are untouched.

Parameters
firstline to begin wrapping
lastline to stop wrapping
Returns
true on success

◆ wrapText()

bool KTextEditor::wrapText ( int startLine,
int endLine )

Warp a line.

Parameters
startLineline to begin wrapping
endLineline to stop wrapping
Returns
true on success

◆ writeSessionConfig()

void KTextEditor::writeSessionConfig ( KConfigGroup & config,
const QSet< QString > & flags = QSetQString >() )
override

Write session settings to the config.

See readSessionConfig() for more details.

Parameters
configwrite the session settings to this KConfigGroup
flagsadditional flags
See also
readSessionConfig()

Member Data Documentation

◆ m_defaultDictionary

QString KTextEditor::m_defaultDictionary
protected

Definition at line 1299 of file katedocument.h.

◆ m_dictionaryRanges

QList<QPair<KTextEditor::MovingRange *, QString> > KTextEditor::m_dictionaryRanges
protected

Definition at line 1300 of file katedocument.h.

◆ m_onTheFlyChecker

KateOnTheFlyChecker* KTextEditor::m_onTheFlyChecker = nullptr
protected

Definition at line 1298 of file katedocument.h.

◆ m_undoManager

KateUndoManager* const KTextEditor::m_undoManager
protected

Definition at line 379 of file katedocument.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:15:44 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.