• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • interfaces
document.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef _KATE_DOCUMENT_INCLUDE_
20 #define _KATE_DOCUMENT_INCLUDE_
21 
22 #include <tdetexteditor/document.h>
23 #include <tdetexteditor/view.h>
24 #include <tdetexteditor/editinterface.h>
25 #include <tdetexteditor/undointerface.h>
26 #include <tdetexteditor/cursorinterface.h>
27 #include <tdetexteditor/documentinfo.h>
28 #include <tdetexteditor/selectioninterface.h>
29 #include <tdetexteditor/selectioninterfaceext.h>
30 #include <tdetexteditor/blockselectioninterface.h>
31 #include <tdetexteditor/searchinterface.h>
32 #include <tdetexteditor/highlightinginterface.h>
33 #include <tdetexteditor/configinterface.h>
34 #include <tdetexteditor/configinterfaceextension.h>
35 #include <tdetexteditor/markinterface.h>
36 #include <tdetexteditor/markinterfaceextension.h>
37 #include <tdetexteditor/wordwrapinterface.h>
38 #include <tdetexteditor/printinterface.h>
39 #include <tdetexteditor/variableinterface.h>
40 
41 #include <tdeaction.h>
42 
43 class TDECompletion;
44 
50 namespace Kate
51 {
52 
53 class View;
54 
55 class KATEPARTINTERFACES_EXPORT Cursor : public KTextEditor::Cursor
56 {
57  public:
58  Cursor () { ; };
59  virtual ~Cursor () { ; };
60 };
61 
62 class KATEPARTINTERFACES_EXPORT ConfigPage : public KTextEditor::ConfigPage
63 {
64  TQ_OBJECT
65 
66  public:
67  ConfigPage ( TQWidget *parent=0, const char *name=0 ) : KTextEditor::ConfigPage (parent, name) { ; };
68  virtual ~ConfigPage () { ; };
69 
70  public slots:
71  virtual void apply () { ; };
72  virtual void reload () { ; };
73  virtual void reset () {};
74  virtual void defaults () {};
75 
76  protected slots:
77  void slotChanged();
78 };
79 
80 class KATEPARTINTERFACES_EXPORT ActionMenu : public TDEActionMenu
81 {
82  TQ_OBJECT
83 
84  public:
85  ActionMenu ( const TQString& text, TQObject* parent = 0, const char* name = 0 )
86  : TDEActionMenu(text, parent, name) { ; };
87  virtual ~ActionMenu () { ; };
88 
89  public:
90  virtual void updateMenu (class Document *) = 0;
91 };
92 
96 class KATEPARTINTERFACES_EXPORT Command
97 {
98  public:
99  Command () {};
100  virtual ~Command () {};
101 
102  public:
107  virtual TQStringList cmds () = 0;
108 
113  virtual bool exec (View *view, const TQString &cmd, TQString &msg) = 0;
114 
119  virtual bool help (View *view, const TQString &cmd, TQString &msg) = 0;
120 };
121 
129 class CommandExtension
130 {
131  public:
132  CommandExtension() {;}
133  virtual ~CommandExtension() {;}
134  //### this is yet to be tried
146  virtual void flagCompletions( TQStringList& /*list*/ ) {;}
147 
157  virtual TDECompletion *completionObject( const TQString & cmdname, Kate::View * /*view*/ ) { Q_UNUSED(cmdname); return 0L; }
158 
169  virtual bool wantsToProcessText( const TQString &cmdname ) { Q_UNUSED(cmdname); return false; }
170  // ### yet to be tested. The obvious candidate is isearch.
177  virtual void processText( Kate::View *view, const TQString &text ) { Q_UNUSED(view); Q_UNUSED(text); }
178 };
179 
182 class KATEPARTINTERFACES_EXPORT Document : public KTextEditor::Document, public KTextEditor::EditInterface,
183  public KTextEditor::UndoInterface, public KTextEditor::CursorInterface,
184  public KTextEditor::SelectionInterface, public KTextEditor::SearchInterface,
185  public KTextEditor::HighlightingInterface, public KTextEditor::BlockSelectionInterface,
186  public KTextEditor::ConfigInterface, public KTextEditor::MarkInterface,
187  public KTextEditor::PrintInterface, public KTextEditor::WordWrapInterface,
188  public KTextEditor::MarkInterfaceExtension,
189  public KTextEditor::SelectionInterfaceExt
190 {
191  TQ_OBJECT
192 
193  public:
194  Document ();
195  Document ( TQObject* parent, const char* name );
196  virtual ~Document ();
197 
201  public:
202  static bool registerCommand (Command *cmd);
203  static bool unregisterCommand (Command *cmd);
204  static Command *queryCommand (const TQString &cmd);
205 
206  public:
212  virtual void isModOnHD(bool =false) { ; };
213 
217  virtual TQString docName () { return 0L; };
218 
225  virtual void setDocName (TQString ) { ; };
226 
227  virtual ActionMenu *hlActionMenu (const TQString& , TQObject* =0, const char* = 0) = 0;
228  virtual ActionMenu *exportActionMenu (const TQString& , TQObject* =0, const char* = 0) = 0;
229 
230  public slots:
231  // clear buffer/filename - update the views
232  virtual void flush () { ; };
233 
237  virtual void reloadFile() = 0;
238 
242  virtual void spellcheck() {};
243 
244  virtual void exportAs(const TQString &) = 0;
245 
246  virtual void applyWordWrap () = 0;
247 
248 
249  public:
250  virtual void setWordWrap (bool ) = 0;
251  virtual bool wordWrap () = 0;
252 
253  virtual void setWordWrapAt (unsigned int) = 0;
254  virtual uint wordWrapAt () = 0;
255 
256 
257  virtual void setEncoding (const TQString &e) = 0;
258  virtual TQString encoding() const = 0;
259 
261  // FIXME: Remove when BIC allowed.
262  public:
264  virtual ConfigPage *colorConfigPage (TQWidget *) = 0;
266  virtual ConfigPage *fontConfigPage (TQWidget *) = 0;
268  virtual ConfigPage *indentConfigPage (TQWidget *) = 0;
270  virtual ConfigPage *selectConfigPage (TQWidget *) = 0;
272  virtual ConfigPage *editConfigPage (TQWidget *) = 0;
274  virtual ConfigPage *keysConfigPage (TQWidget *) = 0;
276  virtual ConfigPage *kSpellConfigPage (TQWidget *) { return 0L; }
278  virtual ConfigPage *hlConfigPage (TQWidget *) = 0;
279 
280  public:
281  virtual uint configFlags () = 0;
282  virtual void setConfigFlags (uint flags) = 0;
283 
284  // Flags for katedocument config !
285  enum ConfigFlags
286  {
287  cfAutoIndent= 0x1,
288  cfBackspaceIndents= 0x2,
289  cfWordWrap= 0x4,
290  cfReplaceTabs= 0x8,
291  cfRemoveSpaces = 0x10,
292  cfWrapCursor= 0x20,
293  cfAutoBrackets= 0x40,
294  cfPersistent= 0x80,
295  cfKeepSelection= 0x100,
296  cfDelOnInput= 0x400,
297  cfXorSelect= 0x800,
298  cfOvr= 0x1000,
299  cfMark= 0x2000,
300  cfKeepIndentProfile= 0x8000,
301  cfKeepExtraSpaces= 0x10000,
302  cfTabIndents= 0x80000,
303  cfShowTabs= 0x200000,
304  cfSpaceIndent= 0x400000,
305  cfSmartHome = 0x800000
306  };
307 
308  signals:
319  void modifiedOnDisc (Kate::Document *doc, bool isModified, unsigned char reason);
320 
321  /*
322  * there static methodes are usefull to turn on/off the dialogs
323  * kate part shows up on open file errors + file changed warnings
324  * open file errors default on, file changed warnings default off, better
325  * for other apps beside kate app using the part
326  */
327  public:
328  // default true
329  static void setOpenErrorDialogsActivated (bool on);
330 
331  // default false
332  static void setFileChangedDialogsActivated (bool on);
333 
334  static const TQString &defaultEncoding ();
335 
336  protected:
337  static bool s_openErrorDialogsActivated;
338  static bool s_fileChangedDialogsActivated;
339 
340  static TQString s_defaultEncoding;
341 };
342 
347 class KATEPARTINTERFACES_EXPORT DocumentExt
348  : public KTextEditor::DocumentInfoInterface,
349  public KTextEditor::VariableInterface
350 {
351  public:
352  DocumentExt ();
353  virtual ~DocumentExt ();
354 
355  public:
359  enum ModifiedOnDiskReason {
360  Unmodified = 0,
361  Modified = 1,
362  Created = 2,
363  Deleted = 3
364  };
365 
366  public:
372  virtual void setModifiedOnDisk( int reason ) = 0;
373 
377  public:
383  virtual void slotModifiedOnDisk( View *v=0 ) = 0;
384 };
385 
391 KATEPARTINTERFACES_EXPORT Document *document (KTextEditor::Document *doc);
392 
398 KATEPARTINTERFACES_EXPORT DocumentExt *documentExt (KTextEditor::Document *doc);
399 
403 KATEPARTINTERFACES_EXPORT Document *createDocument ( TQObject *parent = 0, const char *name = 0 );
404 
405 }
406 
407 #endif
Kate::CommandExtension
Extension to the Command interface, allowing to interact with commands during typing.
Definition: document.h:130
Kate::CommandExtension::flagCompletions
virtual void flagCompletions(TQStringList &)
Fill in a list of flags to complete from.
Definition: document.h:146
Kate::CommandExtension::wantsToProcessText
virtual bool wantsToProcessText(const TQString &cmdname)
Definition: document.h:169
Kate::CommandExtension::processText
virtual void processText(Kate::View *view, const TQString &text)
This is called by the commandline each time the argument text for the command changes,...
Definition: document.h:177
Kate::CommandExtension::completionObject
virtual TDECompletion * completionObject(const TQString &cmdname, Kate::View *)
Definition: document.h:157
Kate::Command
Kate Commands.
Definition: document.h:97
Kate::Command::cmds
virtual TQStringList cmds()=0
Pure text start part of the commands which can be handled by this object which means i....
Kate::Command::help
virtual bool help(View *view, const TQString &cmd, TQString &msg)=0
Shows help for the given view and cmd string, return a bool about success, msg for status.
Kate::Command::exec
virtual bool exec(View *view, const TQString &cmd, TQString &msg)=0
Execute this command for the given view and cmd string, return a bool about success,...
Kate::DocumentExt
Extensions to the Document Interface.
Definition: document.h:350
Kate::DocumentExt::ModifiedOnDiskReason
ModifiedOnDiskReason
Reasons why a document is modified on disk.
Definition: document.h:359
Kate::DocumentExt::setModifiedOnDisk
virtual void setModifiedOnDisk(int reason)=0
For client apps that want to deal with files modified on disk, it is nessecary to reset this property...
Kate::DocumentExt::slotModifiedOnDisk
virtual void slotModifiedOnDisk(View *v=0)=0
These stuff is implemented as slots in the real document.
Kate::Document
This interface provides access to the Kate Document class.
Definition: document.h:190
Kate::Document::selectConfigPage
virtual ConfigPage * selectConfigPage(TQWidget *)=0
Kate::Document::docName
virtual TQString docName()
Returns the document name.
Definition: document.h:217
Kate::Document::hlConfigPage
virtual ConfigPage * hlConfigPage(TQWidget *)=0
Kate::Document::fontConfigPage
virtual ConfigPage * fontConfigPage(TQWidget *)=0
Kate::Document::editConfigPage
virtual ConfigPage * editConfigPage(TQWidget *)=0
Kate::Document::isModOnHD
virtual void isModOnHD(bool=false)
deprecated for KDE 4.0, just does reloadFile, which will ask the normal "do you want it really" quest...
Definition: document.h:212
Kate::Document::kSpellConfigPage
virtual ConfigPage * kSpellConfigPage(TQWidget *)
Definition: document.h:276
Kate::Document::spellcheck
virtual void spellcheck()
Spellchecking.
Definition: document.h:242
Kate::Document::setDocName
virtual void setDocName(TQString)
Sets the document name.
Definition: document.h:225
Kate::Document::keysConfigPage
virtual ConfigPage * keysConfigPage(TQWidget *)=0
Kate::Document::indentConfigPage
virtual ConfigPage * indentConfigPage(TQWidget *)=0
Kate::Document::modifiedOnDisc
void modifiedOnDisc(Kate::Document *doc, bool isModified, unsigned char reason)
Indicate this file is modified on disk.
Kate::Document::colorConfigPage
virtual ConfigPage * colorConfigPage(TQWidget *)=0
Kate::Document::reloadFile
virtual void reloadFile()=0
Reloads the current document from disk if possible.
Kate::View
The Kate::View text editor interface.
Definition: view.h:45
TDEActionMenu
TDECompletion
flush
kndbgstream & flush(kndbgstream &s)
Kate
Kate namespace All classes in this namespace must stay BC during one major release series (e....
Definition: document.h:51
Kate::createDocument
KATEPARTINTERFACES_EXPORT Document * createDocument(TQObject *parent=0, const char *name=0)
Creates a new Kate::Document object.
Definition: interfaces.cpp:114
Kate::documentExt
KATEPARTINTERFACES_EXPORT DocumentExt * documentExt(KTextEditor::Document *doc)
Check if given document is a Kate::DocumentExt.
Definition: interfaces.cpp:106
Kate::document
KATEPARTINTERFACES_EXPORT Document * document(KTextEditor::Document *doc)
Check if given document is a Kate::Document.
Definition: interfaces.cpp:98

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kate

Skip menu "kate"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kate by doxygen 1.9.1
This website is maintained by Timothy Pearson.