KTextEditor

Search for usage in LXR

#include <katedocument.h>

Inheritance diagram for KTextEditor:

Classes

class  AbstractAnnotationItemDelegate
 
class  AnnotationInterface
 
class  AnnotationModel
 
class  AnnotationViewInterface
 
class  AnnotationViewInterfaceV2
 
class  Application
 
class  Attribute
 
class  AttributeBlock
 
class  CodeCompletionInterface
 
class  CodeCompletionInterfaceV2
 
class  CodeCompletionModel
 
class  CodeCompletionModelControllerInterface
 
class  Command
 
class  ConfigInterface
 
class  ConfigPage
 
class  Cursor
 
class  Document
 
class  DocumentCursor
 
class  Editor
 
class  EditorPrivate
 
class  FoldingInterface
 
class  InlineNote
 
class  InlineNoteInterface
 
class  InlineNoteProvider
 
class  LineRange
 
class  MainWindow
 
class  Mark
 
class  MarkInterface
 
class  MarkInterfaceV2
 
class  Message
 
class  ModificationInterface
 
class  MovingCursor
 
class  MovingInterface
 
class  MovingRange
 
class  MovingRangeFeedback
 
class  Plugin
 
class  Range
 
class  SessionConfigInterface
 
class  StyleOptionAnnotationItem
 
class  TextHintInterface
 
class  TextHintProvider
 
class  Variable
 
class  View
 

Public Types

enum  DefaultStyle {
  dsNormal = 0, dsKeyword, dsFunction, dsVariable,
  dsControlFlow, dsOperator, dsBuiltIn, dsExtension,
  dsPreprocessor, dsAttribute, dsChar, dsSpecialChar,
  dsString, dsVerbatimString, dsSpecialString, dsImport,
  dsDataType, dsDecVal, dsBaseN, dsFloat,
  dsConstant, dsComment, dsDocumentation, dsAnnotation,
  dsCommentVar, dsRegionMarker, dsInformation, dsWarning,
  dsAlert, dsOthers, dsError
}
 
enum  EditingPositionKind { Previous, Next }
 
enum  NewLineIndent { Indent, NoIndent }
 
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 }
 
- Public Types inherited from KTextEditor::MarkInterface
enum  MarkChangeAction { MarkAdded = 0, MarkRemoved = 1 }
 
enum  MarkTypes {
  markType01 = 0x1, markType02 = 0x2, markType03 = 0x4, markType04 = 0x8,
  markType05 = 0x10, markType06 = 0x20, markType07 = 0x40, markType08 = 0x80,
  markType09 = 0x100, markType10 = 0x200, markType11 = 0x400, markType12 = 0x800,
  markType13 = 0x1000, markType14 = 0x2000, markType15 = 0x4000, markType16 = 0x8000,
  markType17 = 0x10000, markType18 = 0x20000, markType19 = 0x40000, markType20 = 0x80000,
  markType21 = 0x100000, markType22 = 0x200000, markType23 = 0x400000, markType24 = 0x800000,
  markType25 = 0x1000000, markType26 = 0x2000000, markType27 = 0x4000000, markType28 = 0x8000000,
  markType29 = 0x10000000, markType30 = 0x20000000, markType31 = 0x40000000, markType32 = 0x80000000,
  Bookmark = markType01, BreakpointActive = markType02, BreakpointReached = markType03, BreakpointDisabled = markType04,
  Execution = markType05, Warning = markType06, Error = markType07, SearchMatch = markType32
}
 
- Public Types inherited from KTextEditor::ModificationInterface
enum  ModifiedOnDiskReason { OnDiskUnmodified = 0, OnDiskModified = 1, OnDiskCreated = 2, OnDiskDeleted = 3 }
 

Signals

void aboutToDeleteMovingInterfaceContent (KTextEditor::Document *document)
 
void aboutToInvalidateMovingInterfaceContent (KTextEditor::Document *document)
 
void aboutToRemoveText (const KTextEditor::Range &)
 
void annotationModelChanged (KTextEditor::AnnotationModel *, KTextEditor::AnnotationModel *)
 
