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/selectioninterface.h>
00028 #include <ktexteditor/selectioninterfaceext.h>
00029 #include <ktexteditor/blockselectioninterface.h>
00030 #include <ktexteditor/searchinterface.h>
00031 #include <ktexteditor/highlightinginterface.h>
00032 #include <ktexteditor/configinterface.h>
00033 #include <ktexteditor/configinterfaceextension.h>
00034 #include <ktexteditor/markinterface.h>
00035 #include <ktexteditor/markinterfaceextension.h>
00036 #include <ktexteditor/wordwrapinterface.h>
00037 #include <ktexteditor/printinterface.h>
00038 
00039 #include <kaction.h>
00040 
00041 namespace Kate
00042 {
00043 
00044 class View;
00045 
00046 class Cursor : public KTextEditor::Cursor
00047 {
00048   public:
00049     Cursor () { ; };
00050     virtual ~Cursor () { ; };
00051 };
00052 
00053 class ConfigPage : public KTextEditor::ConfigPage
00054 {
00055   Q_OBJECT
00056 
00057   public:
00058     ConfigPage ( QWidget *parent=0, const char *name=0 ) : KTextEditor::ConfigPage (parent, name) { ; };
00059     virtual ~ConfigPage () { ; };
00060 
00061   public slots:
00062     virtual void apply () { ; };
00063     virtual void reload () { ; };
00064     virtual void reset () {};
00065     virtual void defaults () {};
00066 
00067   protected slots:
00068     void slotChanged();
00069 };
00070 
00071 class ActionMenu : public KActionMenu
00072 {
00073   Q_OBJECT
00074 
00075   public:
00076     ActionMenu ( const QString& text, QObject* parent = 0, const char* name = 0 )
00077       : KActionMenu(text, parent, name) { ; };
00078     virtual ~ActionMenu () { ; };
00079 
00080   public:
00081     virtual void updateMenu (class Document *) = 0;
00082 };
00083 
00087 class Command
00088 {
00089   public:
00090     Command () {};
00091     virtual ~Command () {};
00092 
00093   public:
00098     virtual QStringList cmds () = 0;
00099 
00104     virtual bool exec (View *view, const QString &cmd, QString &msg) = 0;
00105 
00110     virtual bool help (View *view, const QString &cmd, QString &msg) = 0;
00111 };
00112 
00115 class Document : public KTextEditor::Document, public KTextEditor::EditInterface,
00116                      public KTextEditor::UndoInterface, public KTextEditor::CursorInterface,
00117                      public KTextEditor::SelectionInterface, public KTextEditor::SearchInterface,
00118                      public KTextEditor::HighlightingInterface, public KTextEditor::BlockSelectionInterface,
00119                      public KTextEditor::ConfigInterface, public KTextEditor::MarkInterface,
00120                      public KTextEditor::PrintInterface, public KTextEditor::WordWrapInterface,
00121                      public KTextEditor::MarkInterfaceExtension,
00122                      public KTextEditor::SelectionInterfaceExt
00123 {
00124   Q_OBJECT
00125 
00126   public:
00127     Document ();
00128     Document ( QObject* parent, const char* name );
00129     virtual ~Document ();
00130 
00134   public:
00135     static bool registerCommand (Command *cmd);
00136     static bool unregisterCommand (Command *cmd);
00137     static Command *queryCommand (const QString &cmd);
00138 
00139   public:
00144     virtual void isModOnHD(bool =false) { ; };
00145 
00149     virtual QString docName () { return 0L; };
00150 
00156     virtual void setDocName (QString ) { ; };
00157 
00158     virtual ActionMenu *hlActionMenu (const QString& , QObject* =0, const char* = 0) = 0;
00159     virtual ActionMenu *exportActionMenu (const QString& , QObject* =0, const char* = 0) = 0;
00160 
00161   public slots:
00162     // clear buffer/filename - update the views
00163     virtual void flush () { ; };
00164 
00168     virtual void reloadFile() = 0;
00169 
00173     virtual void spellcheck() {};
00174 
00175     virtual void exportAs(const QString &) = 0;
00176 
00177     virtual void applyWordWrap () = 0;
00178 
00179 
00180   public:
00181     virtual void setWordWrap (bool ) = 0;
00182     virtual bool wordWrap () = 0;
00183 
00184     virtual void setWordWrapAt (uint) = 0;
00185     virtual uint wordWrapAt () = 0;
00186 
00187 
00188     virtual void setEncoding (const QString &e) = 0;
00189     virtual QString encoding() const = 0;
00190 
00192   // FIXME: Remove when BIC allowed.
00193   public:
00194     virtual ConfigPage *colorConfigPage (QWidget *) = 0;
00195     virtual ConfigPage *fontConfigPage (QWidget *) = 0;
00196     virtual ConfigPage *indentConfigPage (QWidget *) = 0;
00197     virtual ConfigPage *selectConfigPage (QWidget *) = 0;
00198     virtual ConfigPage *editConfigPage (QWidget *) = 0;
00199     virtual ConfigPage *keysConfigPage (QWidget *) = 0;
00200     virtual ConfigPage *kSpellConfigPage (QWidget *) { return 0L; }
00201     virtual ConfigPage *hlConfigPage (QWidget *) = 0;
00202 
00203   public:
00204     virtual uint configFlags () = 0;
00205     virtual void setConfigFlags (uint flags) = 0;
00206 
00207     // Flags for katedocument config !
00208     enum ConfigFlags
00209     {
00210       cfAutoIndent= 0x1,
00211       cfBackspaceIndents= 0x2,
00212       cfWordWrap= 0x4,
00213       cfReplaceTabs= 0x8,
00214       cfRemoveSpaces = 0x10,
00215       cfWrapCursor= 0x20,
00216       cfAutoBrackets= 0x40,
00217       cfPersistent= 0x80,
00218       cfKeepSelection= 0x100,
00219       cfDelOnInput= 0x400,
00220       cfXorSelect= 0x800,
00221       cfOvr= 0x1000,
00222       cfMark= 0x2000,
00223       cfKeepIndentProfile= 0x8000,
00224       cfKeepExtraSpaces= 0x10000,
00225       cfTabIndents= 0x80000,
00226       cfShowTabs= 0x200000,
00227       cfSpaceIndent= 0x400000,
00228       cfSmartHome = 0x800000
00229     };
00230 
00231   signals:
00232     /* reason = 0 nothing, 1 dirty, 2 created, 3 deleted */
00233     void modifiedOnDisc (Kate::Document *doc, bool isModified, unsigned char reason);
00234 
00235   /*
00236    * there static methodes are usefull to turn on/off the dialogs
00237    * kate part shows up on open file errors + file changed warnings
00238    * open file errors default on, file changed warnings default off, better
00239    * for other apps beside kate app using the part
00240    */
00241   public:
00242     // default true
00243     static void setOpenErrorDialogsActivated (bool on);
00244 
00245     // default false
00246     static void setFileChangedDialogsActivated (bool on);
00247     
00248     static const QString &defaultEncoding ();
00249 
00250   protected:
00251     static bool s_openErrorDialogsActivated;
00252     static bool s_fileChangedDialogsActivated;
00253     
00254     static QString s_defaultEncoding;
00255 };
00256 
00257 Document *document (KTextEditor::Document *doc);
00258 
00259 Document *createDocument ( QObject *parent = 0, const char *name = 0 );
00260 
00261 }
00262 
00263 #endif
KDE Logo
This file is part of the documentation for kate Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Mar 3 19:25:01 2005 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003