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 
00043 
00049 namespace Kate
00050 {
00051 
00052 class View;
00053 
00054 class KATEPARTINTERFACES_EXPORT Cursor : public KTextEditor::Cursor
00055 {
00056   public:
00057     Cursor () { ; };
00058     virtual ~Cursor () { ; };
00059 };
00060 
00061 class KATEPARTINTERFACES_EXPORT ConfigPage : public KTextEditor::ConfigPage
00062 {
00063   Q_OBJECT
00064 
00065   public:
00066     ConfigPage ( QWidget *parent=0, const char *name=0 ) : KTextEditor::ConfigPage (parent, name) { ; };
00067     virtual ~ConfigPage () { ; };
00068 
00069   public slots:
00070     virtual void apply () { ; };
00071     virtual void reload () { ; };
00072     virtual void reset () {};
00073     virtual void defaults () {};
00074 
00075   protected slots:
00076     void slotChanged();
00077 };
00078 
00079 class KATEPARTINTERFACES_EXPORT ActionMenu : public KActionMenu
00080 {
00081   Q_OBJECT
00082 
00083   public:
00084     ActionMenu ( const QString& text, QObject* parent = 0, const char* name = 0 )
00085       : KActionMenu(text, parent, name) { ; };
00086     virtual ~ActionMenu () { ; };
00087 
00088   public:
00089     virtual void updateMenu (class Document *) = 0;
00090 };
00091 
00095 class KATEPARTINTERFACES_EXPORT Command
00096 {
00097   public:
00098     Command () {};
00099     virtual ~Command () {};
00100 
00101   public:
00106     virtual QStringList cmds () = 0;
00107 
00112     virtual bool exec (View *view, const QString &cmd, QString &msg) = 0;
00113 
00118     virtual bool help (View *view, const QString &cmd, QString &msg) = 0;
00119 };
00120 
00121 
00124 class KATEPARTINTERFACES_EXPORT Document : public KTextEditor::Document, public KTextEditor::EditInterface,
00125                      public KTextEditor::UndoInterface, public KTextEditor::CursorInterface,
00126                      public KTextEditor::SelectionInterface, public KTextEditor::SearchInterface,
00127                      public KTextEditor::HighlightingInterface, public KTextEditor::BlockSelectionInterface,
00128                      public KTextEditor::ConfigInterface, public KTextEditor::MarkInterface,
00129                      public KTextEditor::PrintInterface, public KTextEditor::WordWrapInterface,
00130                      public KTextEditor::MarkInterfaceExtension,
00131                      public KTextEditor::SelectionInterfaceExt
00132 {
00133   Q_OBJECT
00134 
00135   public:
00136     Document ();
00137     Document ( QObject* parent, const char* name );
00138     virtual ~Document ();
00139 
00143   public:
00144     static bool registerCommand (Command *cmd);
00145     static bool unregisterCommand (Command *cmd);
00146     static Command *queryCommand (const QString &cmd);
00147 
00148   public:
00153     virtual void isModOnHD(bool =false) { ; };
00154 
00158     virtual QString docName () { return 0L; };
00159 
00165     virtual void setDocName (QString ) { ; };
00166 
00167     virtual ActionMenu *hlActionMenu (const QString& , QObject* =0, const char* = 0) = 0;
00168     virtual ActionMenu *exportActionMenu (const QString& , QObject* =0, const char* = 0) = 0;
00169 
00170   public slots:
00171     // clear buffer/filename - update the views
00172     virtual void flush () { ; };
00173 
00177     virtual void reloadFile() = 0;
00178 
00182     virtual void spellcheck() {};
00183 
00184     virtual void exportAs(const QString &) = 0;
00185 
00186     virtual void applyWordWrap () = 0;
00187 
00188 
00189   public:
00190     virtual void setWordWrap (bool ) = 0;
00191     virtual bool wordWrap () = 0;
00192 
00193     virtual void setWordWrapAt (uint) = 0;
00194     virtual uint wordWrapAt () = 0;
00195 
00196 
00197     virtual void setEncoding (const QString &e) = 0;
00198     virtual QString encoding() const = 0;
00199 
00201   // FIXME: Remove when BIC allowed.
00202   public:
00203     virtual ConfigPage *colorConfigPage (QWidget *) = 0;
00204     virtual ConfigPage *fontConfigPage (QWidget *) = 0;
00205     virtual ConfigPage *indentConfigPage (QWidget *) = 0;
00206     virtual ConfigPage *selectConfigPage (QWidget *) = 0;
00207     virtual ConfigPage *editConfigPage (QWidget *) = 0;
00208     virtual ConfigPage *keysConfigPage (QWidget *) = 0;
00209     virtual ConfigPage *kSpellConfigPage (QWidget *) { return 0L; }
00210     virtual ConfigPage *hlConfigPage (QWidget *) = 0;
00211 
00212   public:
00213     virtual uint configFlags () = 0;
00214     virtual void setConfigFlags (uint flags) = 0;
00215 
00216     // Flags for katedocument config !
00217     enum ConfigFlags
00218     {
00219       cfAutoIndent= 0x1,
00220       cfBackspaceIndents= 0x2,
00221       cfWordWrap= 0x4,
00222       cfReplaceTabs= 0x8,
00223       cfRemoveSpaces = 0x10,
00224       cfWrapCursor= 0x20,
00225       cfAutoBrackets= 0x40,
00226       cfPersistent= 0x80,
00227       cfKeepSelection= 0x100,
00228       cfDelOnInput= 0x400,
00229       cfXorSelect= 0x800,
00230       cfOvr= 0x1000,
00231       cfMark= 0x2000,
00232       cfKeepIndentProfile= 0x8000,
00233       cfKeepExtraSpaces= 0x10000,
00234       cfTabIndents= 0x80000,
00235       cfShowTabs= 0x200000,
00236       cfSpaceIndent= 0x400000,
00237       cfSmartHome = 0x800000
00238     };
00239 
00240   signals:
00241     /* reason = 0 nothing, 1 dirty, 2 created, 3 deleted */
00242     void modifiedOnDisc (Kate::Document *doc, bool isModified, unsigned char reason);
00243 
00244   /*
00245    * there static methodes are usefull to turn on/off the dialogs
00246    * kate part shows up on open file errors + file changed warnings
00247    * open file errors default on, file changed warnings default off, better
00248    * for other apps beside kate app using the part
00249    */
00250   public:
00251     // default true
00252     static void setOpenErrorDialogsActivated (bool on);
00253 
00254     // default false
00255     static void setFileChangedDialogsActivated (bool on);
00256 
00257     static const QString &defaultEncoding ();
00258 
00259   protected:
00260     static bool s_openErrorDialogsActivated;
00261     static bool s_fileChangedDialogsActivated;
00262 
00263     static QString s_defaultEncoding;
00264 };
00265 
00270 class KATEPARTINTERFACES_EXPORT DocumentExt
00271  : public KTextEditor::DocumentInfoInterface,
00272    public KTextEditor::VariableInterface
00273 {
00274   public:
00275     DocumentExt ();
00276     virtual ~DocumentExt ();
00277 
00278   public:
00282     enum ModifiedOnDiskReason {
00283       Unmodified = 0, 
00284       Modified = 1,   
00285       Created = 2,    
00286       Deleted = 3     
00287     };
00288 
00289   public:
00295     virtual void setModifiedOnDisk( int reason ) = 0;
00296 
00300   public:
00306     virtual void slotModifiedOnDisk( View *v=0 ) = 0;
00307 };
00308 
00314 KATEPARTINTERFACES_EXPORT Document *document (KTextEditor::Document *doc);
00315 
00321 KATEPARTINTERFACES_EXPORT DocumentExt *documentExt (KTextEditor::Document *doc);
00322 
00323 KATEPARTINTERFACES_EXPORT Document *createDocument ( QObject *parent = 0, const char *name = 0 );
00324 
00325 }
00326 
00327 #endif
KDE Logo
This file is part of the documentation for kate Library Version 3.3.90.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 30 10:24:41 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003