void charactersSemiInteractivelyInserted (const 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 markChanged (KTextEditor::Document *, KTextEditor::Mark, KTextEditor::MarkInterface::MarkChangeAction) override
 
void markClicked (KTextEditor::Document *document, KTextEditor::Mark mark, bool &handled)
 
void markContextMenuRequested (KTextEditor::Document *document, KTextEditor::Mark mark, QPoint pos, bool &handled)
 
void marksChanged (KTextEditor::Document *) override
 
void markToolTipRequested (KTextEditor::Document *document, KTextEditor::Mark mark, QPoint position, bool &handled)
 
void modifiedOnDisk (KTextEditor::Document *doc, bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason) override
 
void textInsertedRange (KTextEditor::Document *document, const KTextEditor::Range &range)
 
void textRemoved (KTextEditor::Document *document, const KTextEditor::Range &range, const QString &oldText)
 
void undoChanged ()
 
- Signals inherited from KTextEditor::MarkInterface
void markClicked (KTextEditor::Document *document, KTextEditor::Mark mark, bool &handled)
 
void markContextMenuRequested (KTextEditor::Document *document, KTextEditor::Mark mark, QPoint pos, bool &handled)
 
void markToolTipRequested (KTextEditor::Document *document, KTextEditor::Mark mark, QPoint position, bool &handled)
 

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)
 
bool 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 (const KTextEditor::Cursor &position, const QString &s, bool block=false) override
 
bool insertText (const 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 (const KTextEditor::Range &range=KTextEditor::Range::invalid())
 
bool removeLine (int line) override
 
void removeMark (int line, uint markType) override
 
bool removeText (const KTextEditor::Range &range, bool block=false) override
 
bool replaceText (const KTextEditor::Range &range, const QString &s, bool block=false) override
 
bool replaceText (const KTextEditor::Range &r, const QStringList &l, bool b) 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, const KTextEditor::Range &range, bool blockmode)
 
void setDictionary (const QString &dict, const KTextEditor::Range &range)
 
void setEditableMarks (uint markMask) override
 
void setMark (int line, uint markType) override
 
void setMarkDescription (MarkInterface::MarkTypes, const QString &) override
 
void setMarkIcon (MarkInterface::MarkTypes markType, const QIcon &icon) override
 
void setMarkPixmap (MarkInterface::MarkTypes, const QPixmap &) 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

virtual KTextEditor::ViewactiveView () const
 
void addView (KTextEditor::View *)
 
void align (KTextEditor::ViewPrivate *view, const KTextEditor::Range &range)
 
KTextEditor::AnnotationModelannotationModel () const override
 
KToggleActionautoReloadToggleAction ()
 
void backspace (KTextEditor::ViewPrivate *view, const KTextEditor::Cursor &)
 
void bomSetByUser ()
 
KateBufferbuffer ()
 
void bufferHlChanged ()
 
QChar characterAt (const 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, int change)
 
int computePositionWrtOffsets (const OffsetList &offsetList, int pos)
 
KateDocumentConfig * config ()
 
KateDocumentConfig * config () const
 
QStringList configKeys () const override
 
QVariant configValue (const QString &key) override
 
bool containsCharacterEncoding (const KTextEditor::Range &range)
 
KTextEditor::ViewcreateView (QWidget *parent, KTextEditor::MainWindow *mainWindow=nullptr) override
 
QString decodeCharacters (const KTextEditor::Range &range, KTextEditor::DocumentPrivate::OffsetList &decToEncOffsetList, KTextEditor::DocumentPrivate::OffsetList &encToDecOffsetList)
 
QString defaultDictionary () const
 
KTextEditor::DefaultStyle defaultStyleAt (const KTextEditor::Cursor &position) const override
 
int defStyleNum (int line, int column)
 
void del (KTextEditor::ViewPrivate *view, const KTextEditor::Cursor &)
 
void delayAutoReload ()
 
QString dictionaryForMisspelledRange (const 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)
 
uint editableMarks () const override
 
void editBegin ()
 
bool editEnd ()
 
bool editInsertLine (int line, const QString &s)
 
