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 <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 KTempFile;
00069 
00070 class QTimer;
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         QWidget *parentWidget = 0, const char *widgetName = 0, QObject * = 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      QMemArray<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( QWidget *parent, const char *name );
00138     QPtrList<KTextEditor::View> views () const;
00139 
00140     inline KateView *activeView () const { return m_activeView; }
00141 
00142   private:
00143     QPtrList<KateView> m_views;
00144     QPtrList<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, QWidget *parent = 0, const char *name=0 );
00164     QString configPageName (uint number = 0) const;
00165     QString configPageFullName (uint number = 0) const;
00166     QPixmap configPagePixmap (uint number = 0, int size = KIcon::SizeSmall) const;
00167 
00168   //
00169   // KTextEditor::EditInterface stuff
00170   //
00171   public slots:
00172     QString text() const;
00173 
00174     QString text ( uint startLine, uint startCol, uint endLine, uint endCol ) const;
00175     QString text ( uint startLine, uint startCol, uint endLine, uint endCol, bool blockwise ) const;
00176 
00177     QString textLine ( uint line ) const;
00178 
00179     bool setText(const QString &);
00180     bool clear ();
00181 
00182     bool insertText ( uint line, uint col, const QString &s );
00183     bool insertText ( uint line, uint col, const QString &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 QString &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 QString&);
00199     void charactersSemiInteractivelyInserted(int ,int ,const QString&);
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 QString &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 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 
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     QPtrList<KateSuperCursor> m_superCursors;
00364 
00365     //
00366     // some internals for undo/redo
00367     //
00368     QPtrList<KateUndoGroup> undoItems;
00369     QPtrList<KateUndoGroup> redoItems;
00370     bool m_undoDontMerge; //create a setter later on and remove the friend declaration
00371     bool m_undoIgnoreCancel;
00372     QTimer* 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     bool docWasSavedWhenUndoWasEmpty;
00377 
00378     // this sets
00379     void updateModified();
00380 
00381   signals:
00382     void undoChanged ();
00383     void textInserted(int line,int column);
00384 
00385   //
00386   // KTextEditor::CursorInterface stuff
00387   //
00388   public slots:
00389     KTextEditor::Cursor *createCursor ();
00390     QPtrList<KTextEditor::Cursor> cursors () const;
00391 
00392   private:
00393     QPtrList<KTextEditor::Cursor> myCursors;
00394 
00395   //
00396   // KTextEditor::SearchInterface stuff
00397   //
00398   public slots:
00399     bool searchText (unsigned int startLine, unsigned int startCol,
00400         const QString &text, unsigned int *foundAtLine, unsigned int *foundAtCol,
00401         unsigned int *matchLen, bool casesensitive = true, bool backwards = false);
00402     bool searchText (unsigned int startLine, unsigned int startCol,
00403         const QRegExp &regexp, unsigned int *foundAtLine, unsigned int *foundAtCol,
00404         unsigned int *matchLen, bool backwards = false);
00405 
00406   //
00407   // KTextEditor::HighlightingInterface stuff
00408   //
00409   public slots:
00410     uint hlMode ();
00411     bool setHlMode (uint mode);
00412     uint hlModeCount ();
00413     QString hlModeName (uint mode);
00414     QString hlModeSectionName (uint mode);
00415 
00416   public:
00417     void bufferHlChanged ();
00418 
00419   private:
00420     void setDontChangeHlOnSave();
00421 
00422   signals:
00423     void hlChanged ();
00424 
00425   //
00426   // Kate::ArbitraryHighlightingInterface stuff
00427   //
00428   public:
00429     KateArbitraryHighlight* arbitraryHL() const { return m_arbitraryHL; };
00430 
00431   private slots:
00432     void tagArbitraryLines(KateView* view, KateSuperRange* range);
00433 
00434   //
00435   // KTextEditor::ConfigInterface stuff
00436   //
00437   public slots:
00438     void readConfig ();
00439     void writeConfig ();
00440     void readConfig (KConfig *);
00441     void writeConfig (KConfig *);
00442     void readSessionConfig (KConfig *);
00443     void writeSessionConfig (KConfig *);
00444     void configDialog ();
00445 
00446   //
00447   // KTextEditor::MarkInterface and MarkInterfaceExtension
00448   //
00449   public slots:
00450     uint mark( uint line );
00451 
00452     void setMark( uint line, uint markType );
00453     void clearMark( uint line );
00454 
00455     void addMark( uint line, uint markType );
00456     void removeMark( uint line, uint markType );
00457 
00458     QPtrList<KTextEditor::Mark> marks();
00459     void clearMarks();
00460 
00461     void setPixmap( MarkInterface::MarkTypes, const QPixmap& );
00462     void setDescription( MarkInterface::MarkTypes, const QString& );
00463     QString markDescription( MarkInterface::MarkTypes );
00464     QPixmap *markPixmap( MarkInterface::MarkTypes );
00465     QColor markColor( MarkInterface::MarkTypes );
00466 
00467     void setMarksUserChangable( uint markMask );
00468     uint editableMarks();
00469 
00470   signals:
00471     void marksChanged();
00472     void markChanged( KTextEditor::Mark, KTextEditor::MarkInterfaceExtension::MarkChangeAction );
00473 
00474   private:
00475     QIntDict<KTextEditor::Mark> m_marks;
00476     QIntDict<QPixmap>           m_markPixmaps;
00477     QIntDict<QString>           m_markDescriptions;
00478     uint                        m_editableMarks;
00479 
00480   //
00481   // KTextEditor::PrintInterface
00482   //
00483   public slots:
00484     bool printDialog ();
00485     bool print ();
00486 
00487   //
00488   // KTextEditor::DocumentInfoInterface ( ### unfinished )
00489   //
00490   public:
00500     QString mimeType();
00501 
00509     long fileSize();
00510 
00518     QString niceFileSize();
00519 
00528     KMimeType::Ptr mimeTypeForContent();
00529 
00530   //
00531   // KTextEditor::VariableInterface
00532   //
00533   public:
00534     QString variable( const QString &name ) const;
00535 
00536   signals:
00537     void variableChanged( const QString &, const QString & );
00538 
00539   private:
00540     QMap<QString, QString> m_storedVariables;
00541 
00542   //
00543   // KParts::ReadWrite stuff
00544   //
00545   public:
00546     bool openURL( const KURL &url );
00547 
00548     /* Anders:
00549       I reimplemented this, since i need to check if backup succeeded
00550       if requested */
00551     bool save();
00552 
00553     /* Anders: Reimplemented to do kate specific stuff */
00554     bool saveAs( const KURL &url );
00555 
00556     bool openFile (KIO::Job * job);
00557     bool openFile ();
00558 
00559     bool saveFile ();
00560 
00561     void setReadWrite ( bool readwrite = true );
00562 
00563     void setModified( bool m );
00564 
00565   private slots:
00566     void slotDataKate ( KIO::Job* kio_job, const QByteArray &data );
00567     void slotFinishedKate ( KIO::Job * job );
00568 
00569   private:
00570     void abortLoadKate();
00571 
00572     void activateDirWatch ();
00573     void deactivateDirWatch ();
00574 
00575     QString m_dirWatchFile;
00576 
00577   //
00578   // Kate::Document stuff, this is all deprecated!!!!!!!!!!
00579   //
00580   public:
00581     Kate::ConfigPage *colorConfigPage (QWidget *) { return 0; }
00582     Kate::ConfigPage *fontConfigPage (QWidget *) { return 0; }
00583     Kate::ConfigPage *indentConfigPage (QWidget *) { return 0; }
00584     Kate::ConfigPage *selectConfigPage (QWidget *) { return 0; }
00585     Kate::ConfigPage *editConfigPage (QWidget *) { return 0; }
00586     Kate::ConfigPage *keysConfigPage (QWidget *) { return 0; }
00587     Kate::ConfigPage *hlConfigPage (QWidget *) { return 0; }
00588     Kate::ConfigPage *viewDefaultsConfigPage (QWidget *) { return 0; }
00589     Kate::ConfigPage *saveConfigPage( QWidget * ) { return 0; }
00590 
00591     Kate::ActionMenu *hlActionMenu (const QString& /* text */, QObject* /* parent */ = 0, const char* /* name */ = 0) { return 0; }
00592     Kate::ActionMenu *exportActionMenu (const QString& /* text */, QObject* /* parent */ = 0, const char* /* name */ = 0) { return 0; }
00593 
00594   public:
00598     bool typeChars ( KateView *type, const QString &chars );
00599 
00603     inline uint lastLine() const { return numLines()-1; }
00604 
00605     uint configFlags ();
00606     void setConfigFlags (uint flags);
00607 
00608     // Repaint all of all of the views
00609     void repaintViews(bool paintOnlyDirty = true);
00610 
00611     inline KateHighlighting *highlight () { return m_buffer->highlight(); }
00612 
00613     inline KateHighlighting *highlight () const { return m_buffer->highlight(); }
00614 
00615   public slots:    //please keep prototypes and implementations in same order
00616     void tagLines(int start, int end);
00617     void tagLines(KateTextCursor start, KateTextCursor end);
00618 
00619   //export feature, obsolute
00620   public slots:
00621      void exportAs(const QString&) { };
00622 
00623   signals:
00624     void modifiedChanged ();
00625     void preHighlightChanged(uint);
00626 
00627   private slots:
00628     void internalHlChanged();
00629 
00630   public:
00631     void addView(KTextEditor::View *);
00632     void removeView(KTextEditor::View *);
00633 
00634     void addSuperCursor(class KateSuperCursor *, bool privateC);
00635     void removeSuperCursor(class KateSuperCursor *, bool privateC);
00636 
00637     bool ownedView(KateView *);
00638     bool isLastView(int numViews);
00639 
00640     uint currentColumn( const KateTextCursor& );
00641     void newLine(             KateTextCursor&, KateViewInternal * ); // Changes input
00642     void backspace(     KateView *view, const KateTextCursor& );
00643     void del(           KateView *view, const KateTextCursor& );
00644     void transpose(     const KateTextCursor& );
00645 
00646     void paste ( KateView* view );
00647 
00648   public:
00649     void insertIndentChars ( KateView *view );
00650 
00651     void indent ( KateView *view, uint line, int change );
00652     void comment ( KateView *view, uint line, uint column, int change );
00653     void align ( KateView *view, uint line );
00654 
00655     enum TextTransform { Uppercase, Lowercase, Capitalize };
00656 
00664     void transform ( KateView *view, const KateTextCursor &, TextTransform );
00668     void joinLines( uint first, uint last );
00669 
00670   private:
00671     void optimizeLeadingSpace( uint line, int flags, int change );
00672     void replaceWithOptimizedSpace( uint line, uint upto_column, uint space, int flags );
00673 
00674     bool removeStringFromBegining(int line, QString &str);
00675     bool removeStringFromEnd(int line, QString &str);
00676 
00686     bool nextNonSpaceCharPos(int &line, int &col);
00687 
00695     bool previousNonSpaceCharPos(int &line, int &col);
00696 
00701     void addStartLineCommentToSingleLine(int line, int attrib=0);
00706     bool removeStartLineCommentFromSingleLine(int line, int attrib=0);
00707 
00711     void addStartStopCommentToSingleLine(int line, int attrib=0);
00715     bool removeStartStopCommentFromSingleLine(int line, int attrib=0);
00719     bool removeStartStopCommentFromRegion(const KateTextCursor &start, const KateTextCursor &end, int attrib=0);
00720 
00725            void addStartStopCommentToSelection( KateView *view, int attrib=0 );
00729           void addStartLineCommentToSelection( KateView *view, int attrib=0 );
00730 
00737     bool removeStartStopCommentFromSelection( KateView *view, int attrib=0 );
00741     bool removeStartLineCommentFromSelection( KateView *view, int attrib=0 );
00742 
00743   public:
00744     QString getWord( const KateTextCursor& cursor );
00745 
00746   public:
00747     void tagAll();
00748 
00749     void newBracketMark( const KateTextCursor& start, KateBracketRange& bm, int maxLines = -1 );
00750     bool findMatchingBracket( KateTextCursor& start, KateTextCursor& end, int maxLines = -1 );
00751 
00752   private:
00753     void guiActivateEvent( KParts::GUIActivateEvent *ev );
00754 
00755   public:
00756 
00757     QString docName () {return m_docName;};
00758 
00759     void setDocName (QString docName);
00760 
00761     void lineInfo (KateLineInfo *info, unsigned int line);
00762 
00763     KateCodeFoldingTree *foldingTree ();
00764 
00765   public:
00771     bool isModifiedOnDisc() { return m_modOnHd; };
00772 
00774     void isModOnHD( bool =false ) {};
00775 
00776     void setModifiedOnDisk( int reason );
00777 
00778   public slots:
00785     void slotModifiedOnDisk( Kate::View *v=0 );
00786 
00790     void reloadFile();
00791 
00792   private:
00793     int m_isasking; // don't reenter slotModifiedOnDisk when this is true
00794                     // -1: ignore once, 0: false, 1: true
00795 
00796   public slots:
00797     void setEncoding (const QString &e);
00798     QString encoding() const;
00799 
00800   public slots:
00801     void setWordWrap (bool on);
00802     bool wordWrap ();
00803 
00804     void setWordWrapAt (uint col);
00805     uint wordWrapAt ();
00806 
00807   public slots:
00808     void setPageUpDownMovesCursor(bool on);
00809     bool pageUpDownMovesCursor();
00810 
00811   signals:
00812     void modStateChanged (Kate::Document *doc);
00813     void nameChanged (Kate::Document *doc);
00814 
00815   public slots:
00816     // clear buffer/filename - update the views
00817     void flush ();
00818 
00819   signals:
00824     void fileNameChanged ();
00825 
00826   public slots:
00827      void applyWordWrap ();
00828 
00829    // code folding
00830   public:
00831     inline uint getRealLine(unsigned int virtualLine)
00832     {
00833       return m_buffer->lineNumber (virtualLine);
00834     }
00835 
00836     inline uint getVirtualLine(unsigned int realLine)
00837     {
00838       return m_buffer->lineVisibleNumber (realLine);
00839     }
00840 
00841     inline uint visibleLines ()
00842     {
00843       return m_buffer->countVisible ();
00844     }
00845 
00846     inline KateTextLine::Ptr kateTextLine(uint i)
00847     {
00848       return m_buffer->line (i);
00849     }
00850 
00851     inline KateTextLine::Ptr plainKateTextLine(uint i)
00852     {
00853       return m_buffer->plainLine (i);
00854     }
00855 
00856   signals:
00857     void codeFoldingUpdated();
00858     void aboutToRemoveText(const KateTextRange&);
00859     void textRemoved();
00860 
00861   private slots:
00862     void slotModOnHdDirty (const QString &path);
00863     void slotModOnHdCreated (const QString &path);
00864     void slotModOnHdDeleted (const QString &path);
00865 
00866   private:
00876     bool createDigest ( QCString &result );
00877 
00883     QString reasonedMOHString() const;
00884 
00893     void removeTrailingSpace( uint line );
00894 
00895   public:
00896     void updateFileType (int newType, bool user = false);
00897 
00898     int fileType () const { return m_fileType; };
00899 
00900   //
00901   // REALLY internal data ;)
00902   //
00903   private:
00904     // text buffer
00905     KateBuffer *m_buffer;
00906 
00907     KateArbitraryHighlight* m_arbitraryHL;
00908 
00909     KateAutoIndent *m_indenter;
00910 
00911     bool hlSetByUser;
00912 
00913     bool m_modOnHd;
00914     unsigned char m_modOnHdReason;
00915     QCString m_digest; // MD5 digest, updated on load/save
00916 
00917     QString m_docName;
00918     int m_docNameNumber;
00919 
00920     // file type !!!
00921     int m_fileType;
00922     bool m_fileTypeSetByUser;
00923 
00927     bool m_reloading;
00928     bool m_loading; 
00929     bool m_encodingSticky; 
00930 
00931   public slots:
00932     void slotQueryClose_save(bool *handled, bool* abortClosing);
00933 
00934   public:
00935     void makeAttribs (bool needInvalidate = true);
00936 
00937     static bool checkOverwrite( KURL u );
00938 
00939     static void setDefaultEncoding (const QString &encoding);
00940 
00941     void setEncodingSticky( bool e ) { m_encodingSticky = e; }
00942 
00946   public:
00947     inline KateDocumentConfig *config () { return m_config; };
00948 
00949     void updateConfig ();
00950 
00951   private:
00952     KateDocumentConfig *m_config;
00953 
00958   private:
00962     void readDirConfig ();
00963 
00968     void readVariables(bool onlyViewAndRenderer = false);
00969 
00974     void readVariableLine( QString t, bool onlyViewAndRenderer = false );
00978     void setViewVariable( QString var, QString val );
00984     static bool checkBoolValue( QString value, bool *result );
00990     static bool checkIntValue( QString value, int *result );
00995     static bool checkColorValue( QString value, QColor &col );
00996 
01000     static QRegExp kvLine;
01001     static QRegExp kvLineWildcard;
01002     static QRegExp kvLineMime;
01003     static QRegExp kvVar;
01004 
01005     KIO::TransferJob *m_job;
01006     KTempFile *m_tempFile;
01007 
01008   // TemplateInterface
01009   public:
01010       bool setTabInterceptor(KateKeyInterceptorFunctor *interceptor); /* perhaps make it moregeneral like an eventfilter*/
01011       bool removeTabInterceptor(KateKeyInterceptorFunctor *interceptor);
01012       bool invokeTabInterceptor(KKey);
01013 
01014   protected:
01015       virtual bool insertTemplateTextImplementation ( uint line, uint column, const QString &templateString, const QMap<QString,QString> &initialValues, QWidget *parentWindow=0 );
01016       KateKeyInterceptorFunctor *m_tabInterceptor;
01017 
01018   protected slots:
01019       void testTemplateCode();
01020       void dumpRegionTree();
01021 
01022   //BEGIN DEPRECATED
01023   //
01024   // KTextEditor::SelectionInterface stuff
01025   // DEPRECATED, this will be removed for KDE 4.x !!!!!!!!!!!!!!!!!!!!
01026   //
01027   public slots:
01028     bool setSelection ( uint startLine, uint startCol, uint endLine, uint endCol );
01029     bool clearSelection ();
01030     bool hasSelection () const;
01031     QString selection () const;
01032     bool removeSelectedText ();
01033     bool selectAll();
01034 
01035     //
01036     // KTextEditor::SelectionInterfaceExt
01037     //
01038     int selStartLine();
01039     int selStartCol();
01040     int selEndLine();
01041     int selEndCol();
01042 
01043 
01044   // hack, only there to still support the deprecated stuff, will be removed for KDE 4.x
01045   #undef signals
01046   #define signals public
01047   signals:
01048   #undef signals
01049   #define signals protected
01050     void selectionChanged ();
01051 
01052   //
01053   // KTextEditor::BlockSelectionInterface stuff
01054   // DEPRECATED, this will be removed for KDE 4.x !!!!!!!!!!!!!!!!!!!!
01055   //
01056   public slots:
01057     bool blockSelectionMode ();
01058     bool setBlockSelectionMode (bool on);
01059     bool toggleBlockSelectionMode ();
01060 
01061   private:
01062 //END DEPRECATED
01063 
01064   k_dcop:
01065     uint documentNumber () const;
01066 };
01067 
01068 #endif
01069 
01070 // kate: space-indent on; indent-width 2; replace-tabs on;
01071 
KDE Home | KDE Accessibility Home | Description of Access Keys