kate Library API Documentation

katedocument.h

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2001-2004 Christoph Cullmann <cullmann@kde.org> 00003 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> 00004 Copyright (C) 1999 Jochen Wilhelmy <digisnap@cs.tu-berlin.de> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 00021 #ifndef _KATE_DOCUMENT_H_ 00022 #define _KATE_DOCUMENT_H_ 00023 00024 #include "katesupercursor.h" 00025 #include "katetextline.h" 00026 #include "kateundo.h" 00027 #include "katebuffer.h" 00028 #include "katecodefoldinghelpers.h" 00029 00030 #include "../interfaces/document.h" 00031 00032 #include <ktexteditor/configinterfaceextension.h> 00033 #include <ktexteditor/encodinginterface.h> 00034 #include <ktexteditor/sessionconfiginterface.h> 00035 #include <ktexteditor/editinterfaceext.h> 00036 #include <ktexteditor/templateinterface.h> 00037 00038 #include <dcopobject.h> 00039 00040 #include <kmimetype.h> 00041 #include <klocale.h> 00042 00043 #include <qintdict.h> 00044 #include <qmap.h> 00045 #include <qdatetime.h> 00046 00047 namespace KTextEditor { class Plugin; } 00048 00049 namespace KIO { class TransferJob; } 00050 00051 class KateUndoGroup; 00052 class KateCmd; 00053 class KateAttribute; 00054 class KateAutoIndent; 00055 class KateCodeFoldingTree; 00056 class KateBuffer; 00057 class KateView; 00058 class KateViewInternal; 00059 class KateArbitraryHighlight; 00060 class KateSuperRange; 00061 class KateLineInfo; 00062 class KateBrowserExtension; 00063 class KateDocumentConfig; 00064 class KateHighlighting; 00065 class KatePartPluginItem; 00066 class KatePartPluginInfo; 00067 00068 class KSpell; 00069 class KTempFile; 00070 00071 class QTimer; 00072 00073 class KateKeyInterceptorFunctor; 00074 00075 // 00076 // Kate KTextEditor::Document class (and even KTextEditor::Editor ;) 00077 // 00078 class KateDocument : public Kate::Document, 00079 public Kate::DocumentExt, 00080 public KTextEditor::ConfigInterfaceExtension, 00081 public KTextEditor::EncodingInterface, 00082 public KTextEditor::SessionConfigInterface, 00083 public KTextEditor::EditInterfaceExt, 00084 public KTextEditor::TemplateInterface, 00085 public DCOPObject 00086 { 00087 K_DCOP 00088 Q_OBJECT 00089 00090 friend class KateViewInternal; 00091 friend class KateRenderer; 00092 00093 public: 00094 KateDocument (bool bSingleViewMode=false, bool bBrowserView=false, bool bReadOnly=false, 00095 QWidget *parentWidget = 0, const char *widgetName = 0, QObject * = 0, const char * = 0); 00096 ~KateDocument (); 00097 00098 bool closeURL(); 00099 00100 // 00101 // Plugins section 00102 // 00103 public: 00104 void unloadAllPlugins (); 00105 00106 void enableAllPluginsGUI (KateView *view); 00107 void disableAllPluginsGUI (KateView *view); 00108 00109 void loadPlugin (uint pluginIndex); 00110 void unloadPlugin (uint pluginIndex); 00111 00112 void enablePluginGUI (KTextEditor::Plugin *plugin, KateView *view); 00113 void enablePluginGUI (KTextEditor::Plugin *plugin); 00114 00115 void disablePluginGUI (KTextEditor::Plugin *plugin, KateView *view); 00116 void disablePluginGUI (KTextEditor::Plugin *plugin); 00117 00118 private: 00119 QMemArray<KTextEditor::Plugin *> m_plugins; 00120 00121 public: 00122 bool readOnly () const { return m_bReadOnly; } 00123 bool browserView () const { return m_bBrowserView; } 00124 bool singleViewMode () const { return m_bSingleViewMode; } 00125 KateBrowserExtension *browserExtension () { return m_extension; } 00126 void textAsHtmlStream ( uint startLine, uint startCol, uint endLine, uint endCol, bool blockwise, QTextStream *ts) const; 00127 00128 private: 00129 // only to make part work, don't change it ! 00130 bool m_bSingleViewMode; 00131 bool m_bBrowserView; 00132 bool m_bReadOnly; 00133 KateBrowserExtension *m_extension; 00134 00135 // 00136 // KTextEditor::Document stuff 00137 // 00138 public: 00139 KTextEditor::View *createView( QWidget *parent, const char *name ); 00140 QPtrList<KTextEditor::View> views () const; 00141 00142 inline KateView *activeView () const { return m_activeView; } 00143 00144 private: 00145 QPtrList<KateView> m_views; 00146 QPtrList<KTextEditor::View> m_textEditViews; 00147 KateView *m_activeView; 00148 00158 void setActiveView( KateView *view ); 00159 00160 // 00161 // KTextEditor::ConfigInterfaceExtension stuff 00162 // 00163 public slots: 00164 uint configPages () const; 00165 KTextEditor::ConfigPage *configPage (uint number = 0, QWidget *parent = 0, const char *name=0 ); 00166 QString configPageName (uint number = 0) const; 00167 QString configPageFullName (uint number = 0) const; 00168 QPixmap configPagePixmap (uint number = 0, int size = KIcon::SizeSmall) const; 00169 00170 // 00171 // KTextEditor::EditInterface stuff 00172 // 00173 public slots: 00174 QString text() const; 00175 00176 QString text ( uint startLine, uint startCol, uint endLine, uint endCol ) const; 00177 QString text ( uint startLine, uint startCol, uint endLine, uint endCol, bool blockwise ) const; 00178 00179 QString textAsHtml ( uint startLine, uint startCol, uint endLine, uint endCol, bool blockwise) const; 00180 00181 QString textLine ( uint line ) const; 00182 00183 bool setText(const QString &); 00184 bool clear (); 00185 00186 bool insertText ( uint line, uint col, const QString &s ); 00187 bool insertText ( uint line, uint col, const QString &s, bool blockwise ); 00188 00189 bool removeText ( uint startLine, uint startCol, uint endLine, uint endCol ); 00190 bool removeText ( uint startLine, uint startCol, uint endLine, uint endCol, bool blockwise ); 00191 00192 bool insertLine ( uint line, const QString &s ); 00193 bool removeLine ( uint line ); 00194 00195 uint numLines() const; 00196 uint numVisLines() const; 00197 uint length () const; 00198 int lineLength ( uint line ) const; 00199 00200 signals: 00201 void textChanged (); 00202 void charactersInteractivelyInserted(int ,int ,const QString&); 00203 void charactersSemiInteractivelyInserted(int ,int ,const QString&); 00204 void backspacePressed(); 00205 00206 public: 00207 //BEGIN editStart/editEnd (start, end, undo, cursor update, view update) 00213 void editStart (bool withUndo = true); 00215 void editBegin () { editStart(); } 00220 void editEnd (); 00221 00222 //END editStart/editEnd 00223 00224 //BEGIN LINE BASED INSERT/REMOVE STUFF (editStart() and editEnd() included) 00232 bool editInsertText ( uint line, uint col, const QString &s ); 00240 bool editRemoveText ( uint line, uint col, uint len ); 00241 00250 bool editMarkLineAutoWrapped ( uint line, bool autowrapped ); 00251 00262 bool editWrapLine ( uint line, uint col, bool newLine = true, bool *newLineAdded = 0 ); 00270 bool editUnWrapLine ( uint line, bool removeLine = true, uint length = 0 ); 00271 00278 bool editInsertLine ( uint line, const QString &s ); 00284 bool editRemoveLine ( uint line ); 00285 00292 bool wrapText (uint startLine, uint endLine); 00293 //END LINE BASED INSERT/REMOVE STUFF 00294 00295 signals: 00300 void editTextInserted ( uint line, uint col, uint len); 00301 00305 void editTextRemoved ( uint line, uint col, uint len); 00306 00310 void editLineWrapped ( uint line, uint col, uint len ); 00311 00315 void editLineUnWrapped ( uint line, uint col ); 00316 00320 void editLineInserted ( uint line ); 00321 00325 void editLineRemoved ( uint line ); 00326 00327 private: 00328 void undoStart(); 00329 void undoEnd(); 00330 void undoSafePoint(); 00331 00332 private slots: 00333 void undoCancel(); 00334 00335 private: 00336 void editAddUndo (KateUndoGroup::UndoType type, uint line, uint col, uint len, const QString &text); 00337 void editTagLine (uint line); 00338 void editRemoveTagLine (uint line); 00339 void editInsertTagLine (uint line); 00340 00341 uint editSessionNumber; 00342 bool editIsRunning; 00343 bool noViewUpdates; 00344 bool editWithUndo; 00345 uint editTagLineStart; 00346 uint editTagLineEnd; 00347 bool editTagFrom; 00348 bool m_undoComplexMerge; 00349 KateUndoGroup* m_editCurrentUndo; 00350 00351 // 00352 // KTextEditor::SelectionInterface stuff 00353 // 00354 public slots: 00355 bool setSelection ( const KateTextCursor & start, 00356 const KateTextCursor & end ); 00357 bool setSelection ( uint startLine, uint startCol, 00358 uint endLine, uint endCol ); 00359 bool clearSelection (); 00360 bool clearSelection (bool redraw, bool finishedChangingSelection = true); 00361 00362 bool hasSelection () const; 00363 QString selection () const ; 00364 QString selectionAsHtml () const ; 00365 00366 bool removeSelectedText (); 00367 00368 bool selectAll(); 00369 00370 // 00371 // KTextEditor::SelectionInterfaceExt 00372 // 00373 int selStartLine() { return selectStart.line(); }; 00374 int selStartCol() { return selectStart.col(); }; 00375 int selEndLine() { return selectEnd.line(); }; 00376 int selEndCol() { return selectEnd.col(); }; 00377 00378 private: 00379 // some internal functions to get selection state of a line/col 00380 bool lineColSelected (int line, int col); 00381 bool lineSelected (int line); 00382 bool lineEndSelected (int line, int endCol); 00383 bool lineHasSelected (int line); 00384 bool lineIsSelection (int line); 00385 00386 QPtrList<KateSuperCursor> m_superCursors; 00387 00388 // stores the current selection 00389 KateSuperCursor selectStart; 00390 KateSuperCursor selectEnd; 00391 00392 signals: 00393 void selectionChanged (); 00394 void textInserted(int line,int column); 00395 // 00396 // KTextEditor::BlockSelectionInterface stuff 00397 // 00398 public slots: 00399 bool blockSelectionMode (); 00400 bool setBlockSelectionMode (bool on); 00401 bool toggleBlockSelectionMode (); 00402 00403 private: 00404 // do we select normal or blockwise ? 00405 bool blockSelect; 00406 00407 // 00408 // KTextEditor::UndoInterface stuff 00409 // 00410 public slots: 00411 void undo (); 00412 void redo (); 00413 void clearUndo (); 00414 void clearRedo (); 00415 00416 uint undoCount () const; 00417 uint redoCount () const; 00418 00419 uint undoSteps () const; 00420 void setUndoSteps ( uint steps ); 00421 00422 private: 00423 friend class KateTemplateHandler; 00424 // 00425 // some internals for undo/redo 00426 // 00427 QPtrList<KateUndoGroup> undoItems; 00428 QPtrList<KateUndoGroup> redoItems; 00429 bool m_undoDontMerge; //create a setter later on and remove the friend declaration 00430 bool m_undoIgnoreCancel; 00431 QTimer* m_undoMergeTimer; 00432 // these two variables are for resetting the document to 00433 // non-modified if all changes have been undone... 00434 KateUndoGroup* lastUndoGroupWhenSaved; 00435 bool docWasSavedWhenUndoWasEmpty; 00436 00437 // this sets 00438 void updateModified(); 00439 00440 signals: 00441 void undoChanged (); 00442 00443 // 00444 // KTextEditor::CursorInterface stuff 00445 // 00446 public slots: 00447 KTextEditor::Cursor *createCursor (); 00448 QPtrList<KTextEditor::Cursor> cursors () const; 00449 00450 private: 00451 QPtrList<KTextEditor::Cursor> myCursors; 00452 00453 // 00454 // KTextEditor::SearchInterface stuff 00455 // 00456 public slots: 00457 bool searchText (unsigned int startLine, unsigned int startCol, 00458 const QString &text, unsigned int *foundAtLine, unsigned int *foundAtCol, 00459 unsigned int *matchLen, bool casesensitive = true, bool backwards = false); 00460 bool searchText (unsigned int startLine, unsigned int startCol, 00461 const QRegExp &regexp, unsigned int *foundAtLine, unsigned int *foundAtCol, 00462 unsigned int *matchLen, bool backwards = false); 00463 00464 // 00465 // KTextEditor::HighlightingInterface stuff 00466 // 00467 public slots: 00468 uint hlMode (); 00469 bool setHlMode (uint mode); 00470 uint hlModeCount (); 00471 QString hlModeName (uint mode); 00472 QString hlModeSectionName (uint mode); 00473 00474 public: 00475 void bufferHlChanged (); 00476 00477 private: 00478 void setDontChangeHlOnSave(); 00479 00480 signals: 00481 void hlChanged (); 00482 00483 // 00484 // Kate::ArbitraryHighlightingInterface stuff 00485 // 00486 public: 00487 KateArbitraryHighlight* arbitraryHL() const { return m_arbitraryHL; }; 00488 00489 private slots: 00490 void tagArbitraryLines(KateView* view, KateSuperRange* range); 00491 00492 // 00493 // KTextEditor::ConfigInterface stuff 00494 // 00495 public slots: 00496 void readConfig (); 00497 void writeConfig (); 00498 void readConfig (KConfig *); 00499 void writeConfig (KConfig *); 00500 void readSessionConfig (KConfig *); 00501 void writeSessionConfig (KConfig *); 00502 void configDialog (); 00503 00504 // 00505 // KTextEditor::MarkInterface and MarkInterfaceExtension 00506 // 00507 public slots: 00508 uint mark( uint line ); 00509 00510 void setMark( uint line, uint markType ); 00511 void clearMark( uint line ); 00512 00513 void addMark( uint line, uint markType ); 00514 void removeMark( uint line, uint markType ); 00515 00516 QPtrList<KTextEditor::Mark> marks(); 00517 void clearMarks(); 00518 00519 void setPixmap( MarkInterface::MarkTypes, const QPixmap& ); 00520 void setDescription( MarkInterface::MarkTypes, const QString& ); 00521 QString markDescription( MarkInterface::MarkTypes ); 00522 QPixmap *markPixmap( MarkInterface::MarkTypes ); 00523 QColor markColor( MarkInterface::MarkTypes ); 00524 00525 void setMarksUserChangable( uint markMask ); 00526 uint editableMarks(); 00527 00528 signals: 00529 void marksChanged(); 00530 void markChanged( KTextEditor::Mark, KTextEditor::MarkInterfaceExtension::MarkChangeAction ); 00531 00532 private: 00533 QIntDict<KTextEditor::Mark> m_marks; 00534 QIntDict<QPixmap> m_markPixmaps; 00535 QIntDict<QString> m_markDescriptions; 00536 uint m_editableMarks; 00537 00538 // 00539 // KTextEditor::PrintInterface 00540 // 00541 public slots: 00542 bool printDialog (); 00543 bool print (); 00544 00545 // 00546 // KTextEditor::DocumentInfoInterface ( ### unfinished ) 00547 // 00548 public: 00558 QString mimeType(); 00559 00567 long fileSize(); 00568 00576 QString niceFileSize(); 00577 00586 KMimeType::Ptr mimeTypeForContent(); 00587 00588 // 00589 // KTextEditor::VariableInterface 00590 // 00591 public: 00592 QString variable( const QString &name ) const; 00593 00594 signals: 00595 void variableChanged( const QString &, const QString & ); 00596 00597 private: 00598 QMap<QString, QString> m_storedVariables; 00599 00600 // 00601 // KParts::ReadWrite stuff 00602 // 00603 public: 00604 bool openURL( const KURL &url ); 00605 00606 /* Anders: 00607 I reimplemented this, since i need to check if backup succeeded 00608 if requested */ 00609 bool save(); 00610 00611 /* Anders: Reimplemented to do kate specific stuff */ 00612 bool saveAs( const KURL &url ); 00613 00614 bool openFile (KIO::Job * job); 00615 bool openFile (); 00616 00617 bool saveFile (); 00618 00619 void setReadWrite ( bool rw = true ); 00620 00621 void setModified( bool m ); 00622 00623 private slots: 00624 void slotDataKate ( KIO::Job* kio_job, const QByteArray &data ); 00625 void slotFinishedKate ( KIO::Job * job ); 00626 00627 private: 00628 void abortLoadKate(); 00629 00630 void activateDirWatch (); 00631 void deactivateDirWatch (); 00632 00633 QString m_dirWatchFile; 00634 00635 // 00636 // Kate::Document stuff 00637 // 00638 public: 00639 Kate::ConfigPage *colorConfigPage (QWidget *); 00640 Kate::ConfigPage *fontConfigPage (QWidget *); 00641 Kate::ConfigPage *indentConfigPage (QWidget *); 00642 Kate::ConfigPage *selectConfigPage (QWidget *); 00643 Kate::ConfigPage *editConfigPage (QWidget *); 00644 Kate::ConfigPage *keysConfigPage (QWidget *); 00645 Kate::ConfigPage *hlConfigPage (QWidget *); 00646 Kate::ConfigPage *viewDefaultsConfigPage (QWidget *); 00647 Kate::ConfigPage *saveConfigPage( QWidget * ); 00648 00649 Kate::ActionMenu *hlActionMenu (const QString& text, QObject* parent = 0, const char* name = 0); 00650 Kate::ActionMenu *exportActionMenu (const QString& text, QObject* parent = 0, const char* name = 0); 00651 00652 public: 00656 bool typeChars ( KateView *type, const QString &chars ); 00657 00661 inline uint lastLine() const { return numLines()-1; } 00662 00663 uint configFlags (); 00664 void setConfigFlags (uint flags); 00665 00669 void tagSelection(const KateTextCursor &oldSelectStart, const KateTextCursor &oldSelectEnd); 00670 00671 // Repaint all of all of the views 00672 void repaintViews(bool paintOnlyDirty = true); 00673 00674 inline KateHighlighting *highlight () { return m_buffer->highlight(); } 00675 00676 inline KateHighlighting *highlight () const { return m_buffer->highlight(); } 00677 00678 public slots: //please keep prototypes and implementations in same order 00679 void tagLines(int start, int end); 00680 void tagLines(KateTextCursor start, KateTextCursor end); 00681 00682 //export feature 00683 public slots: 00684 void exportAs(const QString&); 00685 00686 private: //the following things should become plugins 00687 bool exportDocumentToHTML (QTextStream *outputStream,const QString &name); 00688 QString HTMLEncode (QChar theChar); 00689 00690 signals: 00691 void modifiedChanged (); 00692 void preHighlightChanged(uint); 00693 00694 private slots: 00695 void internalHlChanged(); 00696 00697 public: 00698 void addView(KTextEditor::View *); 00699 void removeView(KTextEditor::View *); 00700 00701 void addSuperCursor(class KateSuperCursor *, bool privateC); 00702 void removeSuperCursor(class KateSuperCursor *, bool privateC); 00703 00704 bool ownedView(KateView *); 00705 bool isLastView(int numViews); 00706 00707 uint currentColumn( const KateTextCursor& ); 00708 void newLine( KateTextCursor&, KateViewInternal * ); // Changes input 00709 void backspace( const KateTextCursor& ); 00710 void del( const KateTextCursor& ); 00711 void transpose( const KateTextCursor& ); 00712 void cut(); 00713 void copy(); 00714 void paste ( KateView* view ); 00715 00716 void selectWord( const KateTextCursor& cursor ); 00717 void selectLine( const KateTextCursor& cursor ); 00718 void selectLength( const KateTextCursor& cursor, int length ); 00719 00720 public: 00721 void insertIndentChars ( KateView *view ); 00722 00723 void indent ( KateView *view, uint line, int change ); 00724 void comment ( KateView *view, uint line, uint column, int change ); 00725 void align ( uint line ); 00726 00727 enum TextTransform { Uppercase, Lowercase, Capitalize }; 00728 00736 void transform ( KateView *view, const KateTextCursor &, TextTransform ); 00740 void joinLines( uint first, uint last ); 00741 00742 private: 00743 void optimizeLeadingSpace( uint line, int flags, int change ); 00744 void replaceWithOptimizedSpace( uint line, uint upto_column, uint space, int flags ); 00745 00746 bool removeStringFromBegining(int line, QString &str); 00747 bool removeStringFromEnd(int line, QString &str); 00748 00758 bool nextNonSpaceCharPos(int &line, int &col); 00759 00767 bool previousNonSpaceCharPos(int &line, int &col); 00768 00773 void addStartLineCommentToSingleLine(int line, int attrib=0); 00778 bool removeStartLineCommentFromSingleLine(int line, int attrib=0); 00779 00783 void addStartStopCommentToSingleLine(int line, int attrib=0); 00787 bool removeStartStopCommentFromSingleLine(int line, int attrib=0); 00791 bool removeStartStopCommentFromRegion(const KateTextCursor &start, const KateTextCursor &end, int attrib=0); 00792 00797 void addStartStopCommentToSelection( int attrib=0 ); 00801 void addStartLineCommentToSelection( int attrib=0 ); 00802 00809 bool removeStartStopCommentFromSelection( int attrib=0 ); 00813 bool removeStartLineCommentFromSelection( int attrib=0 ); 00814 00815 public: 00816 QString getWord( const KateTextCursor& cursor ); 00817 00818 public: 00819 void tagAll(); 00820 void updateViews(); 00821 00822 void newBracketMark( const KateTextCursor& start, KateTextRange& bm, int maxLines = -1 ); 00823 bool findMatchingBracket( KateTextCursor& start, KateTextCursor& end, int maxLines = -1 ); 00824 00825 private: 00826 void guiActivateEvent( KParts::GUIActivateEvent *ev ); 00827 00828 public: 00829 00830 QString docName () {return m_docName;}; 00831 00832 void setDocName (QString docName); 00833 00834 void lineInfo (KateLineInfo *info, unsigned int line); 00835 00836 KateCodeFoldingTree *foldingTree (); 00837 00838 public: 00844 bool isModifiedOnDisc() { return m_modOnHd; }; 00845 00847 void isModOnHD( bool =false ) {}; 00848 00849 void setModifiedOnDisk( int reason ); 00850 00851 public slots: 00858 void slotModifiedOnDisk( Kate::View *v=0 ); 00859 00863 void reloadFile(); 00864 00865 private: 00866 int m_isasking; // don't reenter slotModifiedOnDisk when this is true 00867 // -1: ignore once, 0: false, 1: true 00868 00869 public slots: 00870 void setEncoding (const QString &e); 00871 QString encoding() const; 00872 00873 public slots: 00874 void setWordWrap (bool on); 00875 bool wordWrap (); 00876 00877 void setWordWrapAt (uint col); 00878 uint wordWrapAt (); 00879 00880 public slots: 00881 void setPageUpDownMovesCursor(bool on); 00882 bool pageUpDownMovesCursor(); 00883 00884 signals: 00885 void modStateChanged (Kate::Document *doc); 00886 void nameChanged (Kate::Document *doc); 00887 00888 public slots: 00889 // clear buffer/filename - update the views 00890 void flush (); 00891 00892 signals: 00897 void fileNameChanged (); 00898 00899 public slots: 00900 void applyWordWrap (); 00901 00902 // code folding 00903 public: 00904 inline uint getRealLine(unsigned int virtualLine) 00905 { 00906 return m_buffer->lineNumber (virtualLine); 00907 } 00908 00909 inline uint getVirtualLine(unsigned int realLine) 00910 { 00911 return m_buffer->lineVisibleNumber (realLine); 00912 } 00913 00914 inline uint visibleLines () 00915 { 00916 return m_buffer->countVisible (); 00917 } 00918 00919 inline KateTextLine::Ptr kateTextLine(uint i) 00920 { 00921 return m_buffer->line (i); 00922 } 00923 00924 inline KateTextLine::Ptr plainKateTextLine(uint i) 00925 { 00926 return m_buffer->plainLine (i); 00927 } 00928 00929 signals: 00930 void codeFoldingUpdated(); 00931 void aboutToRemoveText(const KateTextRange&); 00932 void textRemoved(); 00933 public slots: 00934 void dumpRegionTree(); 00935 00936 private slots: 00937 void slotModOnHdDirty (const QString &path); 00938 void slotModOnHdCreated (const QString &path); 00939 void slotModOnHdDeleted (const QString &path); 00940 00941 private: 00951 bool createDigest ( QCString &result ); 00952 00958 QString reasonedMOHString() const; 00959 00968 void removeTrailingSpace( uint line ); 00969 00970 public: 00971 // should cursor be wrapped ? take config + blockselection state in account 00972 bool wrapCursor (); 00973 00974 public: 00975 void updateFileType (int newType, bool user = false); 00976 00977 int fileType () const { return m_fileType; }; 00978 00979 // 00980 // REALLY internal data ;) 00981 // 00982 private: 00983 // text buffer 00984 KateBuffer *m_buffer; 00985 00986 KateArbitraryHighlight* m_arbitraryHL; 00987 00988 KateAutoIndent *m_indenter; 00989 00990 bool hlSetByUser; 00991 00992 bool m_modOnHd; 00993 unsigned char m_modOnHdReason; 00994 QCString m_digest; // MD5 digest, updated on load/save 00995 00996 QString m_docName; 00997 int m_docNameNumber; 00998 00999 // file type !!! 01000 int m_fileType; 01001 bool m_fileTypeSetByUser; 01002 01006 bool m_reloading; 01007 01008 public slots: 01009 void spellcheck(); 01016 void spellcheck( const KateTextCursor &from, const KateTextCursor &to=KateTextCursor() ); 01017 void ready(KSpell *); 01018 void misspelling( const QString&, const QStringList&, unsigned int ); 01019 void corrected ( const QString&, const QString&, unsigned int); 01020 void spellResult( const QString& ); 01021 void spellCleanDone(); 01022 01023 01024 void slotQueryClose_save(bool *handled, bool* abortClosing); 01025 01026 private: 01027 void locatePosition( uint pos, uint& line, uint& col ); 01028 KSpell *m_kspell; 01029 // define the part of the text to check 01030 KateTextCursor m_spellStart, m_spellEnd; 01031 // keep track of where we are. 01032 KateTextCursor m_spellPosCursor; 01033 uint m_spellLastPos; 01034 01035 public: 01036 void makeAttribs (bool needInvalidate = true); 01037 01038 static bool checkOverwrite( KURL u ); 01039 01040 static void setDefaultEncoding (const QString &encoding); 01041 01045 public: 01046 inline KateDocumentConfig *config () { return m_config; }; 01047 01048 void updateConfig (); 01049 01050 private: 01051 KateDocumentConfig *m_config; 01052 01057 private: 01061 void readDirConfig (); 01062 01067 void readVariables(bool onlyViewAndRenderer = false); 01068 01073 void readVariableLine( QString t, bool onlyViewAndRenderer = false ); 01077 void setViewVariable( QString var, QString val ); 01083 static bool checkBoolValue( QString value, bool *result ); 01089 static bool checkIntValue( QString value, int *result ); 01094 static bool checkColorValue( QString value, QColor &col ); 01095 01096 static QRegExp kvLine; 01097 static QRegExp kvVar; 01098 01099 KIO::TransferJob *m_job; 01100 KTempFile *m_tempFile; 01101 01102 // TemplateInterface 01103 public: 01104 bool setTabInterceptor(KateKeyInterceptorFunctor *interceptor); /* perhaps make it moregeneral like an eventfilter*/ 01105 bool removeTabInterceptor(KateKeyInterceptorFunctor *interceptor); 01106 bool invokeTabInterceptor(KKey); 01107 01108 protected: 01109 virtual bool insertTemplateTextImplementation ( uint line, uint column, const QString &templateString, const QMap<QString,QString> &initialValues, QWidget *parentWindow=0 ); 01110 KateKeyInterceptorFunctor *m_tabInterceptor; 01111 protected slots: 01112 void testTemplateCode(); 01113 // IM input stuff 01114 // 01115 public: 01116 void setIMSelectionValue( uint imStartLine, uint imStart, uint imEnd, 01117 uint imSelStart, uint imSelEnd, bool m_imComposeEvent ); 01118 void getIMSelectionValue( uint *imStartLine, uint *imStart, uint *imEnd, 01119 uint *imSelStart, uint *imSelEnd ); 01120 bool isIMSelection( int _line, int _column ); 01121 bool isIMEdit( int _line, int _column ); 01122 01123 private: 01124 uint m_imStartLine; 01125 uint m_imStart; 01126 uint m_imEnd; 01127 uint m_imSelStart; 01128 uint m_imSelEnd; 01129 bool m_imComposeEvent; 01130 01131 k_dcop: 01132 uint documentNumber () const; 01133 }; 01134 01135 #endif 01136 01137 // kate: space-indent on; indent-width 2; replace-tabs on; 01138
KDE Logo
This file is part of the documentation for kate Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 14 00:46:06 2005 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003