bool editInsertText (int line, int col, const QString &s)
 
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)
 
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)
 
virtual bool finishEditing ()
 
int fromVirtualColumn (int line, int column) const
 
int fromVirtualColumn (const KTextEditor::Cursor &) const
 
KateHighlighting * highlight () const
 
QString highlightingMode () const override
 
QString highlightingModeAt (const 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 (const 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 (MarkInterface::MarkTypes) const
 
QString markDescription (MarkInterface::MarkTypes) const override
 
QIcon markIcon (MarkInterface::MarkTypes markType) const override
 
QPixmap markPixmap (MarkInterface::MarkTypes) 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
 
void newLine (KTextEditor::ViewPrivate *view, NewLineIndent indent=NewLineIndent::Indent)
 
KTextEditor::MovingCursornewMovingCursor (const KTextEditor::Cursor &position, KTextEditor::MovingCursor::InsertBehavior insertBehavior=KTextEditor::MovingCursor::MoveOnInsert) override
 
KTextEditor::MovingRangenewMovingRange (const KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors=KTextEditor::MovingRange::DoNotExpand, KTextEditor::MovingRange::EmptyBehavior emptyBehavior=KTextEditor::MovingRange::AllowEmpty) override
 
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 removeView (KTextEditor::View *)
 
void repaintViews (bool paintOnlyDirty=true)
 
void replaceCharactersByEncoding (const KTextEditor::Range &range)
 
qint64 revision () const override
 
bool saveAs (const QUrl &url) override
 
bool saveFile () override
 
QVector< KTextEditor::RangesearchText (const 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
 
virtual bool startEditing ()
 
Kate::SwapFileswapFile ()
 
void swapTextRanges (KTextEditor::Range firstWord, KTextEditor::Range secondWord)
 
QString text (const KTextEditor::Range &range, bool blockwise=false) const override
 
QString text () const override
 
QStringList textLines (const KTextEditor::Range &range, bool block=false) const override
 
int totalCharacters () const override
 
int toVirtualColumn (int line, int column) const
 
int toVirtualColumn (const KTextEditor::Cursor &) const
 
void transform (KTextEditor::ViewPrivate *view, const KTextEditor::Cursor &, TextTransform)
 
void transformCursor (KTextEditor::Cursor &cursor, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision=-1) override
 
void transformCursor (int &line, int &column, 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 (const KTextEditor::Cursor &cursor) const override
 
KTextEditor::Range wordRangeAt (const 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
 
- Public Member Functions inherited from KTextEditor::MarkInterfaceV2
virtual void setMarkIcon (MarkTypes markType, const QIcon &icon)=0
 
- Public Member Functions inherited from KTextEditor::MarkInterface
virtual ~MarkInterface ()
 
virtual void addMark (int line, uint markType)=0
 
virtual void clearMark (int line)=0
 
virtual void clearMarks ()=0
 
virtual void markChanged (KTextEditor::Document *document, KTextEditor::Mark mark, KTextEditor::MarkInterface::MarkChangeAction action)=0
 
virtual void marksChanged (KTextEditor::Document *document)=0
 
virtual void removeMark (int line, uint markType)=0
 
virtual void setEditableMarks (uint markMask)=0
 
virtual void setMark (int line, uint markType)=0
 
virtual void setMarkDescription (MarkTypes mark, const QString &text)=0
 
virtual void setMarkPixmap (MarkTypes mark, const QPixmap &pixmap)=0
 
- Public Member Functions inherited from KTextEditor::ModificationInterface
virtual ~ModificationInterface ()
 
virtual void modifiedOnDisk (KTextEditor::Document *document, bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason)=0
 
- Public Member Functions inherited from KTextEditor::ConfigInterface
virtual ~ConfigInterface ()
 
- Public Member Functions inherited from KTextEditor::MovingInterface
 MovingInterface ()
 
virtual ~MovingInterface ()
 
void aboutToDeleteMovingInterfaceContent (KTextEditor::Document *document)
 
void aboutToInvalidateMovingInterfaceContent (KTextEditor::Document *document)
 

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
 

Additional Inherited Members

- Static Public Member Functions inherited from KTextEditor::MarkInterface
static int reservedMarkersCount ()
 

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 71 of file katedocument.h.

Member Typedef Documentation

Stores a combination of SearchOption values.

Definition at line 63 of file document.h.

Member Enumeration Documentation

The following lists all valid default styles that are used for the syntax highlighting files in the itemData's defStyleNum attribute.

Not all default styles are used by a syntax highlighting file.

Enumerator
dsNormal 

Default for normal text and source code.

dsKeyword 

Used for language keywords.

dsFunction 

Used for function definitions and function calls.

dsVariable 

Used for variables, if applicable.

dsControlFlow 

Used for control flow highlighting, e.g., if, then, else, return, continue.

dsOperator 

Used for operators such as +, -, *, / and :: etc.

dsBuiltIn 

Used for built-in language classes and functions.

dsExtension 

Used for extensions, such as Qt or boost.

dsPreprocessor 

Used for preprocessor statements.

dsAttribute 

Used for attributes of a function, e.g.

@override in Java.

dsChar 

Used for a single character.

dsSpecialChar 

Used for an escaped character.

dsString 

Used for strings.

dsVerbatimString 

Used for verbatim strings such as HERE docs.

dsSpecialString 

Used for special strings such as regular expressions or LaTeX math mode.

dsImport 

Used for includes, imports and modules.

dsDataType 

Used for data types such as int, char, float etc.

dsDecVal 

Used for decimal values.

dsBaseN 

Used for numbers with base other than 10.

dsFloat 

Used for floating point numbers.

dsConstant 

Used for language constants.

dsComment 

Used for normal comments.

dsDocumentation 

Used for comments that reflect API documentation.

dsAnnotation 

Used for annotations in comments, e.g.

@param in Doxygen or JavaDoc.

dsCommentVar 

Used to refer to variables in a comment, e.g.

after @param in Doxygen or JavaDoc.

dsRegionMarker 

Used for region markers, typically defined by BEGIN/END.

dsInformation 

Used for information, e.g.

the keyword @note in Doxygen.

dsWarning 

Used for warnings, e.g.

the keyword @warning in Doxygen.

dsAlert 

Used for comment specials TODO and WARNING in comments.

dsOthers 

Used for attributes that do not match any of the other default styles.

dsError 

Used to indicate wrong syntax.

Definition at line 26 of file attribute.h.

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[email protected]ster[email protected]@hart[email protected]work[email protected].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 45 of file document.h.

Member Function Documentation

void KTextEditor::aboutToDeleteMovingInterfaceContent ( KTextEditor::Document document)
signal

This signal is emitted before the cursors/ranges/revisions of a document are destroyed as the document is deleted.

Parameters
documentthe document which the interface belongs too which is in the process of being deleted
void KTextEditor::aboutToInvalidateMovingInterfaceContent ( KTextEditor::Document document)
signal

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 load/reload).

While this signal is emitted, still the old document content is around before the clear.

Parameters
documentthe document which the interface belongs too which will invalidate its data
KTextEditor::AnnotationModel* KTextEditor::annotationModel ( ) const
overridevirtual

returns the currently set AnnotationModel or 0 if there's none set

Returns
the current AnnotationModel

Implements KTextEditor::AnnotationInterface.

void KTextEditor::bomSetByUser ( )

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

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 1094 of file katedocument.h.

QByteArray KTextEditor::checksum ( ) const
override

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

Returns
checksum for this document on disk
void KTextEditor::clearEditingPosStack ( )
slot

Removes all the elements in m_editingStack of the respective document.

KateDocumentConfig* KTextEditor::config ( )
inline

Configuration.

Definition at line 1159 of file katedocument.h.

QStringList KTextEditor::configKeys ( ) const
overridevirtual

Get a list of all available keys.

Implements KTextEditor::ConfigInterface.

QVariant KTextEditor::configValue ( const QString key)
overridevirtual

Get a value for the key.

Implements KTextEditor::ConfigInterface.

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

KTextEditor::DefaultStyle KTextEditor::defaultStyleAt ( const 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 DefaultStyle::dsNormal 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 KTextEditor::DefaultStyle
See also
View::defaultStyleAttribute(), View::lineAttributes()
bool KTextEditor::documentReload ( )
overrideslot

Reloads the current document from disk if possible.

uint KTextEditor::editableMarks ( ) const
overridevirtual

Get, which marks can be toggled by the user.

The returned value is a mark mask containing all editable marks combined with a logical OR.

Returns
mark mask containing all editable marks
See also
setEditableMarks()

Implements KTextEditor::MarkInterface.

void KTextEditor::editBegin ( )
inline

Alias for editStart()

Definition at line 225 of file katedocument.h.

bool KTextEditor::editEnd ( )

End a editor operation.

See also
editStart()
bool KTextEditor::editInsertLine ( int  line,
const QString s 
)

Insert a string at the given line.

Parameters
lineline number
sstring to insert
Returns
true on success
bool KTextEditor::editInsertText ( int  line,
int  col,
const QString s 
)

Add a string in the given line/column.

Parameters
lineline number
colcolumn
sstring to be inserted
Returns
true on success
void KTextEditor::editLineUnWrapped ( int  line,
int  col 
)
signal

Emitted each time text from nextLine was upwrapped onto line.

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

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

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
bool KTextEditor::editRemoveLine ( int  line)

Remove a line.

Parameters
lineline number
Returns
true on success
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
bool KTextEditor::editStart ( )

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

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
bool KTextEditor::editWrapLine ( int  line,
int  col,
bool  newLine = true,
bool *  newLineAdded = nullptr 
)

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
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
bool KTextEditor::handleMarkClick ( int  line)
slot

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

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

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

QString KTextEditor::highlightingMode ( ) const
override

Return the name of the currently used mode.

Returns
name of the used mode
QStringList KTextEditor::highlightingModes ( ) const
override

Return a list of the names of all possible modes.

Returns
list of mode names
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.
bool KTextEditor::isModifiedOnDisc ( )
inline
Returns
whether the document is modified on disk since last saved

Definition at line 964 of file katedocument.h.

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

Unwrap a range of lines.

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

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

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
int KTextEditor::lastLine ( ) const
inline

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

Definition at line 806 of file katedocument.h.

qint64 KTextEditor::lastSavedRevision ( ) const
overridevirtual

Last revision the buffer got successful saved.

Returns
last revision buffer got saved, -1 if none

Implements KTextEditor::MovingInterface.

int KTextEditor::lineLengthLimit ( ) const

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

void KTextEditor::lockRevision ( qint64  revision)
overridevirtual

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

Implements KTextEditor::MovingInterface.

uint KTextEditor::mark ( int  line)
overridevirtual

Get all marks set on the line.

Parameters
linerequested line
Returns
a uint representing of the marks set in line concatenated by logical OR
See also
addMark(), removeMark()

Implements KTextEditor::MarkInterface.

QString KTextEditor::markDescription ( MarkInterface::MarkTypes  mark) const
overridevirtual

Get the mark's description to text.

Parameters
markmark to set the description
Returns
text of the given mark or QString(), if the entry does not exist
See also
setMarkDescription(), setMarkPixmap()

Implements KTextEditor::MarkInterface.

QIcon KTextEditor::markIcon ( MarkInterface::MarkTypes  markType) const
overridevirtual

Get the mark's icon.

Parameters
markTypemark type. If the icon does not exist the resulting is null (check with QIcon::isNull()).
See also
setMarkDescription()

Implements KTextEditor::MarkInterfaceV2.

QPixmap KTextEditor::markPixmap ( MarkInterface::MarkTypes  mark) const
overridevirtual

Get the mark's pixmap.

Parameters
markmark type. If the pixmap does not exist the resulting is null (check with QPixmap::isNull()).
See also
setMarkDescription()

Implements KTextEditor::MarkInterface.

const QHash<int, KTextEditor::Mark *>& KTextEditor::marks ( )
overridevirtual

Get a hash holding all marks in the document.

The hash key for a mark is its line.

Returns
a hash holding all marks in the document

KF6 TODO: Change Mark* to Mark. No need for pointer here.

Implements KTextEditor::MarkInterface.

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.
QString KTextEditor::mode ( ) const
override

Return the name of the currently used mode.

Returns
name of the used mode
QStringList KTextEditor::modes ( ) const
override

Return a list of the names of all possible modes.

Returns
list of mode names
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.
void KTextEditor::modifiedOnDisk ( KTextEditor::Document doc,
bool  isModified,
KTextEditor::ModificationInterface::ModifiedOnDiskReason  reason 
)
overridesignal

Indicate this file is modified on disk.

Parameters
docthe KTextEditor::Document object that represents the file on disk
isModifiedindicates the file was modified rather than created or deleted
reasonthe reason we are emitting the signal.
KTextEditor::MovingCursor* KTextEditor::newMovingCursor ( const KTextEditor::Cursor position,
KTextEditor::MovingCursor::InsertBehavior  insertBehavior = KTextEditor::MovingCursor::MoveOnInsert 
)
overridevirtual

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

Implements KTextEditor::MovingInterface.

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

Implements KTextEditor::MovingInterface.

bool KTextEditor::openFile ( )
override

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

Returns
success
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.

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.

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.

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()
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 1103 of file katedocument.h.

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.

qint64 KTextEditor::revision ( ) const
overridevirtual

Current revision.

Returns
current revision

Implements KTextEditor::MovingInterface.

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.

bool KTextEditor::saveFile ( )
override

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

Returns
success
void KTextEditor::setAnnotationModel ( KTextEditor::AnnotationModel model)
overridevirtual

Sets a new AnnotationModel for this document to provide annotation information for each line.

Parameters
modelthe new AnnotationModel

Implements KTextEditor::AnnotationInterface.

void KTextEditor::setConfigValue ( const QString key,
const QVariant value 
)
overridevirtual

Set a the key's value to value.

Implements KTextEditor::ConfigInterface.

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

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
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
void KTextEditor::setModifiedOnDisk ( ModifiedOnDiskReason  reason)
overridevirtual

Set the document's modified-on-disk state to reason.

KTextEditor implementations should emit the signal modifiedOnDisk() along with the reason. When the document is in a clean state again the reason should be ModifiedOnDiskReason::OnDiskUnmodified.

Parameters
reasonthe modified-on-disk reason.
See also
ModifiedOnDiskReason, modifiedOnDisk()

Implements KTextEditor::ModificationInterface.

void KTextEditor::setModifiedOnDiskWarning ( bool  on)
overridevirtual

Control, whether the editor should show a warning dialog whenever a file was modified on disk.

If on is true the editor will show warning dialogs.

Parameters
oncontrols, whether the editor should show a warning dialog for files modified on disk

Implements KTextEditor::ModificationInterface.

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()
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.

void KTextEditor::textInsertedRange ( KTextEditor::Document document,
const 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()
void KTextEditor::textRemoved ( KTextEditor::Document document,
const 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()
void KTextEditor::transform ( KTextEditor::ViewPrivate *  view,
const 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.

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

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

Implements KTextEditor::MovingInterface.

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

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

Implements KTextEditor::MovingInterface.

void KTextEditor::transformRange ( KTextEditor::Range range,
KTextEditor::MovingRange::InsertBehaviors  insertBehaviors,
KTextEditor::MovingRange::EmptyBehavior  emptyBehavior,
qint64  fromRevision,
qint64  toRevision = -1 
)
overridevirtual

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

Implements KTextEditor::MovingInterface.

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
void KTextEditor::unlockRevision ( qint64  revision)
overridevirtual

Release a revision.

Parameters
revisionrevision to release

Implements KTextEditor::MovingInterface.

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

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

Definition at line 1111 of file katedocument.h.

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()
QWidget* KTextEditor::widget ( )
override
Returns
The widget defined by this part, set by setWidget().
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
bool KTextEditor::wrapText ( int  startLine,
int  endLine 
)

Warp a line.

Parameters
startLineline to begin wrapping
endLineline to stop wrapping
Returns
true on success
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()

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Oct 21 2021 22:59:53 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.