kate Library API Documentation

document.h

00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef _KATE_DOCUMENT_INCLUDE_ 00020 #define _KATE_DOCUMENT_INCLUDE_ 00021 00022 #include <ktexteditor/document.h> 00023 #include <ktexteditor/view.h> 00024 #include <ktexteditor/editinterface.h> 00025 #include <ktexteditor/undointerface.h> 00026 #include <ktexteditor/cursorinterface.h> 00027 #include <ktexteditor/documentinfo.h> 00028 #include <ktexteditor/selectioninterface.h> 00029 #include <ktexteditor/selectioninterfaceext.h> 00030 #include <ktexteditor/blockselectioninterface.h> 00031 #include <ktexteditor/searchinterface.h> 00032 #include <ktexteditor/highlightinginterface.h> 00033 #include <ktexteditor/configinterface.h> 00034 #include <ktexteditor/configinterfaceextension.h> 00035 #include <ktexteditor/markinterface.h> 00036 #include <ktexteditor/markinterfaceextension.h> 00037 #include <ktexteditor/wordwrapinterface.h> 00038 #include <ktexteditor/printinterface.h> 00039 #include <ktexteditor/variableinterface.h> 00040 00041 #include <kaction.h> 00042 00048 namespace Kate 00049 { 00050 00051 class View; 00052 00053 class Cursor : public KTextEditor::Cursor 00054 { 00055 public: 00056 Cursor () { ; }; 00057 virtual ~Cursor () { ; }; 00058 }; 00059 00060 class ConfigPage : public KTextEditor::ConfigPage 00061 { 00062 Q_OBJECT 00063 00064 public: 00065 ConfigPage ( QWidget *parent=0, const char *name=0 ) : KTextEditor::ConfigPage (parent, name) { ; }; 00066 virtual ~ConfigPage () { ; }; 00067 00068 public slots: 00069 virtual void apply () { ; }; 00070 virtual void reload () { ; }; 00071 virtual void reset () {}; 00072 virtual void defaults () {}; 00073 00074 protected slots: 00075 void slotChanged(); 00076 }; 00077 00078 class ActionMenu : public KActionMenu 00079 { 00080 Q_OBJECT 00081 00082 public: 00083 ActionMenu ( const QString& text, QObject* parent = 0, const char* name = 0 ) 00084 : KActionMenu(text, parent, name) { ; }; 00085 virtual ~ActionMenu () { ; }; 00086 00087 public: 00088 virtual void updateMenu (class Document *) = 0; 00089 }; 00090 00094 class Command 00095 { 00096 public: 00097 Command () {}; 00098 virtual ~Command () {}; 00099 00100 public: 00105 virtual QStringList cmds () = 0; 00106 00111 virtual bool exec (View *view, const QString &cmd, QString &msg) = 0; 00112 00117 virtual bool help (View *view, const QString &cmd, QString &msg) = 0; 00118 }; 00119 00122 class Document : public KTextEditor::Document, public KTextEditor::EditInterface, 00123 public KTextEditor::UndoInterface, public KTextEditor::CursorInterface, 00124 public KTextEditor::SelectionInterface, public KTextEditor::SearchInterface, 00125 public KTextEditor::HighlightingInterface, public KTextEditor::BlockSelectionInterface, 00126 public KTextEditor::ConfigInterface, public KTextEditor::MarkInterface, 00127 public KTextEditor::PrintInterface, public KTextEditor::WordWrapInterface, 00128 public KTextEditor::MarkInterfaceExtension, 00129 public KTextEditor::SelectionInterfaceExt 00130 { 00131 Q_OBJECT 00132 00133 public: 00134 Document (); 00135 Document ( QObject* parent, const char* name ); 00136 virtual ~Document (); 00137 00141 public: 00142 static bool registerCommand (Command *cmd); 00143 static bool unregisterCommand (Command *cmd); 00144 static Command *queryCommand (const QString &cmd); 00145 00146 public: 00151 virtual void isModOnHD(bool =false) { ; }; 00152 00156 virtual QString docName () { return 0L; }; 00157 00163 virtual void setDocName (QString ) { ; }; 00164 00165 virtual ActionMenu *hlActionMenu (const QString& , QObject* =0, const char* = 0) = 0; 00166 virtual ActionMenu *exportActionMenu (const QString& , QObject* =0, const char* = 0) = 0; 00167 00168 public slots: 00169 // clear buffer/filename - update the views 00170 virtual void flush () { ; }; 00171 00175 virtual void reloadFile() = 0; 00176 00180 virtual void spellcheck() {}; 00181 00182 virtual void exportAs(const QString &) = 0; 00183 00184 virtual void applyWordWrap () = 0; 00185 00186 00187 public: 00188 virtual void setWordWrap (bool ) = 0; 00189 virtual bool wordWrap () = 0; 00190 00191 virtual void setWordWrapAt (uint) = 0; 00192 virtual uint wordWrapAt () = 0; 00193 00194 00195 virtual void setEncoding (const QString &e) = 0; 00196 virtual QString encoding() const = 0; 00197 00199 // FIXME: Remove when BIC allowed. 00200 public: 00201 virtual ConfigPage *colorConfigPage (QWidget *) = 0; 00202 virtual ConfigPage *fontConfigPage (QWidget *) = 0; 00203 virtual ConfigPage *indentConfigPage (QWidget *) = 0; 00204 virtual ConfigPage *selectConfigPage (QWidget *) = 0; 00205 virtual ConfigPage *editConfigPage (QWidget *) = 0; 00206 virtual ConfigPage *keysConfigPage (QWidget *) = 0; 00207 virtual ConfigPage *kSpellConfigPage (QWidget *) { return 0L; } 00208 virtual ConfigPage *hlConfigPage (QWidget *) = 0; 00209 00210 public: 00211 virtual uint configFlags () = 0; 00212 virtual void setConfigFlags (uint flags) = 0; 00213 00214 // Flags for katedocument config ! 00215 enum ConfigFlags 00216 { 00217 cfAutoIndent= 0x1, 00218 cfBackspaceIndents= 0x2, 00219 cfWordWrap= 0x4, 00220 cfReplaceTabs= 0x8, 00221 cfRemoveSpaces = 0x10, 00222 cfWrapCursor= 0x20, 00223 cfAutoBrackets= 0x40, 00224 cfPersistent= 0x80, 00225 cfKeepSelection= 0x100, 00226 cfDelOnInput= 0x400, 00227 cfXorSelect= 0x800, 00228 cfOvr= 0x1000, 00229 cfMark= 0x2000, 00230 cfKeepIndentProfile= 0x8000, 00231 cfKeepExtraSpaces= 0x10000, 00232 cfTabIndents= 0x80000, 00233 cfShowTabs= 0x200000, 00234 cfSpaceIndent= 0x400000, 00235 cfSmartHome = 0x800000 00236 }; 00237 00238 signals: 00239 /* reason = 0 nothing, 1 dirty, 2 created, 3 deleted */ 00240 void modifiedOnDisc (Kate::Document *doc, bool isModified, unsigned char reason); 00241 00242 /* 00243 * there static methodes are usefull to turn on/off the dialogs 00244 * kate part shows up on open file errors + file changed warnings 00245 * open file errors default on, file changed warnings default off, better 00246 * for other apps beside kate app using the part 00247 */ 00248 public: 00249 // default true 00250 static void setOpenErrorDialogsActivated (bool on); 00251 00252 // default false 00253 static void setFileChangedDialogsActivated (bool on); 00254 00255 static const QString &defaultEncoding (); 00256 00257 protected: 00258 static bool s_openErrorDialogsActivated; 00259 static bool s_fileChangedDialogsActivated; 00260 00261 static QString s_defaultEncoding; 00262 }; 00263 00268 class DocumentExt 00269 : public KTextEditor::DocumentInfoInterface, 00270 public KTextEditor::VariableInterface 00271 { 00272 public: 00273 DocumentExt (); 00274 virtual ~DocumentExt (); 00275 00276 public: 00280 enum ModifiedOnDiskReason { 00281 Unmodified = 0, 00282 Modified = 1, 00283 Created = 2, 00284 Deleted = 3 00285 }; 00286 00287 public: 00293 virtual void setModifiedOnDisk( int reason ) = 0; 00294 00298 public: 00304 virtual void slotModifiedOnDisk( View *v=0 ) = 0; 00305 }; 00306 00312 Document *document (KTextEditor::Document *doc); 00313 00319 DocumentExt *documentExt (KTextEditor::Document *doc); 00320 00321 Document *createDocument ( QObject *parent = 0, const char *name = 0 ); 00322 00323 } 00324 00325 #endif
KDE Logo
This file is part of the documentation for kate Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Sep 29 09:45:06 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003