katesupercursor.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KATESUPERCURSOR_H
00020 #define KATESUPERCURSOR_H
00021
00022 #include "katecursor.h"
00023
00024 class KateDocument;
00025 class KateView;
00026
00045 class KateSuperCursor : public QObject, public KateDocCursor, public Kate::Cursor
00046 {
00047 Q_OBJECT
00048
00049 public:
00055 KateSuperCursor(KateDocument* doc, bool privateC, const KateTextCursor& cursor, QObject* parent = 0L, const char* name = 0L);
00056 KateSuperCursor(KateDocument* doc, bool privateC, int lineNum = 0, int col = 0, QObject* parent = 0L, const char* name = 0L);
00057
00058 ~KateSuperCursor ();
00059
00060 public:
00061
00062 void position(uint *line, uint *col) const;
00063 bool setPosition(uint line, uint col);
00064 bool insertText(const QString& text);
00065 bool removeText(uint numberOfCharacters);
00066 QChar currentChar() const;
00067
00071 bool atStartOfLine() const;
00072
00076 bool atEndOfLine() const;
00077
00082 bool moveOnInsert() const;
00083
00089 void setMoveOnInsert(bool moveOnInsert);
00090
00094 operator QString();
00095
00096
00097 virtual void setLine(int lineNum);
00098 virtual void setCol(int colNum);
00099 virtual void setPos(const KateTextCursor& pos);
00100 virtual void setPos(int lineNum, int colNum);
00101
00102 signals:
00106 void positionDirectlyChanged();
00107
00111 void positionChanged();
00112
00116 void positionUnChanged();
00117
00122 void positionDeleted();
00123
00132 void charInsertedAt();
00133
00137 void charDeletedBefore();
00138
00142 void charDeletedAfter();
00143
00144
00145 public:
00146 void editTextInserted ( uint line, uint col, uint len);
00147 void editTextRemoved ( uint line, uint col, uint len);
00148
00149 void editLineWrapped ( uint line, uint col, bool newLine = true );
00150 void editLineUnWrapped ( uint line, uint col, bool removeLine = true, uint length = 0 );
00151
00152 void editLineInserted ( uint line );
00153 void editLineRemoved ( uint line );
00154
00155
00156 private:
00157 KateDocument *m_doc;
00158 bool m_moveOnInsert : 1;
00159 bool m_lineRemoved : 1;
00160 bool m_privateCursor : 1;
00161 };
00162
00168 class KateSuperRange : public QObject, public KateRange
00169 {
00170 friend class KateSuperRangeList;
00171
00172 Q_OBJECT
00173
00174 public:
00176 enum InsertBehaviour {
00178 DoNotExpand = 0,
00180 ExpandLeft = 0x1,
00182 ExpandRight = 0x2
00183 };
00184
00188 KateSuperRange(KateSuperCursor* start, KateSuperCursor* end, QObject* parent = 0L, const char* name = 0L);
00189 KateSuperRange(KateDocument* doc, const KateRange& range, QObject* parent = 0L, const char* name = 0L);
00190 KateSuperRange(KateDocument* doc, const KateTextCursor& start, const KateTextCursor& end, QObject* parent = 0L, const char* name = 0L);
00191
00192 virtual ~KateSuperRange();
00193
00194
00195 virtual KateTextCursor& start();
00196 virtual KateTextCursor& end();
00197 virtual const KateTextCursor& start() const;
00198 virtual const KateTextCursor& end() const;
00199
00203 KateSuperCursor& superStart();
00204 const KateSuperCursor& superStart() const;
00205
00209 KateSuperCursor& superEnd();
00210 const KateSuperCursor& superEnd() const;
00211
00215 int behaviour() const;
00216
00225 void setBehaviour(int behaviour);
00226
00230 virtual bool isValid() const;
00231
00243 bool owns(const KateTextCursor& cursor) const;
00244
00249 bool includes(const KateTextCursor& cursor) const;
00250
00254 bool includes(uint lineNum) const;
00255
00259 bool includesWholeLine(uint lineNum) const;
00260
00264 bool boundaryAt(const KateTextCursor& cursor) const;
00265
00269 bool boundaryOn(uint lineNum) const;
00270
00271 signals:
00281 void positionChanged();
00282
00286 void positionUnChanged();
00287
00291 void contentsChanged();
00292
00296 void boundaryDeleted();
00297
00304 void eliminated();
00305
00309 void tagRange(KateSuperRange* range);
00310
00311 public slots:
00312 void slotTagRange();
00313
00314 private slots:
00315 void slotEvaluateChanged();
00316 void slotEvaluateUnChanged();
00317
00318 private:
00319 void init();
00320 void evaluateEliminated();
00321 void evaluatePositionChanged();
00322
00323 KateSuperCursor* m_start;
00324 KateSuperCursor* m_end;
00325 bool m_evaluate;
00326 bool m_startChanged;
00327 bool m_endChanged;
00328 bool m_deleteCursors;
00329 };
00330
00331 class KateSuperCursorList : public QPtrList<KateSuperCursor>
00332 {
00333 protected:
00334 virtual int compareItems(QPtrCollection::Item item1, QPtrCollection::Item item2);
00335 };
00336
00337 class KateSuperRangeList : public QObject, public QPtrList<KateSuperRange>
00338 {
00339 Q_OBJECT
00340
00341 public:
00345 KateSuperRangeList(bool autoManage = true, QObject* parent = 0L, const char* name = 0L);
00346
00356 KateSuperRangeList(const QPtrList<KateSuperRange>& rangeList, QObject* parent = 0L, const char* name = 0L);
00357
00363 void appendList(const QPtrList<KateSuperRange>& rangeList);
00364
00369 void connectAll();
00370
00374 virtual void clear();
00375
00380 bool autoManage() const;
00381
00385 void setAutoManage(bool autoManage);
00386
00391 QPtrList<KateSuperRange> rangesIncluding(const KateTextCursor& cursor);
00392 QPtrList<KateSuperRange> rangesIncluding(uint line);
00393
00398 bool rangesInclude(const KateTextCursor& cursor);
00399
00406 KateSuperCursor* firstBoundary(const KateTextCursor* start = 0L);
00407
00411 KateSuperCursor* nextBoundary();
00412
00416 KateSuperCursor* currentBoundary();
00417
00418 signals:
00423 void rangeEliminated(KateSuperRange* range);
00424
00428 void listEmpty();
00429
00433 void tagRange(KateSuperRange* range);
00434
00435 protected:
00439 virtual int compareItems(QPtrCollection::Item item1, QPtrCollection::Item item2);
00440
00444 virtual QPtrCollection::Item newItem(QPtrCollection::Item d);
00445
00446 private slots:
00447 void slotEliminated();
00448 void slotDeleted(QObject* range);
00449
00450 private:
00451 bool m_autoManage;
00452 bool m_connect;
00453
00454 KateSuperCursorList m_columnBoundaries;
00455 bool m_trackingBoundaries;
00456 };
00457
00458 #endif
This file is part of the documentation for kate Library Version 3.2.2.