Kate
katedocument.cpp
Go to the documentation of this file.
157 QDBusConnection::sessionBus().registerObject (pathName, this, QDBusConnection::ExportAdaptors | QDBusConnection::ExportScriptableSlots);
213 connect(m_undoManager, SIGNAL(undoStart(KTextEditor::Document*)), this, SIGNAL(exclusiveEditStart(KTextEditor::Document*)));
214 connect(m_undoManager, SIGNAL(undoEnd(KTextEditor::Document*)), this, SIGNAL(exclusiveEditEnd(KTextEditor::Document*)));
215 connect(m_undoManager, SIGNAL(redoStart(KTextEditor::Document*)), this, SIGNAL(exclusiveEditStart(KTextEditor::Document*)));
216 connect(m_undoManager, SIGNAL(redoEnd(KTextEditor::Document*)), this, SIGNAL(exclusiveEditEnd(KTextEditor::Document*)));
263 for (QHash<int, KTextEditor::Mark*>::const_iterator i = m_marks.constBegin(); i != m_marks.constEnd(); ++i)
530 bool KateDocument::insertText( const KTextEditor::Cursor& position, const QString& text, bool block )
606 editInsertText(currentLine, insertColumn, text.mid(currentLineStart, pos - currentLineStart) + QString(spacesRequired, spaceChar));
624 bool KateDocument::insertText( const KTextEditor::Cursor & position, const QStringList & textLines, bool block )
680 editRemoveText(from, range.start().column(), m_buffer->plainLine(from)->length() - range.start().column());
953 if (nextl && (nextl->length() > 0) && !nextl->at(0).isSpace() && ((l->length() < 1) || !l->at(l->length()-1).isSpace()))
1005 emit KTextEditor::Document::textInserted(this, KTextEditor::Range(line, col2, line, col2 + s2.length()));
1046 m_buffer->removeText (KTextEditor::Range (KTextEditor::Cursor (line, col), KTextEditor::Cursor (line, col+len)));
1049 emit KTextEditor::Document::textRemoved(this, KTextEditor::Range(line, col, line, col + len), oldText);
1111 for (QHash<int, KTextEditor::Mark*>::const_iterator i = m_marks.constBegin(); i != m_marks.constEnd(); ++i)
1187 for (QHash<int, KTextEditor::Mark*>::const_iterator i = m_marks.constBegin(); i != m_marks.constEnd(); ++i)
1255 for (QHash<int, KTextEditor::Mark*>::const_iterator i = m_marks.constBegin(); i != m_marks.constEnd(); ++i)
1316 m_buffer->removeText (KTextEditor::Range (KTextEditor::Cursor (line, 0), KTextEditor::Cursor (line, tl->text().size())));
1400 const Qt::CaseSensitivity caseSensitivity = options.testFlag(KTextEditor::Search::CaseInsensitive) ? Qt::CaseInsensitive : Qt::CaseSensitive;
1414 KTextEditor::Range match = searcher.search(KateRegExpSearch::escapePlaintext(pattern), range, backwards);
1542 //BEGIN KTextEditor::SessionConfigInterface and KTextEditor::ParameterizedSessionConfigInterface stuff
1589 config()->setIndentationMode( kconfig.readEntry("Indentation Mode", config()->indentationMode() ) );
1637 for (QHash<int, KTextEditor::Mark*>::const_iterator i = m_marks.constBegin(); i != m_marks.constEnd(); ++i)
1644 //END KTextEditor::SessionConfigInterface and KTextEditor::ParameterizedSessionConfigInterface stuff
1811 void KateDocument::setMarkDescription( MarkInterface::MarkTypes type, const QString& description )
1888 buf.replace(bufpos,len,ld.toLatin1()); //memcpy(buf.data() + bufpos, ld.toLatin1().constData(), len);
1906 = new KTextEditor::Message(i18n ("The file %1 could not be loaded, as it was not possible to read from it.<br />Check if you have read access to this file.", this->url().pathOrUrl()),
1909 QAction* tryAgainAction = new QAction(KIcon("view-refresh"), i18nc("translators: you can also translate 'Try Again' with 'Reload'", "Try Again"), 0);
1924 setOpeningErrorMessage(i18n ("The file %1 could not be loaded, as it was not possible to read from it.\n\nCheck if you have read access to this file.",this->url().pathOrUrl()));
1970 bool success = m_buffer->openFile (localFilePath(), (m_reloading && m_userSetEncodingForNextReload));
1988 // This is needed here because inserting the text moves the view's start position (it is a MovingCursor)
1997 // Inform that the text has changed (required as we're not inside the usual editStart/End stuff)
2036 = new KTextEditor::Message(i18n ("The file %1 was opened with %2 encoding but contained invalid characters.<br />"
2038 "Either reopen the file with the correct encoding chosen or enable the read-write mode again in the menu to be able to edit it.", this->url().pathOrUrl(),
2046 setOpeningErrorMessage(i18n ("The file %1 was opened with %2 encoding but contained invalid characters."
2048 " Either reopen the file with the correct encoding chosen or enable the read-write mode again in the menu to be able to edit it.", this->url().pathOrUrl(), QString (m_buffer->textCodec()->name ())));
2058 = new KTextEditor::Message(i18n ("The file %1 was opened and contained lines longer than the configured Line Length Limit (%2 characters).<br />"
2059 "Those lines were wrapped and the document is set to read-only mode, as saving will modify its content.",
2067 setOpeningErrorMessage(i18n ("The file %1 was opened and contained lines longer than the configured Line Length Limit (%2 characters)."
2068 " Those lines were wrapped and the document is set to read-only mode, as saving will modify its content.", this->url().pathOrUrl(),config()->lineLengthLimit()));
2091 str + i18n("Do you really want to save this unmodified file? You could overwrite changed data in the file on disk."),i18n("Trying to Save Unmodified File"),KGuiItem(i18n("Save Nevertheless"))) != KMessageBox::Continue)
2097 str + i18n("Do you really want to save this file? Both your open file and the file on disk were changed. There could be some data lost."),i18n("Possible Data Loss"),KGuiItem(i18n("Save Nevertheless"))) != KMessageBox::Continue)
2108 i18n("The selected encoding cannot encode every unicode character in this document. Do you really want to save it? There could be some data lost."),i18n("Possible Data Loss"),KGuiItem(i18n("Save Nevertheless"))) != KMessageBox::Continue))
2169 " A reason could be that the media you write to is full or the directory of the file is read-only for you.", url().pathOrUrl())
2212 KMessageBox::error (parentWidget, i18n ("The document could not be saved, as it was not possible to write to %1.\n\nCheck that you have write access to this file or that enough disk space is available.", this->url().pathOrUrl()));
2350 reasonedMOHString() + "\n\n" + i18n("Do you really want to continue to close this file? Data loss may occur."),
2620 || (view->viInputMode() && view->getViInputModeManager()->getCurrentViMode() == ReplaceMode)) {
2643 selectionRange.start().setColumn(fromVirtualColumn(selectionRange.start().line(), newSelectionColumn));
2644 selectionRange.end().setColumn(fromVirtualColumn(selectionRange.end().line(), newSelectionColumn));
2729 if (view->blockSelection() && view->selection() && toVirtualColumn(view->selectionRange().start()) == toVirtualColumn(view->selectionRange().end())) {
2809 if (view->blockSelection() && view->selection() && toVirtualColumn(view->selectionRange().start()) == toVirtualColumn(view->selectionRange().end())) {
3244 bool KateDocument::removeStartStopCommentFromRegion(const KTextEditor::Cursor &start,const KTextEditor::Cursor &end,int attrib)
3255 removeText(KTextEditor::Range(end.line(), end.column() - endCommentLen, end.line(), end.column()));
3322 bool hasStartLineCommentMark = !(highlight()->getCommentSingleLineStart( startAttrib ).isEmpty());
3479 while ( cursor.column() > 0 && highlight()->isInWord( l->at( cursor.column() - 1 ), l->attribute( cursor.column() - 1 ) ) )
3548 while (start > 0 && highlight()->isInWord(textLine->at(start - 1), textLine->attribute(start - 1))) start--;
3573 void KateDocument::newBracketMark( const KTextEditor::Cursor& cursor, KTextEditor::Range& bm, int maxLines )
3736 KEncodingFileDialog::Result res=KEncodingFileDialog::getSaveUrlAndEncoding(config()->encoding(),
3740 if( ! res.URLs.isEmpty() && ! res.URLs.first().isEmpty() && checkOverwrite( res.URLs.first(), parentWidget ) )
3839 for (QHash<int, KTextEditor::Mark*>::const_iterator i = m_marks.constBegin(); i != m_marks.constEnd(); ++i)
3912 KEncodingFileDialog::Result res=KEncodingFileDialog::getSaveUrlAndEncoding(config()->encoding(),
4137 "http://docs.kde.org/stable/en/applications/kate/config-variables.html#variable-remove-trailing-spaces");
4143 "http://docs.kde.org/stable/en/applications/kate/config-variables.html#variable-remove-trailing-spaces");
4175 else if ( var == "word-wrap-column" && checkIntValue( val, &n ) && n > 0 ) // uint, but hard word wrap at 0 will be no fun ;)
4518 int hl (KateHlManager::self()->nameFind (KateGlobal::self()->modeManager()->fileType(newType).hl));
4528 if (!m_indenterSetByUser && !KateGlobal::self()->modeManager()->fileType(newType).indenter.isEmpty())
4565 KEncodingFileDialog::Result res=KEncodingFileDialog::getSaveUrlAndEncoding(config()->encoding(),
4686 bool KateDocument::replaceText( const KTextEditor::Range & range, const QString & s, bool block )
4736 KTextEditor::MovingCursor *KateDocument::newMovingCursor (const KTextEditor::Cursor &position, KTextEditor::MovingCursor::InsertBehavior insertBehavior)
4741 KTextEditor::MovingRange *KateDocument::newMovingRange (const KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors, KTextEditor::MovingRange::EmptyBehavior emptyBehavior)
4766 void KateDocument::transformCursor(int& line, int& column, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision)
4771 void KateDocument::transformCursor (KTextEditor::Cursor &cursor, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision)
4779 void KateDocument::transformRange (KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors, KTextEditor::MovingRange::EmptyBehavior emptyBehavior, qint64 fromRevision, qint64 toRevision)
4781 m_buffer->history().transformRange (range, insertBehaviors, emptyBehavior, fromRevision, toRevision);
4788 return KateGlobal::self()->simpleMode () && KateGlobal::self()->documentConfig()->allowSimpleMode ();
4946 m_loadingMessage = new KTextEditor::Message(i18n ("The file <a href=\"%1\">%2</a> is still loading.", url().pathOrUrl(), url().fileName()));
5043 for (QList<QPair<KTextEditor::MovingRange*, QString> >::iterator i = m_dictionaryRanges.begin();
5055 void KateDocument::setDictionary(const QString& newDictionary, const KTextEditor::Range &range)
5063 for(QList<QPair<KTextEditor::MovingRange*, QString> >::iterator i = m_dictionaryRanges.begin();
5092 QList<KTextEditor::Range> remainingRanges = KateSpellCheckManager::rangeDifference(newDictionaryRange, intersection);
5099 QList<KTextEditor::Range> remainingRanges = KateSpellCheckManager::rangeDifference(*dictionaryRange, intersection);
5100 for(QList<KTextEditor::Range>::iterator j = remainingRanges.begin(); j != remainingRanges.end(); ++j)
5114 if(!newDictionaryRange.isEmpty() && !newDictionary.isEmpty()) // we don't add anything for the default dictionary
5119 m_dictionaryRanges.push_back(QPair<KTextEditor::MovingRange*, QString>(newDictionaryMovingRange, newDictionary));
5208 for(QList<QPair<KTextEditor::MovingRange*, QString> >::iterator i = m_dictionaryRanges.begin();
5260 QString KateDocument::decodeCharacters(const KTextEditor::Range& range, KateDocument::OffsetList& decToEncOffsetList,
5284 const QHash<QString, QChar>& characterEncodingsHash = highlighting->getCharacterEncodings(attr);
5296 decToEncCurrentOffset = decToEncCurrentOffset - (isNullChar ? 0 : 1) + matchingPrefix.length();
5297 encToDecCurrentOffset = encToDecCurrentOffset - matchingPrefix.length() + (isNullChar ? 0 : 1);
5332 const QHash<QChar, QString>& reverseCharacterEncodingsHash = highlighting->getReverseCharacterEncodings(attr);
5333 QHash<QChar, QString>::const_iterator it = reverseCharacterEncodingsHash.find(textLine->at(col));
5348 KTextEditor::Attribute::Ptr KateDocument::defaultStyle(const KTextEditor::HighlightInterface::DefaultStyle ds) const
5353 kWarning() << "ATTENTION: cannot access defaultStyle() without any View (will be fixed eventually)";
5357 KTextEditor::Attribute::Ptr style = highlight()->attributes(view->renderer()->config()->schema()).at(ds);
5366 QList< KTextEditor::HighlightInterface::AttributeBlock > KateDocument::lineAttributes(const unsigned int line)
5374 kWarning() << "ATTENTION: cannot access lineAttributes() without any View (will be fixed eventually)";
5401 kWarning() << "ATTENTION: cannot access lineAttributes() without any View (will be fixed eventually)";
5429 // kDebug() << "col: " << position.column() << " lastchar:" << kateLine->lastChar() << " length:" << kateLine->length() << "global mode:" << highlightingMode();
5484 KateHlContext *context = tl->contextStack().isEmpty() ? highlight()->contextNum(0) : highlight()->contextNum (tl->contextStack().back());
5541 kWarning(13020) << "trying to post a message to a view of another document:" << message->text();
5573 connect(message, SIGNAL(closed(KTextEditor::Message*)), SLOT(messageDestroyed(KTextEditor::Message*)));
virtual const QString & documentName() const
Definition: katedocument.h:828
Definition: katedialogs.h:409
virtual void setConfigValue(const QString &key, const QVariant &value)
Definition: katedocument.cpp:4632
void align(KateView *view, const KTextEditor::Range &range)
Definition: katedocument.cpp:2909
bool canConvert(Type t) const
Interface for embedding KateDocument into a browser.
Definition: katedocumenthelpers.h:36
virtual bool insertLine(int line, const QString &s)
Definition: katedocument.cpp:701
virtual QString highlightingMode() const
Return the name of the currently used mode.
Definition: katedocument.cpp:1494
void clear()
void setKeepExtraSpaces(bool on)
Definition: kateconfig.cpp:598
This class can be used to efficiently search for occurrences of strings in a given string...
Definition: prefixstore.h:41
bool tagLines(int start, int end, bool realLines=false)
Definition: kateview.cpp:1888
Definition: kateconfig.h:279
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
QString dictionaryForMisspelledRange(const KTextEditor::Range &range) const
Definition: ontheflycheck.cpp:95
QString cap(int nth) const
void ignoreModifiedOnDiskOnce()
Definition: katedocument.cpp:4696
void registerDocument(KateDocument *doc)
register document at the factory this allows us to loop over all docs for example on config changes ...
Definition: kateglobal.cpp:474
const QString & backupPrefix() const
Definition: kateconfig.cpp:1000
QString & append(QChar ch)
QScriptValue i18n(QScriptContext *context, QScriptEngine *engine)
i18n("text", arguments [optional])
Definition: katescripthelpers.cpp:186
iterator insert(const Key &key, const T &value)
void setIndentationMode(const QString &identationMode)
Definition: kateconfig.cpp:500
void updateFileType(const QString &newType, bool user=false)
Definition: katedocument.cpp:4503
KateModeManager * modeManager()
global mode manager used to manage the modes centrally
Definition: kateglobal.h:292
QString toUpper() const
virtual KTextEditor::MovingCursor * newMovingCursor(const KTextEditor::Cursor &position, KTextEditor::MovingCursor::InsertBehavior insertBehavior=KTextEditor::MovingCursor::MoveOnInsert)
Create a new moving cursor for this document.
Definition: katedocument.cpp:4736
int computePositionWrtOffsets(const OffsetList &offsetList, int pos)
Definition: katedocument.cpp:5248
QString path() const
void updateConfig()
Update indenter's configuration (indention width, etc.) Is called in the updateConfig() of the docume...
Definition: kateautoindent.cpp:370
virtual void setModifiedOnDiskWarning(bool on)
Definition: katedocument.cpp:3801
virtual KTextEditor::MovingRange * newMovingRange(const KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors=KTextEditor::MovingRange::DoNotExpand, KTextEditor::MovingRange::EmptyBehavior emptyBehavior=KTextEditor::MovingRange::AllowEmpty)
Create a new moving range for this document.
Definition: katedocument.cpp:4741
QList< KateDocument * > & kateDocuments()
return a list of all registered docs
Definition: kateglobal.h:267
void setHighlightedBracketColor(const QColor &col)
Definition: kateconfig.cpp:2432
void replaceCharactersByEncoding(const KTextEditor::Range &range)
Definition: katedocument.cpp:5316
char toAscii() const
virtual QByteArray name() const =0
void repaintViews(bool paintOnlyDirty=true)
Definition: katedocument.cpp:3560
void slotTextInserted(int line, int col, const QString &s)
Notify KateUndoManager that text was inserted.
Definition: kateundomanager.cpp:139
T pop()
Definition: kateconfig.h:280
const QColor & lineMarkerColor(KTextEditor::MarkInterface::MarkTypes type=KTextEditor::MarkInterface::markType01) const
Definition: kateconfig.cpp:2390
void ensureHighlighted(int line, int lookAhead=64)
Update highlighting of given line line, if needed.
Definition: katebuffer.cpp:284
void append(const T &value)
void push_back(const T &value)
static QList< KTextEditor::Range > rangeDifference(const KTextEditor::Range &r1, const KTextEditor::Range &r2)
'r2' is a subrange of 'r1', which is extracted from 'r1' and the remaining ranges are returned ...
Definition: spellcheck.cpp:68
qint64 lastSavedRevision() const
Last revision the buffer got successful saved.
Definition: katetexthistory.h:54
void undoChanged()
QScriptValue i18nc(QScriptContext *context, QScriptEngine *engine)
i18nc("context", "text", arguments [optional])
Definition: katescripthelpers.cpp:210
bool remove()
QString dictionaryForMisspelledRange(const KTextEditor::Range &range) const
Definition: katedocument.cpp:5172
bool editChanged() const
were there changes in the current running editing session?
Definition: katebuffer.h:71
virtual KTextEditor::View * activeView() const
Definition: katedocument.h:156
bool handleMarkClick(int line)
Returns true if the click on the mark should not be further processed.
Definition: katedocument.cpp:1762
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
QString nameForIdentifier(const QString &)
Returns the mode name for a given identifier, as e.g.
Definition: katesyntaxmanager.cpp:388
void readWriteChanged(KTextEditor::Document *document)
void setBackupSuffix(const QString &suffix)
Definition: kateconfig.cpp:1029
iterator begin()
const QByteArray & digest() const
md5 digest of the document on disk, set either through file loading in openFile() or in KateDocument:...
Definition: katetextbuffer.cpp:692
virtual bool setMode(const QString &name)
Set the current mode of the document by giving its name.
Definition: katedocument.cpp:1462
void push(const T &t)
QString getCommentStart(int attrib=0) const
Definition: katehighlight.cpp:1157
T takeFirst()
void setMode(const QString &name)
Switch indenter Nop if already set to given mode Otherwise switch to given indenter or to "None" if n...
Definition: kateautoindent.cpp:304
void configEnd()
end a config change transaction, update the concerned documents/views/renderers
Definition: kateconfig.cpp:64
const T & at(int i) const
void wrapLine(const KTextEditor::Cursor &position)
Wrap line at given cursor position.
Definition: katebuffer.cpp:301
KTextEditor::Attribute::Ptr attribute(uint pos) const
This takes an in index, and returns all the attributes for it.
Definition: katerenderer.cpp:79
void onTheFlySpellCheckingEnabled(bool enable)
Definition: katedocument.cpp:5148
Definition: kateviinputmodemanager.h:54
A Cursor which is bound to a specific Document.
Definition: documentcursor.h:69
bool registerObject(const QString &path, QObject *object, QFlags< QDBusConnection::RegisterOption > options)
bool contains(const QString &str, Qt::CaseSensitivity cs) const
void clearMisspellingForWord(const QString &word)
Definition: katedocument.cpp:5181
bool isSymLink() const
bool isEmpty() const
bool editRemoveLines(int from, int to)
Definition: katedocument.cpp:1294
virtual bool documentReload()
Reloads the current document from disk if possible.
Definition: katedocument.cpp:3806
virtual QString highlightingModeAt(const KTextEditor::Cursor &position)
Definition: katedocument.cpp:5419
virtual KTextEditor::Attribute::Ptr defaultStyle(const KTextEditor::HighlightInterface::DefaultStyle ds) const
Definition: katedocument.cpp:5348
virtual KTextEditor::AnnotationModel * annotationModel() const
Definition: katedocument.cpp:4799
virtual QStringList embeddedHighlightingModes() const
Definition: katedocument.cpp:5414
void overwrittenChar(const QChar &s)
Definition: katevireplacemode.h:48
static QString escapePlaintext(const QString &text)
Returns a modified version of text where escape sequences are resolved, e.g.
Definition: kateregexpsearch.cpp:531
iterator erase(iterator pos)
KTextEditor::Range search(const QString &text, const KTextEditor::Range &inputRange, bool backwards=false)
Search for the given text inside the range inputRange taking into account whether to search casesensi...
Definition: kateplaintextsearch.cpp:52
void indent(KateView *view, const KTextEditor::Range &range)
The document requests the indenter to indent the given range of existing text.
Definition: kateautoindent.cpp:415
void slotTextRemoved(int line, int col, const QString &s)
Notify KateUndoManager that text was removed.
Definition: kateundomanager.cpp:145
QDBusConnection sessionBus()
virtual QString modeSection(int index) const
Returns the name of the section for a mode given its index in the highlight list (as returned by mode...
Definition: katedocument.cpp:1514
virtual KTextEditor::View * createView(QWidget *parent)
Definition: katedocument.cpp:292
QString join(const QString &separator) const
void setSelectionColor(const QColor &col)
Definition: kateconfig.cpp:2356
bool canBreakAt(QChar c, int attrib=0) const
Definition: katehighlight.cpp:1129
bool saveFile(const QString &m_file)
Save the buffer to a file, use the given filename + codec + end of line chars (internal use of qtexts...
Definition: katebuffer.cpp:256
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:1531
bool exists() const
void markChanged(KTextEditor::Document *, KTextEditor::Mark, KTextEditor::MarkInterface::MarkChangeAction)
int count(const Key &key) const
virtual void writeSessionConfig(KConfigGroup &)
Definition: katedocument.cpp:1597
bool setCursorPosition(KTextEditor::Cursor position)
Definition: kateview.cpp:2418
void clear()
void chop(int n)
void setNamedColor(const QString &name)
void bomSetByUser()
Set that the BOM marker is forced via the tool menu.
Definition: katedocument.cpp:1536
void marksChanged(KTextEditor::Document *)
bool move(int chars, WrapBehavior wrapBehavior=Wrap)
Moves the cursor chars character forward or backwards.
Definition: documentcursor.cpp:171
Kate::TextLine plainKateTextLine(uint i)
Definition: katedocument.cpp:4712
QChar separator()
void indent(KTextEditor::Range range, int change)
Definition: katedocument.cpp:2899
Definition: katedialogs.h:408
void backspace(KateView *view, const KTextEditor::Cursor &)
Definition: katedocument.cpp:2726
int fromVirtualColumn(int line, int column) const
Definition: katedocument.cpp:2580
void dictionaryRangesPresent(bool yesNo)
bool copy(const QString &newName)
void setToolTip(const QString &tip)
void markClicked(KTextEditor::Document *document, KTextEditor::Mark mark, bool &handled)
QString getCommentEnd(int attrib=0) const
Definition: katehighlight.cpp:1162
KateViInputModeManager * getViInputModeManager()
Definition: kateview.cpp:1587
void comment(KateView *view, uint line, uint column, int change)
Definition: katedocument.cpp:3302
int size() const
bool isNull() const
static const QChar tabChar('\t')
virtual bool insertLines(int line, const QStringList &s)
Definition: katedocument.cpp:712
virtual void insertText(const KTextEditor::Cursor &position, const QString &text)
Insert text at given cursor position.
Definition: katetextbuffer.cpp:306
void aboutToRemoveText(const KTextEditor::Range &)
T value(int i) const
const KatePrefixStore & getCharacterEncodingsPrefixStore(int attrib) const
Definition: katehighlight.cpp:723
void configStart()
start some config changes this method is needed to init some kind of transaction for config changes...
Definition: kateconfig.cpp:54
void clear()
Definition: katehighlighthelpers.h:72
void resize(int size)
void rangeInvalid(KTextEditor::MovingRange *movingRange)
Definition: katedocument.cpp:5195
virtual const KTextEditor::Range & selectionRange() const
Definition: kateview.cpp:2815
int matchedLength() const
void aboutToDeleteMovingInterfaceContent(KTextEditor::Document *document)
This signal is emitted before the cursors/ranges/revisions of a document are destroyed as the documen...
virtual void transformRange(KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors, KTextEditor::MovingRange::EmptyBehavior emptyBehavior, qint64 fromRevision, qint64 toRevision=-1)
Transform a range from one revision to an other.
Definition: katedocument.cpp:4779
virtual QString mode() const
Return the name of the currently used mode.
Definition: katedocument.cpp:1468
virtual bool setHighlightingMode(const QString &name)
Set the current mode of the document by giving its name.
Definition: katedocument.cpp:1484
int indexIn(const QString &str, int offset, CaretMode caretMode) const
Definition: katedocument.h:734
bool isPrint() const
virtual bool replaceText(const KTextEditor::Range &range, const QString &s, bool block=false)
Definition: katedocument.cpp:4686
virtual bool insertText(const KTextEditor::Cursor &position, const QString &s, bool block=false)
Definition: katedocument.cpp:530
void setBackspaceIndents(bool on)
Definition: kateconfig.cpp:640
virtual QStringList textLines(const KTextEditor::Range &range, bool block=false) const
Definition: katedocument.cpp:398
QString canonicalFilePath() const
QWidget * activeWindow()
int count(const T &value) const
QString decodeCharacters(const KTextEditor::Range &range, KateDocument::OffsetList &decToEncOffsetList, KateDocument::OffsetList &encToDecOffsetList)
The first OffsetList is from decoded to encoded, and the second OffsetList from encoded to decoded...
Definition: katedocument.cpp:5260
void append(const T &value)
void makeAttribs(bool needInvalidate=true)
Definition: katedocument.cpp:2503
void setDefaultDictionary(const QString &dict)
Definition: katedocument.cpp:5133
void removeDocument(KTextEditor::Document *doc)
Definition: katepartpluginmanager.cpp:112
bool isSpace() const
const QString & backupSuffix() const
Definition: kateconfig.cpp:1008
void newBracketMark(const KTextEditor::Cursor &start, KTextEditor::Range &bm, int maxLines=-1)
Definition: katedocument.cpp:3573
const Cursor & toCursor() const
Convert this clever cursor into a dumb one.
Definition: documentcursor.cpp:238
bool openFile(const QString &m_file, bool enforceTextCodec)
Open a file, use the given filename.
Definition: katebuffer.cpp:161
void transformRange(KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors, KTextEditor::MovingRange::EmptyBehavior emptyBehavior, qint64 fromRevision, qint64 toRevision=-1)
Transform a range from one revision to an other.
Definition: katetexthistory.cpp:484
const_iterator constEnd() const
virtual QChar character(const KTextEditor::Cursor &position) const
Definition: katedocument.cpp:388
int toInt(bool *ok) const
bool isEmpty() const
virtual bool setSelection(const KTextEditor::Range &selection)
Definition: kateview.cpp:1956
void setDictionary(const QString &dict, const KTextEditor::Range &range)
Definition: katedocument.cpp:5055
void transform(KateView *view, const KTextEditor::Cursor &, TextTransform)
Handling uppercase, lowercase and capitalize for the view.
Definition: katedocument.cpp:3384
bool editInsertText(int line, int col, const QString &s)
Add a string in the given line/column.
Definition: katedocument.cpp:971
int line() const
Retrieve the line on which this cursor is situated.
Definition: documentcursor.cpp:77
void editEnd(int editTagLineStart, int editTagLineEnd, bool tagFrom)
Definition: kateview.cpp:1866
QChar fromLatin1(char c)
void slotLineInserted(int line, const QString &s)
Notify KateUndoManager that a line was inserted.
Definition: kateundomanager.cpp:169
QList< KTextEditor::Attribute::Ptr > attributes(const QString &schema)
Definition: katehighlight.cpp:2172
void setDigest(const QByteArray &md5sum)
Set the md5sum of this buffer.
Definition: katetextbuffer.cpp:697
QList< QPair< KTextEditor::MovingRange *, QString > > dictionaryRanges() const
Definition: katedocument.cpp:5036
void deregisterDocument(KateDocument *doc)
unregister document at the factory
Definition: kateglobal.cpp:481
int toInt(bool *ok, int base) const
void postMessage(KTextEditor::Message *message, QList< QSharedPointer< QAction > > actions)
Used by Document::postMessage().
Definition: kateview.cpp:3254
bool isEmpty() const
virtual QString variable(const QString &name) const
Definition: katedocument.cpp:4338
bool isEmpty() const
int removeAll(const T &value)
QString trimmed() const
virtual QList< KTextEditor::HighlightInterface::AttributeBlock > lineAttributes(const unsigned int line)
Definition: katedocument.cpp:5366
iterator begin()
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
QByteArray & replace(int pos, int len, const char *after)
const QHash< QChar, QString > & getReverseCharacterEncodings(int attrib) const
Definition: katehighlight.cpp:728
virtual bool isDataRecoveryAvailable() const
Definition: katedocument.cpp:2452
KateDocument(bool bSingleViewMode=false, bool bBrowserView=false, bool bReadOnly=false, QWidget *parentWidget=0, QObject *=0)
Definition: katedocument.cpp:111
virtual KTextEditor::Cursor documentEnd() const
Definition: katedocument.cpp:4681
void setPersistentSelection(bool on)
Definition: kateconfig.cpp:1785
KTextEditor::Range rangeOnLine(KTextEditor::Range range, int line) const
Definition: katedocument.cpp:319
static const QChar spaceChar(' ')
T & first()
void setBackgroundColor(const QColor &col)
Definition: kateconfig.cpp:2335
QList< QPair< KTextEditor::MovingRange *, QString > > m_dictionaryRanges
Definition: katedocument.h:1151
void defaultDictionaryChanged(KateDocument *document)
int remove(const Key &key)
virtual QVariant configValue(const QString &key)
Definition: katedocument.cpp:4608
virtual QPixmap markPixmap(MarkInterface::MarkTypes) const
Definition: katedocument.cpp:1816
Definition: katedocument.h:734
static KatePartPluginManager * self()
Definition: katepartpluginmanager.cpp:70
bool handleMarkContextMenu(int line, QPoint position)
Returns true if the context-menu event should not further be processed.
Definition: katedocument.cpp:1774
virtual QColor markColor(MarkInterface::MarkTypes) const
Definition: katedocument.cpp:1821
iterator erase(iterator pos)
bool typeChars(KateView *type, const QString &realChars)
Type chars in a view.
Definition: katedocument.cpp:2595
QList< Key > keys() const
QStringList getEmbeddedHighlightingModes() const
Returns a list of names of embedded modes.
Definition: katehighlight.cpp:2204
void setBackupPrefix(const QString &prefix)
Definition: kateconfig.cpp:1016
Definition: kateview.h:77
uint redoCount() const
Returns how many redo() actions can be performed.
Definition: kateundomanager.cpp:229
static bool isInWord(const KTextEditor::View *view, const KTextEditor::Cursor &position, QChar c)
Definition: katekeywordcompletion.cpp:118
void messageDestroyed(KTextEditor::Message *message)
Definition: katedocument.cpp:5578
bool isNull() const
void clear()
iterator end()
Definition: katemodemanager.h:34
QString toLower() const
const T value(const Key &key) const
void reserve(int size)
iterator find(const Key &key)
void slotTextInserted(KTextEditor::View *view, const KTextEditor::Cursor &position, const QString &text)
Definition: kateview.cpp:2270
void refreshSpellCheck(const KTextEditor::Range &range=KTextEditor::Range::invalid())
Definition: ontheflycheck.cpp:677
virtual KTextEditor::Attribute::Ptr attributeAt(const KTextEditor::Cursor &position)
Definition: katedocument.cpp:5395
Definition: katedocument.h:74
void setParent(QObject *parent)
void updateAttributes()
update the highlighting attributes (for example after an hl change or after hl config changed) ...
Definition: katerenderer.cpp:74
bool contains(QChar ch, Qt::CaseSensitivity cs) const
void userTypedChar(KateView *view, const KTextEditor::Cursor &position, QChar typedChar)
The user typed some char, the indenter can react on this ' ' will be send as char if the user wraps a...
Definition: kateautoindent.cpp:436
void updateLineModifications()
Definition: kateundomanager.cpp:382
void requestMarkTooltip(int line, QPoint position)
Definition: katedocument.cpp:1752
virtual void removeText(const KTextEditor::Range &range)
Remove text at given range.
Definition: katetextbuffer.cpp:338
bool findMatchingBracket(KTextEditor::Range &range, int maxLines=-1)
Definition: katedocument.cpp:3589
void del(KateView *view, const KTextEditor::Cursor &)
Definition: katedocument.cpp:2806
void setUndoMergeAllEdits(bool merge)
Definition: katedocument.cpp:4722
bool changeIndent(const KTextEditor::Range &range, int change)
Function to provide the common indent/unindent/clean indent functionality to the document This should...
Definition: kateautoindent.cpp:381
void undoSafePoint()
Prevent latest KateUndoGroup from being merged with the next one.
Definition: kateundomanager.cpp:190
KateViReplaceMode * getViReplaceMode()
Definition: kateviinputmodemanager.cpp:561
void variableChanged(KTextEditor::Document *, const QString &, const QString &)
bool editWrapLine(int line, int col, bool newLine=true, bool *newLineAdded=0)
Wrap line.
Definition: katedocument.cpp:1083
virtual QVector< KTextEditor::Range > searchText(const KTextEditor::Range &range, const QString &pattern, const KTextEditor::Search::SearchOptions options)
Definition: katedocument.cpp:1387
const QString & indentationMode() const
Definition: kateconfig.cpp:492
void addDocument(KTextEditor::Document *doc)
Definition: katepartpluginmanager.cpp:100
QString & replace(int position, int n, QChar after)
const T & at(int i) const
const_iterator constBegin() const
void charactersSemiInteractivelyInserted(const KTextEditor::Cursor &position, const QString &text)
virtual void setAnnotationModel(KTextEditor::AnnotationModel *model)
Definition: katedocument.cpp:4792
QVector< KTextEditor::Range > search(const QString &pattern, const KTextEditor::Range &inputRange, bool backwards=false)
Search for the regular expression regexp inside the range inputRange.
Definition: kateregexpsearch.cpp:201
QByteArray toLatin1() const
QString mid(int position, int n) const
virtual void setModifiedOnDisk(ModifiedOnDiskReason reason)
Definition: katedocument.cpp:3787
virtual bool setEncoding(const QString &e)
Definition: katedocument.cpp:3954
bool editRemoveText(int line, int col, int len)
Remove a string in the given line/column.
Definition: katedocument.cpp:1012
T take(const Key &key)
qint64 revision() const
Current revision, just relay the revision of the buffer.
Definition: katetexthistory.cpp:39
QString getWord(const KTextEditor::Cursor &cursor)
Definition: katedocument.cpp:3538
QChar toUpper() const
QString getCommentSingleLineStart(int attrib=0) const
Definition: katehighlight.cpp:1167
virtual void readSessionConfig(const KConfigGroup &)
Definition: katedocument.cpp:1543
void setPageUpDownMovesCursor(bool on)
Definition: kateconfig.cpp:585
bool isEmpty() const
const QHash< QString, QChar > & getCharacterEncodings(int attrib) const
Definition: katehighlight.cpp:718
virtual void removeMark(int line, uint markType)
Definition: katedocument.cpp:1714
int count() const
virtual QStringList modes() const
Return a list of the names of all possible modes.
Definition: katedocument.cpp:1473
virtual void setEditableMarks(uint markMask)
Definition: katedocument.cpp:1836
void aboutToInvalidateMovingInterfaceContent(KTextEditor::Document *document)
This signal is emitted before the ranges of a document are invalidated and the revisions are deleted ...
virtual QString setVariable(const QString &name, const QString &value)
Definition: katedocument.cpp:4343
Definition: katehighlight.h:119
void clearMisspellingForWord(const QString &word)
Definition: ontheflycheck.cpp:106
const QChar at(int position) const
void setFamily(const QString &family)
T & last()
QChar fromAscii(char c)
void markToolTipRequested(KTextEditor::Document *document, KTextEditor::Mark mark, QPoint position, bool &handled)
int count(const T &value) const
void modifiedOnDisk(KTextEditor::Document *doc, bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason)
Indicate this file is modified on disk.
bool isOnTheFlySpellCheckingEnabled() const
Definition: katedocument.cpp:5167
int length() const
Definition: katedialogs.h:407
virtual const QList< KTextEditor::View * > & views() const
Definition: katedocument.cpp:309
const QColor & backgroundColor() const
Definition: kateconfig.cpp:2327
virtual bool openFile()
open the file obtained by the kparts framework the framework abstracts the loading of remote files ...
Definition: katedocument.cpp:1931
bool toBool() const
bool containsCharacterEncoding(const KTextEditor::Range &range)
Definition: katedocument.cpp:5222
virtual void setMarkDescription(MarkInterface::MarkTypes, const QString &)
Definition: katedocument.cpp:1811
void refreshOnTheFlyCheck(const KTextEditor::Range &range=KTextEditor::Range::invalid())
Definition: katedocument.cpp:5188
bool pageUpDownMovesCursor() const
Definition: kateconfig.cpp:577
void setWordWrapMarkerColor(const QColor &col)
Definition: kateconfig.cpp:2453
void slotQueryClose_save(bool *handled, bool *abortClosing)
Definition: katedocument.cpp:4558
virtual const QHash< int, KTextEditor::Mark * > & marks()
Definition: katedocument.cpp:1747
Definition: kateconfig.h:145
void configChanged()
Definition: katedialogs.h:406
void setIconBarColor(const QColor &col)
Definition: kateconfig.cpp:2516
void insertTab(KateView *view, const KTextEditor::Cursor &)
Definition: katedocument.cpp:2914
int indexOf(const QRegExp &rx, int from) const
void prepend(const T &value)
virtual void lockRevision(qint64 revision)
Lock a revision, this will keep it around until released again.
Definition: katedocument.cpp:4756
iterator insert(const Key &key, const T &value)
int toVirtualColumn(int line, int column) const
Definition: katedocument.cpp:2565
bool contains(const Key &key) const
bool editUnWrapLine(int line, bool removeLine=true, int length=0)
Unwrap line.
Definition: katedocument.cpp:1153
void invalidateHighlighting()
Invalidate highlighting of whole buffer.
Definition: katebuffer.cpp:389
void slotLineWrapped(int line, int col, int length, bool newLine)
Notify KateUndoManager that a line was wrapped.
Definition: kateundomanager.cpp:157
Definition: katedocument.h:734
This dialog will prompt the user for what do with a file that is modified on disk.
Definition: katedialogs.h:401
virtual bool postMessage(KTextEditor::Message *message)
Definition: katedocument.cpp:5533
int column() const
Retrieve the column on which this cursor is situated.
Definition: documentcursor.cpp:82
T & first()
void setIndentPastedText(bool on)
Definition: kateconfig.cpp:619
void reflectOnTheFlySpellCheckStatus(bool enabled)
Definition: kateview.cpp:3096
bool pageUpDownMovesCursor() const
Definition: katedocument.cpp:3948
virtual qint64 lastSavedRevision() const
Last revision the buffer got successful saved.
Definition: katedocument.cpp:4751
virtual QStringList highlightingModes() const
Return a list of the names of all possible modes.
Definition: katedocument.cpp:1499
void transformCursor(int &line, int &column, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision=-1)
Transform a cursor from one revision to an other.
Definition: katetexthistory.cpp:436
iterator end()
void slotMarkLineAutoWrapped(int line, bool autowrapped)
Notify KateUndoManager that a line was marked as autowrapped.
Definition: kateundomanager.cpp:151
void markContextMenuRequested(KTextEditor::Document *document, KTextEditor::Mark mark, QPoint pos, bool &handled)
uint undoCount() const
Returns how many undo() actions can be performed.
Definition: kateundomanager.cpp:224
void editStart()
Enclose editor actions with editStart() and editEnd() to group them.
Definition: katedocument.cpp:776
Type type() const
void revertToDefaultDictionary(const KTextEditor::Range &range)
Definition: katedocument.cpp:5128
void removeView(KTextEditor::View *)
removes the view from the list of views.
Definition: katedocument.cpp:2541
ViMode getCurrentViMode() const
Definition: kateviinputmodemanager.cpp:451
QString absolutePath() const
int removeAll(const T &value)
Definition: katedefaultcolors.h:62
QString findPrefix(const QString &s, int start=0) const
Returns the shortest prefix of the given string that is contained in this prefix store starting at po...
Definition: prefixstore.cpp:120
KateOnTheFlyChecker * m_onTheFlyChecker
Definition: katedocument.h:1149
void setAllowComplexMerge(bool allow)
Allows or disallows merging of "complex" undo groups.
Definition: kateundomanager.cpp:429
int size() const
bool isInWord(QChar c, int attrib=0) const
Definition: katehighlight.cpp:1122
virtual void transformCursor(KTextEditor::Cursor &cursor, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision=-1)
Transform a cursor from one revision to an other.
Definition: katedocument.cpp:4771
KMimeType::Ptr mimeTypeForContent()
Definition: katedocument.cpp:1874
virtual bool saveFile()
save the file obtained by the kparts framework the framework abstracts the uploading of remote files ...
Definition: katedocument.cpp:2077
virtual void writeParameterizedSessionConfig(KConfigGroup &, unsigned long configParameters)
Definition: katedocument.cpp:1602
Definition: katedefaultcolors.h:61
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QString toString() const
virtual QString highlightingModeSection(int index) const
Returns the name of the section for a highlight given its index in the highlight list (as returned by...
Definition: katedocument.cpp:1509
void editStart()
Notify KateUndoManager about the beginning of an edit.
Definition: kateundomanager.cpp:65
void lockRevision(qint64 revision)
Lock a revision, this will keep it around until released again.
Definition: katetexthistory.cpp:143
bool setCursorPositionInternal(const KTextEditor::Cursor &position, uint tabwidth=1, bool calledExternally=false)
Definition: kateview.cpp:1293
int searchDirConfigDepth() const
Should Kate Part search for dir wide config file and if, how depth?
Definition: kateconfig.cpp:1063
iterator begin()
QString repeated(int times) const
int findModifiedLine(int startLine, bool down)
Definition: katedocument.cpp:5517
bool editInsertLine(int line, const QString &s)
Insert a string at the given line.
Definition: katedocument.cpp:1223
void setIndentationWidth(int indentationWidth)
Definition: kateconfig.cpp:476
virtual void setMarkPixmap(MarkInterface::MarkTypes, const QPixmap &)
Definition: katedocument.cpp:1806
Definition: ontheflycheck.h:40
bool editMarkLineAutoWrapped(int line, bool autowrapped)
Mark line as autowrapped.
Definition: katedocument.cpp:1056
void annotationModelChanged(KTextEditor::AnnotationModel *, KTextEditor::AnnotationModel *)
int size() const
void setPosition(const KTextEditor::Cursor &position)
Set the current cursor position to position.
Definition: documentcursor.cpp:68
void slotLineRemoved(int line, const QString &s)
Notify KateUndoManager that a line was removed.
Definition: kateundomanager.cpp:175
void deleteDictionaryRange(KTextEditor::MovingRange *movingRange)
Definition: katedocument.cpp:5205
virtual bool removeText(const KTextEditor::Range &range, bool block=false)
Definition: katedocument.cpp:633
void setPageUpDownMovesCursor(bool on)
Definition: katedocument.cpp:3943
void slotLineUnWrapped(int line, int col, int length, bool lineRemoved)
Notify KateUndoManager that a line was un-wrapped.
Definition: kateundomanager.cpp:163
void setHighlightedLineColor(const QColor &col)
Definition: kateconfig.cpp:2377
bool contains(const T &value) const
virtual void discardDataRecovery()
Definition: katedocument.cpp:2463
virtual void slotModifiedOnDisk(KTextEditor::View *v=0)
Ask the user what to do, if the file has been modified on disk.
Definition: katedocument.cpp:3713
void append(const T &value)
void checkRequiredStyle()
Check if the current highlighting mode provides the style required by the current indenter...
Definition: kateautoindent.cpp:355
QString fileType(KateDocument *doc, const QString &fileToReadFrom)
get the right fileType for the given document -1 if none found !
Definition: katemodemanager.cpp:205
bool isValid() const
bool setEncoding(const QString &encoding)
Definition: kateconfig.cpp:852
virtual void readParameterizedSessionConfig(const KConfigGroup &, unsigned long configParameters)
Definition: katedocument.cpp:1548
virtual KTextEditor::Search::SearchOptions supportedSearchOptions() const
Definition: katedocument.cpp:1432
const T value(const Key &key) const
void rangeEmpty(KTextEditor::MovingRange *movingRange)
Definition: katedocument.cpp:5200
singleShot
virtual QString markDescription(MarkInterface::MarkTypes) const
Definition: katedocument.cpp:1831
static bool checkOverwrite(KUrl u, QWidget *parent)
Definition: katedocument.cpp:4584
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:58 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.