KTextEditor

movinginterface.h
1 /* SPDX-License-Identifier: LGPL-2.0-or-later
2 
3  Copyright (C) 2010 Christoph Cullmann <[email protected]>
4 
5  Based on code of the SmartCursor/Range by:
6  Copyright (C) 2003-2005 Hamish Rodda <[email protected]>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
23 
24 #ifndef KTEXTEDITOR_MOVINGINTERFACE_H
25 #define KTEXTEDITOR_MOVINGINTERFACE_H
26 
27 #include <ktexteditor/movingcursor.h>
28 #include <ktexteditor/movingrange.h>
29 #include <ktexteditor/movingrangefeedback.h>
30 #include <ktexteditor_export.h>
31 
32 namespace KTextEditor
33 {
48 class KTEXTEDITOR_EXPORT MovingInterface
49 {
50  //
51  // Constructor/Destructor
52  //
53 public:
58 
62  virtual ~MovingInterface();
63 
64  //
65  // Normal API
66  //
67 public:
74  virtual MovingCursor *newMovingCursor(const Cursor &position, MovingCursor::InsertBehavior insertBehavior = MovingCursor::MoveOnInsert) = 0;
75 
84 
89  virtual qint64 revision() const = 0;
90 
95  virtual qint64 lastSavedRevision() const = 0;
96 
102  virtual void lockRevision(qint64 revision) = 0;
103 
108  virtual void unlockRevision(qint64 revision) = 0;
109 
117  virtual void transformCursor(KTextEditor::Cursor &cursor, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision = -1) = 0;
118 
127  virtual void transformCursor(int &line, int &column, KTextEditor::MovingCursor::InsertBehavior insertBehavior, qint64 fromRevision, qint64 toRevision = -1) = 0;
128 
137  virtual void transformRange(KTextEditor::Range &range, KTextEditor::MovingRange::InsertBehaviors insertBehaviors, MovingRange::EmptyBehavior emptyBehavior, qint64 fromRevision, qint64 toRevision = -1) = 0;
138 
139  //
140  // Signals
141  //
142 public:
149 
158 
159 private:
163  class MovingInterfacePrivate *const d = nullptr;
164 };
165 
166 }
167 
168 Q_DECLARE_INTERFACE(KTextEditor::MovingInterface, "org.kde.KTextEditor.MovingInterface")
169 
170 #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:179
A Cursor which is bound to a specific Document, and maintains its position.
Definition: movingcursor.h:68
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:157
Don&#39;t expand to encapsulate new characters in either direction. This is the default.
Definition: movingrange.h:167
The Cursor represents a position in a Document.
Definition: cursor.h:85
InsertBehavior
Insert behavior of this cursor, should it stay if text is insert at its position or should it move...
Definition: movingcursor.h:78
A KParts derived class representing a text document.
Definition: document.h:199
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:180
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...
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-2020 The KDE developers.
Generated on Fri Aug 7 2020 22:55:47 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.