• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • interfaces
  • ktexteditor
smartinterface.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 Copyright (C) 2005 Hamish Rodda <rodda@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KDELIBS_KTEXTEDITOR_SMARTINTERFACE_H
21#define KDELIBS_KTEXTEDITOR_SMARTINTERFACE_H
22
23#include <ktexteditor/ktexteditor_export.h>
24#include <ktexteditor/smartrange.h>
25
26class QMutex;
27
28namespace KTextEditor
29{
30class Document;
31class View;
32class SmartCursor;
33
118class KTEXTEDITOR_EXPORT SmartInterface
119{
120 friend class Attribute;
121
122 public:
123 SmartInterface();
124 virtual ~SmartInterface();
125
132 QMutex* smartMutex() const;
133
143 virtual void clearSmartInterface() = 0;
144
150 bool clearOnDocumentReload() const;
151
157 void setClearOnDocumentReload(bool clearOnReload);
158
159 //BEGIN New cursor methods
166 virtual int currentRevision() const = 0;
167
172 virtual void releaseRevision(int revision) const = 0;
173
183 virtual void useRevision(int revision) = 0;
184
189 void clearRevision();
190
197 virtual KTextEditor::Cursor translateFromRevision(const KTextEditor::Cursor& cursor, KTextEditor::SmartCursor::InsertBehavior insertBehavior = KTextEditor::SmartCursor::StayOnInsert) const;
198
205 virtual KTextEditor::Range translateFromRevision(const KTextEditor::Range& range, KTextEditor::SmartRange::InsertBehaviors insertBehavior = KTextEditor::SmartRange::ExpandLeft | KTextEditor::SmartRange::ExpandRight) const;
206
224 virtual SmartCursor* newSmartCursor(const Cursor& position = Cursor::start(), SmartCursor::InsertBehavior insertBehavior = SmartCursor::MoveOnInsert) = 0;
225
239 SmartCursor* newSmartCursor(int line, int column, SmartCursor::InsertBehavior insertBehavior = SmartCursor::MoveOnInsert);
240
245 virtual void deleteCursors() = 0;
246 //END
247
248 //BEGIN New range methods
263 virtual SmartRange* newSmartRange(const Range& range = Range(),
264 SmartRange* parent = 0L,
265 SmartRange::InsertBehaviors insertBehavior = SmartRange::DoNotExpand) = 0;
266
276 SmartRange* newSmartRange(const Cursor& startPosition,
277 const Cursor& endPosition,
278 SmartRange* parent = 0L,
279 SmartRange::InsertBehaviors insertBehavior = SmartRange::DoNotExpand);
280
292 SmartRange* newSmartRange(int startLine, int startColumn, int endLine, int endColumn, SmartRange* parent = 0L, SmartRange::InsertBehaviors insertBehavior = SmartRange::DoNotExpand);
293
302 virtual SmartRange* newSmartRange(SmartCursor* start, SmartCursor* end, SmartRange* parent = 0L, SmartRange::InsertBehaviors insertBehavior = SmartRange::DoNotExpand) = 0;
303
317 virtual void unbindSmartRange(SmartRange* range) = 0;
318
325 virtual void deleteRanges() = 0;
326 //END
327
328 //BEGIN Syntax highlighting extension
345 virtual void addHighlightToDocument(SmartRange* topRange, bool supportDynamic = false) = 0;
346
353 virtual void removeHighlightFromDocument(SmartRange* topRange) = 0;
354
360 virtual const QList<SmartRange*> documentHighlights() const = 0;
361
365 virtual void clearDocumentHighlights() = 0;
366
375 virtual void addHighlightToView(View* view, SmartRange* topRange, bool supportDynamic = false) = 0;
376
388 virtual void removeHighlightFromView(View* view, SmartRange* topRange) = 0;
389
401 virtual const QList<SmartRange*> viewHighlights(View* view) const = 0;
402
408 virtual void clearViewHighlights(View* view) = 0;
409 //END
410
411 //BEGIN Action binding extension - not implemented
412 /* not implemented
413 * Register a SmartRange tree as providing bound actions,
414 * and that they should interact with all of the views of a document.
415 *
416 * \param topRange the top range of the tree to add
417 */
418 virtual void addActionsToDocument(SmartRange* topRange) = 0;
419
420 /* not implemented
421 * Remove a SmartRange tree from providing bound actions
422 * to all of the views of a document.
423 *
424 * \param topRange the top range of the tree to remove
425 */
426 virtual void removeActionsFromDocument(SmartRange* topRange) = 0;
427
428 /* not implemented
429 * Return a list of SmartRange%s which are currently registered as
430 * providing bound actions to all of the views of a document.
431 */
432 virtual const QList<SmartRange*> documentActions() const = 0;
433
434 /* not implemented
435 * Remove all bound SmartRange%s which provide actions to the document.
436 */
437 virtual void clearDocumentActions() = 0;
438
439 /* not implemented
440 * Register a SmartRange tree as providing bound actions,
441 * and that they should interact with the specified \p view.
442 *
443 * \param view view on which to use the actions
444 * \param topRange the top range of the tree to add
445 */
446 virtual void addActionsToView(View* view, SmartRange* topRange) = 0;
447
448 /* not implemented
449 * Remove a SmartRange tree from providing bound actions
450 * to the specified \p view.
451 *
452 * \note implementations should not take into account document-bound
453 * action ranges when calling this function; it is intended solely
454 * to be the counter of addActionsToView()
455 *
456 * \param view view on which the actions were previously used
457 * \param topRange the top range of the tree to remove
458 */
459 virtual void removeActionsFromView(View* view, SmartRange* topRange) = 0;
460
461 /* not implemented
462 * Return a list of SmartRange%s which are currently registered as
463 * providing bound actions to the specified \p view.
464 *
465 * \note implementations should not take into account document-bound
466 * action ranges when returning the list; it is intended solely
467 * to show actions added via addActionsToView()
468 *
469 * \param view view to query for the action list
470 */
471 virtual const QList<SmartRange*> viewActions(View* view) const = 0;
472
473 /* not implemented
474 * Remove all bound SmartRange%s which provide actions to the specified \p view.
475 *
476 * \param view view from which to remove actions
477 */
478 virtual void clearViewActions(View* view) = 0;
479 //END
480
481 protected:
488 virtual void attributeDynamic(Attribute::Ptr a) = 0;
495 virtual void attributeNotDynamic(Attribute::Ptr a) = 0;
496
497 private:
498 class SmartInterfacePrivate* const d;
499};
500
501}
502
503Q_DECLARE_INTERFACE(KTextEditor::SmartInterface, "org.kde.KTextEditor.SmartInterface")
504
505#endif
506
507// kate: space-indent on; indent-width 2; replace-tabs on;
KSharedPtr< Attribute >
KTextEditor::Attribute
A class which provides customized text decorations.
Definition: attribute.h:61
KTextEditor::Cursor
An object which represents a position in a Document.
Definition: cursor.h:62
KTextEditor::Range
An object representing a section of text, from one Cursor to another.
Definition: range.h:55
KTextEditor::SmartCursor
A Cursor which is bound to a specific Document, and maintains its position.
Definition: smartcursor.h:66
KTextEditor::SmartCursor::InsertBehavior
InsertBehavior
Definition: smartcursor.h:187
KTextEditor::SmartCursor::StayOnInsert
@ StayOnInsert
Definition: smartcursor.h:188
KTextEditor::SmartInterface
A Document extension interface for handling SmartCursors and SmartRanges.
Definition: smartinterface.h:119
KTextEditor::SmartInterface::addActionsToDocument
virtual void addActionsToDocument(SmartRange *topRange)=0
KTextEditor::SmartInterface::unbindSmartRange
virtual void unbindSmartRange(SmartRange *range)=0
Delete a SmartRange without deleting the SmartCursors which make up its start() and end().
KTextEditor::SmartInterface::newSmartRange
virtual SmartRange * newSmartRange(const Range &range=Range(), SmartRange *parent=0L, SmartRange::InsertBehaviors insertBehavior=SmartRange::DoNotExpand)=0
Creates a new SmartRange.
KTextEditor::SmartInterface::clearViewActions
virtual void clearViewActions(View *view)=0
KTextEditor::SmartInterface::newSmartCursor
virtual SmartCursor * newSmartCursor(const Cursor &position=Cursor::start(), SmartCursor::InsertBehavior insertBehavior=SmartCursor::MoveOnInsert)=0
Creates a new SmartCursor.
KTextEditor::SmartInterface::viewHighlights
virtual const QList< SmartRange * > viewHighlights(View *view) const =0
Return a list of SmartRanges which are currently registered as providing arbitrary highlighting infor...
KTextEditor::SmartInterface::clearSmartInterface
virtual void clearSmartInterface()=0
Clears or deletes all instances of smart objects, ie:
KTextEditor::SmartInterface::deleteCursors
virtual void deleteCursors()=0
Delete all SmartCursors from this document, with the exception of those cursors currently bound to ra...
KTextEditor::SmartInterface::viewActions
virtual const QList< SmartRange * > viewActions(View *view) const =0
KTextEditor::SmartInterface::documentHighlights
virtual const QList< SmartRange * > documentHighlights() const =0
Return a list of SmartRanges which are currently registered as providing arbitrary highlighting infor...
KTextEditor::SmartInterface::removeHighlightFromDocument
virtual void removeHighlightFromDocument(SmartRange *topRange)=0
Remove a SmartRange tree from providing arbitrary highlighting information to all of the views of a d...
KTextEditor::SmartInterface::documentActions
virtual const QList< SmartRange * > documentActions() const =0
KTextEditor::SmartInterface::useRevision
virtual void useRevision(int revision)=0
Tell the smart interface to work against the given revision when creating cursors and ranges.
KTextEditor::SmartInterface::addActionsToView
virtual void addActionsToView(View *view, SmartRange *topRange)=0
KTextEditor::SmartInterface::newSmartRange
virtual SmartRange * newSmartRange(SmartCursor *start, SmartCursor *end, SmartRange *parent=0L, SmartRange::InsertBehaviors insertBehavior=SmartRange::DoNotExpand)=0
Creates a new SmartRange from pre-existing SmartCursors.
KTextEditor::SmartInterface::attributeDynamic
virtual void attributeDynamic(Attribute::Ptr a)=0
KTextEditor::SmartInterface::releaseRevision
virtual void releaseRevision(int revision) const =0
Release a revision token provided by currentRevision().
KTextEditor::SmartInterface::translateFromRevision
virtual KTextEditor::Range translateFromRevision(const KTextEditor::Range &range, KTextEditor::SmartRange::InsertBehaviors insertBehavior=KTextEditor::SmartRange::ExpandLeft|KTextEditor::SmartRange::ExpandRight) const
Translate the given range against the revision specified through useRevision(), using the given inser...
KTextEditor::SmartInterface::removeActionsFromView
virtual void removeActionsFromView(View *view, SmartRange *topRange)=0
KTextEditor::SmartInterface::attributeNotDynamic
virtual void attributeNotDynamic(Attribute::Ptr a)=0
KTextEditor::SmartInterface::addHighlightToDocument
virtual void addHighlightToDocument(SmartRange *topRange, bool supportDynamic=false)=0
Register a SmartRange tree as providing arbitrary highlighting information, and that it should be ren...
KTextEditor::SmartInterface::deleteRanges
virtual void deleteRanges()=0
Delete all SmartRanges from this document.
KTextEditor::SmartInterface::clearViewHighlights
virtual void clearViewHighlights(View *view)=0
Clear the highlight ranges from a View.
KTextEditor::SmartInterface::removeHighlightFromView
virtual void removeHighlightFromView(View *view, SmartRange *topRange)=0
Remove a SmartRange tree from providing arbitrary highlighting information to a specific view of a do...
KTextEditor::SmartInterface::removeActionsFromDocument
virtual void removeActionsFromDocument(SmartRange *topRange)=0
KTextEditor::SmartInterface::clearDocumentActions
virtual void clearDocumentActions()=0
KTextEditor::SmartInterface::addHighlightToView
virtual void addHighlightToView(View *view, SmartRange *topRange, bool supportDynamic=false)=0
Register a SmartRange tree as providing arbitrary highlighting information, and that it should be ren...
KTextEditor::SmartInterface::currentRevision
virtual int currentRevision() const =0
Retrieve a token representing the current version of the document.
KTextEditor::SmartInterface::clearDocumentHighlights
virtual void clearDocumentHighlights()=0
Clear the highlight ranges from a Document.
KTextEditor::SmartRange
A Range which is bound to a specific Document, and maintains its position.
Definition: smartrange.h:95
KTextEditor::SmartRange::ExpandRight
@ ExpandRight
Expand to encapsulate new characters to the right of the range.
Definition: smartrange.h:106
KTextEditor::SmartRange::ExpandLeft
@ ExpandLeft
Expand to encapsulate new characters to the left of the range.
Definition: smartrange.h:104
KTextEditor::View
A text widget with KXMLGUIClient that represents a Document.
Definition: view.h:146
QList
ktexteditor_export.h
KTextEditor
Namespace for the KDE Text Editor Interfaces.
Definition: annotationinterface.h:31
smartrange.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal