• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • kde-4.14
  • applications
  • kate
  • 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 
26 class QMutex;
27 
28 namespace KTextEditor
29 {
30 class Document;
31 class View;
32 class SmartCursor;
33 
118 class 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 
503 Q_DECLARE_INTERFACE(KTextEditor::SmartInterface, "org.kde.KTextEditor.SmartInterface")
504 
505 #endif
506 
507 // kate: space-indent on; indent-width 2; replace-tabs on;
KTextEditor::SmartCursor::StayOnInsert
Definition: smartcursor.h:188
QMutex
KTextEditor::Attribute
A class which provides customized text decorations.
Definition: attribute.h:58
KTextEditor::SmartCursor::InsertBehavior
InsertBehavior
Definition: smartcursor.h:187
KTextEditor::SmartRange
A Range which is bound to a specific Document, and maintains its position.
Definition: smartrange.h:94
KTextEditor::Cursor::start
static Cursor start()
Returns a cursor representing the start of any document - i.e., line 0, column 0. ...
Definition: cursor.cpp:57
smartrange.h
KTextEditor::Cursor
An object which represents a position in a Document.
Definition: cursor.h:55
KTextEditor::SmartRange::ExpandRight
Expand to encapsulate new characters to the right of the range.
Definition: smartrange.h:106
ktexteditor_export.h
KTextEditor::Attribute::Ptr
KSharedPtr< Attribute > Ptr
Definition: attribute.h:61
KTextEditor::SmartCursor
A Cursor which is bound to a specific Document, and maintains its position.
Definition: smartcursor.h:65
KTEXTEDITOR_EXPORT
#define KTEXTEDITOR_EXPORT
Definition: ktexteditor_export.h:35
KTextEditor::SmartRange::ExpandLeft
Expand to encapsulate new characters to the left of the range.
Definition: smartrange.h:104
QList
KTextEditor::Range
An object representing a section of text, from one Cursor to another.
Definition: range.h:54
KTextEditor::SmartInterface
A Document extension interface for handling SmartCursors and SmartRanges.
Definition: smartinterface.h:118
KTextEditor::SmartCursor::MoveOnInsert
Definition: smartcursor.h:189
KTextEditor::View
A text widget with KXMLGUIClient that represents a Document.
Definition: view.h:145
KTextEditor::SmartRange::DoNotExpand
Don't expand to encapsulate new characters in either direction. This is the default.
Definition: smartrange.h:102
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:48 by doxygen 1.8.7 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

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



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