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., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, 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 <tdetexteditor/configinterfaceextension.h> 00033 #include <tdetexteditor/encodinginterface.h> 00034 #include <tdetexteditor/sessionconfiginterface.h> 00035 #include <tdetexteditor/editinterfaceext.h> 00036 #include <tdetexteditor/templateinterface.h> 00037 00038 #include <dcopobject.h> 00039 00040 #include <kmimetype.h> 00041 #include <tdelocale.h> 00042 00043 #include <tqintdict.h> 00044 #include <tqmap.h> 00045 #include <tqdatetime.h> 00046 00047 namespace KTextEditor { class Plugin; } 00048 00049 namespace TDEIO { 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 KTempFile; 00069 00070 class TQTimer; 00071 00072 class KateKeyInterceptorFunctor; 00073 00074 // 00075 // Kate KTextEditor::Document class (and even KTextEditor::Editor ;) 00076 // 00077 class KateDocument : public Kate::Document, 00078 public Kate::DocumentExt, 00079 public KTextEditor::ConfigInterfaceExtension, 00080 public KTextEditor::EncodingInterface, 00081 public KTextEditor::SessionConfigInterface, 00082 public KTextEditor::EditInterfaceExt, 00083 public KTextEditor::TemplateInterface, 00084 public DCOPObject 00085 { 00086 K_DCOP 00087 Q_OBJECT 00088 00089 friend class KateViewInternal; 00090 friend class KateRenderer; 00091 00092 public: 00093 KateDocument (bool bSingleViewMode=false, bool bBrowserView=false, bool bReadOnly=false, 00094 TQWidget *parentWidget = 0, const char *widgetName = 0, TQObject * = 0, const char * = 0); 00095 ~KateDocument (); 00096 00097 bool closeURL(); 00098 00099 // 00100 // Plugins section 00101 // 00102 public: 00103 void unloadAllPlugins (); 00104 00105 void enableAllPluginsGUI (KateView *view); 00106 void disableAllPluginsGUI (KateView *view); 00107 00108 void loadPlugin (uint pluginIndex); 00109 void unloadPlugin (uint pluginIndex); 00110 00111 void enablePluginGUI (KTextEditor::Plugin *plugin, KateView *view); 00112 void enablePluginGUI (KTextEditor::Plugin *plugin); 00113 00114 void disablePluginGUI (KTextEditor::Plugin *plugin, KateView *view); 00115 void disablePluginGUI (KTextEditor::Plugin *plugin); 00116 00117 private: 00118 TQMemArray<KTextEditor::Plugin *> m_plugins; 00119 00120 public: 00121 bool readOnly () const { return m_bReadOnly; } 00122 bool browserView () const { return m_bBrowserView; } 00123 bool singleViewMode () const { return m_bSingleViewMode; } 00124 KateBrowserExtension *browserExtension () { return m_extension; } 00125 00126 private: 00127 // only to make part work, don't change it ! 00128 bool m_bSingleViewMode; 00129 bool m_bBrowserView; 00130 bool m_bReadOnly; 00131 KateBrowserExtension *m_extension; 00132 00133 // 00134 // KTextEditor::Document stuff 00135 // 00136 public: 00137 KTextEditor::View *createView( TQWidget *parent, const char *name ); 00138 TQPtrList<KTextEditor::View> views () const; 00139 00140 inline KateView *activeView () const { return m_activeView; } 00141 00142 private: 00143 TQPtrList<KateView> m_views; 00144 TQPtrList<KTextEditor::View> m_textEditViews; 00145 KateView *m_activeView; 00146 00156 void setActiveView( KateView *view ); 00157 00158 // 00159 // KTextEditor::ConfigInterfaceExtension stuff 00160 // 00161 public slots: 00162 uint configPages () const; 00163 KTextEditor::ConfigPage *configPage (uint number = 0, TQWidget *parent = 0, const char *name=0 ); 00164 TQString configPageName (uint number = 0) const; 00165 TQString configPageFullName (uint number = 0) const; 00166 TQPixmap configPagePixmap (uint number = 0, int size = TDEIcon::SizeSmall) const; 00167 00168 // 00169 // KTextEditor::EditInterface stuff 00170 // 00171 public slots: 00172 TQString text() const; 00173 00174 TQString text ( uint startLine, uint startCol, uint endLine, uint endCol ) const; 00175 TQString text ( uint startLine, uint startCol, uint endLine, uint endCol, bool blockwise ) const; 00176 00177 TQString textLine ( uint line ) const; 00178 00179 bool setText(const TQString &); 00180 bool clear (); 00181 00182 bool insertText ( uint line, uint col, const TQString &s ); 00183 bool insertText ( uint line, uint col, const TQString &s, bool blockwise ); 00184 00185 bool removeText ( uint startLine, uint startCol, uint endLine, uint endCol ); 00186 bool removeText ( uint startLine, uint startCol, uint endLine, uint endCol, bool blockwise ); 00187 00188 bool insertLine ( uint line, const TQString &s ); 00189 bool removeLine ( uint line ); 00190 00191 uint numLines() const; 00192 uint numVisLines() const; 00193 uint length () const; 00194 int lineLength ( uint line ) const; 00195 00196 signals: 00197 void textChanged (); 00198 void charactersInteractivelyInserted(int ,int ,const TQString&); 00199 void charactersSemiInteractivelyInserted(int ,int ,const TQString&); 00200 void backspacePressed(); 00201 00202 public: 00203 //BEGIN editStart/editEnd (start, end, undo, cursor update, view update) 00209 void editStart (bool withUndo = true); 00211 void editBegin () { editStart(); } 00216 void editEnd (); 00217 private: 00218 bool m_isInUndo; 00219 00220 //END editStart/editEnd 00221 00222 //BEGIN LINE BASED INSERT/REMOVE STUFF (editStart() and editEnd() included) 00223 public: 00231 bool editInsertText ( uint line, uint col, const TQString &s ); 00239 bool editRemoveText ( uint line, uint col, uint len ); 00240 00249 bool editMarkLineAutoWrapped ( uint line, bool autowrapped ); 00250 00261 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 TQString &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 TQString &text); 00337 00338 uint editSessionNumber; 00339 bool editIsRunning; 00340 bool editWithUndo; 00341 bool m_undoComplexMerge; 00342 KateUndoGroup* m_editCurrentUndo; 00343 00344 // 00345 // KTextEditor::UndoInterface stuff 00346 // 00347 public slots: 00348 void undo (); 00349 void redo (); 00350 void clearUndo (); 00351 void clearRedo (); 00352 00353 uint undoCount () const; 00354 uint redoCount () const; 00355 00356 uint undoSteps () const; 00357 void setUndoSteps ( uint steps ); 00358 00359 private: 00360 friend class KateTemplateHandler; 00361 00362 private: 00363 TQPtrList<KateSuperCursor> m_superCursors; 00364 00365 // 00366 // some internals for undo/redo 00367 // 00368 TQPtrList<KateUndoGroup> undoItems; 00369 TQPtrList<KateUndoGroup> redoItems; 00370 bool m_undoDontMerge; //create a setter later on and remove the friend declaration 00371 bool m_undoIgnoreCancel; 00372 TQTimer* m_undoMergeTimer; 00373 // these two variables are for resetting the document to 00374 // non-modified if all changes have been undone... 00375 KateUndoGroup* lastUndoGroupWhenSaved; 00376 KateUndoGroup* lastRedoGroupWhenSaved; 00377 bool docWasSavedWhenUndoWasEmpty; 00378 bool docWasSavedWhenRedoWasEmpty; 00379 00380 // this sets 00381 void updateModified(); 00382 00383 signals: 00384 void undoChanged (); 00385 void textInserted(int line,int column); 00386 00387 // 00388 // KTextEditor::CursorInterface stuff 00389 // 00390 public slots: 00391 KTextEditor::Cursor *createCursor (); 00392 TQPtrList<KTextEditor::Cursor> cursors () const; 00393 00394 private: 00395 TQPtrList<KTextEditor::Cursor> myCursors; 00396 00397 // 00398 // KTextEditor::SearchInterface stuff 00399 // 00400 public slots: 00401 bool searchText (unsigned int startLine, unsigned int startCol, 00402 const TQString &text, unsigned int *foundAtLine, unsigned int *foundAtCol, 00403 unsigned int *matchLen, bool casesensitive = true, bool backwards = false); 00404 bool searchText (unsigned int startLine, unsigned int startCol, 00405 const TQRegExp ®exp, unsigned int *foundAtLine, unsigned int *foundAtCol, 00406 unsigned int *matchLen, bool backwards = false); 00407 00408 // 00409 // KTextEditor::HighlightingInterface stuff 00410 // 00411 public slots: 00412 uint hlMode (); 00413 bool setHlMode (uint mode); 00414 uint hlModeCount (); 00415 TQString hlModeName (uint mode); 00416 TQString hlModeSectionName (uint mode); 00417 00418 public: 00419 void bufferHlChanged (); 00420 00421 private: 00422 void setDontChangeHlOnSave(); 00423 00424 signals: 00425 void hlChanged (); 00426 00427 // 00428 // Kate::ArbitraryHighlightingInterface stuff 00429 // 00430 public: 00431 KateArbitraryHighlight* arbitraryHL() const { return m_arbitraryHL; }; 00432 00433 private slots: 00434 void tagArbitraryLines(KateView* view, KateSuperRange* range); 00435 00436 // 00437 // KTextEditor::ConfigInterface stuff 00438 // 00439 public slots: 00440 void readConfig (); 00441 void writeConfig (); 00442 void readConfig (TDEConfig *); 00443 void writeConfig (TDEConfig *); 00444 void readSessionConfig (TDEConfig *); 00445 void writeSessionConfig (TDEConfig *); 00446 void configDialog (); 00447 00448 // 00449 // KTextEditor::MarkInterface and MarkInterfaceExtension 00450 // 00451 public slots: 00452 uint mark( uint line ); 00453 00454 void setMark( uint line, uint markType ); 00455 void clearMark( uint line ); 00456 00457 void addMark( uint line, uint markType ); 00458 void removeMark( uint line, uint markType ); 00459 00460 TQPtrList<KTextEditor::Mark> marks(); 00461 void clearMarks(); 00462 00463 void setPixmap( MarkInterface::MarkTypes, const TQPixmap& ); 00464 void setDescription( MarkInterface::MarkTypes, const TQString& ); 00465 TQString markDescription( MarkInterface::MarkTypes ); 00466 TQPixmap *markPixmap( MarkInterface::MarkTypes ); 00467 TQColor markColor( MarkInterface::MarkTypes ); 00468 00469 void setMarksUserChangable( uint markMask ); 00470 uint editableMarks(); 00471 00472 signals: 00473 void marksChanged(); 00474 void markChanged( KTextEditor::Mark, KTextEditor::MarkInterfaceExtension::MarkChangeAction ); 00475 00476 private: 00477 TQIntDict<KTextEditor::Mark> m_marks; 00478 TQIntDict<TQPixmap> m_markPixmaps; 00479 TQIntDict<TQString> m_markDescriptions; 00480 uint m_editableMarks; 00481 00482 // 00483 // KTextEditor::PrintInterface 00484 // 00485 public slots: 00486 bool printDialog (); 00487 bool print (); 00488 00489 // 00490 // KTextEditor::DocumentInfoInterface ( ### unfinished ) 00491 // 00492 public: 00502 TQString mimeType(); 00503 00511 long fileSize(); 00512 00520 TQString niceFileSize(); 00521 00530 KMimeType::Ptr mimeTypeForContent(); 00531 00532 // 00533 // KTextEditor::VariableInterface 00534 // 00535 public: 00536 TQString variable( const TQString &name ) const; 00537 00538 signals: 00539 void variableChanged( const TQString &, const TQString & ); 00540 00541 private: 00542 TQMap<TQString, TQString> m_storedVariables; 00543 00544 // 00545 // KParts::ReadWrite stuff 00546 // 00547 public: 00548 bool openURL( const KURL &url ); 00549 00550 /* Anders: 00551 I reimplemented this, since i need to check if backup succeeded 00552 if requested */ 00553 bool save(); 00554 00555 /* Anders: Reimplemented to do kate specific stuff */ 00556 bool saveAs( const KURL &url ); 00557 00558 bool openFile (TDEIO::Job * job); 00559 bool openFile (); 00560 00561 bool saveFile (); 00562 00563 void setReadWrite ( bool readwrite = true ); 00564 00565 void setModified( bool m ); 00566 00567 private slots: 00568 void slotDataKate ( TDEIO::Job* tdeio_job, const TQByteArray &data ); 00569 void slotFinishedKate ( TDEIO::Job * job ); 00570 00571 private: 00572 void abortLoadKate(); 00573 00574 void activateDirWatch (); 00575 void deactivateDirWatch (); 00576 00577 TQString m_dirWatchFile; 00578 00579 // 00580 // Kate::Document stuff, this is all deprecated!!!!!!!!!! 00581 // 00582 public: 00583 Kate::ConfigPage *colorConfigPage (TQWidget *) { return 0; } 00584 Kate::ConfigPage *fontConfigPage (TQWidget *) { return 0; } 00585 Kate::ConfigPage *indentConfigPage (TQWidget *) { return 0; } 00586 Kate::ConfigPage *selectConfigPage (TQWidget *) { return 0; } 00587 Kate::ConfigPage *editConfigPage (TQWidget *) { return 0; } 00588 Kate::ConfigPage *keysConfigPage (TQWidget *) { return 0; } 00589 Kate::ConfigPage *hlConfigPage (TQWidget *) { return 0; } 00590 Kate::ConfigPage *viewDefaultsConfigPage (TQWidget *) { return 0; } 00591 Kate::ConfigPage *saveConfigPage( TQWidget * ) { return 0; } 00592 00593 Kate::ActionMenu *hlActionMenu (const TQString& /* text */, TQObject* /* parent */ = 0, const char* /* name */ = 0) { return 0; } 00594 Kate::ActionMenu *exportActionMenu (const TQString& /* text */, TQObject* /* parent */ = 0, const char* /* name */ = 0) { return 0; } 00595 00596 public: 00600 bool typeChars ( KateView *type, const TQString &chars ); 00601 00605 inline uint lastLine() const { return numLines()-1; } 00606 00607 uint configFlags (); 00608 void setConfigFlags (uint flags); 00609 00610 // Repaint all of all of the views 00611 void repaintViews(bool paintOnlyDirty = true); 00612 00613 inline KateHighlighting *highlight () { return m_buffer->highlight(); } 00614 00615 inline KateHighlighting *highlight () const { return m_buffer->highlight(); } 00616 00617 public slots: //please keep prototypes and implementations in same order 00618 void tagLines(int start, int end); 00619 void tagLines(KateTextCursor start, KateTextCursor end); 00620 00621 //export feature, obsolute 00622 public slots: 00623 void exportAs(const TQString&) { }; 00624 00625 signals: 00626 void modifiedChanged (); 00627 void preHighlightChanged(uint); 00628 00629 private slots: 00630 void internalHlChanged(); 00631 00632 public: 00633 void addView(KTextEditor::View *); 00634 void removeView(KTextEditor::View *); 00635 00636 void addSuperCursor(class KateSuperCursor *, bool privateC); 00637 void removeSuperCursor(class KateSuperCursor *, bool privateC); 00638 00639 bool ownedView(KateView *); 00640 bool isLastView(int numViews); 00641 00642 uint currentColumn( const KateTextCursor& ); 00643 void newLine( KateTextCursor&, KateViewInternal * ); // Changes input 00644 void backspace( KateView *view, const KateTextCursor& ); 00645 void del( KateView *view, const KateTextCursor& ); 00646 void transpose( const KateTextCursor& ); 00647 00648 void paste ( KateView* view ); 00649 00650 public: 00651 void insertIndentChars ( KateView *view ); 00652 00653 void indent ( KateView *view, uint line, int change ); 00654 void comment ( KateView *view, uint line, uint column, int change ); 00655 void align ( KateView *view, uint line ); 00656 00657 enum TextTransform { Uppercase, Lowercase, Capitalize }; 00658 00666 void transform ( KateView *view, const KateTextCursor &, TextTransform ); 00670 void joinLines( uint first, uint last ); 00671 00672 private: 00673 void optimizeLeadingSpace( uint line, int flags, int change ); 00674 void replaceWithOptimizedSpace( uint line, uint upto_column, uint space, int flags ); 00675 00676 bool removeStringFromBegining(int line, TQString &str); 00677 bool removeStringFromEnd(int line, TQString &str); 00678 00688 bool nextNonSpaceCharPos(int &line, int &col); 00689 00697 bool previousNonSpaceCharPos(int &line, int &col); 00698 00703 void addStartLineCommentToSingleLine(int line, int attrib=0); 00708 bool removeStartLineCommentFromSingleLine(int line, int attrib=0); 00709 00713 void addStartStopCommentToSingleLine(int line, int attrib=0); 00717 bool removeStartStopCommentFromSingleLine(int line, int attrib=0); 00721 bool removeStartStopCommentFromRegion(const KateTextCursor &start, const KateTextCursor &end, int attrib=0); 00722 00727 void addStartStopCommentToSelection( KateView *view, int attrib=0 ); 00731 void addStartLineCommentToSelection( KateView *view, int attrib=0 ); 00732 00739 bool removeStartStopCommentFromSelection( KateView *view, int attrib=0 ); 00743 bool removeStartLineCommentFromSelection( KateView *view, int attrib=0 ); 00744 00745 public: 00746 TQString getWord( const KateTextCursor& cursor ); 00747 00748 public: 00749 void tagAll(); 00750 00751 void newBracketMark( const KateTextCursor& start, KateBracketRange& bm, int maxLines = -1 ); 00752 bool findMatchingBracket( KateTextCursor& start, KateTextCursor& end, int maxLines = -1 ); 00753 00754 private: 00755 void guiActivateEvent( KParts::GUIActivateEvent *ev ); 00756 00757 public: 00758 00759 TQString docName () {return m_docName;}; 00760 00761 void setDocName (TQString docName); 00762 00763 void lineInfo (KateLineInfo *info, unsigned int line); 00764 00765 KateCodeFoldingTree *foldingTree (); 00766 00767 public: 00773 bool isModifiedOnDisc() { return m_modOnHd; }; 00774 00776 void isModOnHD( bool =false ) {}; 00777 00778 void setModifiedOnDisk( int reason ); 00779 00780 public slots: 00787 void slotModifiedOnDisk( Kate::View *v=0 ); 00788 00792 void reloadFile(); 00793 00794 private: 00795 int m_isasking; // don't reenter slotModifiedOnDisk when this is true 00796 // -1: ignore once, 0: false, 1: true 00797 00798 public slots: 00799 void setEncoding (const TQString &e); 00800 TQString encoding() const; 00801 00802 public slots: 00803 void setWordWrap (bool on); 00804 bool wordWrap (); 00805 00806 void setWordWrapAt (uint col); 00807 uint wordWrapAt (); 00808 00809 public slots: 00810 void setPageUpDownMovesCursor(bool on); 00811 bool pageUpDownMovesCursor(); 00812 00813 signals: 00814 void modStateChanged (Kate::Document *doc); 00815 void nameChanged (Kate::Document *doc); 00816 00817 public slots: 00818 // clear buffer/filename - update the views 00819 void flush (); 00820 00821 signals: 00826 void fileNameChanged (); 00827 00828 public slots: 00829 void applyWordWrap (); 00830 00831 // code folding 00832 public: 00833 inline uint getRealLine(unsigned int virtualLine) 00834 { 00835 return m_buffer->lineNumber (virtualLine); 00836 } 00837 00838 inline uint getVirtualLine(unsigned int realLine) 00839 { 00840 return m_buffer->lineVisibleNumber (realLine); 00841 } 00842 00843 inline uint visibleLines () 00844 { 00845 return m_buffer->countVisible (); 00846 } 00847 00848 inline KateTextLine::Ptr kateTextLine(uint i) 00849 { 00850 return m_buffer->line (i); 00851 } 00852 00853 inline KateTextLine::Ptr plainKateTextLine(uint i) 00854 { 00855 return m_buffer->plainLine (i); 00856 } 00857 00858 signals: 00859 void codeFoldingUpdated(); 00860 void aboutToRemoveText(const KateTextRange&); 00861 void textRemoved(); 00862 00863 private slots: 00864 void slotModOnHdDirty (const TQString &path); 00865 void slotModOnHdCreated (const TQString &path); 00866 void slotModOnHdDeleted (const TQString &path); 00867 00868 private: 00878 bool createDigest ( TQCString &result ); 00879 00885 TQString reasonedMOHString() const; 00886 00895 void removeTrailingSpace( uint line ); 00896 00897 public: 00898 void updateFileType (int newType, bool user = false); 00899 00900 int fileType () const { return m_fileType; }; 00901 00902 // 00903 // REALLY internal data ;) 00904 // 00905 private: 00906 // text buffer 00907 KateBuffer *m_buffer; 00908 00909 KateArbitraryHighlight* m_arbitraryHL; 00910 00911 KateAutoIndent *m_indenter; 00912 00913 bool hlSetByUser; 00914 00915 bool m_modOnHd; 00916 unsigned char m_modOnHdReason; 00917 TQCString m_digest; // MD5 digest, updated on load/save 00918 00919 TQString m_docName; 00920 int m_docNameNumber; 00921 00922 // file type !!! 00923 int m_fileType; 00924 bool m_fileTypeSetByUser; 00925 00929 bool m_reloading; 00930 bool m_loading; 00931 bool m_encodingSticky; 00932 00933 public slots: 00934 void slotQueryClose_save(bool *handled, bool* abortClosing); 00935 00936 public: 00937 void makeAttribs (bool needInvalidate = true); 00938 00939 static bool checkOverwrite( KURL u ); 00940 00941 static void setDefaultEncoding (const TQString &encoding); 00942 00943 void setEncodingSticky( bool e ) { m_encodingSticky = e; } 00944 00948 public: 00949 inline KateDocumentConfig *config () { return m_config; }; 00950 00951 void updateConfig (); 00952 00953 private: 00954 KateDocumentConfig *m_config; 00955 00960 private: 00964 void readDirConfig (); 00965 00970 void readVariables(bool onlyViewAndRenderer = false); 00971 00976 void readVariableLine( TQString t, bool onlyViewAndRenderer = false ); 00980 void setViewVariable( TQString var, TQString val ); 00986 static bool checkBoolValue( TQString value, bool *result ); 00992 static bool checkIntValue( TQString value, int *result ); 00997 static bool checkColorValue( TQString value, TQColor &col ); 00998 01002 static TQRegExp kvLine; 01003 static TQRegExp kvLineWildcard; 01004 static TQRegExp kvLineMime; 01005 static TQRegExp kvVar; 01006 01007 TDEIO::TransferJob *m_job; 01008 KTempFile *m_tempFile; 01009 01010 // TemplateInterface 01011 public: 01012 bool setTabInterceptor(KateKeyInterceptorFunctor *interceptor); /* perhaps make it moregeneral like an eventfilter*/ 01013 bool removeTabInterceptor(KateKeyInterceptorFunctor *interceptor); 01014 bool invokeTabInterceptor(KKey); 01015 01016 protected: 01017 virtual bool insertTemplateTextImplementation ( uint line, uint column, const TQString &templateString, const TQMap<TQString,TQString> &initialValues, TQWidget *parentWindow=0 ); 01018 KateKeyInterceptorFunctor *m_tabInterceptor; 01019 01020 protected slots: 01021 void testTemplateCode(); 01022 void dumpRegionTree(); 01023 01024 //BEGIN DEPRECATED 01025 // 01026 // KTextEditor::SelectionInterface stuff 01027 // DEPRECATED, this will be removed for KDE 4.x !!!!!!!!!!!!!!!!!!!! 01028 // 01029 public slots: 01030 bool setSelection ( uint startLine, uint startCol, uint endLine, uint endCol ); 01031 bool clearSelection (); 01032 bool hasSelection () const; 01033 TQString selection () const; 01034 bool removeSelectedText (); 01035 bool selectAll(); 01036 01037 // 01038 // KTextEditor::SelectionInterfaceExt 01039 // 01040 int selStartLine(); 01041 int selStartCol(); 01042 int selEndLine(); 01043 int selEndCol(); 01044 01045 01046 // hack, only there to still support the deprecated stuff, will be removed for KDE 4.x 01047 #undef signals 01048 #define signals public 01049 signals: 01050 #undef signals 01051 #define signals protected 01052 void selectionChanged (); 01053 01054 // 01055 // KTextEditor::BlockSelectionInterface stuff 01056 // DEPRECATED, this will be removed for KDE 4.x !!!!!!!!!!!!!!!!!!!! 01057 // 01058 public slots: 01059 bool blockSelectionMode (); 01060 bool setBlockSelectionMode (bool on); 01061 bool toggleBlockSelectionMode (); 01062 01063 private: 01064 //END DEPRECATED 01065 01066 k_dcop: 01067 uint documentNumber () const; 01068 long documentListPosition () const; 01069 void setDocumentListPosition (long pos); 01070 }; 01071 01072 #endif 01073 01074 // kate: space-indent on; indent-width 2; replace-tabs on; 01075