document.h
/* This file is part of the KDE libraries
Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KATE_DOCUMENT_INCLUDE_
#define _KATE_DOCUMENT_INCLUDE_
#include <ktexteditor/document.h>
#include <ktexteditor/view.h>
#include <ktexteditor/editinterface.h>
#include <ktexteditor/undointerface.h>
#include <ktexteditor/cursorinterface.h>
#include <ktexteditor/documentinfo.h>
#include <ktexteditor/selectioninterface.h>
#include <ktexteditor/selectioninterfaceext.h>
#include <ktexteditor/blockselectioninterface.h>
#include <ktexteditor/searchinterface.h>
#include <ktexteditor/highlightinginterface.h>
#include <ktexteditor/configinterface.h>
#include <ktexteditor/configinterfaceextension.h>
#include <ktexteditor/markinterface.h>
#include <ktexteditor/markinterfaceextension.h>
#include <ktexteditor/wordwrapinterface.h>
#include <ktexteditor/printinterface.h>
#include <ktexteditor/variableinterface.h>
#include <kaction.h>
class KCompletion;
namespace Kate
{
class View;
class KATEPARTINTERFACES_EXPORT Cursor : public KTextEditor::Cursor
{
public:
Cursor () { ; };
virtual ~Cursor () { ; };
};
class KATEPARTINTERFACES_EXPORT ConfigPage : public KTextEditor::ConfigPage
{
Q_OBJECT
public:
ConfigPage ( QWidget *parent=0, const char *name=0 ) : KTextEditor::ConfigPage (parent, name) { ; };
virtual ~ConfigPage () { ; };
public slots:
virtual void apply () { ; };
virtual void reload () { ; };
virtual void reset () {};
virtual void defaults () {};
protected slots:
void slotChanged();
};
class KATEPARTINTERFACES_EXPORT ActionMenu : public KActionMenu
{
Q_OBJECT
public:
ActionMenu ( const QString& text, QObject* parent = 0, const char* name = 0 )
: KActionMenu(text, parent, name) { ; };
virtual ~ActionMenu () { ; };
public:
virtual void updateMenu (class Document *) = 0;
};
class KATEPARTINTERFACES_EXPORT Command
{
public:
Command () {};
virtual ~Command () {};
public:
virtual QStringList cmds () = 0;
virtual bool exec (View *view, const QString &cmd, QString &msg) = 0;
virtual bool help (View *view, const QString &cmd, QString &msg) = 0;
};
class CommandExtension
{
public:
CommandExtension() {;}
virtual ~CommandExtension() {;}
//### this is yet to be tried
virtual void flagCompletions( QStringList& /*list*/ ) {;}
virtual KCompletion *completionObject( const QString & cmdname, Kate::View * /*view*/ ) { Q_UNUSED(cmdname); return 0L; }
virtual bool wantsToProcessText( const QString &cmdname ) { Q_UNUSED(cmdname); return false; }
// ### yet to be tested. The obvious candidate is isearch.
virtual void processText( Kate::View *view, const QString &text ) { Q_UNUSED(view); Q_UNUSED(text); }
};
class KATEPARTINTERFACES_EXPORT Document : public KTextEditor::Document, public KTextEditor::EditInterface,
public KTextEditor::UndoInterface, public KTextEditor::CursorInterface,
public KTextEditor::SelectionInterface, public KTextEditor::SearchInterface,
public KTextEditor::HighlightingInterface, public KTextEditor::BlockSelectionInterface,
public KTextEditor::ConfigInterface, public KTextEditor::MarkInterface,
public KTextEditor::PrintInterface, public KTextEditor::WordWrapInterface,
public KTextEditor::MarkInterfaceExtension,
public KTextEditor::SelectionInterfaceExt
{
Q_OBJECT
public:
Document ();
Document ( QObject* parent, const char* name );
virtual ~Document ();
public:
static bool registerCommand (Command *cmd);
static bool unregisterCommand (Command *cmd);
static Command *queryCommand (const QString &cmd);
public:
virtual void isModOnHD(bool =false) { ; };
virtual QString docName () { return 0L; };
virtual void setDocName (QString ) { ; };
virtual ActionMenu *hlActionMenu (const QString& , QObject* =0, const char* = 0) = 0;
virtual ActionMenu *exportActionMenu (const QString& , QObject* =0, const char* = 0) = 0;
public slots:
// clear buffer/filename - update the views
virtual void flush () { ; };
virtual void reloadFile() = 0;
virtual void spellcheck() {};
virtual void exportAs(const QString &) = 0;
virtual void applyWordWrap () = 0;
public:
virtual void setWordWrap (bool ) = 0;
virtual bool wordWrap () = 0;
virtual void setWordWrapAt (unsigned int) = 0;
virtual uint wordWrapAt () = 0;
virtual void setEncoding (const QString &e) = 0;
virtual QString encoding() const = 0;
// FIXME: Remove when BIC allowed.
public:
virtual ConfigPage *colorConfigPage (QWidget *) = 0;
virtual ConfigPage *fontConfigPage (QWidget *) = 0;
virtual ConfigPage *indentConfigPage (QWidget *) = 0;
virtual ConfigPage *selectConfigPage (QWidget *) = 0;
virtual ConfigPage *editConfigPage (QWidget *) = 0;
virtual ConfigPage *keysConfigPage (QWidget *) = 0;
virtual ConfigPage *kSpellConfigPage (QWidget *) { return 0L; }
virtual ConfigPage *hlConfigPage (QWidget *) = 0;
public:
virtual uint configFlags () = 0;
virtual void setConfigFlags (uint flags) = 0;
// Flags for katedocument config !
enum ConfigFlags
{
cfAutoIndent= 0x1,
cfBackspaceIndents= 0x2,
cfWordWrap= 0x4,
cfReplaceTabs= 0x8,
cfRemoveSpaces = 0x10,
cfWrapCursor= 0x20,
cfAutoBrackets= 0x40,
cfPersistent= 0x80,
cfKeepSelection= 0x100,
cfDelOnInput= 0x400,
cfXorSelect= 0x800,
cfOvr= 0x1000,
cfMark= 0x2000,
cfKeepIndentProfile= 0x8000,
cfKeepExtraSpaces= 0x10000,
cfTabIndents= 0x80000,
cfShowTabs= 0x200000,
cfSpaceIndent= 0x400000,
cfSmartHome = 0x800000
};
signals:
void modifiedOnDisc (Kate::Document *doc, bool isModified, unsigned char reason);
/*
* there static methodes are usefull to turn on/off the dialogs
* kate part shows up on open file errors + file changed warnings
* open file errors default on, file changed warnings default off, better
* for other apps beside kate app using the part
*/
public:
// default true
static void setOpenErrorDialogsActivated (bool on);
// default false
static void setFileChangedDialogsActivated (bool on);
static const QString &defaultEncoding ();
protected:
static bool s_openErrorDialogsActivated;
static bool s_fileChangedDialogsActivated;
static QString s_defaultEncoding;
};
class KATEPARTINTERFACES_EXPORT DocumentExt
: public KTextEditor::DocumentInfoInterface,
public KTextEditor::VariableInterface
{
public:
DocumentExt ();
virtual ~DocumentExt ();
public:
enum ModifiedOnDiskReason {
Unmodified = 0,
Modified = 1,
Created = 2,
Deleted = 3
};
public:
virtual void setModifiedOnDisk( int reason ) = 0;
public:
virtual void slotModifiedOnDisk( View *v=0 ) = 0;
};
KATEPARTINTERFACES_EXPORT Document *document (KTextEditor::Document *doc);
KATEPARTINTERFACES_EXPORT DocumentExt *documentExt (KTextEditor::Document *doc);
KATEPARTINTERFACES_EXPORT Document *createDocument ( QObject *parent = 0, const char *name = 0 );
}
#endif
Kate::CommandExtension
Extension to the Command interface, allowing to interact with commands during typing.
Definition: document.h:129
flush
kndbgstream & flush(kndbgstream &s)
Kate::createDocument
KATEPARTINTERFACES_EXPORT Document * createDocument(QObject *parent=0, const char *name=0)
Creates a new Kate::Document object.
Definition: interfaces.cpp:114
Kate::Document
This interface provides access to the Kate Document class.
Definition: document.h:182
Kate::Document::docName
virtual QString docName()
Returns the document name.
Definition: document.h:217
Kate::View
The Kate::View text editor interface.
Definition: view.h:42
Kate::DocumentExt
Extensions to the Document Interface.
Definition: document.h:347
Kate::documentExt
KATEPARTINTERFACES_EXPORT DocumentExt * documentExt(KTextEditor::Document *doc)
Check if given document is a Kate::DocumentExt.
Definition: interfaces.cpp:106
Kate::CommandExtension::wantsToProcessText
virtual bool wantsToProcessText(const QString &cmdname)
Definition: document.h:169
Kate::CommandExtension::flagCompletions
virtual void flagCompletions(QStringList &)
Fill in a list of flags to complete from.
Definition: document.h:146
KCompletion
Kate::Document::spellcheck
virtual void spellcheck()
Spellchecking.
Definition: document.h:242
Kate::DocumentExt::ModifiedOnDiskReason
ModifiedOnDiskReason
Reasons why a document is modified on disk.
Definition: document.h:359
Kate::Command
Kate Commands.
Definition: document.h:96
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
KATEPARTINTERFACES_EXPORT Document * document(KTextEditor::Document *doc)
Check if given document is a Kate::Document.
Definition: interfaces.cpp:98
Kate::Document::setDocName
virtual void setDocName(QString)
Sets the document name.
Definition: document.h:225
Kate::CommandExtension::processText
virtual void processText(Kate::View *view, const QString &text)
This is called by the commandline each time the argument text for the command changes, if wantsToProcessText() returns true.
Definition: document.h:177
Kate::CommandExtension::completionObject
virtual KCompletion * completionObject(const QString &cmdname, Kate::View *)
Definition: document.h:157
Kate::Document::kSpellConfigPage
virtual ConfigPage * kSpellConfigPage(QWidget *)
Definition: document.h:276

KDE Home | KDE Accessibility Home | Description of Access Keys