KTextEditor
smartinterface.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2005 Hamish Rodda <rodda@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KDELIBS_KTEXTEDITOR_SMARTINTERFACE_H 00021 #define KDELIBS_KTEXTEDITOR_SMARTINTERFACE_H 00022 00023 #include <ktexteditor/ktexteditor_export.h> 00024 #include <ktexteditor/smartrange.h> 00025 00026 class QMutex; 00027 00028 namespace KTextEditor 00029 { 00030 class Document; 00031 class View; 00032 class SmartCursor; 00033 00118 class KTEXTEDITOR_EXPORT SmartInterface 00119 { 00120 friend class Attribute; 00121 00122 public: 00123 SmartInterface(); 00124 virtual ~SmartInterface(); 00125 00132 QMutex* smartMutex() const; 00133 00143 virtual void clearSmartInterface() = 0; 00144 00150 bool clearOnDocumentReload() const; 00151 00157 void setClearOnDocumentReload(bool clearOnReload); 00158 00159 //BEGIN New cursor methods 00166 virtual int currentRevision() const = 0; 00167 00172 virtual void releaseRevision(int revision) const = 0; 00173 00183 virtual void useRevision(int revision) = 0; 00184 00189 void clearRevision(); 00190 00197 virtual KTextEditor::Cursor translateFromRevision(const KTextEditor::Cursor& cursor, KTextEditor::SmartCursor::InsertBehavior insertBehavior = KTextEditor::SmartCursor::StayOnInsert) const; 00198 00205 virtual KTextEditor::Range translateFromRevision(const KTextEditor::Range& range, KTextEditor::SmartRange::InsertBehaviors insertBehavior = KTextEditor::SmartRange::ExpandLeft | KTextEditor::SmartRange::ExpandRight) const; 00206 00224 virtual SmartCursor* newSmartCursor(const Cursor& position = Cursor::start(), SmartCursor::InsertBehavior insertBehavior = SmartCursor::MoveOnInsert) = 0; 00225 00239 SmartCursor* newSmartCursor(int line, int column, SmartCursor::InsertBehavior insertBehavior = SmartCursor::MoveOnInsert); 00240 00245 virtual void deleteCursors() = 0; 00246 //END 00247 00248 //BEGIN New range methods 00263 virtual SmartRange* newSmartRange(const Range& range = Range(), 00264 SmartRange* parent = 0L, 00265 SmartRange::InsertBehaviors insertBehavior = SmartRange::DoNotExpand) = 0; 00266 00276 SmartRange* newSmartRange(const Cursor& startPosition, 00277 const Cursor& endPosition, 00278 SmartRange* parent = 0L, 00279 SmartRange::InsertBehaviors insertBehavior = SmartRange::DoNotExpand); 00280 00292 SmartRange* newSmartRange(int startLine, int startColumn, int endLine, int endColumn, SmartRange* parent = 0L, SmartRange::InsertBehaviors insertBehavior = SmartRange::DoNotExpand); 00293 00302 virtual SmartRange* newSmartRange(SmartCursor* start, SmartCursor* end, SmartRange* parent = 0L, SmartRange::InsertBehaviors insertBehavior = SmartRange::DoNotExpand) = 0; 00303 00317 virtual void unbindSmartRange(SmartRange* range) = 0; 00318 00325 virtual void deleteRanges() = 0; 00326 //END 00327 00328 //BEGIN Syntax highlighting extension 00345 virtual void addHighlightToDocument(SmartRange* topRange, bool supportDynamic = false) = 0; 00346 00353 virtual void removeHighlightFromDocument(SmartRange* topRange) = 0; 00354 00360 virtual const QList<SmartRange*> documentHighlights() const = 0; 00361 00365 virtual void clearDocumentHighlights() = 0; 00366 00375 virtual void addHighlightToView(View* view, SmartRange* topRange, bool supportDynamic = false) = 0; 00376 00388 virtual void removeHighlightFromView(View* view, SmartRange* topRange) = 0; 00389 00401 virtual const QList<SmartRange*> viewHighlights(View* view) const = 0; 00402 00408 virtual void clearViewHighlights(View* view) = 0; 00409 //END 00410 00411 //BEGIN Action binding extension - not implemented 00412 /* not implemented 00413 * Register a SmartRange tree as providing bound actions, 00414 * and that they should interact with all of the views of a document. 00415 * 00416 * \param topRange the top range of the tree to add 00417 */ 00418 virtual void addActionsToDocument(SmartRange* topRange) = 0; 00419 00420 /* not implemented 00421 * Remove a SmartRange tree from providing bound actions 00422 * to all of the views of a document. 00423 * 00424 * \param topRange the top range of the tree to remove 00425 */ 00426 virtual void removeActionsFromDocument(SmartRange* topRange) = 0; 00427 00428 /* not implemented 00429 * Return a list of SmartRange%s which are currently registered as 00430 * providing bound actions to all of the views of a document. 00431 */ 00432 virtual const QList<SmartRange*> documentActions() const = 0; 00433 00434 /* not implemented 00435 * Remove all bound SmartRange%s which provide actions to the document. 00436 */ 00437 virtual void clearDocumentActions() = 0; 00438 00439 /* not implemented 00440 * Register a SmartRange tree as providing bound actions, 00441 * and that they should interact with the specified \p view. 00442 * 00443 * \param view view on which to use the actions 00444 * \param topRange the top range of the tree to add 00445 */ 00446 virtual void addActionsToView(View* view, SmartRange* topRange) = 0; 00447 00448 /* not implemented 00449 * Remove a SmartRange tree from providing bound actions 00450 * to the specified \p view. 00451 * 00452 * \note implementations should not take into account document-bound 00453 * action ranges when calling this function; it is intended solely 00454 * to be the counter of addActionsToView() 00455 * 00456 * \param view view on which the actions were previously used 00457 * \param topRange the top range of the tree to remove 00458 */ 00459 virtual void removeActionsFromView(View* view, SmartRange* topRange) = 0; 00460 00461 /* not implemented 00462 * Return a list of SmartRange%s which are currently registered as 00463 * providing bound actions to the specified \p view. 00464 * 00465 * \note implementations should not take into account document-bound 00466 * action ranges when returning the list; it is intended solely 00467 * to show actions added via addActionsToView() 00468 * 00469 * \param view view to query for the action list 00470 */ 00471 virtual const QList<SmartRange*> viewActions(View* view) const = 0; 00472 00473 /* not implemented 00474 * Remove all bound SmartRange%s which provide actions to the specified \p view. 00475 * 00476 * \param view view from which to remove actions 00477 */ 00478 virtual void clearViewActions(View* view) = 0; 00479 //END 00480 00481 protected: 00488 virtual void attributeDynamic(Attribute::Ptr a) = 0; 00495 virtual void attributeNotDynamic(Attribute::Ptr a) = 0; 00496 00497 private: 00498 class SmartInterfacePrivate* const d; 00499 }; 00500 00501 } 00502 00503 Q_DECLARE_INTERFACE(KTextEditor::SmartInterface, "org.kde.KTextEditor.SmartInterface") 00504 00505 #endif 00506 00507 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE 4.6 API Reference