KTextEditor

movinginterface.h
1 /*
2  SPDX-FileCopyrightText: 2010 Christoph Cullmann <[email protected]>
3 
4  Based on code of the SmartCursor/Range by:
5  SPDX-FileCopyrightText: 2003-2005 Hamish Rodda <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #ifndef KTEXTEDITOR_MOVINGINTERFACE_H
11 #define KTEXTEDITOR_MOVINGINTERFACE_H
12 
13 #include <ktexteditor/movingcursor.h>
14 #include <ktexteditor/movingrange.h>
15 #include <ktexteditor/movingrangefeedback.h>
16 #include <ktexteditor_export.h>
17 
18 namespace KTextEditor
19 {
34 class KTEXTEDITOR_EXPORT MovingInterface
35 {
36  //
37  // Constructor/Destructor
38  //
39 public:
44 
48  virtual ~MovingInterface();
49 
50  //
51  // Normal API
52  //
53 public:
60  virtual MovingCursor *newMovingCursor(const Cursor &position, MovingCursor::InsertBehavior insertBehavior = MovingCursor::MoveOnInsert) = 0;
61 
69  virtual MovingRange *newMovingRange(const Range &range,
72 
77  virtual qint64 revision() const = 0;
78 
83  virtual qint64 lastSavedRevision() const = 0;
84 
90  virtual void lockRevision(qint64 revision) = 0;
91 
96  virtual void unlockRevision(qint64 revision) = 0;
97 
105  virtual void
106  transformCursor(KTextEditor::Cursor &cursor, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision = -1) = 0;
107 
116  virtual void
117  transformCursor(int &line, int &column, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision = -1) = 0;
118 
127  virtual void transformRange(KTextEditor::Range &range,
129  MovingRange::EmptyBehavior emptyBehavior,
130  qint64 fromRevision,
131  qint64 toRevision = -1) = 0;
132 
133  //
134  // Signals
135  //
136 public:
143 
152 
153 private:
157  class MovingInterfacePrivate *const d = nullptr;
158 };
159 
160 }
161 
162 Q_DECLARE_INTERFACE(KTextEditor::MovingInterface, "org.kde.KTextEditor.MovingInterface")
163 
164 #endif
KTextEditor::MovingRange * newMovingRange(const KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors=KTextEditor::MovingRange::DoNotExpand, KTextEditor::MovingRange::EmptyBehavior emptyBehavior=KTextEditor::MovingRange::AllowEmpty) override
Create a new moving range for this document.
void aboutToDeleteMovingInterfaceContent(KTextEditor::Document *document)
This signal is emitted before the cursors/ranges/revisions of a document are destroyed as the documen...
void unlockRevision(qint64 revision) override
Release a revision.
EmptyBehavior
Behavior of range if it becomes empty.
Definition: movingrange.h:166
A Cursor which is bound to a specific Document, and maintains its position.
Definition: movingcursor.h:54
void lockRevision(qint64 revision) override
Lock a revision, this will keep it around until released again.
A range that is bound to a specific Document, and maintains its position.
Definition: movingrange.h:144
Don&#39;t expand to encapsulate new characters in either direction. This is the default.
Definition: movingrange.h:154
The Cursor represents a position in a Document.
Definition: cursor.h:71
InsertBehavior
Insert behavior of this cursor, should it stay if text is insert at its position or should it move...
Definition: movingcursor.h:64
A KParts derived class representing a text document.
Definition: document.h:185
Document interface for MovingCursors and MovingRanges.
qint64 lastSavedRevision() const override
Last revision the buffer got successful saved.
qint64 revision() const override
Current revision.
MovingInterface()
Default constructor.
allow range to be empty
Definition: movingrange.h:167
KTextEditor::MovingCursor * newMovingCursor(const KTextEditor::Cursor &position, KTextEditor::MovingCursor::InsertBehavior insertBehavior=KTextEditor::MovingCursor::MoveOnInsert) override
Create a new moving cursor for this document.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Definition: katetextblock.h:21
An object representing a section of text, from one Cursor to another.
virtual ~MovingInterface()
Virtual destructor.
void transformCursor(KTextEditor::Cursor &cursor, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision=-1) override
Transform a cursor from one revision to an other.
void aboutToInvalidateMovingInterfaceContent(KTextEditor::Document *document)
This signal is emitted before the ranges of a document are invalidated and the revisions are deleted ...
void transformRange(KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors, KTextEditor::MovingRange::EmptyBehavior emptyBehavior, qint64 fromRevision, qint64 toRevision=-1) override
Transform a range from one revision to an other.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 27 2021 22:56:57 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.