00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _KATE_DOCUMENT_H_
00023 #define _KATE_DOCUMENT_H_
00024
00025 #include <QtCore/QLinkedList>
00026 #include <QtCore/QMap>
00027 #include <QtCore/QDate>
00028 #include <QtGui/QClipboard>
00029 #include <QtCore/QStack>
00030
00031 #include <kmimetype.h>
00032 #include <klocale.h>
00033 #include <kshortcut.h>
00034 #include <kencodingdetector.h>
00035
00036 #include <ktexteditor/document.h>
00037 #include <ktexteditor/sessionconfiginterface.h>
00038 #include <ktexteditor/searchinterface.h>
00039 #include <ktexteditor/markinterface.h>
00040 #include <ktexteditor/variableinterface.h>
00041 #include <ktexteditor/modificationinterface.h>
00042 #include <ktexteditor/smartinterface.h>
00043 #include <ktexteditor/rangefeedback.h>
00044 #include <ktexteditor/annotationinterface.h>
00045
00046 #include "katetextline.h"
00047 #include "kateautoindent.h"
00048 #include "katenamespace.h"
00049
00050 namespace KTextEditor { class Plugin; class Attribute; }
00051
00052 namespace KIO { class TransferJob; }
00053
00054 class KateUndoGroup;
00055 class KateCodeFoldingTree;
00056 class KateBuffer;
00057 class KateView;
00058 class KateSmartRange;
00059 class KateLineInfo;
00060 class KateBrowserExtension;
00061 class KateDocumentConfig;
00062 class KateHighlighting;
00063 class KateSmartManager;
00064
00065
00066 class QTimer;
00067
00068 class KateKeyInterceptorFunctor;
00069
00070
00071 struct ReplacementPart {
00072 enum Type {
00073 Reference,
00074 Text,
00075 UpperCase,
00076 LowerCase,
00077 KeepCase,
00078 Counter
00079 };
00080
00081 Type type;
00082
00083
00084 int index;
00085
00086
00087 QString text;
00088 };
00089
00090
00091
00092
00093 class KateDocument : public KTextEditor::Document,
00094 public KTextEditor::SessionConfigInterface,
00095 public KTextEditor::SearchInterface,
00096 public KTextEditor::MarkInterface,
00097 public KTextEditor::VariableInterface,
00098 public KTextEditor::ModificationInterface,
00099 public KTextEditor::SmartInterface,
00100 private KTextEditor::SmartRangeWatcher,
00101 public KTextEditor::AnnotationInterface
00102 {
00103 Q_OBJECT
00104 Q_INTERFACES(KTextEditor::SessionConfigInterface)
00105 Q_INTERFACES(KTextEditor::SearchInterface)
00106 Q_INTERFACES(KTextEditor::MarkInterface)
00107 Q_INTERFACES(KTextEditor::VariableInterface)
00108 Q_INTERFACES(KTextEditor::ModificationInterface)
00109 Q_INTERFACES(KTextEditor::SmartInterface)
00110 Q_INTERFACES(KTextEditor::AnnotationInterface)
00111
00112 public:
00113 explicit KateDocument (bool bSingleViewMode=false, bool bBrowserView=false, bool bReadOnly=false,
00114 QWidget *parentWidget = 0, QObject * = 0);
00115 ~KateDocument ();
00116
00117 using ReadWritePart::closeUrl;
00118 bool closeUrl();
00119
00120 KTextEditor::Editor *editor ();
00121
00122
00123
00124
00125 public:
00129 virtual QWidget *widget();
00130
00131 public:
00132 bool readOnly () const { return m_bReadOnly; }
00133 bool browserView () const { return m_bBrowserView; }
00134 bool singleViewMode () const { return m_bSingleViewMode; }
00135 KateBrowserExtension *browserExtension () { return m_extension; }
00136 static bool simpleMode ();
00137
00138 private:
00139
00140 bool m_bSingleViewMode;
00141 bool m_bBrowserView;
00142 bool m_bReadOnly;
00143 KateBrowserExtension *m_extension;
00144
00145
00146
00147
00148 public:
00149 KTextEditor::View *createView( QWidget *parent );
00150 const QList<KTextEditor::View*> &views () const;
00151
00152 virtual KTextEditor::View* activeView() const { return m_activeView; }
00153
00154 KateView* activeKateView() const;
00155
00156 Q_SIGNALS:
00157 void activeViewSelectionChanged(KTextEditor::View* view);
00158
00159 private:
00160 QLinkedList<KateView*> m_views;
00161 QList<KTextEditor::View*> m_textEditViews;
00162 KTextEditor::View *m_activeView;
00163
00164
00165
00166
00167 public Q_SLOTS:
00168 virtual bool setText(const QString &);
00169 virtual bool setText(const QStringList& text);
00170 virtual bool clear ();
00171
00172 virtual bool insertText ( const KTextEditor::Cursor &position, const QString &s, bool block = false );
00173 virtual bool insertText ( const KTextEditor::Cursor &position, const QStringList &text, bool block = false );
00174
00175 virtual bool insertLine ( int line, const QString &s );
00176 virtual bool insertLines ( int line, const QStringList &s );
00177
00178 bool removeText ( const KTextEditor::Range &range, bool block = false );
00179 bool removeLine ( int line );
00180
00181 bool replaceText ( const KTextEditor::Range &range, const QString &s, bool block = false );
00182
00183
00184 bool replaceText (const KTextEditor::Range &r, const QStringList &l, bool b)
00185 { return KTextEditor::Document::replaceText (r, l, b); }
00186
00187 public:
00188 virtual QString text ( const KTextEditor::Range &range, bool blockwise = false ) const;
00189 virtual QStringList textLines ( const KTextEditor::Range& range, bool block = false ) const;
00190 virtual QString text() const;
00191 virtual QString line(int line) const;
00192 virtual QChar character(const KTextEditor::Cursor& position) const;
00193 int lines() const;
00194 virtual KTextEditor::Cursor documentEnd() const;
00195 int numVisLines() const;
00196 int totalCharacters() const;
00197 int lineLength(int line) const;
00198
00199 Q_SIGNALS:
00200 void charactersSemiInteractivelyInserted(const KTextEditor::Cursor& position, const QString& text);
00201
00202 public:
00203
00209 void editStart (bool withUndo = true, Kate::EditSource editSource = Kate::NoEditSource);
00211 void editBegin (Kate::EditSource editSource = Kate::NoEditSource) { editStart(true, editSource); }
00216 void editEnd ();
00217
00218 void pushEditState();
00219 void popEditState();
00220
00221 bool startEditing () { editStart (true, Kate::ThirdPartyEdit); return true; }
00222 bool endEditing () { editEnd (); return true; }
00223
00224
00225
00226
00234 bool editInsertText ( int line, int col, const QString &s, Kate::EditSource editSource = Kate::NoEditSource );
00242 bool editRemoveText ( int line, int col, int len, Kate::EditSource editSource = Kate::NoEditSource );
00243
00252 bool editMarkLineAutoWrapped ( int line, bool autowrapped );
00253
00264 bool editWrapLine ( int line, int col, bool newLine = true, bool *newLineAdded = 0 );
00272 bool editUnWrapLine ( int line, bool removeLine = true, int length = 0 );
00273
00280 bool editInsertLine ( int line, const QString &s, Kate::EditSource editSource = Kate::NoEditSource );
00286 bool editRemoveLine ( int line, Kate::EditSource editSource = Kate::NoEditSource );
00287
00294 bool wrapText (int startLine, int endLine);
00295
00296
00297 Q_SIGNALS:
00301 void editLineWrapped ( int line, int col, int len );
00302
00306 void editLineUnWrapped ( int line, int col );
00307
00308 private:
00309 void undoStart();
00310 void undoEnd();
00311
00312 public:
00313 void undoSafePoint();
00314
00315 bool undoDontMerge() const;
00316 void setUndoDontMerge(bool dontMerge);
00317
00318 bool undoDontMergeComplex() const;
00319 void setUndoDontMergeComplex(bool dontMerge);
00320
00321 bool isEditRunning() const;
00322 bool isWithUndo() const {return editWithUndo;}
00323 private Q_SLOTS:
00324 void undoCancel();
00325
00326 private:
00327 void editAddUndo (int type, uint line, uint col, uint len, const QString &text);
00328
00329 int editSessionNumber;
00330 QStack<int> editStateStack;
00331 QStack<Kate::EditSource> m_editSources;
00332 bool editIsRunning;
00333 bool editWithUndo;
00334 bool m_undoComplexMerge;
00335 KateUndoGroup* m_editCurrentUndo;
00336
00337
00338
00339
00340 public Q_SLOTS:
00341 void undo ();
00342 void redo ();
00343 void clearUndo ();
00344 void clearRedo ();
00345
00346 public:
00347 uint undoCount () const;
00348 uint redoCount () const;
00349 class KateEditHistory* history() const { return m_editHistory; }
00350
00351 private:
00352 KateEditHistory* m_editHistory;
00353
00354
00355
00356
00357 QList<KateUndoGroup*> undoItems;
00358 QList<KateUndoGroup*> redoItems;
00359 bool m_undoDontMerge;
00360 bool m_undoIgnoreCancel;
00361 QTimer* m_undoMergeTimer;
00362
00363
00364 KateUndoGroup* lastUndoGroupWhenSaved;
00365 KateUndoGroup* lastRedoGroupWhenSaved;
00366 bool docWasSavedWhenUndoWasEmpty;
00367 bool docWasSavedWhenRedoWasEmpty;
00368
00369
00370 void updateModified();
00371
00372 Q_SIGNALS:
00373 void undoChanged ();
00374
00375
00376
00377
00378 public Q_SLOTS:
00379 QVector<KTextEditor::Range> searchText(
00380 const KTextEditor::Range & range,
00381 const QString & pattern,
00382 const KTextEditor::Search::SearchOptions options);
00383
00384 KTextEditor::Search::SearchOptions supportedSearchOptions() const;
00385
00386
00387
00388
00389 private:
00404 KTextEditor::Range searchText (const KTextEditor::Range & inputRange,
00405 const QString &text, bool casesensitive = true, bool backwards = false);
00406
00420 QVector<KTextEditor::Range> searchRegex (const KTextEditor::Range & inputRange,
00421 QRegExp & regexp, bool backwards = false);
00422
00423 private:
00427 QWidget * dialogParent();
00428
00429
00430
00431
00432 public:
00443 static void escapePlaintext(QString & text, QList<ReplacementPart> * parts = NULL,
00444 bool replacementGoodies = false);
00445
00456 static int repairPattern(QString & pattern, bool & stillMultiLine);
00457
00458
00459
00460
00461 private:
00475 static int fixedLastIndexIn(const QRegExp & matcher, const QString & str,
00476 int offset = -1, QRegExp::CaretMode caretMode = QRegExp::CaretAtZero);
00477
00478
00479
00480
00481 public:
00487 virtual QString mode() const;
00488
00494 virtual QString highlightingMode() const;
00495
00500 virtual QStringList modes() const;
00501
00506 virtual QStringList highlightingModes() const;
00507
00513 virtual bool setMode(const QString &name);
00514
00520 virtual bool setHighlightingMode(const QString &name);
00527 virtual QString highlightingModeSection( int index ) const;
00528
00535 virtual QString modeSection( int index ) const;
00536
00537
00538
00539
00540
00541
00542 Q_SIGNALS:
00549 void modeChanged(KTextEditor::Document *document);
00550
00557 void highlightingModeChanged(KTextEditor::Document *document);
00558
00559
00560
00561
00562 public:
00563 void bufferHlChanged();
00564
00565 private:
00566 void setDontChangeHlOnSave();
00567
00568
00569
00570
00571 public:
00572 void readSessionConfig (const KConfigGroup&);
00573 void writeSessionConfig (KConfigGroup&);
00574
00575
00576
00577
00578 public Q_SLOTS:
00579 void setMark( int line, uint markType );
00580 void clearMark( int line );
00581
00582 void addMark( int line, uint markType );
00583 void removeMark( int line, uint markType );
00584
00585 void clearMarks();
00586
00587 void setMarkPixmap( MarkInterface::MarkTypes, const QPixmap& );
00588
00589 void setMarkDescription( MarkInterface::MarkTypes, const QString& );
00590
00591 void setEditableMarks( uint markMask );
00592
00593 public:
00594 uint mark( int line );
00595 const QHash<int, KTextEditor::Mark*> &marks ();
00596 QPixmap markPixmap( MarkInterface::MarkTypes ) const;
00597 QString markDescription( MarkInterface::MarkTypes ) const;
00598 QColor markColor( MarkInterface::MarkTypes ) const;
00599 uint editableMarks() const;
00600
00601 Q_SIGNALS:
00602 void marksChanged( KTextEditor::Document* );
00603 void markChanged( KTextEditor::Document*, KTextEditor::Mark, KTextEditor::MarkInterface::MarkChangeAction );
00604
00605 private:
00606 QHash<int, KTextEditor::Mark*> m_marks;
00607 QHash<int,QPixmap> m_markPixmaps;
00608 QHash<int,QString> m_markDescriptions;
00609 uint m_editableMarks;
00610
00611
00612
00613
00614 public Q_SLOTS:
00615 bool printDialog ();
00616 bool print ();
00617
00618
00619
00620
00621 public:
00629 QString mimeType();
00630
00637 KMimeType::Ptr mimeTypeForContent();
00638
00639
00640
00641
00642 public:
00643 QString variable( const QString &name ) const;
00644
00645 Q_SIGNALS:
00646 void variableChanged( KTextEditor::Document*, const QString &, const QString & );
00647
00648 private:
00649 QMap<QString, QString> m_storedVariables;
00650
00651
00652
00653
00654 public:
00655 virtual void clearSmartInterface();
00656
00657 virtual int currentRevision() const;
00658 virtual void releaseRevision(int revision) const;
00659 virtual void useRevision(int revision = -1);
00660 virtual KTextEditor::Cursor translateFromRevision(const KTextEditor::Cursor& cursor, KTextEditor::SmartCursor::InsertBehavior insertBehavior = KTextEditor::SmartCursor::StayOnInsert) const;
00661 virtual KTextEditor::Range translateFromRevision(const KTextEditor::Range& range, KTextEditor::SmartRange::InsertBehaviors insertBehavior = KTextEditor::SmartRange::ExpandLeft | KTextEditor::SmartRange::ExpandRight) const;
00662
00663 virtual KTextEditor::SmartCursor* newSmartCursor(const KTextEditor::Cursor& position, KTextEditor::SmartCursor::InsertBehavior insertBehavior = KTextEditor::SmartCursor::MoveOnInsert);
00664 virtual void deleteCursors();
00665
00666 virtual KTextEditor::SmartRange* newSmartRange(const KTextEditor::Range& range, KTextEditor::SmartRange* parent = 0L, KTextEditor::SmartRange::InsertBehaviors insertBehavior = KTextEditor::SmartRange::DoNotExpand);
00667 virtual KTextEditor::SmartRange* newSmartRange(KTextEditor::SmartCursor* start, KTextEditor::SmartCursor* end, KTextEditor::SmartRange* parent = 0L, KTextEditor::SmartRange::InsertBehaviors insertBehavior = KTextEditor::SmartRange::DoNotExpand);
00668 virtual void unbindSmartRange(KTextEditor::SmartRange* range);
00669 virtual void deleteRanges();
00670
00671
00672 virtual void addHighlightToDocument(KTextEditor::SmartRange* topRange, bool supportDynamic);
00673 virtual const QList<KTextEditor::SmartRange*> documentHighlights() const;
00674 virtual void clearDocumentHighlights();
00675
00676 virtual void addHighlightToView(KTextEditor::View* view, KTextEditor::SmartRange* topRange, bool supportDynamic);
00677 virtual void removeHighlightFromView(KTextEditor::View* view, KTextEditor::SmartRange* topRange);
00678 virtual const QList<KTextEditor::SmartRange*> viewHighlights(KTextEditor::View* view) const;
00679 virtual void clearViewHighlights(KTextEditor::View* view);
00680
00681
00682 virtual void addActionsToDocument(KTextEditor::SmartRange* topRange);
00683 virtual const QList<KTextEditor::SmartRange*> documentActions() const;
00684 virtual void clearDocumentActions();
00685
00686 virtual void addActionsToView(KTextEditor::View* view, KTextEditor::SmartRange* topRange);
00687 virtual void removeActionsFromView(KTextEditor::View* view, KTextEditor::SmartRange* topRange);
00688 virtual const QList<KTextEditor::SmartRange*> viewActions(KTextEditor::View* view) const;
00689 virtual void clearViewActions(KTextEditor::View* view);
00690
00691 KateSmartManager* smartManager() const { return m_smartManager; }
00692
00693 Q_SIGNALS:
00694 void dynamicHighlightAdded(KateSmartRange* range);
00695 void dynamicHighlightRemoved(KateSmartRange* range);
00696
00697 public Q_SLOTS:
00698 virtual void removeHighlightFromDocument(KTextEditor::SmartRange* topRange);
00699 virtual void removeActionsFromDocument(KTextEditor::SmartRange* topRange);
00700
00701 protected:
00702 virtual void attributeDynamic(KTextEditor::Attribute::Ptr a);
00703 virtual void attributeNotDynamic(KTextEditor::Attribute::Ptr a);
00704
00705 private:
00706
00707 virtual void rangeDeleted(KTextEditor::SmartRange* range);
00708
00709 KateSmartManager* m_smartManager;
00710 QList<KTextEditor::SmartRange*> m_documentHighlights;
00711 QList<KTextEditor::SmartRange*> m_documentDynamicHighlights;
00712 QList<KTextEditor::SmartRange*> m_documentActions;
00713
00714
00715
00716
00717 public:
00718
00719 virtual void setAnnotationModel( KTextEditor::AnnotationModel* model );
00720 virtual KTextEditor::AnnotationModel* annotationModel() const;
00721
00722 Q_SIGNALS:
00723 void annotationModelChanged( KTextEditor::AnnotationModel*, KTextEditor::AnnotationModel* );
00724
00725 private:
00726 KTextEditor::AnnotationModel* m_annotationModel;
00727
00728
00729
00730
00731 public:
00737 bool openFile ();
00738
00744 bool saveFile ();
00745
00746 void setReadWrite ( bool rw = true );
00747
00748 void setModified( bool m );
00749
00750 private:
00751 void activateDirWatch (const QString &useFileName = QString());
00752 void deactivateDirWatch ();
00753
00754 QString m_dirWatchFile;
00755
00756 public:
00760 bool typeChars ( KateView *type, const QString &chars );
00761
00765 inline int lastLine() const { return lines()-1; }
00766
00767
00768 void repaintViews(bool paintOnlyDirty = true);
00769
00770 KateHighlighting *highlight () const;
00771
00772 public Q_SLOTS:
00773 void tagLines(int start, int end);
00774 void tagLines(KTextEditor::Cursor start, KTextEditor::Cursor end);
00775
00776
00777 public Q_SLOTS:
00778 void exportAs(const QString&) { }
00779
00780 Q_SIGNALS:
00781 void preHighlightChanged(uint);
00782
00783 private Q_SLOTS:
00784 void internalHlChanged();
00785
00786 public:
00787 void addView(KTextEditor::View *);
00794 void removeView(KTextEditor::View *);
00795 void setActiveView(KTextEditor::View*);
00796
00797 bool ownedView(KateView *);
00798
00799 uint toVirtualColumn( const KTextEditor::Cursor& );
00800 void newLine( KateView*view );
00801 void backspace( KateView *view, const KTextEditor::Cursor& );
00802 void del( KateView *view, const KTextEditor::Cursor& );
00803 void transpose( const KTextEditor::Cursor& );
00804
00805 void paste ( KateView* view, QClipboard::Mode = QClipboard::Clipboard );
00806
00807 public:
00808 void indent ( KateView *view, uint line, int change );
00809 void comment ( KateView *view, uint line, uint column, int change );
00810 void align ( KateView *view, uint line );
00811
00812 enum TextTransform { Uppercase, Lowercase, Capitalize };
00813
00821 void transform ( KateView *view, const KTextEditor::Cursor &, TextTransform );
00825 void joinLines( uint first, uint last );
00826
00827 private:
00828 bool removeStringFromBeginning(int line, const QString &str);
00829 bool removeStringFromEnd(int line, const QString &str);
00830
00840 bool nextNonSpaceCharPos(int &line, int &col);
00841
00849 bool previousNonSpaceCharPos(int &line, int &col);
00850
00855 void addStartLineCommentToSingleLine(int line, int attrib=0);
00860 bool removeStartLineCommentFromSingleLine(int line, int attrib=0);
00861
00865 void addStartStopCommentToSingleLine(int line, int attrib=0);
00869 bool removeStartStopCommentFromSingleLine(int line, int attrib=0);
00873 bool removeStartStopCommentFromRegion(const KTextEditor::Cursor &start, const KTextEditor::Cursor &end, int attrib=0);
00874
00879 void addStartStopCommentToSelection( KateView *view, int attrib=0 );
00883 void addStartLineCommentToSelection( KateView *view, int attrib=0 );
00884
00891 bool removeStartStopCommentFromSelection( KateView *view, int attrib=0 );
00895 bool removeStartLineCommentFromSelection( KateView *view, int attrib=0 );
00896
00897 public:
00898 QString getWord( const KTextEditor::Cursor& cursor );
00899
00900 public:
00901 void tagAll();
00902
00903 void newBracketMark( const KTextEditor::Cursor& start, KTextEditor::Range& bm, int maxLines = -1 );
00904 bool findMatchingBracket( KTextEditor::Range& range, int maxLines = -1 );
00905
00906 private:
00907 void guiActivateEvent( KParts::GUIActivateEvent *ev );
00908
00909 public:
00910 const QString &documentName () const { return m_docName; }
00911
00912 void setDocName (QString docName);
00913
00914 void lineInfo (KateLineInfo *info, unsigned int line);
00915
00916 KateCodeFoldingTree *foldingTree ();
00917
00918 public:
00922 bool isModifiedOnDisc() { return m_modOnHd; }
00923
00924 void setModifiedOnDisk( ModifiedOnDiskReason reason );
00925
00926 void setModifiedOnDiskWarning ( bool on );
00927
00928 public Q_SLOTS:
00933 void slotModifiedOnDisk( KTextEditor::View *v = 0 );
00934
00938 bool documentReload ();
00939
00940 bool documentSave ();
00941 bool documentSaveAs ();
00942
00943 Q_SIGNALS:
00950 void modifiedOnDisk (KTextEditor::Document *doc, bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason);
00951
00952 public:
00953 void ignoreModifiedOnDiskOnce();
00954
00955 private:
00956 int m_isasking;
00957
00958
00959 public:
00960 bool setEncoding (const QString &e);
00961 const QString &encoding() const;
00962 void setScriptForEncodingAutoDetection (KEncodingDetector::AutoDetectScript);
00963 KEncodingDetector::AutoDetectScript scriptForEncodingAutoDetection() const;
00964
00965
00966 public Q_SLOTS:
00967 void setWordWrap (bool on);
00968 void setWordWrapAt (uint col);
00969
00970 public:
00971 bool wordWrap() const;
00972 uint wordWrapAt() const;
00973
00974 public Q_SLOTS:
00975 void setPageUpDownMovesCursor(bool on);
00976
00977 public:
00978 bool pageUpDownMovesCursor() const;
00979
00980
00981 public:
00982 uint getRealLine(unsigned int virtualLine);
00983 uint getVirtualLine(unsigned int realLine);
00984 uint visibleLines ();
00985 KateTextLine::Ptr kateTextLine(uint i);
00986 KateTextLine::Ptr plainKateTextLine(uint i);
00987
00988 Q_SIGNALS:
00989 void codeFoldingUpdated();
00990 void aboutToRemoveText(const KTextEditor::Range&);
00991 void textRemoved();
00992
00993 private Q_SLOTS:
00994 void slotModOnHdDirty (const QString &path);
00995 void slotModOnHdCreated (const QString &path);
00996 void slotModOnHdDeleted (const QString &path);
00997
00998 private:
01006 bool createDigest ( QByteArray &result );
01007
01011 QString reasonedMOHString() const;
01012
01019 void removeTrailingSpace(int line);
01020 inline void blockRemoveTrailingSpaces(bool block)
01021 { m_blockRemoveTrailingSpaces = block; }
01022
01023 private:
01025 bool m_blockRemoveTrailingSpaces;
01026
01027 public:
01028 void updateFileType (const QString &newType, bool user = false);
01029
01030 QString fileType () const { return m_fileType; }
01031
01032
01033
01034
01035 private:
01036
01037 KateBuffer *m_buffer;
01038
01039
01040 KateAutoIndent m_indenter;
01041
01042 bool hlSetByUser;
01043
01044 bool m_modOnHd;
01045 ModifiedOnDiskReason m_modOnHdReason;
01046 QByteArray m_digest;
01047
01048 QString m_docName;
01049 int m_docNameNumber;
01050
01051
01052 QString m_fileType;
01053 bool m_fileTypeSetByUser;
01054
01058 bool m_reloading;
01059
01060 public Q_SLOTS:
01061 void slotQueryClose_save(bool *handled, bool* abortClosing);
01062
01063 public:
01064 virtual bool queryClose();
01065
01066 void makeAttribs (bool needInvalidate = true);
01067
01068 static bool checkOverwrite( KUrl u, QWidget *parent );
01069
01073 public:
01074 KateDocumentConfig *config() { return m_config; }
01075 KateDocumentConfig *config() const { return m_config; }
01076
01077 void updateConfig ();
01078
01079 private:
01080 KateDocumentConfig *m_config;
01081
01086 private:
01090 void readDirConfig ();
01091
01096 void readVariables(bool onlyViewAndRenderer = false);
01097
01102 void readVariableLine( QString t, bool onlyViewAndRenderer = false );
01106 void setViewVariable( QString var, QString val );
01112 static bool checkBoolValue( QString value, bool *result );
01118 static bool checkIntValue( QString value, int *result );
01123 static bool checkColorValue( QString value, QColor &col );
01124
01128 static QRegExp kvLine;
01129 static QRegExp kvLineWildcard;
01130 static QRegExp kvLineMime;
01131 static QRegExp kvVar;
01132
01133 bool s_fileChangedDialogsActivated;
01134
01135
01136 public:
01137 bool setTabInterceptor(KateKeyInterceptorFunctor *interceptor);
01138 bool removeTabInterceptor(KateKeyInterceptorFunctor *interceptor);
01139 bool invokeTabInterceptor(int key);
01140 bool insertTemplateTextImplementation ( const KTextEditor::Cursor &c, const QString &templateString, const QMap<QString,QString> &initialValues, QWidget *);
01141
01142 protected:
01143 KateKeyInterceptorFunctor *m_tabInterceptor;
01144
01145 protected Q_SLOTS:
01146 void testTemplateCode();
01147 void dumpRegionTree();
01148 public:
01149 class LoadSaveFilterCheckPlugins;
01150 private:
01151 void setPreSavePostDialogFilterChecks(QStringList plugins) {m_preSavePostDialogFilterChecks=plugins;}
01152 QStringList m_preSavePostDialogFilterChecks;
01153 void setPostLoadFilterChecks(QStringList plugins) {m_postLoadFilterChecks=plugins;}
01154 QStringList m_postLoadFilterChecks;
01155 static LoadSaveFilterCheckPlugins* loadSaveFilterCheckPlugins();
01156 };
01157
01158 #endif
01159
01160
01161