diff options
Diffstat (limited to 'interfaces/tdetexteditor')
92 files changed, 7091 insertions, 0 deletions
diff --git a/interfaces/tdetexteditor/.kateconfig b/interfaces/tdetexteditor/.kateconfig new file mode 100644 index 000000000..5b0885abe --- /dev/null +++ b/interfaces/tdetexteditor/.kateconfig @@ -0,0 +1 @@ +kate: space-indent on; indent-width 2; replace-tabs on; diff --git a/interfaces/tdetexteditor/CMakeLists.txt b/interfaces/tdetexteditor/CMakeLists.txt new file mode 100644 index 000000000..a9d39edbb --- /dev/null +++ b/interfaces/tdetexteditor/CMakeLists.txt @@ -0,0 +1,96 @@ +################################################# +# +# (C) 2010 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${TQT_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_BINARY_DIR}/tdecore + ${CMAKE_BINARY_DIR}/kabc + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/dcop + ${CMAKE_SOURCE_DIR}/tdecore + ${CMAKE_SOURCE_DIR}/tdeui + ${CMAKE_SOURCE_DIR}/kio + ${CMAKE_SOURCE_DIR}/kio/kio + ${CMAKE_SOURCE_DIR}/kabc + ${CMAKE_SOURCE_DIR}/interfaces +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### headers ################################### + +install( FILES + document.h view.h editor.h plugin.h editinterface.h + undointerface.h selectioninterface.h cursorinterface.h + clipboardinterface.h popupmenuinterface.h viewcursorinterface.h + searchinterface.h highlightinginterface.h blockselectioninterface.h + codecompletioninterface.h configinterface.h markinterface.h + printinterface.h wordwrapinterface.h dynwordwrapinterface.h + markinterfaceextension.h configinterfaceextension.h + encodinginterface.h viewstatusmsginterface.h + sessionconfiginterface.h editorchooser.h documentinfo.h + selectioninterfaceext.h selectionextdcopinterface.h + texthintinterface.h editinterfaceext.h variableinterface.h + templateinterface.h + DESTINATION ${INCLUDE_INSTALL_DIR}/tdetexteditor ) + + +##### other data ################################ + +install( FILES + tdetexteditor.desktop tdetexteditoreditor.desktop + tdetexteditorplugin.desktop + DESTINATION ${SERVICETYPES_INSTALL_DIR} ) + +install( FILES + kcm_tdetexteditor.desktop + DESTINATION ${DATA_INSTALL_DIR}/kcm_componentchooser ) + + + +##### tdetexteditor ############################### + +set( target tdetexteditor ) + +set( ${target}_SRCS + tdetexteditor.cpp + editinterface.cpp clipboardinterface.cpp selectioninterface.cpp searchinterface.cpp + codecompletioninterface.cpp wordwrapinterface.cpp blockselectioninterface.cpp + configinterface.cpp cursorinterface.cpp dynwordwrapinterface.cpp + printinterface.cpp highlightinginterface.cpp markinterface.cpp + popupmenuinterface.cpp undointerface.cpp viewcursorinterface.cpp + editdcopinterface.cpp editdcopinterface.skel clipboarddcopinterface.cpp + clipboarddcopinterface.skel selectiondcopinterface.cpp selectiondcopinterface.skel + searchdcopinterface.cpp searchdcopinterface.skel markinterfaceextension.cpp + configinterfaceextension.cpp encodinginterface.cpp sessionconfiginterface.cpp + viewstatusmsginterface.cpp editorchooser_ui.ui editorchooser.cpp + blockselectiondcopinterface.cpp documentinfo.cpp documentdcopinfo.cpp + blockselectiondcopinterface.skel documentdcopinfo.skel encodingdcopinterface.cpp + encodingdcopinterface.skel printdcopinterface.cpp printdcopinterface.skel + undodcopinterface.cpp undodcopinterface.skel viewcursordcopinterface.cpp + viewcursordcopinterface.skel viewstatusmsgdcopinterface.cpp + viewstatusmsgdcopinterface.skel selectioninterfaceext.cpp selectionextdcopinterface.skel + texthintinterface.cpp editinterfaceext.cpp variableinterface.cpp templateinterface.cpp +) + +tde_add_library( ${target} SHARED AUTOMOC + SOURCES ${${target}_SRCS} + VERSION 0.0.0 + LINK tdeui-shared kabc-shared tdeparts-shared + DEPENDENCIES dcopidl dcopidl2cpp + DESTINATION ${LIB_INSTALL_DIR} +) diff --git a/interfaces/tdetexteditor/Makefile.am b/interfaces/tdetexteditor/Makefile.am new file mode 100644 index 000000000..5663bb761 --- /dev/null +++ b/interfaces/tdetexteditor/Makefile.am @@ -0,0 +1,52 @@ +INCLUDES = -I$(top_srcdir)/kio -I$(top_srcdir) -I$(top_srcdir)/interfaces -I$(top_builddir)/interfaces -I$(top_srcdir)/kabc -I$(top_builddir)/kabc $(all_includes) + +lib_LTLIBRARIES = libtdetexteditor.la + +libtdetexteditor_la_SOURCES = tdetexteditor.cpp \ + editinterface.cpp clipboardinterface.cpp selectioninterface.cpp searchinterface.cpp \ + codecompletioninterface.cpp wordwrapinterface.cpp blockselectioninterface.cpp \ + configinterface.cpp cursorinterface.cpp dynwordwrapinterface.cpp \ + printinterface.cpp highlightinginterface.cpp markinterface.cpp \ + popupmenuinterface.cpp undointerface.cpp viewcursorinterface.cpp \ + editdcopinterface.cpp editdcopinterface.skel clipboarddcopinterface.cpp \ + clipboarddcopinterface.skel selectiondcopinterface.cpp selectiondcopinterface.skel \ + searchdcopinterface.cpp searchdcopinterface.skel markinterfaceextension.cpp \ + configinterfaceextension.cpp encodinginterface.cpp sessionconfiginterface.cpp \ + viewstatusmsginterface.cpp editorchooser_ui.ui editorchooser.cpp \ + blockselectiondcopinterface.cpp documentinfo.cpp documentdcopinfo.cpp\ + blockselectiondcopinterface.skel documentdcopinfo.skel encodingdcopinterface.cpp \ + encodingdcopinterface.skel printdcopinterface.cpp printdcopinterface.skel \ + undodcopinterface.cpp undodcopinterface.skel viewcursordcopinterface.cpp \ + viewcursordcopinterface.skel viewstatusmsgdcopinterface.cpp \ + viewstatusmsgdcopinterface.skel selectioninterfaceext.cpp selectionextdcopinterface.skel \ + texthintinterface.cpp editinterfaceext.cpp variableinterface.cpp templateinterface.cpp + + +libtdetexteditor_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor +libtdetexteditor_la_LIBADD = $(LIB_KPARTS) $(top_builddir)/dcop/libDCOP.la $(LIB_KABC) $(LIB_TDECORE) $(LIB_QT) $(LIB_KFILE) $(LIB_TDEUI) + +tdetexteditorinclude_HEADERS = document.h view.h editor.h plugin.h editinterface.h undointerface.h \ + selectioninterface.h cursorinterface.h \ + clipboardinterface.h popupmenuinterface.h \ + viewcursorinterface.h searchinterface.h highlightinginterface.h \ + blockselectioninterface.h codecompletioninterface.h \ + configinterface.h markinterface.h printinterface.h wordwrapinterface.h \ + dynwordwrapinterface.h markinterfaceextension.h configinterfaceextension.h \ + encodinginterface.h viewstatusmsginterface.h sessionconfiginterface.h editorchooser.h \ + documentinfo.h selectioninterfaceext.h selectionextdcopinterface.h texthintinterface.h \ + editinterfaceext.h variableinterface.h templateinterface.h + +tdetexteditorincludedir = $(includedir)/tdetexteditor + +METASOURCES = AUTO + +servicetypedir = $(kde_servicetypesdir) +servicetype_DATA = tdetexteditor.desktop tdetexteditoreditor.desktop tdetexteditorplugin.desktop + +kcm_tdetexteditor_DATA = kcm_tdetexteditor.desktop +kcm_tdetexteditordir = $(kde_datadir)/kcm_componentchooser + +templateinterface.lo: $(top_builddir)/kabc/addressee.h + +include ../../admin/Doxyfile.am + diff --git a/interfaces/tdetexteditor/blockselectiondcopinterface.cpp b/interfaces/tdetexteditor/blockselectiondcopinterface.cpp new file mode 100644 index 000000000..34b7294b2 --- /dev/null +++ b/interfaces/tdetexteditor/blockselectiondcopinterface.cpp @@ -0,0 +1,33 @@ +#include "blockselectiondcopinterface.h" +#include "blockselectioninterface.h" + +#include <dcopclient.h> +using namespace KTextEditor; + +BlockSelectionDCOPInterface::BlockSelectionDCOPInterface( BlockSelectionInterface *Parent, const char *name) + : DCOPObject(name) +{ + m_parent = Parent; +} + +BlockSelectionDCOPInterface::~BlockSelectionDCOPInterface() +{ + +} + +uint BlockSelectionDCOPInterface::blockSelectionInterfaceNumber () +{ + return m_parent->blockSelectionInterfaceNumber(); +} +bool BlockSelectionDCOPInterface::blockSelectionMode () +{ + return m_parent->blockSelectionMode (); +} +bool BlockSelectionDCOPInterface::setBlockSelectionMode (bool on) +{ + return m_parent->setBlockSelectionMode (on); +} +bool BlockSelectionDCOPInterface::toggleBlockSelectionMode () +{ + return m_parent->toggleBlockSelectionMode (); +} diff --git a/interfaces/tdetexteditor/blockselectiondcopinterface.h b/interfaces/tdetexteditor/blockselectiondcopinterface.h new file mode 100644 index 000000000..4b74fd2a0 --- /dev/null +++ b/interfaces/tdetexteditor/blockselectiondcopinterface.h @@ -0,0 +1,60 @@ +#ifndef BlockSelection_DCOP_INTERFACE_H +#define BlockSelection_DCOP_INTERFACE_H + +#include <dcopobject.h> +#include <dcopref.h> +#include <tqstringlist.h> +#include <tqcstring.h> + +namespace KTextEditor +{ + class BlockSelectionInterface; + /** + This is the main interface to the BlockSelectionInterface of KTextEditor. + This will provide a consistant dcop interface to all KDE applications that use it. + @short DCOP interface to BlockSelectionInterface. + @author Ian Reinhart Geiser <[email protected]> + */ + class KTEXTEDITOR_EXPORT BlockSelectionDCOPInterface : virtual public DCOPObject + { + K_DCOP + + public: + /** + Construct a new interface object for the text editor. + @param Parent the parent BlockSelectionInterface object + that will provide us with the functions for the interface. + @param name the QObject's name + */ + BlockSelectionDCOPInterface( BlockSelectionInterface *Parent, const char *name ); + /** + Destructor + Cleans up the object. + */ + virtual ~BlockSelectionDCOPInterface(); + k_dcop: + uint blockSelectionInterfaceNumber (); + + /** + * Returns the status of the selection mode - true indicates block selection mode is on. + * If this is true, selections applied via the SelectionInterface are handled as + * blockselections and the paste functions of the ClipboardInterface works on + * rectangular blocks of text rather than normal. (copy too, but thats clear I hope ;) + */ + bool blockSelectionMode (); + + /** + * set blockselection mode to state "on" + */ + bool setBlockSelectionMode (bool on) ; + + /** + * toggle blockseletion mode + */ + bool toggleBlockSelectionMode (); + + private: + BlockSelectionInterface *m_parent; + }; +} +#endif diff --git a/interfaces/tdetexteditor/blockselectioninterface.cpp b/interfaces/tdetexteditor/blockselectioninterface.cpp new file mode 100644 index 000000000..6d562a43e --- /dev/null +++ b/interfaces/tdetexteditor/blockselectioninterface.cpp @@ -0,0 +1,74 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "blockselectioninterface.h" +#include "blockselectiondcopinterface.h" +#include "document.h" + +namespace KTextEditor +{ + +class PrivateBlockSelectionInterface +{ + public: + PrivateBlockSelectionInterface() {interface = 0;} + ~PrivateBlockSelectionInterface() {} + BlockSelectionDCOPInterface *interface; +}; + +} + +using namespace KTextEditor; + +unsigned int BlockSelectionInterface::globalBlockSelectionInterfaceNumber = 0; + +BlockSelectionInterface::BlockSelectionInterface() +{ + globalBlockSelectionInterfaceNumber++; + myBlockSelectionInterfaceNumber = globalBlockSelectionInterfaceNumber++; + TQString name = "BlockSelectionInterface#" + TQString::number(myBlockSelectionInterfaceNumber); + + d = new PrivateBlockSelectionInterface(); + d->interface = new BlockSelectionDCOPInterface(this, name.latin1()); +} + +BlockSelectionInterface::~BlockSelectionInterface() +{ + delete d->interface; + delete d; +} + +unsigned int BlockSelectionInterface::blockSelectionInterfaceNumber () const +{ + return myBlockSelectionInterfaceNumber; +} + +void BlockSelectionInterface::setBlockSelectionInterfaceDCOPSuffix (const TQCString &suffix) +{ + d->interface->setObjId ("BlockSelectionInterface#"+suffix); +} + +BlockSelectionInterface *KTextEditor::blockSelectionInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::BlockSelectionInterface*>(doc); +} diff --git a/interfaces/tdetexteditor/blockselectioninterface.h b/interfaces/tdetexteditor/blockselectioninterface.h new file mode 100644 index 000000000..b2cd785eb --- /dev/null +++ b/interfaces/tdetexteditor/blockselectioninterface.h @@ -0,0 +1,82 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_blockselectioninterface_h__ +#define __tdetexteditor_blockselectioninterface_h__ + +#include <tdelibs_export.h> + +class TQCString; + +namespace KTextEditor +{ + +/** + * An interface for the Document class which allows the selection + * method to be changed between selecting rectangular blocks of text and normal mode + * (all text between the start cursor and the current cursor). + */ +class KTEXTEDITOR_EXPORT BlockSelectionInterface +{ + friend class PrivateBlockSelectionInterface; + + public: + BlockSelectionInterface (); + virtual ~BlockSelectionInterface (); + + unsigned int blockSelectionInterfaceNumber () const; + + protected: + void setBlockSelectionInterfaceDCOPSuffix (const TQCString &suffix); + + /** + * slots !!! + */ + public: + /** + * Returns the status of the selection mode - true indicates block selection mode is on. + * If this is true, selections applied via the SelectionInterface are handled as + * blockselections and the paste functions of the ClipboardInterface works on + * rectangular blocks of text rather than normal. (copy too, but thats clear I hope ;) + */ + virtual bool blockSelectionMode () = 0; + + /** + * Set block selection mode to state "on" + */ + virtual bool setBlockSelectionMode (bool on) = 0; + + /** + * toggle block seletion mode + */ + virtual bool toggleBlockSelectionMode () = 0; + + private: + class PrivateBlockSelectionInterface *d; + static unsigned int globalBlockSelectionInterfaceNumber; + unsigned int myBlockSelectionInterfaceNumber; +}; + +/** + * Access the block selection interface of document @param doc + */ +KTEXTEDITOR_EXPORT BlockSelectionInterface *blockSelectionInterface (class Document *doc); + +} + +#endif diff --git a/interfaces/tdetexteditor/clipboarddcopinterface.cpp b/interfaces/tdetexteditor/clipboarddcopinterface.cpp new file mode 100644 index 000000000..334046ee5 --- /dev/null +++ b/interfaces/tdetexteditor/clipboarddcopinterface.cpp @@ -0,0 +1,40 @@ +#include "clipboarddcopinterface.h" +#include "clipboardinterface.h" + +#include <dcopclient.h> +using namespace KTextEditor; + +ClipboardDCOPInterface::ClipboardDCOPInterface( ClipboardInterface *Parent, const char *name) + : DCOPObject(name) +{ + m_parent = Parent; +} + +ClipboardDCOPInterface::~ClipboardDCOPInterface() +{ + +} + + /** + * Copies selected text. + */ + void ClipboardDCOPInterface::copy ( ) + { + m_parent->copy(); + } + + /** + * Cuts selected text. + */ + void ClipboardDCOPInterface::cut ( ) + { + m_parent->cut(); + } + + /** + * Pastes text from clipboard. + */ + void ClipboardDCOPInterface::paste ( ) + { + m_parent->paste(); + } diff --git a/interfaces/tdetexteditor/clipboarddcopinterface.h b/interfaces/tdetexteditor/clipboarddcopinterface.h new file mode 100644 index 000000000..8104e9d4d --- /dev/null +++ b/interfaces/tdetexteditor/clipboarddcopinterface.h @@ -0,0 +1,54 @@ +#ifndef Clipboard_DCOP_INTERFACE_H +#define Clipboard_DCOP_INTERFACE_H + +#include <dcopobject.h> +#include <dcopref.h> +#include <tqstringlist.h> +#include <tqcstring.h> + +namespace KTextEditor +{ + class ClipboardInterface; + /** + This is the main interface to the ClipboardInterface of KTextEdit. + This will provide a consistant dcop interface to all KDE applications that use it. + @short DCOP interface to ClipboardInterface. + @author Ian Reinhart Geiser <[email protected]> + */ + class KTEXTEDITOR_EXPORT ClipboardDCOPInterface : virtual public DCOPObject + { + K_DCOP + + public: + /** + Construct a new interface object for the text editor. + @param Parent the parent ClipboardInterface object + that will provide us with the functions for the interface. + @param name the QObject's name + */ + ClipboardDCOPInterface( ClipboardInterface *Parent, const char *name ); + /** + Destructor + Cleans up the object. + */ + virtual ~ClipboardDCOPInterface(); + k_dcop: + /** + * copies selected text + */ + void copy ( ); + /** + * cuts selected text + */ + void cut ( ); + /** + * pastes selected text + */ + void paste ( ); + private: + ClipboardInterface *m_parent; + }; +} +#endif + + diff --git a/interfaces/tdetexteditor/clipboardinterface.cpp b/interfaces/tdetexteditor/clipboardinterface.cpp new file mode 100644 index 000000000..89f92d089 --- /dev/null +++ b/interfaces/tdetexteditor/clipboardinterface.cpp @@ -0,0 +1,56 @@ +#include "clipboardinterface.h" +#include "clipboarddcopinterface.h" + +#include "view.h" + +using namespace KTextEditor; + +namespace KTextEditor +{ + class PrivateClipboardInterface + { + public: + PrivateClipboardInterface() + { + interface = 0; + } + ~PrivateClipboardInterface(){} + // Data Members + ClipboardDCOPInterface *interface; + }; + +} + +unsigned int ClipboardInterface::globalClipboardInterfaceNumber = 0; + +ClipboardInterface::ClipboardInterface() +{ + d = new PrivateClipboardInterface(); + globalClipboardInterfaceNumber++; + myClipboardInterfaceNumber = globalClipboardInterfaceNumber++; + TQString name = "ClipboardInterface#" + TQString::number(myClipboardInterfaceNumber); + d->interface = new ClipboardDCOPInterface(this, name.latin1()); +} +ClipboardInterface::~ClipboardInterface() +{ + delete d->interface; + delete d; +} + +unsigned int ClipboardInterface::clipboardInterfaceNumber () const +{ + return myClipboardInterfaceNumber; +} + +void ClipboardInterface::setClipboardInterfaceDCOPSuffix (const TQCString &suffix) +{ + d->interface->setObjId ("ClipboardInterface#"+suffix); +} + +ClipboardInterface *KTextEditor::clipboardInterface (View *view) +{ + if (!view) + return 0; + + return dynamic_cast<KTextEditor::ClipboardInterface*>(view); +} diff --git a/interfaces/tdetexteditor/clipboardinterface.h b/interfaces/tdetexteditor/clipboardinterface.h new file mode 100644 index 000000000..8eeeb77ba --- /dev/null +++ b/interfaces/tdetexteditor/clipboardinterface.h @@ -0,0 +1,74 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_clipboardinterface_h__ +#define __tdetexteditor_clipboardinterface_h__ + +#include <tdelibs_export.h> + +class TQCString; + +namespace KTextEditor +{ + +/** +* This is an interface for accessing the clipboard through the View class. +*/ +class KTEXTEDITOR_EXPORT ClipboardInterface +{ + friend class PrivateClipboardInterface; + + public: + ClipboardInterface(); + virtual ~ClipboardInterface(); + + unsigned int clipboardInterfaceNumber () const; + + protected: + void setClipboardInterfaceDCOPSuffix (const TQCString &suffix); + + /** + * slots !!! + */ + public: + /** + * copies selected text + */ + virtual void copy ( ) const = 0; + + /** + * copies selected text + */ + virtual void cut ( ) = 0; + + /** + * copies selected text + */ + virtual void paste ( ) = 0; + + private: + class PrivateClipboardInterface *d; + static unsigned int globalClipboardInterfaceNumber; + unsigned int myClipboardInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT ClipboardInterface *clipboardInterface (class View *view); + +} + +#endif diff --git a/interfaces/tdetexteditor/codecompletioninterface.cpp b/interfaces/tdetexteditor/codecompletioninterface.cpp new file mode 100644 index 000000000..416dd593a --- /dev/null +++ b/interfaces/tdetexteditor/codecompletioninterface.cpp @@ -0,0 +1,51 @@ + +#include "codecompletioninterface.h" +#include "view.h" + +using namespace KTextEditor; + +namespace KTextEditor +{ + class PrivateCodeCompletionInterface + { + public: + PrivateCodeCompletionInterface() {} + ~PrivateCodeCompletionInterface(){} + + }; +} + +unsigned int CodeCompletionInterface::globalCodeCompletionInterfaceNumber = 0; + +CodeCompletionInterface::CodeCompletionInterface() +{ + globalCodeCompletionInterfaceNumber++; + myCodeCompletionInterfaceNumber = globalCodeCompletionInterfaceNumber++; + + d = new PrivateCodeCompletionInterface(); +} + +CodeCompletionInterface::~CodeCompletionInterface() +{ + delete d; +} + +unsigned int CodeCompletionInterface::codeCompletionInterfaceNumber () const +{ + return myCodeCompletionInterfaceNumber; +} + +void CodeCompletionInterface::setCodeCompletionInterfaceDCOPSuffix (const TQCString &/*suffix*/) +{ + //d->interface->setObjId ("CodeCompletionInterface#"+suffix); +} + +CodeCompletionInterface *KTextEditor::codeCompletionInterface (View *view) +{ + if (!view) + return 0; + + return dynamic_cast<KTextEditor::CodeCompletionInterface*>(view); +} + + diff --git a/interfaces/tdetexteditor/codecompletioninterface.h b/interfaces/tdetexteditor/codecompletioninterface.h new file mode 100644 index 000000000..4f726578f --- /dev/null +++ b/interfaces/tdetexteditor/codecompletioninterface.h @@ -0,0 +1,202 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + 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 __tdetexteditor_codecompletioninterface_h__ +#define __tdetexteditor_codecompletioninterface_h__ + +#include <tqstring.h> +#include <tqstringlist.h> + +#include <tdelibs_export.h> + +namespace KTextEditor +{ + +/** + * An item for the completion popup. <code>text</code> is the completed string, + * <code>prefix</code> appears in front of it, <code>suffix</code> appears after it. + * <code>type</code> does not appear in the completion list. + * <code>prefix</code>, <code>suffix</code>, and <code>type</code> are not part of the + * inserted text if a completion takes place. <code>comment</code> appears in a tooltip right of + * the completion list for the currently selected item. <code>userdata</code> can be + * free formed data, which the user of this interface can use in + * CodeCompletionInterface::filterInsertString(). + * + * + */ +class KTEXTEDITOR_EXPORT CompletionEntry +{ + public: + TQString type; + TQString text; + TQString prefix; + TQString postfix; + TQString comment; + + TQString userdata; + + bool operator==( const CompletionEntry &c ) const { + return ( c.type == type && + c.text == text && + c.postfix == postfix && + c.prefix == prefix && + c.comment == comment && + c.userdata == userdata); + } +}; + +/** + * This is an interface for the KTextEditor::View class. It can be used + * to show completion lists, i.e. lists that pop up while a user is typing. + * The user can then choose from the list or he can just keep typing. The + * completion list will disappear if an item is chosen, if no completion + * is available or if the user presses Esc etc. The contents of the list + * is automatically adapted to the string the user types. + * + * There are other signals, which may be implmemented, but aren't documented here, because + * it would have been a BIC change...: + * + * void completionExtendedComment(CompletionEntry) + * + * This is emitted when the user has completed the argument entry (ie. enters the wrapping symbol(s) + * void argHintCompleted() + * + * This is emitted when there is a reason other than completion for the hint being hidden. + * void argHintAborted() + * + * This is emitted when a code completion box is about to be displayed + * void aboutToShowCompletionBox() + * + */ +class KTEXTEDITOR_EXPORT CodeCompletionInterface +{ + friend class PrivateCodeCompletionInterface; + + public: + CodeCompletionInterface(); + virtual ~CodeCompletionInterface(); + + unsigned int codeCompletionInterfaceNumber () const; + + protected: + void setCodeCompletionInterfaceDCOPSuffix (const TQCString &suffix); + + + public: + // + // slots !!! + // + /** + * This shows an argument hint. + */ + virtual void showArgHint (TQStringList functionList, const TQString& strWrapping, const TQString& strDelimiter) = 0; + + /** + * This shows a completion list. @p offset is the real start of the text that + * should be completed. <code>0</code> means that the text starts at the current cursor + * position. if @p casesensitive is @p true, the popup will only contain completions + * that match the input text regarding case. + */ + virtual void showCompletionBox (TQValueList<CompletionEntry> complList,int offset=0, bool casesensitive=true)=0; + + // + // signals !!! + // + public: + + + /** + * This signal is emitted when the completion list disappears and no completion has + * been done. This is the case e.g. when the user presses Escape. + * + * IMPORTANT: Please check if a connect to this signal worked, and implement some fallback + * when the implementation doesn't support it + * + * IMPORTANT FOR IMPLEMENTERS: When you don't support this signal, please just override the inherited + * function, if you support it, declare it as a signal + */ + virtual void completionAborted()=0; + + /** + * This signal is emitted when the completion list disappears and a completion has + * been inserted into text. This is the case e.g. when the user presses Return + * on a selected item in the completion list. + * + * IMPORTANT: Please check if a connect to this signal worked, and implement some fallback + * when the implementation doesn't support it + * + * IMPORTANT FOR IMPLEMENTERS: When you don't support this signal, please just override the inherited + * function, if you support it, declare it as a signal + */ + virtual void completionDone()=0; + + /** + * This signal is the same as completionDone(), but additionally it carries + * the information which completion item was used. + * + * IMPORTANT: Please check if a connect to this signal worked, and implement some fallback + * when the implementation doesn't support it + * + * IMPORTANT: The pointer to the CompleteionEntry, is only valid in the slots connected to this signal + * when the connected slots are left, the data element may be destroyed, depending on the implementation + * + * IMPORTANT FOR IMPLEMENTERS: When you don't support this signal, please just override the inherited + * function, if you support it, declare it as a signal. + * + */ + virtual void completionDone(CompletionEntry)=0; + + /** + * This signal is emitted when the argument hint disappears. + * This is the case e.g. when the user moves the cursor somewhere else. + * + * IMPORTANT: Please check if a connect to this signal worked, and implement some fallback + * when the implementation doesn't support it + * + * IMPORTANT FOR IMPLEMENTERS: When you don't support this signal, please just override the inherited + * function, if you support it, declare it as a signal + */ + virtual void argHintHidden()=0; + + /** + * This signal is emitted just before a completion takes place. + * You can use it to modify the CompletionEntry. The modified + * entry will not be visible in the completion list (because that has + * just disappeared) but it will be used when the completion is + * inserted into the text. + * + * IMPORTANT: Please check if a connect to this signal worked, and implement some fallback + * when the implementation doesn't support it + * + * IMPORTANT FOR IMPLEMENTERS: When you don't support this signal, please just override the inherited + * function, if you support it, declare it as a signal + */ + virtual void filterInsertString(CompletionEntry*,TQString*)=0; + + + private: + class PrivateCodeCompletionInterface *d; + static unsigned int globalCodeCompletionInterfaceNumber; + unsigned int myCodeCompletionInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT CodeCompletionInterface *codeCompletionInterface (class View *view); + +} + +#endif diff --git a/interfaces/tdetexteditor/configinterface.cpp b/interfaces/tdetexteditor/configinterface.cpp new file mode 100644 index 000000000..63bf086e0 --- /dev/null +++ b/interfaces/tdetexteditor/configinterface.cpp @@ -0,0 +1,79 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "configinterface.h" + +#include "document.h" +#include "plugin.h" + +namespace KTextEditor +{ + +class PrivateConfigInterface +{ + public: + PrivateConfigInterface() {} + ~PrivateConfigInterface() {} +}; + +} + +using namespace KTextEditor; + +unsigned int ConfigInterface::globalConfigInterfaceNumber = 0; + +ConfigInterface::ConfigInterface() +{ + globalConfigInterfaceNumber++; + myConfigInterfaceNumber = globalConfigInterfaceNumber++; + + d = new PrivateConfigInterface(); +} + +ConfigInterface::~ConfigInterface() +{ + delete d; +} + +unsigned int ConfigInterface::configInterfaceNumber () const +{ + return myConfigInterfaceNumber; +} + +void ConfigInterface::setConfigInterfaceDCOPSuffix (const TQCString &/*suffix*/) +{ + //d->interface->setObjId ("ConfigInterface#"+suffix); +} + +ConfigInterface *KTextEditor::configInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::ConfigInterface*>(doc); +} + +ConfigInterface *KTextEditor::configInterface (Plugin *plugin) +{ + if (!plugin) + return 0; + + return dynamic_cast<KTextEditor::ConfigInterface*>(plugin); +} diff --git a/interfaces/tdetexteditor/configinterface.h b/interfaces/tdetexteditor/configinterface.h new file mode 100644 index 000000000..ed6a80d81 --- /dev/null +++ b/interfaces/tdetexteditor/configinterface.h @@ -0,0 +1,93 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_configinterface_h__ +#define __tdetexteditor_configinterface_h__ + +#include <tdelibs_export.h> + +class TQCString; +class TDEConfig; + +namespace KTextEditor +{ + +/** +* This is an interface for accessing the configuration of the +* Document and Plugin classes. +*/ +class KTEXTEDITOR_EXPORT ConfigInterface +{ + friend class PrivateConfigInterface; + + public: + ConfigInterface(); + virtual ~ConfigInterface(); + + unsigned int configInterfaceNumber () const; + + protected: + void setConfigInterfaceDCOPSuffix (const TQCString &suffix); + + // + // slots !!! + // + public: + /** + Read/Write the config to the standard place where this editor + part saves it config, say: read/save default values for that + editor part, which means for all current open documents + */ + virtual void readConfig () = 0; + virtual void writeConfig () = 0; + + /** + Read/Write the config of the part to a given kconfig object + to store the settings in a different place than the standard + */ + virtual void readConfig (TDEConfig *) = 0; + virtual void writeConfig (TDEConfig *) = 0; + + /** + Read/Write session config of only this document/view/plugin + */ + virtual void readSessionConfig (TDEConfig *) = 0; + virtual void writeSessionConfig (TDEConfig *) = 0; + + /** + Shows a config dialog for the part, changes will be applied + to the part, but not saved anywhere automagically, call + writeConfig to save it + */ + virtual void configDialog () = 0; + + private: + class PrivateConfigInterface *d; + static unsigned int globalConfigInterfaceNumber; + unsigned int myConfigInterfaceNumber; +}; + +class Plugin; +class Document; + +KTEXTEDITOR_EXPORT ConfigInterface *configInterface (Document *doc); +KTEXTEDITOR_EXPORT ConfigInterface *configInterface (Plugin *plugin); + +} + +#endif diff --git a/interfaces/tdetexteditor/configinterfaceextension.cpp b/interfaces/tdetexteditor/configinterfaceextension.cpp new file mode 100644 index 000000000..460d930a4 --- /dev/null +++ b/interfaces/tdetexteditor/configinterfaceextension.cpp @@ -0,0 +1,84 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "configinterfaceextension.h" +#include "configinterfaceextension.moc" + +#include "document.h" +#include "plugin.h" + +namespace KTextEditor +{ + +class PrivateConfigInterfaceExtension +{ + public: + PrivateConfigInterfaceExtension() {} + ~PrivateConfigInterfaceExtension() {} +}; + +} + +using namespace KTextEditor; + +ConfigPage::ConfigPage ( TQWidget *parent, const char *name ) : TQWidget (parent, name) { ; } + +ConfigPage::~ConfigPage () { ; } + +unsigned int ConfigInterfaceExtension::globalConfigInterfaceExtensionNumber = 0; + +ConfigInterfaceExtension::ConfigInterfaceExtension() +{ + globalConfigInterfaceExtensionNumber++; + myConfigInterfaceExtensionNumber = globalConfigInterfaceExtensionNumber++; + + d = new PrivateConfigInterfaceExtension(); +} + +ConfigInterfaceExtension::~ConfigInterfaceExtension() +{ + delete d; +} + +unsigned int ConfigInterfaceExtension::configInterfaceExtensionNumber () const +{ + return myConfigInterfaceExtensionNumber; +} + +void ConfigInterfaceExtension::setConfigInterfaceExtensionDCOPSuffix (const TQCString &/*suffix*/) +{ + //d->interface->setObjId ("ConfigInterfaceExtension#"+suffix); +} + +ConfigInterfaceExtension *KTextEditor::configInterfaceExtension (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::ConfigInterfaceExtension*>(doc); +} + +ConfigInterfaceExtension *KTextEditor::configInterfaceExtension (Plugin *plugin) +{ + if (!plugin) + return 0; + + return dynamic_cast<KTextEditor::ConfigInterfaceExtension*>(plugin); +} diff --git a/interfaces/tdetexteditor/configinterfaceextension.h b/interfaces/tdetexteditor/configinterfaceextension.h new file mode 100644 index 000000000..d139ba696 --- /dev/null +++ b/interfaces/tdetexteditor/configinterfaceextension.h @@ -0,0 +1,116 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_configinterfaceextension_h__ +#define __tdetexteditor_configinterfaceextension_h__ + +#include <tqwidget.h> +#include <tqpixmap.h> +#include <kicontheme.h> + +namespace KTextEditor +{ + +class KTEXTEDITOR_EXPORT ConfigPage : public TQWidget +{ + Q_OBJECT + + public: + ConfigPage ( TQWidget *parent=0, const char *name=0 ); + virtual ~ConfigPage (); + + // + // slots !!! + // + public: + /** + Applies the changes to all documents + */ + virtual void apply () = 0; + + /** + Reset the changes + */ + virtual void reset () = 0; + + /** + Sets default options + */ + virtual void defaults () = 0; + + signals: + /** + Emitted when something changes + */ + void changed(); +}; + +/** +* This is an interface to extend the configuration of the +* Document, Plugin and PluginViewInterface classes. +*/ +class KTEXTEDITOR_EXPORT ConfigInterfaceExtension +{ + friend class PrivateConfigInterfaceExtension; + + public: + ConfigInterfaceExtension(); + virtual ~ConfigInterfaceExtension(); + + unsigned int configInterfaceExtensionNumber () const; + + protected: + void setConfigInterfaceExtensionDCOPSuffix (const TQCString &suffix); + + // + // slots !!! + // + public: + /** + Number of available config pages + */ + virtual uint configPages () const = 0; + + /** + returns config page with the given number, + config pages from 0 to configPages()-1 are available + if configPages() > 0 + */ + virtual ConfigPage *configPage (uint number = 0, TQWidget *parent = 0, const char *name=0 ) = 0; + + virtual TQString configPageName (uint number = 0) const = 0; + virtual TQString configPageFullName (uint number = 0) const = 0; + virtual TQPixmap configPagePixmap (uint number = 0, int size = KIcon::SizeSmall) const = 0; + + + private: + class PrivateConfigInterfaceExtension *d; + static unsigned int globalConfigInterfaceExtensionNumber; + unsigned int myConfigInterfaceExtensionNumber; +}; + +class Document; +class Plugin; +class ViewPlugin; + +KTEXTEDITOR_EXPORT ConfigInterfaceExtension *configInterfaceExtension (Document *doc); +KTEXTEDITOR_EXPORT ConfigInterfaceExtension *configInterfaceExtension (Plugin *plugin); + +} + +#endif diff --git a/interfaces/tdetexteditor/cursorinterface.cpp b/interfaces/tdetexteditor/cursorinterface.cpp new file mode 100644 index 000000000..96d00290e --- /dev/null +++ b/interfaces/tdetexteditor/cursorinterface.cpp @@ -0,0 +1,69 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "cursorinterface.h" +#include "document.h" + +namespace KTextEditor +{ + +class PrivateCursorInterface +{ + public: + PrivateCursorInterface() {} + ~PrivateCursorInterface() {} +}; + +} + +using namespace KTextEditor; + +unsigned int CursorInterface::globalCursorInterfaceNumber = 0; + +CursorInterface::CursorInterface() +{ + globalCursorInterfaceNumber++; + myCursorInterfaceNumber = globalCursorInterfaceNumber++; + + d = new PrivateCursorInterface(); +} + +CursorInterface::~CursorInterface() +{ + delete d; +} + +unsigned int CursorInterface::cursorInterfaceNumber () const +{ + return myCursorInterfaceNumber; +} + +void CursorInterface::setCursorInterfaceDCOPSuffix (const TQCString &/*suffix*/) +{ + //d->interface->setObjId ("CursorInterface#"+suffix); +} + +CursorInterface *KTextEditor::cursorInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::CursorInterface*>(doc); +} diff --git a/interfaces/tdetexteditor/cursorinterface.h b/interfaces/tdetexteditor/cursorinterface.h new file mode 100644 index 000000000..e31d33395 --- /dev/null +++ b/interfaces/tdetexteditor/cursorinterface.h @@ -0,0 +1,84 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_cursorinterface_h__ +#define __tdetexteditor_cursorinterface_h__ + +#include <tqptrlist.h> +#include <tqstring.h> + +#include <tdelibs_export.h> + +namespace KTextEditor +{ + +/** + * This class represents a text cursor. + */ +class KTEXTEDITOR_EXPORT Cursor +{ + public: + virtual void position ( unsigned int *line, unsigned int *col ) const = 0; + + virtual bool setPosition ( unsigned int line, unsigned int col ) = 0; + + virtual bool insertText ( const TQString& text ) = 0; + + virtual bool removeText ( unsigned int numberOfCharacters ) = 0; + + virtual TQChar currentChar () const = 0; +}; + +/** +* This is an interface for accessing the cursor of the Document class. +*/ +class KTEXTEDITOR_EXPORT CursorInterface +{ + friend class PrivateCursorInterface; + + public: + CursorInterface (); + virtual ~CursorInterface (); + + unsigned int cursorInterfaceNumber () const; + + protected: + void setCursorInterfaceDCOPSuffix (const TQCString &suffix); + + public: + /** + * Create a new cursor object + */ + virtual Cursor *createCursor ( ) = 0; + + /* + * Accessor to the list of cursors. + */ + virtual TQPtrList<Cursor> cursors () const = 0; + + private: + class PrivateCursorInterface *d; + static unsigned int globalCursorInterfaceNumber; + unsigned int myCursorInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT CursorInterface *cursorInterface (class Document *doc); + +} + +#endif diff --git a/interfaces/tdetexteditor/document.h b/interfaces/tdetexteditor/document.h new file mode 100644 index 000000000..83d8b7cf6 --- /dev/null +++ b/interfaces/tdetexteditor/document.h @@ -0,0 +1,85 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_document_h__ +#define __tdetexteditor_document_h__ + +#include "editor.h" + +namespace KTextEditor +{ + +/** + * The main class representing a text document. + * This class provides access to the document's views. + */ +class KTEXTEDITOR_EXPORT Document : public KTextEditor::Editor +{ + friend class PrivateDocument; + + Q_OBJECT + + + public: + Document ( TQObject *parent = 0, const char *name = 0 ); + virtual ~Document (); + + /** + * Returns the global number of this document in your app. + */ + unsigned int documentNumber () const; + + /** + * Returns this document's DCOP suffix for identifiying its DCOP interface. + */ + TQCString documentDCOPSuffix () const; + + /** + * Create a view that will display the document data. You can create as many + * views as you like. When the user modifies data in one view then all other + * views will be updated as well. + */ + virtual class View *createView ( TQWidget *parent, const char *name = 0 ) = 0; + + /* + * Returns a list of all views of this document. + */ + virtual TQPtrList<class View> views () const = 0; + + /** + * Returns the list position of this document in your app, if applicable. + */ + long documentListPosition () const; + + /** + * Sets the list position of this document in your app, if applicable. + */ + void setDocumentListPosition (long pos); + + private: + class PrivateDocument *d; + static unsigned int globalDocumentNumber; + unsigned int myDocumentNumber; + long myDocumentListPosition; +}; + +KTEXTEDITOR_EXPORT Document *createDocument ( const char* libname, TQObject *parent = 0, const char *name = 0 ); + +} + +#endif diff --git a/interfaces/tdetexteditor/documentdcopinfo.cpp b/interfaces/tdetexteditor/documentdcopinfo.cpp new file mode 100644 index 000000000..b339d01cd --- /dev/null +++ b/interfaces/tdetexteditor/documentdcopinfo.cpp @@ -0,0 +1,33 @@ +#include "documentinfo.h" +#include "documentdcopinfo.h" + +#include <dcopclient.h> +using namespace KTextEditor; + +DocumentInfoDCOPInterface::DocumentInfoDCOPInterface( DocumentInfoInterface *Parent, const char *name) + : DCOPObject(name) +{ + m_parent = Parent; +} + +DocumentInfoDCOPInterface::~DocumentInfoDCOPInterface() +{ + +} + +TQString DocumentInfoDCOPInterface::mimeType() +{ + return m_parent->mimeType(); +} +long DocumentInfoDCOPInterface::fileSize() +{ + return m_parent->fileSize(); +} +TQString DocumentInfoDCOPInterface::niceFileSize() +{ + return m_parent->niceFileSize(); +} +uint DocumentInfoDCOPInterface::documentInfoInterfaceNumber () +{ + return m_parent->documentInfoInterfaceNumber (); +} diff --git a/interfaces/tdetexteditor/documentdcopinfo.h b/interfaces/tdetexteditor/documentdcopinfo.h new file mode 100644 index 000000000..ea25284fe --- /dev/null +++ b/interfaces/tdetexteditor/documentdcopinfo.h @@ -0,0 +1,47 @@ +#ifndef DocumentInfo_DCOP_INTERFACE_H +#define DocumentInfo_DCOP_INTERFACE_H + +#include <dcopobject.h> +#include <dcopref.h> +#include <tqstringlist.h> +#include <tqcstring.h> + +namespace KTextEditor +{ + class DocumentInfoInterface; + /** + This is the main interface to the DocumentInfoInterface of KTextEdit. + This will provide a consistant dcop interface to all KDE applications that use it. + @short DCOP interface to DocumentInfoInterface. + @author Ian Reinhart Geiser <[email protected]> + */ + + class KTEXTEDITOR_EXPORT DocumentInfoDCOPInterface : virtual public DCOPObject + { + K_DCOP + + public: + /** + Construct a new interface object for the text editor. + @param Parent the parent DocumentInfoInterface object + that will provide us with the functions for the interface. + @param name the QObject's name + */ + DocumentInfoDCOPInterface( DocumentInfoInterface *Parent, const char *name ); + /** + Destructor + Cleans up the object. + */ + virtual ~DocumentInfoDCOPInterface(); + k_dcop: + TQString mimeType(); + long fileSize(); + TQString niceFileSize(); + uint documentInfoInterfaceNumber (); + private: + DocumentInfoInterface *m_parent; + }; +} +#endif + + diff --git a/interfaces/tdetexteditor/documentinfo.cpp b/interfaces/tdetexteditor/documentinfo.cpp new file mode 100644 index 000000000..c675bfb5f --- /dev/null +++ b/interfaces/tdetexteditor/documentinfo.cpp @@ -0,0 +1,65 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + 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. +*/ + +// $Id$ + +#include "documentinfo.h" +#include "documentdcopinfo.h" + +namespace KTextEditor +{ + +class PrivateDocumentInfoInterface +{ + public: + PrivateDocumentInfoInterface() {interface = 0;} + ~PrivateDocumentInfoInterface() {} + DocumentInfoDCOPInterface *interface; +}; + +} + +using namespace KTextEditor; + +unsigned int DocumentInfoInterface::globalDocumentInfoInterfaceNumber = 0; + +DocumentInfoInterface::DocumentInfoInterface() +{ + globalDocumentInfoInterfaceNumber++; + myDocumentInfoInterfaceNumber = globalDocumentInfoInterfaceNumber++; + + d = new PrivateDocumentInfoInterface(); + TQString name = "DocumentInterface#" + TQString::number(myDocumentInfoInterfaceNumber); + d->interface = new DocumentInfoDCOPInterface(this, name.latin1()); +} + +DocumentInfoInterface::~DocumentInfoInterface() +{ + delete d->interface; + delete d; +} + +unsigned int DocumentInfoInterface::documentInfoInterfaceNumber () const +{ + return myDocumentInfoInterfaceNumber; +} + +void DocumentInfoInterface::setDocumentInfoInterfaceDCOPSuffix (const TQCString &suffix) +{ + d->interface->setObjId ("DocumentInfoInterface#"+suffix); +} diff --git a/interfaces/tdetexteditor/documentinfo.h b/interfaces/tdetexteditor/documentinfo.h new file mode 100644 index 000000000..46a19bfd5 --- /dev/null +++ b/interfaces/tdetexteditor/documentinfo.h @@ -0,0 +1,60 @@ +/* This file is part of the KDE libraries + Copyright (C) 2002 Joseph Wenninger <[email protected]> + + 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 __tdetexteditor_documentinfointerface_h__ +#define __tdetexteditor_documentinfointerface_h__ + +class TQString; +class TQCString; + +#include <tdelibs_export.h> + +namespace KTextEditor +{ + +/** + * This is an interface for accessing information about files open + * in the Document, Plugin and PluginViewInterface classes. + */ +class KTEXTEDITOR_EXPORT DocumentInfoInterface +{ + friend class PrivateDocumentInterface; + + public: + DocumentInfoInterface(); + virtual ~DocumentInfoInterface(); + + virtual TQString mimeType()=0; + virtual long fileSize()=0; + virtual TQString niceFileSize()=0; + + unsigned int documentInfoInterfaceNumber () const; + + protected: + void setDocumentInfoInterfaceDCOPSuffix (const TQCString &suffix); + + private: + class PrivateDocumentInfoInterface *d; + static unsigned int globalDocumentInfoInterfaceNumber; + unsigned int myDocumentInfoInterfaceNumber; +}; + + +} + +#endif diff --git a/interfaces/tdetexteditor/dynwordwrapinterface.cpp b/interfaces/tdetexteditor/dynwordwrapinterface.cpp new file mode 100644 index 000000000..9c1da6d4b --- /dev/null +++ b/interfaces/tdetexteditor/dynwordwrapinterface.cpp @@ -0,0 +1,69 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "dynwordwrapinterface.h" +#include "view.h" + +namespace KTextEditor +{ + +class PrivateDynWordWrapInterface +{ + public: + PrivateDynWordWrapInterface() {} + ~PrivateDynWordWrapInterface() {} +}; + +} + +using namespace KTextEditor; + +unsigned int DynWordWrapInterface::globalDynWordWrapInterfaceNumber = 0; + +DynWordWrapInterface::DynWordWrapInterface() +{ + globalDynWordWrapInterfaceNumber++; + myDynWordWrapInterfaceNumber = globalDynWordWrapInterfaceNumber++; + + d = new PrivateDynWordWrapInterface(); +} + +DynWordWrapInterface::~DynWordWrapInterface() +{ + delete d; +} + +unsigned int DynWordWrapInterface::dynWordWrapInterfaceNumber () const +{ + return myDynWordWrapInterfaceNumber; +} + +void DynWordWrapInterface::setDynWordWrapInterfaceDCOPSuffix (const TQCString &/*suffix*/) +{ + //d->interface->setObjId ("DynWordWrapInterface#"+suffix); +} + +DynWordWrapInterface *KTextEditor::dynWordWrapInterface (View *view) +{ + if (!view) + return 0; + + return dynamic_cast<KTextEditor::DynWordWrapInterface*>(view); +} diff --git a/interfaces/tdetexteditor/dynwordwrapinterface.h b/interfaces/tdetexteditor/dynwordwrapinterface.h new file mode 100644 index 000000000..9a6ce116b --- /dev/null +++ b/interfaces/tdetexteditor/dynwordwrapinterface.h @@ -0,0 +1,64 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann ([email protected]) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 __tdetexteditor_dynwordwrapinterface_h__ +#define __tdetexteditor_dynwordwrapinterface_h__ + +#include <tdelibs_export.h> + +class TQCString; + +namespace KTextEditor +{ + +/** + * This is an interface for accessing dynamic word wrapping functionality + * of the View class. + */ +class KTEXTEDITOR_EXPORT DynWordWrapInterface +{ + friend class PrivateDynWordWrapInterface; + + public: + DynWordWrapInterface (); + virtual ~DynWordWrapInterface (); + + unsigned int dynWordWrapInterfaceNumber () const; + + protected: + void setDynWordWrapInterfaceDCOPSuffix (const TQCString &suffix); + + // + // slots !!! + // + public: + virtual void setDynWordWrap (bool) = 0; + virtual bool dynWordWrap () const = 0; + + private: + class PrivateDynWordWrapInterface *d; + static unsigned int globalDynWordWrapInterfaceNumber; + unsigned int myDynWordWrapInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT DynWordWrapInterface *dynWordWrapInterface (class View *view); + +} + +#endif diff --git a/interfaces/tdetexteditor/editdcopinterface.cpp b/interfaces/tdetexteditor/editdcopinterface.cpp new file mode 100644 index 000000000..6130ccd14 --- /dev/null +++ b/interfaces/tdetexteditor/editdcopinterface.cpp @@ -0,0 +1,61 @@ +#include "editdcopinterface.h" +#include "editinterface.h" + +#include <dcopclient.h> +using namespace KTextEditor; + +EditDCOPInterface::EditDCOPInterface( EditInterface *Parent, const char *name) + : DCOPObject(name) +{ + m_parent = Parent; +} + +EditDCOPInterface::~EditDCOPInterface() +{ + +} + +TQString EditDCOPInterface::text () +{ + return m_parent->text(); +} + +TQString EditDCOPInterface::textLine ( uint line ) +{ + return m_parent->textLine(line); +} + +int EditDCOPInterface::numLines () +{ + return m_parent->numLines(); +} + +int EditDCOPInterface::length () +{ + return m_parent->length(); +} + +void EditDCOPInterface::setText ( const TQString &text ) +{ + m_parent->setText(text); +} + +bool EditDCOPInterface::insertText ( uint line, uint col, const TQString &text ) +{ + return m_parent->insertText( line, col, text); +} + +bool EditDCOPInterface::removeText ( uint startLine, uint startCol, uint endLine, uint endCol ) +{ + return m_parent->removeText( startLine, startCol, endLine, endCol); +} + +bool EditDCOPInterface::insertLine ( uint line, const TQString &text ) +{ + return m_parent->insertLine( line, text); +} + +bool EditDCOPInterface::removeLine ( uint line ) +{ + return m_parent->removeLine( line ); +} diff --git a/interfaces/tdetexteditor/editdcopinterface.h b/interfaces/tdetexteditor/editdcopinterface.h new file mode 100644 index 000000000..f169fb15b --- /dev/null +++ b/interfaces/tdetexteditor/editdcopinterface.h @@ -0,0 +1,90 @@ +#ifndef EDIT_DCOP_INTERFACE_H +#define EDIT_DCOP_INTERFACE_H + +#include <dcopobject.h> +#include <dcopref.h> +#include <tqstringlist.h> +#include <tqcstring.h> +//#include "editdcopinterface.moc" +namespace KTextEditor +{ + class EditInterface; + /** + This is the main interface to the EditInterface of KTextEdit. + This will provide a consistant dcop interface to all KDE applications that use it. + @short DCOP interface to EditInterface. + @author Ian Reinhart Geiser <[email protected]> + */ + class KTEXTEDITOR_EXPORT EditDCOPInterface : virtual public DCOPObject + { + K_DCOP + + public: + /** + Construct a new interface object for the text editor. + @param Parent the parent EditInterface object + that will provide us with the functions for the interface. + @param name the QObject's name + */ + EditDCOPInterface( EditInterface *Parent, const char *name ); + /** + Destructor + Cleans up the object. + **/ + virtual ~EditDCOPInterface(); + k_dcop: + /** + * @return the complete document as a single QString + */ + virtual TQString text (); + + /** + * @return All the text from the requested line. + */ + virtual TQString textLine ( uint line ); + + /** + * @return The current number of lines in the document + */ + virtual int numLines (); + + /** + * @return the number of characters in the document + */ + virtual int length (); + + /** + * Set the given text into the view. + * Warning: This will overwrite any data currently held in this view. + */ + virtual void setText (const TQString &text ); + + /** + * Inserts text at line "line", column "col" + * returns true if success + */ + virtual bool insertText ( uint line, uint col, const TQString &text ); + + /** + * remove text at line "line", column "col" + * returns true if success + */ + virtual bool removeText ( uint startLine, uint startCol, uint endLine, uint endCol) ; + + /** + * Insert line(s) at the given line number. + */ + virtual bool insertLine ( uint line, const TQString &text ); + + /** + * Insert line(s) at the given line number. + * If only one line is in the current document, removeLine will fail (return false) + */ + virtual bool removeLine ( uint line ); + private: + EditInterface *m_parent; + }; +} +#endif + + diff --git a/interfaces/tdetexteditor/editinterface.cpp b/interfaces/tdetexteditor/editinterface.cpp new file mode 100644 index 000000000..cfa0b67bc --- /dev/null +++ b/interfaces/tdetexteditor/editinterface.cpp @@ -0,0 +1,57 @@ +#include "editinterface.h" +#include "editdcopinterface.h" +#include "document.h" + +using namespace KTextEditor; + +namespace KTextEditor +{ + class PrivateEditInterface + { + public: + PrivateEditInterface() + { + interface = 0; + } + ~PrivateEditInterface(){} + // Data Members + EditDCOPInterface *interface; + }; + +} + +uint EditInterface::globalEditInterfaceNumber = 0; + +EditInterface::EditInterface() +{ + d = new PrivateEditInterface(); + globalEditInterfaceNumber++; + myEditInterfaceNumber = globalEditInterfaceNumber; + TQString name = "EditInterface#" + TQString::number(myEditInterfaceNumber); + d->interface = new EditDCOPInterface(this, name.latin1()); +} + +EditInterface::~EditInterface() +{ + delete d->interface; + delete d; +} + +uint EditInterface::editInterfaceNumber () const +{ + return myEditInterfaceNumber; +} + +void EditInterface::setEditInterfaceDCOPSuffix (const TQCString &suffix) +{ + d->interface->setObjId ("EditInterface#"+suffix); +} + +EditInterface *KTextEditor::editInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::EditInterface*>(doc); +} + diff --git a/interfaces/tdetexteditor/editinterface.h b/interfaces/tdetexteditor/editinterface.h new file mode 100644 index 000000000..05e4941f2 --- /dev/null +++ b/interfaces/tdetexteditor/editinterface.h @@ -0,0 +1,137 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_editinterface_h__ +#define __tdetexteditor_editinterface_h__ + +#include <tqstring.h> + +#include <tdelibs_export.h> + +namespace KTextEditor +{ + +/** +* This is the main interface for accessing and modifying +* text of the Document class. +*/ +class KTEXTEDITOR_EXPORT EditInterface +{ + friend class PrivateEditInterface; + + public: + EditInterface(); + virtual ~EditInterface(); + + uint editInterfaceNumber () const; + + protected: + void setEditInterfaceDCOPSuffix (const TQCString &suffix); + + public: + /** + * slots !!! + */ + /** + * @return the complete document as a single QString + */ + virtual TQString text () const = 0; + + /** + * @return a QString + */ + virtual TQString text ( uint startLine, uint startCol, uint endLine, uint endCol ) const = 0; + + /** + * @return All the text from the requested line. + */ + virtual TQString textLine ( uint line ) const = 0; + + /** + * @return The current number of lines in the document + */ + virtual uint numLines () const = 0; + + /** + * @return the number of characters in the document + */ + virtual uint length () const = 0; + + /** + * @return the number of characters in the line (-1 if no line "line") + */ + virtual int lineLength ( uint line ) const = 0; + + /** + * Set the given text into the view. + * Warning: This will overwrite any data currently held in this view. + */ + virtual bool setText ( const TQString &text ) = 0; + + /** + * clears the document + * Warning: This will overwrite any data currently held in this view. + */ + virtual bool clear () = 0; + + /** + * Inserts text at line "line", column "col" + * returns true if success + * Use insertText(numLines(), ...) to append text at end of document + */ + virtual bool insertText ( uint line, uint col, const TQString &text ) = 0; + + /** + * remove text at line "line", column "col" + * returns true if success + */ + virtual bool removeText ( uint startLine, uint startCol, uint endLine, uint endCol ) = 0; + + /** + * Insert line(s) at the given line number. + * Use insertLine(numLines(), text) to append line at end of document + */ + virtual bool insertLine ( uint line, const TQString &text ) = 0; + + /** + * Remove line(s) at the given line number. + */ + virtual bool removeLine ( uint line ) = 0; + + /** + * signals !!! + */ + public: + virtual void textChanged () = 0; + + virtual void charactersInteractivelyInserted(int ,int ,const TQString&)=0; //line, col, characters if you don't support this, don't create a signal, just overload it. + + /** + * only for the interface itself - REAL PRIVATE + */ + private: + class PrivateEditInterface *d; + static uint globalEditInterfaceNumber; + uint myEditInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT EditInterface *editInterface (class Document *doc); + +} + +#endif diff --git a/interfaces/tdetexteditor/editinterfaceext.cpp b/interfaces/tdetexteditor/editinterfaceext.cpp new file mode 100644 index 000000000..008fa488d --- /dev/null +++ b/interfaces/tdetexteditor/editinterfaceext.cpp @@ -0,0 +1,50 @@ +/* This file is part of the KDE libraries + Copyright (C) 2003 Hamish Rodda <[email protected]> + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +#include "editinterfaceext.h" +#include "document.h" + +using namespace KTextEditor; + +uint EditInterfaceExt::globalEditInterfaceExtNumber = 0; + +EditInterfaceExt::EditInterfaceExt() + : d(0L) +{ + globalEditInterfaceExtNumber++; + myEditInterfaceExtNumber = globalEditInterfaceExtNumber; +} + +EditInterfaceExt::~EditInterfaceExt() +{ +} + +uint EditInterfaceExt::editInterfaceExtNumber() const +{ + return myEditInterfaceExtNumber; +} + +EditInterfaceExt *KTextEditor::editInterfaceExt (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::EditInterfaceExt*>(doc); +} + diff --git a/interfaces/tdetexteditor/editinterfaceext.h b/interfaces/tdetexteditor/editinterfaceext.h new file mode 100644 index 000000000..25b74201c --- /dev/null +++ b/interfaces/tdetexteditor/editinterfaceext.h @@ -0,0 +1,74 @@ +/* This file is part of the KDE libraries + Copyright (C) 2003 Hamish Rodda <[email protected]> + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_editinterfaceext_h__ +#define __tdetexteditor_editinterfaceext_h__ + +#include <tqstring.h> + +#include <tdelibs_export.h> + +namespace KTextEditor +{ + +/** +* This is the main interface for accessing and modifying +* text of the Document class. +*/ +class KTEXTEDITOR_EXPORT EditInterfaceExt +{ + friend class PrivateEditInterfaceExt; + + public: + EditInterfaceExt(); + virtual ~EditInterfaceExt(); + + uint editInterfaceExtNumber() const; + + /** + * Begin an editing sequence. Edit commands during this sequence will be + * bunched together such that they represent a single undo command in the + * editor, and so that repaint events do not occur inbetween. + * + * Your application should not return control to the event loop while it + * has an unterminated (no matching editEnd() call) editing sequence + * (result undefined) - so do all of your work in one go... + */ + virtual void editBegin() = 0; + + /** + * End and editing sequence. + */ + virtual void editEnd() = 0; + + public: + /** + * only for the interface itself - REAL PRIVATE + */ + private: + class PrivateEditInterfaceExt *d; + static uint globalEditInterfaceExtNumber; + uint myEditInterfaceExtNumber; +}; + +KTEXTEDITOR_EXPORT EditInterfaceExt *editInterfaceExt (class Document *doc); + +} + +#endif diff --git a/interfaces/tdetexteditor/editor.h b/interfaces/tdetexteditor/editor.h new file mode 100644 index 000000000..8b6699f9f --- /dev/null +++ b/interfaces/tdetexteditor/editor.h @@ -0,0 +1,65 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_editor_h__ +#define __tdetexteditor_editor_h__ + +#include <tdeparts/part.h> + +/** + * KTextEditor is KDE's standard text editing KPart interface. + */ +namespace KTextEditor +{ + +/** + * This is a simplfied version of the Document & View classes + * Usage: Load it, merge it's gui + be happy + * Extensibility: Use the Document / View classes if you want + * advanced features, interfaces, etc. This class is just a good text editor + * widget replacement for applications which just need an embedded text edtor + * and are not interested in using advanced interfaces. + */ + +class KTEXTEDITOR_EXPORT Editor : public KParts::ReadWritePart +{ + friend class PrivateEditor; + + Q_OBJECT + + + public: + /** + * Create a new editor widget. + */ + Editor ( TQObject *parent = 0, const char *name = 0 ); + virtual ~Editor (); + + unsigned int editorNumber () const; + + private: + class PrivateEditor *d; + static unsigned int globalEditorNumber; + unsigned int myEditorNumber; +}; + +KTEXTEDITOR_EXPORT Editor *createEditor ( const char* libname, TQWidget *parentWidget = 0, const char *widgetName = 0, TQObject *parent = 0, const char *name = 0 ); + +} + +#endif diff --git a/interfaces/tdetexteditor/editorchooser.cpp b/interfaces/tdetexteditor/editorchooser.cpp new file mode 100644 index 000000000..807d342d0 --- /dev/null +++ b/interfaces/tdetexteditor/editorchooser.cpp @@ -0,0 +1,162 @@ +#include <editorchooser.h> +#include <editorchooser.moc> + +#include <tqcombobox.h> +#include <ktrader.h> +#include <kconfig.h> +#include <tqstringlist.h> +#include <kservice.h> +#include <klocale.h> +#include <tqlabel.h> +#include <kapplication.h> +#include <tqlayout.h> + +#include "editorchooser_ui.h" + +using namespace KTextEditor; + +namespace KTextEditor +{ + class PrivateEditorChooser + { + public: + PrivateEditorChooser() + { + } + ~PrivateEditorChooser(){} + // Data Members + EditorChooser_UI *chooser; + TQStringList ElementNames; + TQStringList elements; + }; + +} + +EditorChooser::EditorChooser(TQWidget *parent,const char *name) : + TQWidget (parent,name) + { + d = new PrivateEditorChooser (); + + // sizemanagment + TQGridLayout *grid = new TQGridLayout( this, 1, 1 ); + + + d->chooser = new EditorChooser_UI (this, name); + + grid->addWidget( d->chooser, 0, 0); + + + KTrader::OfferList offers = KTrader::self()->query("text/plain", "'KTextEditor/Document' in ServiceTypes"); + TDEConfig *config=new TDEConfig("default_components"); + config->setGroup("KTextEditor"); + TQString editor = config->readPathEntry("embeddedEditor"); + + if (editor.isEmpty()) editor="katepart"; + + for (KTrader::OfferList::Iterator it = offers.begin(); it != offers.end(); ++it) + { + if ((*it)->desktopEntryName().contains(editor)) + { + d->chooser->editorCombo->insertItem(TQString(i18n("System Default (%1)").arg((*it)->name()))); + break; + } + } + + for (KTrader::OfferList::Iterator it = offers.begin(); it != offers.end(); ++it) + { + d->chooser->editorCombo->insertItem((*it)->name()); + d->elements.append((*it)->desktopEntryName()); + } + d->chooser->editorCombo->setCurrentItem(0); +} + +EditorChooser:: ~EditorChooser(){ + delete d; +} + +void EditorChooser::readAppSetting(const TQString& postfix){ + TDEConfig *cfg=kapp->config(); + TQString previousGroup=cfg->group(); + cfg->setGroup("KTEXTEDITOR:"+postfix); + TQString editor=cfg->readPathEntry("editor"); + if (editor.isEmpty()) d->chooser->editorCombo->setCurrentItem(0); + else + { + int idx=d->elements.findIndex(editor); + idx=idx+1; + d->chooser->editorCombo->setCurrentItem(idx); + } + cfg->setGroup(previousGroup); +} + +void EditorChooser::writeAppSetting(const TQString& postfix){ + TDEConfig *cfg=kapp->config(); + TQString previousGroup=cfg->group(); + cfg->setGroup("KTEXTEDITOR:"+postfix); + cfg->writeEntry("DEVELOPER_INFO","NEVER TRY TO USE VALUES FROM THAT GROUP, THEY ARE SUBJECT TO CHANGES"); + cfg->writePathEntry("editor", (d->chooser->editorCombo->currentItem()==0) ? + TQString::null : (*d->elements.at(d->chooser->editorCombo->currentItem()-1))); + cfg->sync(); + cfg->setGroup(previousGroup); + +} + +KTextEditor::Document *EditorChooser::createDocument(TQObject *parent,const char* name, const TQString& postfix,bool fallBackToKatePart){ + + KTextEditor::Document *tmpDoc=0; + + TDEConfig *cfg=kapp->config(); + TQString previousGroup=cfg->group(); + cfg->setGroup("KTEXTEDITOR:"+postfix); + TQString editor=cfg->readPathEntry("editor"); + cfg->setGroup(previousGroup); + if (editor.isEmpty()) + { + TDEConfig *config=new TDEConfig("default_components"); + config->setGroup("KTextEditor"); + editor = config->readPathEntry("embeddedEditor", "katepart"); + delete config; + } + + KService::Ptr serv=KService::serviceByDesktopName(editor); + if (serv) + { + tmpDoc=KTextEditor::createDocument(serv->library().latin1(),parent,name); + if (tmpDoc) return tmpDoc; + } + if (fallBackToKatePart) + return KTextEditor::createDocument("libkatepart",parent,name); + + return 0; +} + +KTextEditor::Editor *EditorChooser::createEditor(TQWidget *parentWidget,TQObject *parent,const char* widgetName, + const char* name,const TQString& postfix,bool fallBackToKatePart){ + + KTextEditor::Editor *tmpEd=0; + + TDEConfig *cfg=kapp->config(); + TQString previousGroup=cfg->group(); + cfg->setGroup("KTEXTEDITOR:"+postfix); + TQString editor=cfg->readPathEntry("editor"); + cfg->setGroup(previousGroup); + if (editor.isEmpty()) + { + TDEConfig *config=new TDEConfig("default_components"); + config->setGroup("KTextEditor"); + editor = config->readPathEntry("embeddedEditor", "katepart"); + delete config; + } + + KService::Ptr serv=KService::serviceByDesktopName(editor); + if (serv) + { + tmpEd=KTextEditor::createEditor(serv->library().latin1(),parentWidget,widgetName,parent,name); + if (tmpEd) return tmpEd; + } + if (fallBackToKatePart) + return KTextEditor::createEditor("libkatepart",parentWidget,widgetName,parent,name); + + return 0; +} + diff --git a/interfaces/tdetexteditor/editorchooser.h b/interfaces/tdetexteditor/editorchooser.h new file mode 100644 index 000000000..251776c10 --- /dev/null +++ b/interfaces/tdetexteditor/editorchooser.h @@ -0,0 +1,58 @@ +#ifndef _EDITOR_CHOOSER_H_ +#define _EDITOR_CHOOSER_H_ + +#include <tdetexteditor/editor.h> +#include <tdetexteditor/document.h> + +#include <tqwidget.h> + +class TDEConfig; +class TQString; + +namespace KTextEditor +{ + +class KTEXTEDITOR_EXPORT EditorChooser: public TQWidget +{ + friend class PrivateEditorChooser; + + Q_OBJECT + + public: + EditorChooser(TQWidget *parent=0,const char *name=0); + virtual ~EditorChooser(); + + /* void writeSysDefault();*/ + + void readAppSetting(const TQString& postfix=TQString::null); + void writeAppSetting(const TQString& postfix=TQString::null); + + static KTextEditor::Document *createDocument(TQObject* parent=0,const char *name=0,const TQString& postfix=TQString::null, bool fallBackToKatePart=true); + static KTextEditor::Editor *createEditor(TQWidget *parentWidget,TQObject *parent,const char* widgetName=0,const char* name=0,const TQString& postfix=TQString::null,bool fallBackToKatePart=true); + private: + class PrivateEditorChooser *d; +}; + +/* +class EditorChooserBackEnd: public ComponentChooserPlugin { + +Q_OBJECT +public: + EditorChooserBackEnd(TQObject *parent=0, const char *name=0); + virtual ~EditorChooserBackEnd(); + + virtual TQWidget *widget(TQWidget *); + virtual const TQStringList &choices(); + virtual void saveSettings(); + + void readAppSetting(TDEConfig *cfg,const TQString& postfix); + void writeAppSetting(TDEConfig *cfg,const TQString& postfix); + +public slots: + virtual void madeChoice(int pos,const TQString &choice); + +}; +*/ + +} +#endif diff --git a/interfaces/tdetexteditor/editorchooser_ui.ui b/interfaces/tdetexteditor/editorchooser_ui.ui new file mode 100644 index 000000000..e2bc82adb --- /dev/null +++ b/interfaces/tdetexteditor/editorchooser_ui.ui @@ -0,0 +1,64 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>EditorChooser_UI</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>EditorChooser</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>482</width> + <height>141</height> + </rect> + </property> + <property name="caption"> + <string>Editor Chooser</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="minimumSize"> + <size> + <width>460</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Please choose the default text editing component that you wish to use in this application. If you choose <B>System Default</B>, the application will honor your changes in the Control Center. All other choices will override that setting.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter|AlignLeft</set> + </property> + </widget> + <widget class="TQComboBox"> + <property name="name"> + <cstring>editorCombo</cstring> + </property> + </widget> + </vbox> + </widget> + </vbox> +</widget> +<tabstops> + <tabstop>editorCombo</tabstop> +</tabstops> +<includes> + <include location="global" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="6" margin="11"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/interfaces/tdetexteditor/encodingdcopinterface.cpp b/interfaces/tdetexteditor/encodingdcopinterface.cpp new file mode 100644 index 000000000..eb408c16e --- /dev/null +++ b/interfaces/tdetexteditor/encodingdcopinterface.cpp @@ -0,0 +1,28 @@ +#include "encodingdcopinterface.h" +#include "encodinginterface.h" + +#include <dcopclient.h> +using namespace KTextEditor; + +EncodingDCOPInterface::EncodingDCOPInterface( EncodingInterface *Parent, const char *name) + : DCOPObject(name) +{ + m_parent = Parent; +} + +EncodingDCOPInterface::~EncodingDCOPInterface() +{ + + } +uint EncodingDCOPInterface::encodingInterfaceNumber () +{ + return m_parent->encodingInterfaceNumber (); +} +void EncodingDCOPInterface::setEncoding (TQString e) +{ + m_parent->setEncoding (e); +} +TQString EncodingDCOPInterface::encoding() +{ + return m_parent->encoding(); +} diff --git a/interfaces/tdetexteditor/encodingdcopinterface.h b/interfaces/tdetexteditor/encodingdcopinterface.h new file mode 100644 index 000000000..38de4e0aa --- /dev/null +++ b/interfaces/tdetexteditor/encodingdcopinterface.h @@ -0,0 +1,46 @@ +#ifndef Encoding_DCOP_INTERFACE_H +#define Encoding_DCOP_INTERFACE_H + +#include <dcopobject.h> +#include <dcopref.h> +#include <tqstringlist.h> +#include <tqcstring.h> +//#include "editdcopinterface.moc" +namespace KTextEditor +{ + class EncodingInterface; + /** + This is the main interface to the EncodingInterface of KTextEdit. + This will provide a consistant dcop interface to all KDE applications that use it. + @short DCOP interface to EncodingInterface. + @author Ian Reinhart Geiser <[email protected]> + */ + class KTEXTEDITOR_EXPORT EncodingDCOPInterface : virtual public DCOPObject + { + K_DCOP + + public: + /** + Construct a new interface object for the text editor. + @param Parent the parent EncodingInterface object + that will provide us with the functions for the interface. + @param name the QObject's name + */ + EncodingDCOPInterface( EncodingInterface *Parent, const char *name ); + /** + Destructor + Cleans up the object. + */ + virtual ~EncodingDCOPInterface(); + k_dcop: + uint encodingInterfaceNumber (); + void setEncoding (TQString e) ; + TQString encoding(); + + private: + EncodingInterface *m_parent; + }; +} +#endif + + diff --git a/interfaces/tdetexteditor/encodinginterface.cpp b/interfaces/tdetexteditor/encodinginterface.cpp new file mode 100644 index 000000000..a0ef1ad22 --- /dev/null +++ b/interfaces/tdetexteditor/encodinginterface.cpp @@ -0,0 +1,76 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "encodinginterface.h" +#include "encodingdcopinterface.h" +#include "document.h" + + + +namespace KTextEditor +{ + +class PrivateEncodingInterface +{ + public: + PrivateEncodingInterface() {interface=0;} + ~PrivateEncodingInterface() {} + EncodingDCOPInterface *interface; +}; + +} + +using namespace KTextEditor; + +unsigned int EncodingInterface::globalEncodingInterfaceNumber = 0; + +EncodingInterface::EncodingInterface() +{ + globalEncodingInterfaceNumber++; + myEncodingInterfaceNumber = globalEncodingInterfaceNumber++; + + d = new PrivateEncodingInterface(); + ::TQString name = "EncodingInterface#" + ::TQString::number(myEncodingInterfaceNumber); + d->interface = new EncodingDCOPInterface(this, name.latin1()); +} + +EncodingInterface::~EncodingInterface() +{ + delete d->interface; + delete d; +} + +unsigned int EncodingInterface::encodingInterfaceNumber () const +{ + return myEncodingInterfaceNumber; +} + +void EncodingInterface::setEncodingInterfaceDCOPSuffix (const TQCString &suffix) +{ + d->interface->setObjId ("EncodingInterface#"+suffix); +} + +EncodingInterface *KTextEditor::encodingInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::EncodingInterface*>(doc); +} diff --git a/interfaces/tdetexteditor/encodinginterface.h b/interfaces/tdetexteditor/encodinginterface.h new file mode 100644 index 000000000..42d0186ad --- /dev/null +++ b/interfaces/tdetexteditor/encodinginterface.h @@ -0,0 +1,63 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_encodinginterface_h__ +#define __tdetexteditor_encodinginterface_h__ + +#include <tdelibs_export.h> + +class TQString; +class TQCString; + +namespace KTextEditor +{ + +/** +* This is an interface to the text encoding of a Document class. +*/ +class KTEXTEDITOR_EXPORT EncodingInterface +{ + friend class PrivateEncodingInterface; + + public: + EncodingInterface(); + virtual ~EncodingInterface(); + + unsigned int encodingInterfaceNumber () const; + + protected: + void setEncodingInterfaceDCOPSuffix (const TQCString &suffix); + + // + // slots !!! + // + public: + virtual void setEncoding (const class TQString &e) = 0; + virtual class TQString encoding() const = 0; + + private: + class PrivateEncodingInterface *d; + static unsigned int globalEncodingInterfaceNumber; + unsigned int myEncodingInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT EncodingInterface *encodingInterface (class Document *doc); + +} + +#endif diff --git a/interfaces/tdetexteditor/highlightinginterface.cpp b/interfaces/tdetexteditor/highlightinginterface.cpp new file mode 100644 index 000000000..1677ca87c --- /dev/null +++ b/interfaces/tdetexteditor/highlightinginterface.cpp @@ -0,0 +1,69 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "highlightinginterface.h" +#include "document.h" + +namespace KTextEditor +{ + +class PrivateHighlightingInterface +{ + public: + PrivateHighlightingInterface() {} + ~PrivateHighlightingInterface() {} +}; + +} + +using namespace KTextEditor; + +unsigned int HighlightingInterface::globalHighlightingInterfaceNumber = 0; + +HighlightingInterface::HighlightingInterface() +{ + globalHighlightingInterfaceNumber++; + myHighlightingInterfaceNumber = globalHighlightingInterfaceNumber++; + + d = new PrivateHighlightingInterface(); +} + +HighlightingInterface::~HighlightingInterface() +{ + delete d; +} + +unsigned int HighlightingInterface::highlightingInterfaceNumber () const +{ + return myHighlightingInterfaceNumber; +} + +void HighlightingInterface::setHighlightingInterfaceDCOPSuffix (const TQCString &/*suffix*/) +{ + //d->interface->setObjId ("HighlightingInterface#"+suffix); +} + +HighlightingInterface *KTextEditor::highlightingInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::HighlightingInterface*>(doc); +} diff --git a/interfaces/tdetexteditor/highlightinginterface.h b/interfaces/tdetexteditor/highlightinginterface.h new file mode 100644 index 000000000..e7bd811e2 --- /dev/null +++ b/interfaces/tdetexteditor/highlightinginterface.h @@ -0,0 +1,92 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann ([email protected]) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 __tdetexteditor_highlightinginterface_h__ +#define __tdetexteditor_highlightinginterface_h__ + +#include <tdelibs_export.h> + +class TQString; +class TQCString; + +namespace KTextEditor +{ + +/** +* This is an interface for syntax highlighting of a Document. +*/ +class KTEXTEDITOR_EXPORT HighlightingInterface +{ + friend class PrivateHighlightingInterface; + + public: + HighlightingInterface (); + virtual ~HighlightingInterface (); + + unsigned int highlightingInterfaceNumber () const; + + protected: + void setHighlightingInterfaceDCOPSuffix (const TQCString &suffix); + + // + // slots !!! + // + public: + /** + * returns the current active highlighting mode + */ + virtual unsigned int hlMode () = 0; + + /** + * set the current active highlighting mode + */ + virtual bool setHlMode (unsigned int mode) = 0; + + /** + * returns the number of available highlightings + */ + virtual unsigned int hlModeCount () = 0; + + /** + * returns the name of the highlighting with number "mode" + */ + virtual TQString hlModeName (unsigned int mode) = 0; + + /** + * returns the sectionname of the highlighting with number "mode" + */ + virtual TQString hlModeSectionName (unsigned int mode) = 0; + + // + // signals !!! + // + public: + virtual void hlChanged () = 0; + + private: + class PrivateHighlightingInterface *d; + static unsigned int globalHighlightingInterfaceNumber; + unsigned int myHighlightingInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT HighlightingInterface *highlightingInterface (class Document *doc); + +} + +#endif diff --git a/interfaces/tdetexteditor/kcm_tdetexteditor.desktop b/interfaces/tdetexteditor/kcm_tdetexteditor.desktop new file mode 100644 index 000000000..490fad3ae --- /dev/null +++ b/interfaces/tdetexteditor/kcm_tdetexteditor.desktop @@ -0,0 +1,172 @@ +Name=Embedded Text Editor +Name[af]=Ingebedde Teks Redigeerder +Name[ar]=محرر نص مدمج +Name[az]=Daxili Mətn Editoru +Name[be]=Унутраны тэкставы рэдактар +Name[bg]=Текстов редактор +Name[bn]=অভ্যন্তরীন টেক্সট সম্পাদক +Name[br]=Aozer skrid enframmet +Name[bs]=Umetnuti tekst editor +Name[ca]=Editor de text, encastable +Name[cs]=Zabudovaný textový editor +Name[csb]=Òbsôdzony editora tekstu +Name[cy]=Golygydd Testun Mewnol +Name[da]=Indlejret teksteditor +Name[de]=Erweiterte Editorkomponente +Name[el]=Ενσωματωμένος επεξεργαστής κειμένου +Name[eo]=Interna tekstredaktilo +Name[es]=Editor de texto empotrable +Name[et]=Põimitud tekstiredaktor +Name[eu]=Kapsulatutako testu-editorea +Name[fa]=ویرایشگر متن نهفته +Name[fi]=Upotettava tekstieditori +Name[fr]=Éditeur de texte intégré +Name[fy]=Ynsletten tekstbewurker +Name[ga]=Eagarthóir téacs leabaithe +Name[gl]=Editor de Textos Incrustado +Name[he]=עורך טקסט מוטבע +Name[hi]=अंतर्निहित पाठ संपादक +Name[hr]=Ugrađeni uređivač teksta +Name[hsb]=Integrowane wobdźěłanje tekstow +Name[hu]=Beágyazott szövegszerkesztő +Name[id]=Komponen Editor Teks Embedded +Name[is]=Ívafinn textaritill +Name[it]=Editor di testi integrato +Name[ja]=埋め込みテキストエディタ +Name[ka]=ტექსტის ჩადგმული რედაქტორი +Name[kk]=Ендірілетін мәтін редакторы +Name[km]=កម្មវិធីនិពន្ធអត្ថបទដែលបានបង្កប់ +Name[ko]=끼워넣은 글월 편집기 +Name[lb]=Agebauten Texteditor +Name[lt]=Įdėtas tekstų redaktorius +Name[lv]=Iegultais teksta redaktors +Name[mk]=Вгнезден текст уредувач +Name[mn]=Холбоост текст боловсруулагч +Name[ms]=Editor Teks Terimplan +Name[nb]=Innebygget skriveprogram +Name[nds]=Inbett Texteditor +Name[ne]=सम्मिलित पाठ सम्पादक +Name[nl]=Ingebedde tekst-editor +Name[nn]=Inkluderbart skriveprogram +Name[nso]=Mofetosi wa Sengwalwana yo a Robaditswego +Name[pa]=ਸ਼ਾਮਿਲ ਪਾਠ ਸੰਪਾਦਕ +Name[pl]=Osadzony edytor tekstu +Name[pt]=Editor de Texto Embebido +Name[pt_BR]=Editor de textos integrado +Name[ro]=Editor de text înglobat +Name[ru]=Встроенный текстовый редактор +Name[rw]=Muhinduzi yUmwandiko Irimo +Name[se]=Vuojuhahtti čállinprográmma +Name[sk]=Vložiteľný textový editor +Name[sl]=Vključeni urejevalnik besedil +Name[sq]=Tekst Editori i ngulur +Name[sr]=Уграђени уређивач текста +Name[sr@Latn]=Ugrađeni uređivač teksta +Name[ss]=Sihleli sembhalo lesilele +Name[sv]=Inbäddad texteditor +Name[ta]=உட்பொதிந்த உரை தொகுப்பி +Name[te]=పొదగిన వాచకం సరిచేయునది +Name[tg]=Таҳриргари матни дарунсохт +Name[th]=โปรแกรมแก้ไขข้อความแบบฝังตัว +Name[tr]=Gömülü Metin Düzenleyici +Name[tt]=Mäten öçen Quşılma-Üzgärtkeçe +Name[uk]=Вмонтований текстовий редактор +Name[uz]=Ichki matn tahrirchi +Name[uz@cyrillic]=Ички матн таҳрирчи +Name[ven]=Musengulusi wa manwalwa o dzheniswaho +Name[vi]=Bộ Soạn thảo Văn bản nhúng +Name[wa]=Ravalé aspougneu di tecse +Name[xh]=Umhleli Wombhalo Olungiselelweyo +Name[zh_CN]=嵌入式文本编辑器 +Name[zh_HK]=嵌入式文字編輯器 +Name[zh_TW]=嵌入式文字編輯器 +Name[zu]=Umlungisi Wombhalo Oshuthekiwe +Comment=The text editor service provides applications with a text viewer and editor. TDE applications that provide text editing facilities should use this service. +Comment[af]=Die teks redigeerder diens verskaf programme met 'n teks aansig en redigeerder. Kde programme wat verskaf teks redigering fasiliteite moet gebruik hierdie diens. +Comment[ar]=تقوم خدمة محرر النصوص بتزويد التطبيقات بمعاين نصوص ومحرر. يجب أن تستخدم تطبيقات كيدي التي تزود بتسهيلات تحرير النصوص هذه الخدمة. +Comment[az]=Mətn redaktə xidməti proqramları mətn nümayişçisi və editoru ilə tə'min edir. Mətn redaktə bacarıqları olan proqramlar bu xidməti işlətməlidir. +Comment[be]=Сервіс тэкставага рэдактара дазваляе праглядаць і рэдагаваць тэкст у праграмах. Праграмы TDE, якія выконваюць гэтыя функцыі, павінны працаваць з гэтым сервісам. +Comment[bg]=Текстовия редактор, представлява компонент за вграждане в другите програми, който предоставя функционалност за разглеждане и редактиране на текстови файлове. +Comment[bn]=টেক্সট সম্পাদক সার্ভিসটি বিভিন্ন অ্যাপলিকেশন-কে একটি টেক্সট প্রদর্শক এবং সম্পাদক ব্যবহার করার সুযোগ দেয়। কোন কে.ডি.ই. অ্যাপলিকেশন টেক্সট সম্পাদনা করার সুবিধা দিতে চাইলে তার এই সার্ভিসটি ব্যবহার করা উচিত্। +Comment[bs]=Text editor servis pruža aplikacijama preglednik i editor teksta. TDE aplikacije koje imaju mogućnost editovanja teksta bi trebale koristiti ovaj servis. +Comment[ca]=El servei de l'editor de text proveeix d'aplicacions amb un visor i un editor de text. Les aplicacions TDE que proveeixen de facilitats d'edició haurien d'emprar aquest servei. +Comment[cs]=Služba textového editoru poskytuje aplikacím prohlížeč a editor textu. Aplikace TDE, které umožňují editovat text, by měly používat tuto službu. +Comment[csb]=Ùsłëżnota tekstowegò editora zezwôlô aplikacejom na przezéranié ë edicejã tekstów. Programë TDE, jaczé ùprzistãpniają nã edicëjną fùnkcëjã, mają brëkòwac ti ùsłëżnonë. +Comment[cy]=Mae'r gwasanaeth golygu testun yn darparu gwelydd testun a golygydd i gymhwysiadau. dylai cymhwysiadau TDE sy'n darparu galluoedd golygu testun ddefnyddio'r gwasanaeth yma. +Comment[da]=Teksteditor-tjenesten udstyrer programmer med en tekstfremviser og editor. TDE-programmer der bruger tekstredigeringsfaciliteter bør benytte denne tjeneste. +Comment[de]=Diese Komponente stellt Programmen einen Textbetrachter und -editor zur Verfügung. TDE-Anwendungen, die mit Textbearbeitung zu tun haben, sollten dieses Angebot nutzen. +Comment[el]=Η υπηρεσία επεξεργαστή κειμένου παρέχει στις εφαρμογές έναν προβολέα και επεξεργαστή κειμένου. Οι εφαρμογές του TDE που παρέχουν δυνατότητες επεξεργασίας κειμένου θα πρέπει να χρησιμοποιούν αυτή την υπηρεσία. +Comment[eo]=La tekstredaktila servo donas vin aplikaĵojn kun tekstrigardilo kaj redaktilo. TDE aplikaĵoj kiuj volas uzi tekstredaktadon uzu tiun ĉi servon. +Comment[es]=El servicio del editor de texto proporciona aplicaciones con un visor de textos y un editor de textos. Las aplicaciones TDE que suministran propiedades de edición deberían utilizar este servicio. +Comment[et]=Tekstiredaktori teenus annab rakendustele komponendi teksti vaatamiseks ja redigeerimiseks. Seda kasutavad kõik TDE rakendused, mis tegelevad teksti redigeerimisega. +Comment[eu]=Testu-editorearen zerbitzuak testu-ikustailea eta editorea duten aplikazioak eskaintzen ditu. Testuak editatzeko aukera ematen duten TDE aplikazioek erabili beharko lukete zerbitzu hau. +Comment[fa]=خدمت ویرایشگر متن، کاربردهایی را توسط یک مشاهدهگر و ویرایشگر متن، فراهم میکند. کاربردهای TDE که امکانات ویرایش متن را فراهم میکنند باید از این \ خدمت استفاده نمایند. +Comment[fi]=Tekstieditoripalvelu tarjoaa sovelluksille tekstinäyttäjän- ja muokkaimen. TDE-sovelluksien, jotka tarjoavat tekstinmuokkauspalveluita, tulisi käyttää tätä palvelua. +Comment[fo]=Tekstritiltænastuni gera forrit út við ein tekstvísari og -ritil. TDE-forrit ið geva nýtarin møguleiki fyri at rætta tekst eiga at nýta hesa tænasta. +Comment[fr]=Le service d'édition de texte fournit des applications comportant un afficheur de texte et un éditeur. Les applications TDE qui fournissent des fonctions d'édition de texte devraient utiliser ce service. +Comment[fy]=De tekstbewurkings-fasiliteit foarsjocht programma's fan een tekstwerjouwer en -ferwurker. TDE-applikaasjes mei tekstferwurkingsmooglikheden kinne hjir gebrûk fan meitsje. +Comment[ga]=Cuirtear amharcán téacs agus eagarthóir ar fáil d'fheidhmchláir trín seirbhís eagarthóireachta téacs. Ba cheart d'fheidhmchláir TDE a sholáthraíonn áiseanna eagarthóireachta an tseirbhís seo a úsáid. +Comment[gl]=O servizo de edición de texto fornece ás aplicacións de visor e editor de textos. Todas as aplicacións de TDE que fornezan facilidades de edición de textos deberan empregar este servizo. +Comment[he]=שירות עורך הטקסט מספק ליישומים מציג ועורך טקסט. יישומי TDE שמספקים אמצעים לעריכת טקסט ישתמשו בשירות זה. +Comment[hi]=पाठ संपादक सेवा जो अनुप्रयोगों को एक पाठ दर्शक व एक संपादक उपलब्घ कराती है। केडीई अनुप्रयोग जो पाठ संपादन सुविधा उपलब्ध कराती हैं, उन्हें इसका प्रयोग करना चाहिए। +Comment[hr]=Usluga tekstualnog uređivača aplikacijama omugućuje pregledavanje i uređivanje teksta. TDE aplikacije koje omogućuju uređivanje teksta trebale bi upotrebljavati ovo sučelje. +Comment[hsb]=Wobdźěłanje teksta staji programam wobdźěłarja a wobhladowarja teksta k dispoziciji. TDE-aplikacije, kiž tajke něšto trjebaja, měli tutón serwis wužiwać. +Comment[hu]=A szövegszerkesztő szolgáltatáson keresztül az alkalmazások szövegek megtekintését és szerkesztését végezhetik el. A TDE szövegszerkesztő programjai használhatják. +Comment[id]=Layanan penyuntingan teks memberikan penampil dan penyunting teks untuk aplikasi. Aplikasi TDE yang menyediakan fasilitas penyuntingan teks seharusnya menggunakan layanan ini. +Comment[is]=Ívafni ritillinn færir forritum texta-skoðara og ritil. TDE forrit sem birta ritil til textavinnslu ættu að nota þessa þjónustu. +Comment[it]=Il servizio di editor di testi fornisce alle applicazioni un visualizzatore ed un editor di testi. Le applicazioni TDE che permettono l'elaborazione di testi dovrebbero usare questo servizio. +Comment[ja]=テキストエディタサービスはアプリケーションにテキストビューアとテキストエディタを提供します。テキスト編集の機能を持つ TDE アプリケーションはこれを使用します。 +Comment[ka]=პროგრამების ტექსტური რედაქტორი ტექსტების საჩვენებლად და დასარედაქტირებლად. იგი გამოიყენება იმ TDE პროგრამების მიერ, რომელთაც ტექსტის რედაქტირება ესაჭიროებათ. +Comment[kk]=Қолданбаларға мәтінді қарау және өңдеу мүмкіншілікті беретін қызмет. Мәтінді өңдеу үшін TDE қолданбалар осы қызметті пайдалану керек. +Comment[km]=សេវាកម្មវិធីនិពន្ធអត្ថបទផ្តល់នូវសំណុំកម្មវិធីរួមមានកម្មវិធីមើលអត្ថបទ និងកម្មវិធីនិពន្ធអត្ថបទ ។ សំណុំកម្មវិធី TDE ដែលផ្តល់មធ្យោបាយនិពន្ធអត្ថបទ គួរប្រើសេវានេះ ។ +Comment[ko]=이 글월 편집기 서비스는 응용 프로그램이 글월을 보거나 고칠 수 있는 기능을 제공합니다. 글월을 고칠 수 있는 TDE 응용 프로그램은 이 서비스를 써야 합니다. +Comment[lb]=Den Texeditor-Service stellt Programmer en Textlieser an en Texteditor zur Verfügung.TDE-Programmer, déi Textmanipuléierungsfunktiounen ubidden, sollen dëse Service benotzen. +Comment[lt]=Teksto redaktoriaus tarnyba pateikia programoms teksto žiūriklį ir redaktorių. TDE programos, leidžiančios redaguoti tekstą, turėtų naudoti šią tarnybą. +Comment[lv]=Teksta redaktora serviss sniedz teksta aplūkošanas un rediģēšanas pakalpojumus programmām. TDE programmām, kurām tas ir nepieciešams, vajadzētu izmantot šo servisu. +Comment[mk]=Сервисот за текст уредувач ги снабдува апликациите со текст прегледник и уредувач. TDE апликациите што овозможуваат уредување текст би требало да го користат овој сервис. +Comment[mn]=Текст засварлагч үйлчилгээ нь текст харах болон засварлах прогрммуудаар хангадаг. TDE программууд энэ үйлчилгээний хэрэглэх хэрэгтэй текст засварлах нэмэлт боломжуудаар хангадаг. +Comment[ms]= Servis penyunting teks yang menyediakan aplikasi dengan pelihat teks dan editor. Aplikasi TDE yang menyediakan kemudahan penyuntingan teks patut menggunakan servis ini. +Comment[mt]=Is-servizz ta' editur ta' test jipprovdi l-programmi b'werrej u editur ta' test. Programmi tal-TDE li jipprovdu servizzi ta' editjar ta' test għandhom jużaw dan is-servizz. +Comment[nb]=Skriveprogrammet gir kan vise og redigere teks. TDE-programmer som kan redigere tekst bør bruke denne tjenesten. +Comment[nds]=De Texteditor-Deenst föögt Programmen en Textwieser un -editor to. TDE-Programmen, mit de Texten bewerkt warrt, schöölt em bruken. +Comment[ne]=पाठ सम्पादक सेवाले पाठ दर्शक र सम्पादकसँग अनुप्रयोग उपलब्ध गराउँछ । TDE अनुप्रयोग जसले पाठ सम्पादक सुविधाहरू उपलब्ध गर्छ त्यसले यो सेवा प्रयोग गर्छ । +Comment[nl]=Dit component stelt programma's een tekstviewer en -editor tot hun beschikking. TDE-toepassingen die te maken hebben met het bewerken van tekst kunnen gebruik maken van deze aangeboden dienst. +Comment[nn]=Skriveprogramtenesta tilbyr vising og redigering av tekst. TDE-program som skal visa eller redigera tekst bør bruka denne tenesta. +Comment[nso]=Tirelo ya phetoso ya sengwalwana e aba ditshumiso le molebeledi lemofetosi wa sengwalwana. Ditshumiso tsa TDE tseo di abago ditirelo tsaphetoso ya sengwalwana di swanetse go somisa tirelo ye. +Comment[pa]=ਪਾਠ ਸੰਪਾਦਕ ਸੇਵਾ ਉਹ ਸਾਰੇ ਕਾਰਜ ਉਪਲੱਬਧ ਕਰਵਾਉਦਾ ਹੈ, ਜੋ ਕਿ ਪਾਠ ਦਰਸ਼ਕ ਤੇ ਸੰਪਾਦਕ ਸ਼ਾਮਿਲ ਹਨ। TDE ਕਾਰਜ ਜੋ ਕਿ ਪਾਠ ਸੰਪਾਦਨ ਦੀ ਸਹੂਲਤ ਉਪਲੱਬਧ ਕਰਵਾਉਦੀਆਂ ਹਨ, ਇਸ ਨੂੰ ਇਸਤੇਮਾਲ ਕਰਦੀਆਂ ਹਨ। +Comment[pl]=Usługa edytora tekstowego pozwala programom na przeglądanie i edycję tekstów. Programy TDE, które udostępniają funkcje edycyjne, powinny używać tej usługi. +Comment[pt]=O serviço de edição de texto oferece às aplicações um visualizador e editor de texto. As aplicações do TDE que oferecem funcionalidade de edição de texto devem usar este serviço. +Comment[pt_BR]=O serviço de edição de texto fornece aplicações com um visualizador e um editor de textos. Aplicações do TDE que fornecem facilidades de edição de texto devem usar este serviço. +Comment[ro]=Serviciul de editare text asigură aplicaţiilor un vizualizor de text şi un editor. Aplicaţiile TDE care oferă capabilităţi de editare de text ar trebui să utilizeze acest serviciu. +Comment[ru]=Сервис текстового редактора для приложений, в которых требуется просмотр и редактирование текста. Его должны использовать приложения TDE, где требуется редактирование текста. +Comment[rw]=Serivise ya muhinduzi y'umwandiko itanga amaporogaramu afite mugaragaza na muhinduzi y'umwandiko. Amaporogaramu TDE atanga uburyo bwo guhindura umwandiko agomba gukoresha iyi serivise. +Comment[se]=Čállinprográmmabálvalus fállá teakstačájeheami ja -doaimmaheaheami. TDE-prográmmat, mat fállet teakstadoaimmahanvejolašvuođaid, galggašedje geavahit dán bálvalusa. +Comment[sk]=Služba textového editora poskytuje aplikáciám prehliadač a editor textových súborov. Aplikácie TDE, ktoré podporujú úpravu textu, by mali používať túto službu. +Comment[sl]=Storitev urejevalnika besedila omogoča programom dostop do pregledovalnika in urejevalnika besedil. Programi za TDE, ki omogočajo urejanje besedila, naj bi uporabljali to storitev. +Comment[sq]=Servisi i tekst editorit i pajis aplikacionet me vështruesin dhe editorin e tekstit. Aplikacionet e TDE-së që na pajisin me shërbime të editimit të tekstit duhet ta përdorin këtë servis. +Comment[sr]= Сервис уређивача текста обезбеђује програмима преглед и измене текстова. TDE програми који обезбеђују могућност обраде текста требало би да користе овај сервис. +Comment[sr@Latn]= Servis uređivača teksta obezbeđuje programima pregled i izmene tekstova. TDE programi koji obezbeđuju mogućnost obrade teksta trebalo bi da koriste ovaj servis. +Comment[ss]=Lusito lwekuhleal umbhalo luniketa ticelo letinesibuki sembhalo kanye nesihleli. Ticelo te KDe letiniketa tinsita tekuhlelwa kwembhalo kufanele tisebentise lolusito. +Comment[sv]=Texteditortjänsten ger program en textvisare och editor. TDE-program som tillhandahåller textredigeringsfunktioner bör använda denna tjänst. +Comment[ta]=உரை மற்றும் தொகுப்பாளருடனான பயன்பாடுகளை உரை தொகுப்பாளர் சேவை வழங்குகிறது. உரை தொகுக்கும் வசதிகளை வழங்கும் கேடிஇ பயன்பாடுகள் இச்சேவையைப் பயன்படுத்த வேண்டும். +Comment[te]=కార్యక్రమాలకు వాచకం సరిచేయు సేవ ఒక వాచకం విక్షణ మరియు సరిచెయుటకు సహాయపడును. కెడిఈ కార్యక్రమాలు వాచకం సరిచెయు సౌకర్యాలు వున్నట్టైతె దిని సేవ ను ఉపయొగించొకొవలెను +Comment[tg]=Хидмати таҳриргари матн барномаҳоро бо намоишгар ва таҳриргари матн таъмин мекунад. Барномаҳои TDE дорои таҳриргари матн бояд ин хидмат истифода барад. +Comment[th]=บริการตัวแก้ไขข้อความ จะจัดเตรียมตัวดูข้อความและตัวแก้ไขข้อความให้กับแอพพลิเคชัน แอพพลิเคชันของ TDE ที่เตรียมความสามารถในการแก้ไขข้อความมาให้ ควรที่จะใช้บริการนี้ +Comment[tt]=Mäten üzgärtü xezmäte törle yazılımnarnı mäten kürsätkeçe/üzgärtkeçe belän tä'min itä. Mäten üzgärtüçe TDE-yazılımnar bu xezmätne qullanırğa tieş. +Comment[uk]=Служба "Текстовий редактор" постачає програми з переглядачем та редактором тексту. Програми TDE, які надають можливість редагування тексту, повинні користуватись цією службою. +Comment[uz]=Matn tarhrirchi xizmati dasturlarni matn koʻruvchi va tahrirchi bilan taʼminlaydi. Matn tahrirlash imkoniyatini yaratuvchi TDE dasturlari shu xizmatni ishlatishi kerak. +Comment[uz@cyrillic]=Матн тарҳрирчи хизмати дастурларни матн кўрувчи ва таҳрирчи билан таъминлайди. Матн таҳрирлаш имкониятини яратувчи TDE дастурлари шу хизматни ишлатиши керак. +Comment[ven]=Tshumelo ya musengulusi wa manwalwa i diswa apulifikhesheni dzirena na vhavhoni vha manwalwa na musengulusi. Apulifikhesheni ya TDE ine ya disa zwishumiswa zwa u sengulusa manwalwa i fanela u shumisa tshumelo ino. +Comment[vi]=Dịch vụ soạn thảo văn bản cung cấp cho ứng dụng một bộ xem và soạn thảo văn bản. Các ứng dụng TDE mà cung cấp khả năng soạn thảo văn bản nên dùng dịch vụ này. +Comment[xh]=Inkonzo yomhleli wombhalo onika izicelo ngombonisi wombhalo nomhleli Izicelo ze TDE ezinikezela ngohlelo lombhalo ekufuneka isebenzise lenkonzo. +Comment[zh_CN]=文本编辑器服务提供了文本查看器和编辑器的应用程序。提供文本编辑功能的 TDE 应用程序都应该使用此服务。 +Comment[zh_HK]=文字編輯服務為各種程式提供一個檢視和編輯文字的介面。任何提供文字編輯功能的 TDE 程式都應該使用這項服務。 +Comment[zh_TW]=文字編輯服務提供程式一個文字檢視器以及編輯器。提供文字編輯功能的 TDE 程式擁該使用這項服務。 +Comment[zu]=Umsebenzi womlungisi wombhalo onikeza imiyaleli ngombukisi wombhalo kanye nomhleli.Abayaleli abanikeza izisebenzi zokulungisa umbhalo okumele zisebenzise lomsebenzi. +ServiceTypeToConfigure=KTextEditor/Document +MimeTypeOfInterest=text/plain +defaultImplementation=katepart +storeInFile=default_components +valueSection=KTextEditor +valueName=embeddedEditor +configurationType=component diff --git a/interfaces/tdetexteditor/markinterface.cpp b/interfaces/tdetexteditor/markinterface.cpp new file mode 100644 index 000000000..024db35c4 --- /dev/null +++ b/interfaces/tdetexteditor/markinterface.cpp @@ -0,0 +1,74 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "markinterface.h" +#include "document.h" + +namespace KTextEditor +{ + +class PrivateMarkInterface +{ + public: + PrivateMarkInterface() {} + ~PrivateMarkInterface() {} +}; + +} + +using namespace KTextEditor; + +unsigned int MarkInterface::globalMarkInterfaceNumber = 0; + +MarkInterface::MarkInterface() +{ + globalMarkInterfaceNumber++; + myMarkInterfaceNumber = globalMarkInterfaceNumber++; + + d = new PrivateMarkInterface(); +} + +MarkInterface::~MarkInterface() +{ + delete d; +} + +unsigned int MarkInterface::markInterfaceNumber () const +{ + return myMarkInterfaceNumber; +} + +void MarkInterface::setMarkInterfaceDCOPSuffix (const TQCString &/*suffix*/) +{ + //d->interface->setObjId ("MarkInterface#"+suffix); +} + +MarkInterface *KTextEditor::markInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::MarkInterface*>(doc); +} + +int MarkInterface::reservedMarkersCount() +{ + return 7; +} diff --git a/interfaces/tdetexteditor/markinterface.h b/interfaces/tdetexteditor/markinterface.h new file mode 100644 index 000000000..64e948572 --- /dev/null +++ b/interfaces/tdetexteditor/markinterface.h @@ -0,0 +1,171 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann ([email protected]) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 __tdetexteditor_markinterface_h__ +#define __tdetexteditor_markinterface_h__ + +#include <tqptrlist.h> + +#include <tdelibs_export.h> + +class TQCString; + +namespace KTextEditor +{ + +class Mark +{ + public: + uint line; + uint type; +}; + +/** +* This is an interface to enable marks to be made in the iconborder of the Document class. +*/ +class KTEXTEDITOR_EXPORT MarkInterface +{ + friend class PrivateMarkInterface; + + public: + MarkInterface (); + virtual ~MarkInterface (); + + unsigned int markInterfaceNumber () const; + + protected: + void setMarkInterfaceDCOPSuffix (const TQCString &suffix); + + // + // slots !!! + // + public: + /** + * @return a uint representing the marks set in @p line OR'ed togeather. + */ + virtual uint mark (uint line) = 0; + + /** + * Adds a mark of type @p markType to @p line. + * Has no effect if the line allready contains a mark of that type. + */ + virtual void setMark (uint line, uint markType) = 0; + /** + * Clears all marks set in @p line. + */ + virtual void clearMark (uint line) = 0; + + virtual void addMark (uint line, uint markType) = 0; + /** + * Removes any mark of type @p markType from @p line. + */ + virtual void removeMark (uint line, uint markType) = 0; + + /** + * @return a list of all marks in the document + */ + virtual TQPtrList<KTextEditor::Mark> marks () = 0; + /** + * Clears all marks in the document. + */ + virtual void clearMarks () = 0; + + /** + * get the number of predefined marker types we have so far. + * @note If you change this you have to make sure katepart supports the new size! + * @return number of reserved marker types + * @since 3.3 + */ + static int reservedMarkersCount(); + + /** + * Pre-defined mark types. + * + * To create a non-standard mark type, use MarkInterfaceExtension. + * To add a new standard mark type, edit this interface to document the type. + */ + enum MarkTypes + { + /** Bookmark */ + markType01= 0x1, + /** Breakpoint active */ + markType02= 0x2, + /** Breakpoint reached */ + markType03= 0x4, + /** Breakpoint disabled */ + markType04= 0x8, + /** Execution mark */ + markType05= 0x10, + /** Warning */ + markType06= 0x20, + /** Error */ + markType07= 0x40, + + markType08= 0x80, + markType09= 0x100, + markType10= 0x200, + markType11= 0x400, + markType12= 0x800, + markType13= 0x1000, + markType14= 0x2000, + markType15= 0x4000, + markType16= 0x8000, + markType17= 0x10000, + markType18= 0x20000, + markType19= 0x40000, + markType20= 0x80000, + markType21= 0x100000, + markType22= 0x200000, + markType23= 0x400000, + markType24= 0x800000, + markType25= 0x1000000, + markType26= 0x2000000, + markType27= 0x4000000, + markType28= 0x8000000, + markType29= 0x10000000, + markType30= 0x20000000, + markType31= 0x40000000, + markType32= 0x80000000, + /* reserved marks */ + Bookmark = markType01, + BreakpointActive = markType02, + BreakpointReached = markType03, + BreakpointDisabled = markType04, + Execution = markType05, + Warning = markType06, + Error = markType07 + }; + + // + // signals !!! + // + public: + virtual void marksChanged () = 0; + + private: + class PrivateMarkInterface *d; + static unsigned int globalMarkInterfaceNumber; + unsigned int myMarkInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT MarkInterface *markInterface (class Document *doc); + +} + +#endif diff --git a/interfaces/tdetexteditor/markinterfaceextension.cpp b/interfaces/tdetexteditor/markinterfaceextension.cpp new file mode 100644 index 000000000..86538abfc --- /dev/null +++ b/interfaces/tdetexteditor/markinterfaceextension.cpp @@ -0,0 +1,69 @@ +/* This file is part of the KDE libraries + Copyright (C) 2002 Joseph Wenninger <[email protected]> + + 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. +*/ + +// $Id$ + +#include "markinterfaceextension.h" +#include "document.h" + +namespace KTextEditor +{ + +class PrivateMarkInterfaceExtension +{ + public: + PrivateMarkInterfaceExtension() {} + ~PrivateMarkInterfaceExtension() {} +}; + +} + +using namespace KTextEditor; + +unsigned int MarkInterfaceExtension::globalMarkInterfaceExtensionNumber = 0; + +MarkInterfaceExtension::MarkInterfaceExtension() +{ + globalMarkInterfaceExtensionNumber++; + myMarkInterfaceExtensionNumber = globalMarkInterfaceExtensionNumber++; + + d = new PrivateMarkInterfaceExtension(); +} + +MarkInterfaceExtension::~MarkInterfaceExtension() +{ + delete d; +} + +unsigned int MarkInterfaceExtension::markInterfaceExtensionNumber () const +{ + return myMarkInterfaceExtensionNumber; +} + +void MarkInterfaceExtension::setMarkInterfaceExtensionDCOPSuffix (const TQCString &/*suffix*/) +{ + //d->interface->setObjId ("MarkInterfaceExtension#"+suffix); +} + +MarkInterfaceExtension *KTextEditor::markInterfaceExtension (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::MarkInterfaceExtension*>(doc); +} diff --git a/interfaces/tdetexteditor/markinterfaceextension.h b/interfaces/tdetexteditor/markinterfaceextension.h new file mode 100644 index 000000000..7aef736db --- /dev/null +++ b/interfaces/tdetexteditor/markinterfaceextension.h @@ -0,0 +1,83 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Joseph Wenninger <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 __tdetexteditor_markinterface_extension_h__ +#define __tdetexteditor_markinterface_extension_h__ + +#include <tqptrlist.h> +#include <tqpixmap.h> +#include <tqstring.h> +#include "markinterface.h" + +class TQCString; + +namespace KTextEditor +{ + + +/** +* This is an interface for custom extensions of the MarkInterface. +* It allows the developer to set pixmaps for custom marks and to indicate which +* marks are settable by the user, for example (in kate), as actions in the iconborder's popup menu. +*/ +class KTEXTEDITOR_EXPORT MarkInterfaceExtension +{ + friend class PrivateMarkInterfaceExtension; + + public: + MarkInterfaceExtension (); + virtual ~MarkInterfaceExtension (); + + unsigned int markInterfaceExtensionNumber () const; + + protected: + void setMarkInterfaceExtensionDCOPSuffix (const TQCString &suffix); + + public: + virtual void setPixmap(MarkInterface::MarkTypes, const TQPixmap &)=0; + virtual void setDescription(MarkInterface::MarkTypes, const TQString &)=0; + virtual void setMarksUserChangable(uint markMask)=0; + + enum MarkChangeAction { + MarkAdded=0, + MarkRemoved=1 + }; + // + // slots !!! + // + public: + + // + // signals !!! + // + public: + virtual void markChanged (KTextEditor::Mark mark, + KTextEditor::MarkInterfaceExtension::MarkChangeAction action) = 0; + + private: + class PrivateMarkInterfaceExtension *d; + static unsigned int globalMarkInterfaceExtensionNumber; + unsigned int myMarkInterfaceExtensionNumber; +}; + +KTEXTEDITOR_EXPORT MarkInterfaceExtension *markInterfaceExtension (class Document *doc); + +} + +#endif diff --git a/interfaces/tdetexteditor/plugin.h b/interfaces/tdetexteditor/plugin.h new file mode 100644 index 000000000..68416bf78 --- /dev/null +++ b/interfaces/tdetexteditor/plugin.h @@ -0,0 +1,88 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_plugin_h__ +#define __tdetexteditor_plugin_h__ + +#include <tqobject.h> + +#include <tdelibs_export.h> + +namespace KTextEditor +{ + +class Document; +class View; + +/** + * Basic KTextEditor plugin class. + * This plugin will be bound to a Document. + */ +class KTEXTEDITOR_EXPORT Plugin : public TQObject +{ + friend class PrivatePlugin; + + Q_OBJECT + + public: + Plugin ( Document *document = 0, const char *name = 0 ); + virtual ~Plugin (); + + unsigned int pluginNumber () const; + + Document *document () const; + + private: + class PrivatePlugin *d; + static unsigned int globalPluginNumber; + unsigned int myPluginNumber; +}; + +KTEXTEDITOR_EXPORT Plugin *createPlugin ( const char* libname, Document *document = 0, const char *name = 0 ); + +/** + * View plugin class. + * This plugin will be bound to a View + */ +class KTEXTEDITOR_EXPORT PluginViewInterface +{ + friend class PrivatePluginViewInterface; + + public: + PluginViewInterface (); + virtual ~PluginViewInterface (); + + unsigned int pluginViewInterfaceNumber () const; + + /* + * will be called from the part to bound the plugin to a view + */ + virtual void addView (View *) = 0; + virtual void removeView (View *) = 0; + + private: + class PrivatePluginViewInterface *d; + static unsigned int globalPluginViewInterfaceNumber; + unsigned int myPluginViewInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT PluginViewInterface *pluginViewInterface (Plugin *plugin); + +} + +#endif diff --git a/interfaces/tdetexteditor/popupmenuinterface.cpp b/interfaces/tdetexteditor/popupmenuinterface.cpp new file mode 100644 index 000000000..350fa138b --- /dev/null +++ b/interfaces/tdetexteditor/popupmenuinterface.cpp @@ -0,0 +1,69 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "popupmenuinterface.h" +#include "view.h" + +namespace KTextEditor +{ + +class PrivatePopupMenuInterface +{ + public: + PrivatePopupMenuInterface() {} + ~PrivatePopupMenuInterface() {} +}; + +} + +using namespace KTextEditor; + +unsigned int PopupMenuInterface::globalPopupMenuInterfaceNumber = 0; + +PopupMenuInterface::PopupMenuInterface() +{ + globalPopupMenuInterfaceNumber++; + myPopupMenuInterfaceNumber = globalPopupMenuInterfaceNumber++; + + d = new PrivatePopupMenuInterface(); +} + +PopupMenuInterface::~PopupMenuInterface() +{ + delete d; +} + +unsigned int PopupMenuInterface::popupMenuInterfaceNumber () const +{ + return myPopupMenuInterfaceNumber; +} + +void PopupMenuInterface::setPopupMenuInterfaceDCOPSuffix (const TQCString &/*suffix*/) +{ + //d->interface->setObjId ("PopupMenuInterface#"+suffix); +} + +PopupMenuInterface *KTextEditor::popupMenuInterface (View *view) +{ + if (!view) + return 0; + + return dynamic_cast<KTextEditor::PopupMenuInterface*>(view); +} diff --git a/interfaces/tdetexteditor/popupmenuinterface.h b/interfaces/tdetexteditor/popupmenuinterface.h new file mode 100644 index 000000000..3ca833709 --- /dev/null +++ b/interfaces/tdetexteditor/popupmenuinterface.h @@ -0,0 +1,66 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_popupmenuinterface_h__ +#define __tdetexteditor_popupmenuinterface_h__ + +#include <tdelibs_export.h> + +class TQCString; +class TQPopupMenu; + +namespace KTextEditor +{ + +/** +* This is an interface to provide custom popup menus for a View. +*/ +class KTEXTEDITOR_EXPORT PopupMenuInterface +{ + friend class PrivatePopupMenuInterface; + + public: + PopupMenuInterface (); + virtual ~PopupMenuInterface (); + + unsigned int popupMenuInterfaceNumber () const; + + protected: + void setPopupMenuInterfaceDCOPSuffix (const TQCString &suffix); + + // + // normal methodes + // + public: + /** + Install a Popup Menu. The Popup Menu will be activated on + a right mouse button press event. + */ + virtual void installPopup (TQPopupMenu *rmb_Menu) = 0; + + private: + class PrivatePopupMenuInterface *d; + static unsigned int globalPopupMenuInterfaceNumber; + unsigned int myPopupMenuInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT PopupMenuInterface *popupMenuInterface (class View *view); + +} + +#endif diff --git a/interfaces/tdetexteditor/printdcopinterface.cpp b/interfaces/tdetexteditor/printdcopinterface.cpp new file mode 100644 index 000000000..3b9eddfe9 --- /dev/null +++ b/interfaces/tdetexteditor/printdcopinterface.cpp @@ -0,0 +1,30 @@ +#include "printdcopinterface.h" +#include "printinterface.h" + +#include <dcopclient.h> +using namespace KTextEditor; + +PrintDCOPInterface::PrintDCOPInterface( PrintInterface *Parent, const char *name) + : DCOPObject(name) +{ + m_parent = Parent; +} + +PrintDCOPInterface::~PrintDCOPInterface() +{ + +} + +uint PrintDCOPInterface::printInterfaceNumber () +{ + return m_parent->printInterfaceNumber(); +} +bool PrintDCOPInterface::printDialog () +{ + return m_parent->printDialog(); +} +bool PrintDCOPInterface::print () +{ + return m_parent->print(); +} + diff --git a/interfaces/tdetexteditor/printdcopinterface.h b/interfaces/tdetexteditor/printdcopinterface.h new file mode 100644 index 000000000..e41e6da5d --- /dev/null +++ b/interfaces/tdetexteditor/printdcopinterface.h @@ -0,0 +1,46 @@ +#ifndef Print_DCOP_INTERFACE_H +#define Print_DCOP_INTERFACE_H + +#include <dcopobject.h> +#include <dcopref.h> +#include <tqstringlist.h> +#include <tqcstring.h> +//#include "editdcopinterface.moc" +namespace KTextEditor +{ + class PrintInterface; + /** + This is the main interface to the PrintInterface of KTextEdit. + This will provide a consistant dcop interface to all KDE applications that use it. + @short DCOP interface to PrintInterface. + @author Ian Reinhart Geiser <[email protected]> + */ + class KTEXTEDITOR_EXPORT PrintDCOPInterface : virtual public DCOPObject + { + K_DCOP + + public: + /** + Construct a new interface object for the text editor. + @param Parent the parent PrintInterface object + that will provide us with the functions for the interface. + @param name the QObject's name + */ + PrintDCOPInterface( PrintInterface *Parent, const char *name ); + /** + Destructor + Cleans up the object. + */ + virtual ~PrintDCOPInterface(); + k_dcop: + uint printInterfaceNumber () ; + bool printDialog (); + bool print (); + + private: + PrintInterface *m_parent; + }; +} +#endif + + diff --git a/interfaces/tdetexteditor/printinterface.cpp b/interfaces/tdetexteditor/printinterface.cpp new file mode 100644 index 000000000..5a4011eb4 --- /dev/null +++ b/interfaces/tdetexteditor/printinterface.cpp @@ -0,0 +1,74 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "printinterface.h" +#include "printdcopinterface.h" +#include "document.h" + +namespace KTextEditor +{ + +class PrivatePrintInterface +{ + public: + PrivatePrintInterface() {interface=0;} + ~PrivatePrintInterface() {} + PrintDCOPInterface *interface; +}; + +} + +using namespace KTextEditor; + +unsigned int PrintInterface::globalPrintInterfaceNumber = 0; + +PrintInterface::PrintInterface() +{ + globalPrintInterfaceNumber++; + myPrintInterfaceNumber = globalPrintInterfaceNumber++; + + d = new PrivatePrintInterface(); + TQString name = "PrintInterface#" + TQString::number(myPrintInterfaceNumber); + d->interface = new PrintDCOPInterface(this, name.latin1()); +} + +PrintInterface::~PrintInterface() +{ + delete d->interface; + delete d; +} + +unsigned int PrintInterface::printInterfaceNumber () const +{ + return myPrintInterfaceNumber; +} + +void PrintInterface::setPrintInterfaceDCOPSuffix (const TQCString &suffix) +{ + d->interface->setObjId ("PrintInterface#"+suffix); +} + +PrintInterface *KTextEditor::printInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::PrintInterface*>(doc); +} diff --git a/interfaces/tdetexteditor/printinterface.h b/interfaces/tdetexteditor/printinterface.h new file mode 100644 index 000000000..cca453d6c --- /dev/null +++ b/interfaces/tdetexteditor/printinterface.h @@ -0,0 +1,63 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann ([email protected]) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 __tdetexteditor_printinterface_h__ +#define __tdetexteditor_printinterface_h__ + +#include <tdelibs_export.h> + +class TQCString; + +namespace KTextEditor +{ + +/** +* This is an interface to printing functions of a Document. +*/ +class KTEXTEDITOR_EXPORT PrintInterface +{ + friend class PrivatePrintInterface; + + public: + PrintInterface (); + virtual ~PrintInterface (); + + unsigned int printInterfaceNumber () const; + + protected: + void setPrintInterfaceDCOPSuffix (const TQCString &suffix); + + // + // slots !!! + // + public: + virtual bool printDialog () = 0; + virtual bool print () = 0; + + private: + class PrivatePrintInterface *d; + static unsigned int globalPrintInterfaceNumber; + unsigned int myPrintInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT PrintInterface *printInterface (class Document *doc); + +} + +#endif diff --git a/interfaces/tdetexteditor/searchdcopinterface.cpp b/interfaces/tdetexteditor/searchdcopinterface.cpp new file mode 100644 index 000000000..ce29e4927 --- /dev/null +++ b/interfaces/tdetexteditor/searchdcopinterface.cpp @@ -0,0 +1,95 @@ +#include "searchdcopinterface.h" +#include "searchinterface.h" + +#include <dcopclient.h> +#include <tqregexp.h> + +using namespace KTextEditor; + +SearchDCOPInterface::SearchDCOPInterface( SearchInterface *Parent, const char *name) + : DCOPObject(name) +{ + m_parent = Parent; + m_currentcol = 0; + m_currentrow = 0; + m_currentmatchlen = 0; +} + +SearchDCOPInterface::~SearchDCOPInterface() +{ + +} + +bool SearchDCOPInterface::findFirstString( TQString text, bool caseSensitive) +{ + return m_parent->searchText(0, 0, text, &m_currentrow, &m_currentcol, &m_currentmatchlen, caseSensitive); +} +bool SearchDCOPInterface::findNextString( TQString text, bool caseSensitive) +{ + return m_parent->searchText(m_currentrow, m_currentcol+1, text, &m_currentrow, &m_currentcol, &m_currentmatchlen, caseSensitive); +} + +bool SearchDCOPInterface::findPreviousString( TQString text, bool caseSensitive) +{ + if( m_currentcol == 0) + m_currentrow--; + else + m_currentcol--; + return m_parent->searchText(m_currentrow, m_currentcol, text, &m_currentrow, &m_currentcol, &m_currentmatchlen, caseSensitive, true); +} + +bool SearchDCOPInterface::findLastString( TQString text, bool caseSensitive) +{ + return m_parent->searchText(0,0, text, &m_currentrow, &m_currentcol, &m_currentmatchlen, caseSensitive, true); +} + +bool SearchDCOPInterface::findStringAt( uint row, uint col, TQString text, bool caseSensitive) +{ + return m_parent->searchText(row,col, text, &m_currentrow, &m_currentcol, &m_currentmatchlen, caseSensitive); + +} + +bool SearchDCOPInterface::findFirstRegExp( TQString regexp) +{ + return m_parent->searchText( 0,0, TQRegExp(regexp), &m_currentrow, &m_currentcol, &m_currentmatchlen); +} + +bool SearchDCOPInterface::findNextRegExp( TQString regexp) +{ + return m_parent->searchText( m_currentrow, m_currentcol+1, TQRegExp(regexp), &m_currentrow, &m_currentcol, &m_currentmatchlen); +} + +bool SearchDCOPInterface::findPreviousRegExp( TQString regexp) +{ + if( m_currentcol == 0) + m_currentrow--; + else + m_currentcol--; + return m_parent->searchText( m_currentrow, m_currentcol, TQRegExp(regexp), &m_currentrow, &m_currentcol, &m_currentmatchlen, true); + +} + +bool SearchDCOPInterface::findLastRegExp(TQString regexp) +{ + return m_parent->searchText( 0,0, TQRegExp(regexp), &m_currentrow, &m_currentcol, &m_currentmatchlen, true); +} + +bool SearchDCOPInterface::findRegExpAt( uint row, uint col, TQString regexp) +{ + return m_parent->searchText( row, col, TQRegExp(regexp), &m_currentrow, &m_currentcol, &m_currentmatchlen, false); +} + +uint SearchDCOPInterface::currentMatchLine() +{ + return m_currentrow; +} +uint SearchDCOPInterface::currentMatchCol() +{ + return m_currentcol; +} +uint SearchDCOPInterface::currentMatchLength() +{ + return m_currentmatchlen; +} + + diff --git a/interfaces/tdetexteditor/searchdcopinterface.h b/interfaces/tdetexteditor/searchdcopinterface.h new file mode 100644 index 000000000..d4f558a26 --- /dev/null +++ b/interfaces/tdetexteditor/searchdcopinterface.h @@ -0,0 +1,59 @@ +#ifndef SEARCH_DCOP_INTERFACE_H +#define SEARCH_DCOP_INTERFACE_H + +#include <dcopobject.h> +#include <dcopref.h> +#include <tqstringlist.h> +#include <tqcstring.h> + +namespace KTextEditor +{ + class SearchInterface; + /** + This is the main interface to the SearchInterface of KTextEdit. + This will provide a consistant dcop interface to all KDE applications that use it. + @short DCOP interface to SearchInterface. + @author Ian Reinhart Geiser <[email protected]> + */ + class KTEXTEDITOR_EXPORT SearchDCOPInterface : virtual public DCOPObject + { + K_DCOP + + public: + /** + Construct a new interface object for the text editor. + @param Parent the parent SearchInterface object + that will provide us with the functions for the interface. + @param name the QObject's name + */ + SearchDCOPInterface( SearchInterface *Parent, const char *name ); + /** + Destructor + Cleans up the object. + **/ + virtual ~SearchDCOPInterface(); + k_dcop: + bool findFirstString(TQString text, bool caseSensitive); + bool findNextString(TQString text, bool caseSensitive); + bool findPreviousString( TQString text, bool caseSensitive); + bool findLastString(TQString text, bool caseSensitive); + bool findStringAt( uint row, uint col, TQString text, bool caseSensitive); + + bool findFirstRegExp( TQString regexp); + bool findNextRegExp( TQString regexp); + bool findPreviousRegExp( TQString regexp); + bool findLastRegExp( TQString regexp); + bool findRegExpAt( uint row, uint col, TQString regexp); + + uint currentMatchLine(); + uint currentMatchCol(); + uint currentMatchLength(); + + private: + SearchInterface *m_parent; + uint m_currentcol; + uint m_currentrow; + uint m_currentmatchlen; + }; +} +#endif diff --git a/interfaces/tdetexteditor/searchinterface.cpp b/interfaces/tdetexteditor/searchinterface.cpp new file mode 100644 index 000000000..6ea021e0d --- /dev/null +++ b/interfaces/tdetexteditor/searchinterface.cpp @@ -0,0 +1,55 @@ +#include "searchinterface.h" +#include "searchdcopinterface.h" +#include "document.h" + +using namespace KTextEditor; + +namespace KTextEditor +{ + class PrivateSearchInterface + { + public: + PrivateSearchInterface() + { + interface = 0; + } + ~PrivateSearchInterface(){} + // Data Members + SearchDCOPInterface *interface; + }; + +} + +unsigned int SearchInterface::globalSearchInterfaceNumber = 0; + +SearchInterface::SearchInterface() +{ + d = new PrivateSearchInterface(); + globalSearchInterfaceNumber++; + mySearchInterfaceNumber=globalSearchInterfaceNumber; + TQString name = "SearchInterface#" + TQString::number(mySearchInterfaceNumber); + d->interface = new SearchDCOPInterface(this, name.latin1()); +} +SearchInterface::~SearchInterface() +{ + delete d->interface; + delete d; +} + +unsigned int SearchInterface::searchInterfaceNumber () const +{ + return mySearchInterfaceNumber; +} + +void SearchInterface::setSearchInterfaceDCOPSuffix (const TQCString &suffix) +{ + d->interface->setObjId ("SearchInterface#"+suffix); +} + +SearchInterface *KTextEditor::searchInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::SearchInterface*>(doc); +} diff --git a/interfaces/tdetexteditor/searchinterface.h b/interfaces/tdetexteditor/searchinterface.h new file mode 100644 index 000000000..f16c76dd1 --- /dev/null +++ b/interfaces/tdetexteditor/searchinterface.h @@ -0,0 +1,65 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann ([email protected]) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 __tdetexteditor_searchinterface_h__ +#define __tdetexteditor_searchinterface_h__ + +#include <tdelibs_export.h> + +class TQRegExp; +class TQString; +class TQCString; + +namespace KTextEditor +{ + +/** +* This is an interface to allow searching of a Document. +*/ +class KTEXTEDITOR_EXPORT SearchInterface +{ + friend class PrivateSearchInterface; + + public: + SearchInterface(); + virtual ~SearchInterface(); + + unsigned int searchInterfaceNumber () const; + + protected: + void setSearchInterfaceDCOPSuffix (const TQCString &suffix); + + // + // slots !!! + // + public: + virtual bool searchText (unsigned int startLine, unsigned int startCol, const TQString &text, unsigned int *foundAtLine, unsigned int *foundAtCol, unsigned int *matchLen, bool casesensitive = true, bool backwards = false) = 0; + virtual bool searchText (unsigned int startLine, unsigned int startCol, const TQRegExp ®exp, unsigned int *foundAtLine, unsigned int *foundAtCol, unsigned int *matchLen, bool backwards = false) = 0; + + private: + class PrivateSearchInterface *d; + static unsigned int globalSearchInterfaceNumber; + unsigned int mySearchInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT SearchInterface *searchInterface (class Document *doc); + +} + +#endif diff --git a/interfaces/tdetexteditor/selectiondcopinterface.cpp b/interfaces/tdetexteditor/selectiondcopinterface.cpp new file mode 100644 index 000000000..f341297e0 --- /dev/null +++ b/interfaces/tdetexteditor/selectiondcopinterface.cpp @@ -0,0 +1,64 @@ +#include "selectiondcopinterface.h" +#include "selectioninterface.h" + +#include <dcopclient.h> +using namespace KTextEditor; + +SelectionDCOPInterface::SelectionDCOPInterface( SelectionInterface *Parent, const char *name) + : DCOPObject(name) +{ + m_parent = Parent; +} + +SelectionDCOPInterface::~SelectionDCOPInterface() +{ + +} + + /** + * @return set the selection from line_start,col_start to line_end,col_end + */ + bool SelectionDCOPInterface::setSelection ( uint startLine, uint startCol, uint endLine, uint endCol ) + { + return m_parent->setSelection ( startLine, startCol, endLine, endCol ); + } + + /** + * removes the current Selection (not Text) + */ + bool SelectionDCOPInterface::clearSelection () + { + return m_parent->clearSelection(); + } + + /** + * @return true if there is a selection + */ + bool SelectionDCOPInterface::hasSelection () + { + return m_parent->hasSelection(); + } + + /** + * @return a TQString for the selected text + */ + TQString SelectionDCOPInterface::selection () + { + return m_parent->selection(); + } + + /** + * removes the selected Text + */ + bool SelectionDCOPInterface::removeSelectedText () + { + return m_parent->removeSelectedText(); + } + + /** + * select the whole text + */ + bool SelectionDCOPInterface::selectAll () + { + return m_parent->selectAll(); + } diff --git a/interfaces/tdetexteditor/selectiondcopinterface.h b/interfaces/tdetexteditor/selectiondcopinterface.h new file mode 100644 index 000000000..aa2973540 --- /dev/null +++ b/interfaces/tdetexteditor/selectiondcopinterface.h @@ -0,0 +1,72 @@ +#ifndef SELECTION_DCOP_INTERFACE_H +#define SELECTION_DCOP_INTERFACE_H + +#include <dcopobject.h> +#include <dcopref.h> +#include <tqstringlist.h> +#include <tqcstring.h> + +namespace KTextEditor +{ + class SelectionInterface; + /** + This is the main interface to the SelectionInterface of KTextEdit. + This will provide a consistant dcop interface to all KDE applications that use it. + @short DCOP interface to SelectionInterface. + @author Ian Reinhart Geiser <[email protected]> + */ + class KTEXTEDITOR_EXPORT SelectionDCOPInterface : virtual public DCOPObject + { + K_DCOP + + public: + /** + Construct a new interface object for the text editor. + @param Parent the parent SelectionInterface object + that will provide us with the functions for the interface. + @param name the QObject's name + */ + SelectionDCOPInterface( SelectionInterface *Parent, const char *name ); + /** + Destructor + Cleans up the object. + **/ + virtual ~SelectionDCOPInterface(); + k_dcop: + /** + * @return set the selection from line_start,col_start to line_end,col_end + */ + bool setSelection ( uint startLine, uint startCol, uint endLine, uint endCol ); + + /** + * removes the current Selection (not Text) + */ + bool clearSelection (); + + /** + * @return true if there is a selection + */ + bool hasSelection (); + + /** + * @return a TQString for the selected text + */ + TQString selection (); + + /** + * removes the selected Text + */ + bool removeSelectedText (); + + /** + * select the whole text + */ + bool selectAll (); + + private: + SelectionInterface *m_parent; + }; +} +#endif + + diff --git a/interfaces/tdetexteditor/selectionextdcopinterface.h b/interfaces/tdetexteditor/selectionextdcopinterface.h new file mode 100644 index 000000000..5c3e32baf --- /dev/null +++ b/interfaces/tdetexteditor/selectionextdcopinterface.h @@ -0,0 +1,57 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Anders Lund <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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. + + $Id$ +*/ + +#ifndef _SELECTION_EXT_DCOP_INTERFACE_H_ +#define _SELECTION_EXT_DCOP_INTERFACE_H_ + +#include "selectioninterfaceext.h" + +#include <tqstring.h> +#include <dcopobject.h> +#include <dcopref.h> + +namespace KTextEditor { +/** + DCOP interface for the SelectionInterfaceExt. + @author Anders Lund <[email protected]> +*/ +class KTEXTEDITOR_EXPORT SelectionExtDCOPInterface : virtual public DCOPObject +{ + K_DCOP + public: + SelectionExtDCOPInterface( SelectionInterfaceExt *parent, const char *name ); + virtual ~SelectionExtDCOPInterface(); + k_dcop: + /** The selection start line number */ + int selStartLine(); + /** The selection start col */ + int selStartCol(); + /** The selection end line */ + int selEndLine(); + /** The selection end col */ + int selEndCol(); + private: + SelectionInterfaceExt *m_parent; +}; + +} // namespace KTextEditor + +#endif // _SELECTION_EXT_DCOP_INTERFACE_H_ diff --git a/interfaces/tdetexteditor/selectioninterface.cpp b/interfaces/tdetexteditor/selectioninterface.cpp new file mode 100644 index 000000000..0a8dc6b00 --- /dev/null +++ b/interfaces/tdetexteditor/selectioninterface.cpp @@ -0,0 +1,65 @@ +#include "selectioninterface.h" +#include "selectiondcopinterface.h" +#include "document.h" +#include "view.h" + +using namespace KTextEditor; + +namespace KTextEditor +{ + class PrivateSelectionInterface + { + public: + PrivateSelectionInterface() + { + interface = 0; + } + ~PrivateSelectionInterface(){} + // Data Members + SelectionDCOPInterface *interface; + }; + +} + +unsigned int SelectionInterface::globalSelectionInterfaceNumber = 0; + +SelectionInterface::SelectionInterface() +{ + d = new PrivateSelectionInterface(); + globalSelectionInterfaceNumber++; + mySelectionInterfaceNumber = globalSelectionInterfaceNumber; + TQString name = "SelectionInterface#" + TQString::number(mySelectionInterfaceNumber); + d->interface = new SelectionDCOPInterface(this, name.latin1()); +} +SelectionInterface::~SelectionInterface() +{ + delete d->interface; + delete d; +} + +unsigned int SelectionInterface::selectionInterfaceNumber () const +{ + return mySelectionInterfaceNumber; +} + +void SelectionInterface::setSelectionInterfaceDCOPSuffix (const TQCString &suffix) +{ + d->interface->setObjId ("SelectionInterface#"+suffix); +} + +SelectionInterface *KTextEditor::selectionInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::SelectionInterface*>(doc); +} + +SelectionInterface *KTextEditor::selectionInterface (View *view) +{ + if (!view) + return 0; + + return dynamic_cast<KTextEditor::SelectionInterface*>(view); +} + diff --git a/interfaces/tdetexteditor/selectioninterface.h b/interfaces/tdetexteditor/selectioninterface.h new file mode 100644 index 000000000..03f50de33 --- /dev/null +++ b/interfaces/tdetexteditor/selectioninterface.h @@ -0,0 +1,100 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann ([email protected]) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 __tdetexteditor_selectioninterface_h__ +#define __tdetexteditor_selectioninterface_h__ + +#include <tqstring.h> + +#include <tdelibs_export.h> + +namespace KTextEditor +{ + +/** +* This is an interface to text selection for the Document class. +*/ +class KTEXTEDITOR_EXPORT SelectionInterface +{ + friend class PrivateSelectionInterface; + + public: + SelectionInterface(); + virtual ~SelectionInterface(); + + unsigned int selectionInterfaceNumber () const; + + protected: + void setSelectionInterfaceDCOPSuffix (const TQCString &suffix); + + /* + * slots !!! + */ + public: + /** + * @return set the selection from line_start,col_start to line_end,col_end + */ + virtual bool setSelection ( unsigned int startLine, unsigned int startCol, unsigned int endLine, unsigned int endCol ) = 0; + + /** + * removes the current Selection (not Text) + */ + virtual bool clearSelection () = 0; + + /** + * @return true if there is a selection + */ + virtual bool hasSelection () const = 0; + + /** + * @return a TQString for the selected text + */ + virtual TQString selection () const = 0; + + /** + * removes the selected Text + */ + virtual bool removeSelectedText () = 0; + + /** + * select the whole text + */ + virtual bool selectAll () = 0; + + // + // signals !!! + // + public: + virtual void selectionChanged () = 0; + + private: + class PrivateSelectionInterface *d; + static unsigned int globalSelectionInterfaceNumber; + unsigned int mySelectionInterfaceNumber; +}; + +class Document; +class View; + +KTEXTEDITOR_EXPORT SelectionInterface *selectionInterface (Document *doc); +KTEXTEDITOR_EXPORT SelectionInterface *selectionInterface (View *view); + +} + +#endif diff --git a/interfaces/tdetexteditor/selectioninterfaceext.cpp b/interfaces/tdetexteditor/selectioninterfaceext.cpp new file mode 100644 index 000000000..3034f33a5 --- /dev/null +++ b/interfaces/tdetexteditor/selectioninterfaceext.cpp @@ -0,0 +1,115 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Anders Lund <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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. + + $Id$ +*/ + +#include "selectioninterfaceext.h" +#include "selectionextdcopinterface.h" +#include "document.h" +#include "view.h" +#include <dcopclient.h> + +using namespace KTextEditor; + +//BEGIN KTextEditor::SelectionInterfaceExt +class KTextEditor::PrivateSelectionInterfaceExt { + public: + PrivateSelectionInterfaceExt() : interface( 0 ) {} + ~PrivateSelectionInterfaceExt() {} + + SelectionExtDCOPInterface *interface; +}; + +unsigned int SelectionInterfaceExt::globalSelectionInterfaceExtNumber = 0; + +SelectionInterfaceExt::SelectionInterfaceExt() + : d ( new PrivateSelectionInterfaceExt ) +{ + globalSelectionInterfaceExtNumber++; + mySelectionInterfaceExtNumber = globalSelectionInterfaceExtNumber; + TQString name = "SelectionInterfaceExt#" + TQString::number(mySelectionInterfaceExtNumber); + d->interface = new SelectionExtDCOPInterface(this, name.latin1()); +} + +SelectionInterfaceExt::~SelectionInterfaceExt() +{ + delete d->interface; + delete d; +} + +unsigned int SelectionInterfaceExt::selectionInterfaceExtNumber () const +{ + return mySelectionInterfaceExtNumber; +} + +void SelectionInterfaceExt::setSelectionInterfaceExtDCOPSuffix (const TQCString &suffix) +{ + d->interface->setObjId ("SelectionInterfaceExt#"+suffix); +} + +SelectionInterfaceExt *KTextEditor::selectionInterfaceExt (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::SelectionInterfaceExt*>(doc); +} + +SelectionInterfaceExt *KTextEditor::selectionInterfaceExt (View *view) +{ + if (!view) + return 0; + + return dynamic_cast<KTextEditor::SelectionInterfaceExt*>(view); +} + +//END KTextEditor::SelectionInterfaceExt + +//BEGIN KTextEditor::SelectionExtDCOPInterface +SelectionExtDCOPInterface::SelectionExtDCOPInterface( + SelectionInterfaceExt *parent, const char* name ) + : DCOPObject( name ), + m_parent( parent ) +{ +} + +SelectionExtDCOPInterface::~SelectionExtDCOPInterface() +{ +} + +int SelectionExtDCOPInterface::selStartLine() +{ + return m_parent->selStartLine(); +} + +int SelectionExtDCOPInterface::selStartCol() +{ + return m_parent->selStartCol(); +} + +int SelectionExtDCOPInterface::selEndLine() +{ + return m_parent->selEndLine(); +} + +int SelectionExtDCOPInterface::selEndCol() +{ + return m_parent->selEndCol(); +} +//END KTextEditor::SelectionExtDCOPInterface diff --git a/interfaces/tdetexteditor/selectioninterfaceext.h b/interfaces/tdetexteditor/selectioninterfaceext.h new file mode 100644 index 000000000..8f57fb7e9 --- /dev/null +++ b/interfaces/tdetexteditor/selectioninterfaceext.h @@ -0,0 +1,74 @@ +/* This file is part of the KDE project + Copyright (C) 2002 Anders Lund <[email protected]> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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. + + $Id$ +*/ + +#ifndef __tdetexteditor_selectioninterface_ext_h__ +#define __tdetexteditor_selectioninterface_ext_h__ + +#include <tdelibs_export.h> + +class TQCString; + +namespace KTextEditor +{ + +/** + Provide access to seleciton positions. + This is an interface for the Document class. + Mainly here for dcop and the sake of scripting. + @author Anders Lund <[email protected]> +*/ +class KTEXTEDITOR_EXPORT SelectionInterfaceExt +{ + friend class PrivateSelectionInterfaceExt; + + public: + SelectionInterfaceExt(); + virtual ~SelectionInterfaceExt(); + + unsigned int selectionInterfaceExtNumber () const; + + protected: + void setSelectionInterfaceExtDCOPSuffix (const TQCString &suffix); + + public: + /** The selection start line number */ + virtual int selStartLine()=0; + /** The selection start col */ + virtual int selStartCol()=0; + /** The selection end line */ + virtual int selEndLine()=0; + /** The selection end col */ + virtual int selEndCol()=0; + + private: + class PrivateSelectionInterfaceExt *d; + static unsigned int globalSelectionInterfaceExtNumber; + unsigned int mySelectionInterfaceExtNumber; +}; + +class Document; +class View; + +KTEXTEDITOR_EXPORT SelectionInterfaceExt *selectionInterfaceExt (Document *doc); +KTEXTEDITOR_EXPORT SelectionInterfaceExt *selectionInterfaceExt (View *view); + +} // namespace KTextEditor +#endif diff --git a/interfaces/tdetexteditor/sessionconfiginterface.cpp b/interfaces/tdetexteditor/sessionconfiginterface.cpp new file mode 100644 index 000000000..def7bf0a5 --- /dev/null +++ b/interfaces/tdetexteditor/sessionconfiginterface.cpp @@ -0,0 +1,88 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "sessionconfiginterface.h" + +#include "document.h" +#include "view.h" +#include "plugin.h" + +namespace KTextEditor +{ + +class PrivateSessionConfigInterface +{ + public: + PrivateSessionConfigInterface() {} + ~PrivateSessionConfigInterface() {} +}; + +} + +using namespace KTextEditor; + +unsigned int SessionConfigInterface::globalSessionConfigInterfaceNumber = 0; + +SessionConfigInterface::SessionConfigInterface() +{ + globalSessionConfigInterfaceNumber++; + mySessionConfigInterfaceNumber = globalSessionConfigInterfaceNumber++; + + d = new PrivateSessionConfigInterface(); +} + +SessionConfigInterface::~SessionConfigInterface() +{ + delete d; +} + +unsigned int SessionConfigInterface::configInterfaceNumber () const +{ + return mySessionConfigInterfaceNumber; +} + +void SessionConfigInterface::setSessionConfigInterfaceDCOPSuffix (const TQCString &/*suffix*/) +{ + //d->interface->setObjId ("SessionConfigInterface#"+suffix); +} + +SessionConfigInterface *KTextEditor::sessionConfigInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::SessionConfigInterface*>(doc); +} + +SessionConfigInterface *KTextEditor::sessionConfigInterface (View *view) +{ + if (!view) + return 0; + + return dynamic_cast<KTextEditor::SessionConfigInterface*>(view); +} + +SessionConfigInterface *KTextEditor::sessionConfigInterface (Plugin *plugin) +{ + if (!plugin) + return 0; + + return dynamic_cast<KTextEditor::SessionConfigInterface*>(plugin); +} diff --git a/interfaces/tdetexteditor/sessionconfiginterface.h b/interfaces/tdetexteditor/sessionconfiginterface.h new file mode 100644 index 000000000..f92502b36 --- /dev/null +++ b/interfaces/tdetexteditor/sessionconfiginterface.h @@ -0,0 +1,71 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_sessionconfiginterface_h__ +#define __tdetexteditor_sessionconfiginterface_h__ + +#include <tdelibs_export.h> + +class TQCString; +class TDEConfig; + +namespace KTextEditor +{ + +/** +* This is an interface to session-specific configuration of the +* Document, Plugin and PluginViewInterface classes. +*/ +class KTEXTEDITOR_EXPORT SessionConfigInterface +{ + friend class PrivateSessionConfigInterface; + + public: + SessionConfigInterface(); + virtual ~SessionConfigInterface(); + + unsigned int configInterfaceNumber () const; + + protected: + void setSessionConfigInterfaceDCOPSuffix (const TQCString &suffix); + + // + // slots !!! + // + public: + /** + * Read/Write session config of only this document/view/plugin + * In case of the document, that means for example it should reload the file, + * restore all marks, ... + */ + virtual void readSessionConfig (TDEConfig *) = 0; + virtual void writeSessionConfig (TDEConfig *) = 0; + + private: + class PrivateSessionConfigInterface *d; + static unsigned int globalSessionConfigInterfaceNumber; + unsigned int mySessionConfigInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT SessionConfigInterface *sessionConfigInterface (class Document *doc); +KTEXTEDITOR_EXPORT SessionConfigInterface *sessionConfigInterface (class View *view); +KTEXTEDITOR_EXPORT SessionConfigInterface *sessionConfigInterface (class Plugin *plugin); + +} + +#endif diff --git a/interfaces/tdetexteditor/tdetexteditor.cpp b/interfaces/tdetexteditor/tdetexteditor.cpp new file mode 100644 index 000000000..354361ed2 --- /dev/null +++ b/interfaces/tdetexteditor/tdetexteditor.cpp @@ -0,0 +1,242 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann ([email protected]) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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. +*/ + +#include <config.h> + +#include "document.h" +#include "view.h" +#include "plugin.h" +#include "editor.h" + +#include <kaction.h> +#include <tdeparts/factory.h> +#include <tdeparts/componentfactory.h> + +#include "document.moc" +#include "view.moc" +#include "plugin.moc" +#include "editor.moc" + +using namespace KTextEditor; + +namespace KTextEditor +{ + class PrivateDocument + { + public: + PrivateDocument () + { + } + + ~PrivateDocument() + { + } + }; + + class PrivateView + { + public: + PrivateView () + { + } + + ~PrivateView() + { + } + }; + + class PrivatePlugin + { + public: + PrivatePlugin () + { + } + + ~PrivatePlugin () + { + } + + class Document *m_doc; + }; + + class PrivatePluginViewInterface + { + public: + PrivatePluginViewInterface () + { + } + + ~PrivatePluginViewInterface () + { + } + }; + + class PrivateEditor + { + public: + PrivateEditor () + { + } + + ~PrivateEditor() + { + } + }; +} + +unsigned int Document::globalDocumentNumber = 0; +unsigned int View::globalViewNumber = 0; +unsigned int Plugin::globalPluginNumber = 0; +unsigned int PluginViewInterface::globalPluginViewInterfaceNumber = 0; +unsigned int Editor::globalEditorNumber = 0; + +Document::Document( TQObject *parent, const char *name ) : KTextEditor::Editor (parent, name ) +{ + globalDocumentNumber++; + myDocumentNumber = globalDocumentNumber; + myDocumentListPosition = -1; // Don't care +} + +Document::~Document() +{ +} + +unsigned int Document::documentNumber () const +{ + return myDocumentNumber; +} + +long Document::documentListPosition () const +{ + return myDocumentListPosition; +} + +void Document::setDocumentListPosition (long pos) +{ + myDocumentListPosition = pos; +} + +TQCString Document::documentDCOPSuffix () const +{ + TQCString num; + num.setNum (documentNumber()); + + return num; +} + +View::View( Document *, TQWidget *parent, const char *name ) : TQWidget( parent, name ) +{ + globalViewNumber++; + myViewNumber = globalViewNumber; +} + +View::~View() +{ +} + +unsigned int View::viewNumber () const +{ + return myViewNumber; +} + +TQCString View::viewDCOPSuffix () const +{ + TQCString num1, num2; + num1.setNum (viewNumber()); + num2.setNum (document()->documentNumber()); + + return num2 + "-" + num1; +} + +Plugin::Plugin( Document *document, const char *name ) : TQObject (document, name ) +{ + globalPluginNumber++; + myPluginNumber = globalPluginNumber; + d = new PrivatePlugin (); + d->m_doc = document; +} + +Plugin::~Plugin() +{ + delete d; +} + +unsigned int Plugin::pluginNumber () const +{ + return myPluginNumber; +} + +Document *Plugin::document () const +{ + return d->m_doc; +} + +PluginViewInterface::PluginViewInterface() +{ + globalPluginViewInterfaceNumber++; + myPluginViewInterfaceNumber = globalPluginViewInterfaceNumber; +} + +PluginViewInterface::~PluginViewInterface() +{ +} + +unsigned int PluginViewInterface::pluginViewInterfaceNumber () const +{ + return myPluginViewInterfaceNumber; +} + +Editor::Editor( TQObject *parent, const char *name ) : KParts::ReadWritePart( parent, name ) +{ + globalEditorNumber++; + myEditorNumber = globalEditorNumber; +} + +Editor::~Editor() +{ +} + +unsigned int Editor::editorNumber () const +{ + return myEditorNumber; +} + +Editor *KTextEditor::createEditor ( const char* libname, TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name ) +{ + return KParts::ComponentFactory::createPartInstanceFromLibrary<Editor>( libname, parentWidget, widgetName, parent, name ); +} + +Document *KTextEditor::createDocument ( const char* libname, TQObject *parent, const char *name ) +{ + return KParts::ComponentFactory::createPartInstanceFromLibrary<Document>( libname, 0, 0, parent, name ); +} + +Plugin *KTextEditor::createPlugin ( const char* libname, Document *document, const char *name ) +{ + return KParts::ComponentFactory::createInstanceFromLibrary<Plugin>( libname, document, name ); +} + +PluginViewInterface *KTextEditor::pluginViewInterface (Plugin *plugin) +{ + if (!plugin) + return 0; + + return dynamic_cast<KTextEditor::PluginViewInterface*>(plugin); +} + diff --git a/interfaces/tdetexteditor/tdetexteditor.desktop b/interfaces/tdetexteditor/tdetexteditor.desktop new file mode 100644 index 000000000..17556bdf6 --- /dev/null +++ b/interfaces/tdetexteditor/tdetexteditor.desktop @@ -0,0 +1,86 @@ +[Desktop Entry] +Type=ServiceType +X-TDE-ServiceType=KTextEditor/Document +X-TDE-Derived=KParts/ReadWritePart +Comment=Embeddable Text Editor Component (with Doc/View Separation) +Comment[af]=Inlegbare Teks Redigeerder Komponent (met Dok/Besigtig Seperasie) +Comment[ar]=مكوّن تحرير النصوص القابل للدمج )مع Doc/View Separation( +Comment[az]=Hopdurula Bilən Mətn Editor Komponenti (Doc/Nümayiş Ayrımlı) +Comment[be]=Унутраны тэкставы рэдактар (з падзелам Дакумент/Прагляд) +Comment[bg]=Текстов редактор (с разделение между Doc/View) +Comment[bn]=অভ্যন্তরীণ টেক্সট সম্পাদক কম্পোনেন্ট (পৃথক ডক/ভিউ সহ) +Comment[bs]=Umetljiva komponenta za obradu teksta (sa odvojenim Doc/View) +Comment[ca]=Component encastable de l'editor de text (amb separació Doc/Vista) +Comment[cs]=Pohltitelná komponenta textového editoru (s oddělením Doc/View) +Comment[csb]=Dzéł editora tekstu (do òbsôdzaniô, z paradygmatã Dokùment/Wëzdrzatk) +Comment[cy]=Cydran Golygydd Testun Mewnadeiladwy (wrth Wahanu Dogfen/Golwg) +Comment[da]=Teksteditorkomponent som kan indlejres (med dok./visning-adskillelse) +Comment[de]=Einbettungsfähige Editorkomponente (mit Text/Ansicht-Aufteilung) +Comment[el]=Ενσωματώσιμο στοιχείο επεξεργαστή κειμένου (με διαχωρισμό Doc/View) +Comment[eo]=Enkorpigebla redaktilo (kun apartigo de dokumento kaj rigardo) +Comment[es]=Componente incrustable de editor de textos (con separación Doc/Vista) +Comment[et]=Põimitav tekstiredaktori komponent (dokument/vaade eraldamisega) +Comment[eu]=Testu-editorearen kapsulatutako osagaia (Dok/Ikusi bereizketarekin) +Comment[fa]=مولفۀ ویرایشگر متن نهفته )با سند/نمای مجزا( +Comment[fi]=Upotettava tekstimuokkauskomponentti (Asiakirja/Näkymä-jaolla) +Comment[fr]=Composant d'édition de texte intégrable (avec séparation doc / vue) +Comment[fy]=Yn te sluten tekstbewurkerkomponint (mei skieding fan tekst/werjefte) +Comment[ga]=Comhpháirt eagarthóireacht téacs inleabaithe (le deighilt idir cáipéis agus amharc) +Comment[gl]=Compoñente incrustábel de Edición de Texto (cunha Separación Doc/Vista) +Comment[he]=רכיב עורך טקסט בר הטבעה (עם הפרדה בין מסמך לתצוגה) +Comment[hi]=अंतर्निहित किया जा सकने वाला पाठ संपादक (डाक/व्यू सेपरेशन के साथ) +Comment[hr]=Ugradiva komponenta obrade teksta (s Doc/View razdvajanjem) +Comment[hsb]=Komponenta za integrowane wobdźěłanje teksta +Comment[hu]=Beágyazható szövegszerkesztő (dokumentum/nézet modellel) +Comment[id]=Komponen Penyuntingan Teks Tersisipkan (dengan Pemisahan Doc/View) +Comment[is]=Ívafinn textaritill (með skjal/sýn aðskilnaði) +Comment[it]=Componente integrabile per l'elaborazione di testi (con separazione documento/vista) +Comment[ja]=埋め込み可能なテキストエディタコンポーネント (Doc/View 分離) +Comment[ka]=ტექსტის რედაქტირების ჩადგმადი კომპონენტი (დოკუმენტი/ჩვენება მოდელის მხარდაჭერით) +Comment[kk]=Ендірілетін мәтін өңдеу компоненті (Құжат/көрініс үлгіні қолдайтын) +Comment[km]=សមាសភាគកម្មវិធីនិពន្ធអត្ថបទដែលអាចបង្កប់ (ដោយប្រើការបំបែក Doc/View) +Comment[ko]=끼워넣는 글월 편집기 구성 요소 (Doc/View 나눔) +Comment[lb]=Abettbar Texteditor-Komponent (mat Dokument/Usiicht Trennung) +Comment[lt]=Įdedamas tekstų redaktoriaus komponentas (su Doc/View atskyrimu) +Comment[lv]=Iegulstama tekstu redaktora komponente (ar Dok/Skatīt atdalīšanu) +Comment[mk]=Вгнездлива компонента за уредување на текст (со Док/Приказ раздвојување) +Comment[mn]=Суулгах боломж бүхий засварлагчийн бүрдэл хэсэг(Teкст/Харах-тусгаарлалттай) +Comment[ms]=Komponen Penyunting Teks Boleh Selit (Dokumentasi/Pelihat berasingan) +Comment[mt]=Komponent integrat editur tat-test (b'separazzjoni dokument/wiri) +Comment[nb]=Innebyggbar tekstredigeringskomponent (med Doc/View-skille) +Comment[nds]=Inbettbor Texteditor-Komponent (mit Dokment/Ansicht-Trennen) +Comment[ne]=सम्मिलित पाठ सम्पादक अवयव (डक/दृश्य विभाजनसँग) +Comment[nl]=Ingebed teksteditorcomponent (met scheiding van tekst/weergave) +Comment[nn]=Inkluderbart komponent for tekstvising (med Doc/View-deling) +Comment[nso]=Seripa seo se Robatsegago sa Mofetosi wa Sengwalwana (le Karogano ya Doc/Bona) +Comment[pa]=ਸ਼ਾਮਿਲ ਹੋਣਯੋਗ ਪਾਠ ਸੰਪਾਦਕ ਭਾਗ (Doc/ਦਰਿਸ਼ ਵੱਖ ਕਰਨ ਨਾਲ) +Comment[pl]=Składnik edytora tekstu (do osadzania, z paradygmatem Dokument/Widok) +Comment[pt]=Componente Incorporado do Editor de Texto (com Separação entre Documentos) +Comment[pt_BR]=Componente de edição de textos integrado (com separação de Documentação/Visualização) +Comment[ro]=Componentă de editare text (cu separare Doc/Vizualizare) +Comment[ru]=Встраиваемый элемент редактора текста (с поддержкой модели документ/вид) +Comment[rw]=Inyangingo Muhinduzi y'Umwandiko Ishyirwamo (ifite itandukanya Inyandiko/Ukugaragaza) +Comment[se]=Vuojuhanláhkái čállinprográmmaoassi (Doc/View-sirremiin) +Comment[sk]=Vložiteľný komponent textového editora (s oddelením Doc/View) +Comment[sl]=Vgradljiva komponenta urejevalnika besedil (z ločevanjem pogleda in dokumenta) +Comment[sq]=Komponenta e ngulshme e Tekst Editorit (me ndarje Dokument/Vështrues) +Comment[sr]=Уградива компонента за уређивање текста (са „документ/приказ“ одвајањем) +Comment[sr@Latn]=Ugradiva komponenta za uređivanje teksta (sa „dokument/prikaz“ odvajanjem) +Comment[ss]=Incenye yesihleli sembhalo lenamatselekako (ne Doc/Bona kwehlukana) +Comment[sv]=Inbäddningsbar texteditor (med dok/vyseparation) +Comment[ta]=உட்பொதிந்த உரை தொகுப்பாளர் பகுதி (ஆவண/காட்சி பிரிவுகளுடன்) +Comment[te]=పొదగబడె వాచకం సరిచేయు అంశం (పత్ర/వీక్షణ విభజన వున్నది) +Comment[tg]=Қисми таҳриргари матни дарунсохт (бо вазифаи намоиши санад) +Comment[th]=คอมโปเนนท์แก้ไขข้อความที่ฝังได้ (โดยแยก เอกสาร/แสดงผล) +Comment[tr]=Gömülebilir Metin Düzenleyici Bileşeni (Doc/View ayrımı dahil) +Comment[tt]=Mäten Üzgärtüçe Quşılma-Komponent (İstälek/Küreneş ayıru belän) +Comment[uk]=Компонент редактора текстів, який можна вбудовувати (з розділенням документ/вигляд) +Comment[uz]=Ichiga oʻrnatib boʻladigan matn tahrirchi komponenti (hujjat/koʻrinish imkoniyati bilan) +Comment[uz@cyrillic]=Ичига ўрнатиб бўладиган матн таҳрирчи компоненти (ҳужжат/кўриниш имконияти билан) +Comment[ven]=Khomphonente ya musengulusi ya manwalwa (ina Doc/u khethekana ha u vhona) +Comment[vi]=Thành phần Soạn thảo Văn bản có nhúng được (có khả năng phân cách tài liệu/khung xem) +Comment[xh]=Inxenye Yomhleli Wombhalo Olungiselelweyo (ngo Xwebhu/Ulwahlulo Lwemboniselo) +Comment[zh_CN]=可嵌入的文本编辑器部件(带 文档/查看 分离) +Comment[zh_HK]=可嵌入的文字編輯器元件 (Doc/View 分開) +Comment[zh_TW]=可嵌入的文字編輯器元件 (Doc/View 分開) +Comment[zu]=IIunga Lomlungisi Wombhalo (Ngokuhlukana kwe-Doc/Umbukiso) diff --git a/interfaces/tdetexteditor/tdetexteditoreditor.desktop b/interfaces/tdetexteditor/tdetexteditoreditor.desktop new file mode 100644 index 000000000..6048da92b --- /dev/null +++ b/interfaces/tdetexteditor/tdetexteditoreditor.desktop @@ -0,0 +1,86 @@ +[Desktop Entry] +Type=ServiceType +X-TDE-ServiceType=KTextEditor/Editor +X-TDE-Derived=KParts/ReadWritePart +Comment=Embeddable Text Editor Component (without Doc/View Separation) +Comment[af]=Inlegbare Teks Redigeerder Komponent (sonder om te Dok/Besigtig Seperasie) +Comment[ar]=مكوّن تحرير النصوص القابل للدمج )مع Doc/View Separation( +Comment[az]=Hopdurula Bilən Mətn Editor Komponenti (Doc/Nümayiş Ayrımsız) +Comment[be]=Унутраны тэкставы рэдактар (без падзелу Дакумент/Прагляд) +Comment[bg]=Текстов редактор (без разделение между Doc/View) +Comment[bn]=অভ্যন্তরীণ টেক্সট সম্পাদক কম্পোনেন্ট (পৃথক ডক/ভিউ ছাড়া) +Comment[bs]=Umetljiva komponenta za obradu teksta (bez odvojenog Doc/View) +Comment[ca]=Component encastable de l'editor de text (sense separació Doc/Vista) +Comment[cs]=Pohltitelná komponenta textového editoru (bez oddělení Doc/View) +Comment[csb]=Dzéł editora tekstu (do òbsôdzaniô, bez paradygmatu Dokùment/Wëzdrzatk) +Comment[cy]=Cydran Golygydd Testun Mewnadeiladwy (heb Wahanu Dogfen/Golwg) +Comment[da]=Teksteditorkomponent som kan indlejres (uden dok./visning-adskillelse) +Comment[de]=Einbettungsfähige Editorkomponente (ohne Text/Ansicht-Aufteilung) +Comment[el]=Ενσωματώσιμο στοιχείο επεξεργαστή κειμένου (χωρίς διαχωρισμό Doc/View) +Comment[eo]=Enkorpigebla redaktilo (sen apartigo de dokumento kaj rigardo) +Comment[es]=Componente incrustable de editor de textos (sin separación Doc/Vista) +Comment[et]=Põimitav tekstiredaktori komponent +Comment[eu]=Testu-editorearen kapsulatutako osagaia (Dok/Ikusi bereizketarik gabe) +Comment[fa]=مولفۀ ویرایشگر متن نهفته ) بدون سند/نمای مجزا( +Comment[fi]=Upotettava tekstimuokkauskomponentti (ilman Asiakirja/Näkymä-jakoa) +Comment[fr]=Composant d'édition de texte intégrable (sans séparation doc / vue) +Comment[fy]=Yn te sluten tekstbewurkerkomponint (sûnder skieding fan tekst/werjefte) +Comment[ga]=Comhpháirt eagarthóireacht téacs inleabaithe (gan deighilt idir cáipéis agus amharc) +Comment[gl]=Compoñente incrustábel de Edición de Texto (sen Separación Doc/Vista) +Comment[he]=רכיב עורך טקסט בר הטבעה (בלי הפרדה בין מסמך לתצוגה) +Comment[hi]=अंतर्निहित किया जा सकने वाला पाठ संपादक (डाक/व्यू सेपरेशन के बगैर) +Comment[hr]=Ugradiva komponenta obrade teksta (bez Doc/View razdvajanja) +Comment[hsb]=Integrujomna komponenta za wobdźěłanje tekstow (bjez doc/view-separacije) +Comment[hu]=Beágyazható szövegszerkesztő (dokumentum/nézet modell nélkül) +Comment[id]=Komponen Penyuntingan Teks Tersisipkan (tanpa Pemisahan Doc/View) +Comment[is]=Ívafinn textaritill (án skjal/sýn aðskilnaðar) +Comment[it]=Componente integrabile per l'elaborazione di testi (senza separazione documento/vista) +Comment[ja]=埋め込み可能なテキストエディタコンポーネント (Doc/View 分離なし) +Comment[ka]=ტექსტის რედაქტირების ჩადგმადი კომპონენტი (დოკუმენტი/ჩვენება მოდელის მხარდაჭერის გარეშე) +Comment[kk]=Ендірілетін мәтін өңдеу компоненті (Құжат/көрініс үлгіні қолдамайтын) +Comment[km]=សមាសភាគកម្មវិធីនិពន្ធអត្ថបទដែលអាចបង្កប់ (ដោយគ្មានការបំបែក Doc/View) +Comment[ko]=끼워넣는 글월 편집기 구성 요소 (Doc/View 나누지 않음) +Comment[lb]=Abettbar Texteditor-Komponent (ouni Dokument/Usiicht Trennung) +Comment[lt]=Įdedamas tekstų redaktoriaus komponentas (be Doc/View atskyrimo) +Comment[lv]=Iegulstama tekstu redaktora komponente (bez Dok/Skatīt atdalīšanas) +Comment[mk]=Вгнездлива компонента за уредување на текст (без Док/Приказ раздвојување) +Comment[mn]=Суулгах боломж бүхий засварлагчийн бүрдэл хэсэг(Teкст/Харах-тусгаарлалтгүй) +Comment[ms]=Komponen Penyunting Teks Boleh Selit (Dokumentasi/Pelihat tidak berasingan) +Comment[mt]=Komponent integrat editur tat-test (mingħajr separazzjoni dokument/wiri) +Comment[nb]=Innebyggbar tekstredigeringskomponent (uten Doc/View skille) +Comment[nds]=Inbettbor Texteditor-Komponent (ahn Dokment/Ansicht-Trennen) +Comment[ne]=सम्मिलित पाठ सम्पादक अवयव (डक/दृश्य विभाजनवाहेक) +Comment[nl]=Ingebed teksteditorcomponent (zonder scheiding van tekst/weergave) +Comment[nn]=Inkluderbart komponent for tekstvising (utan Doc/View-deling) +Comment[nso]=Seripa seo se Robatsegago sa Mofetosi wa Sengwalwana (kantle le Karogano ya Doc/Bona) +Comment[pa]=ਸ਼ਾਮਿਲ ਹੋਣਯੋਗ ਪਾਠ ਸੰਪਾਦਕ ਭਾਗ (Doc/ਦਰਿਸ਼ ਵੱਖ ਕਰਨ ਬਿਨਾਂ) +Comment[pl]=Składnik edytora tekstu (do osadzania, bez paradygmatu Dokument/Widok) +Comment[pt]=Componente Incorporado do Editor de Texto (sem Separação entre Documentos) +Comment[pt_BR]=Componente de edição de textos integrado (sem separação de Documentação/Visualização) +Comment[ro]=Componentă de editare text (fără separare Doc/Vizualizare) +Comment[ru]=Встраиваемый элемент редактора текста (без поддержки модели документ/вид) +Comment[rw]=Inyangingo Muhinduzi y'Umwandiko Ishyirwamo (nta tandukanya Inyandiko/Ukugaragaza) +Comment[se]=Vuojuhanláhkái čállinprográmmaoassi (almmá Doc/View-sirrema) +Comment[sk]=Vložiteľný komponent textového editora (bez oddelenia Doc/View) +Comment[sl]=Vgradljiva komponenta urejevalnika besedil (brez ločevanja pogleda in dokumenta) +Comment[sq]=Komponenta e ngulshme e Tekst Editorit (pa ndarje Dokument/Vështrues) +Comment[sr]=Уградива компонента за уређивање текста (без „документ/приказ“ одвајања) +Comment[sr@Latn]=Ugradiva komponenta za uređivanje teksta (bez „dokument/prikaz“ odvajanja) +Comment[ss]=Incenye yesihleli sembhalo lenamatselekako (ngaphandle kwe Doc/Bona kwehlukana) +Comment[sv]=Inbäddningsbar texteditor (utan dok/vyseparation) +Comment[ta]=உட்பொதிந்த உரை தொகுப்பாளர் கூறு (ஆவண/காட்சி பிரிவுகளற்ற) +Comment[te]=పొదగబడె వాచకం సరిచేయు అంశం (పత్ర/వీక్షణ విభజన లేకుండా) +Comment[tg]=Қисми таҳриргари матни дарунсохт (бе вазифаи намоиши санад) +Comment[th]=คอมโปเนนท์แก้ไขข้อความที่ฝังได้ (โดยไม่แยก เอกสาร/แสดงผล) +Comment[tr]=Gömülebilir Metin Düzenleyici Bileşeni (Doc/View ayrımı yok) +Comment[tt]=Mäten Üzgärtüçe Quşılma-Komponent (İstälek/Küreneş ayıru belän tügel) +Comment[uk]=Компонент редактора текстів, який можна вбудовувати (без розділення документ/вигляд) +Comment[uz]=Ichiga oʻrnatib boʻladigan matn tahrirchi komponenti (hujjat/koʻrinish imkoniyatsiz) +Comment[uz@cyrillic]=Ичига ўрнатиб бўладиган матн таҳрирчи компоненти (ҳужжат/кўриниш имкониятсиз) +Comment[ven]=Khomphonente ya musengulusi wa manwalwa (i sina Doc/U khethekana hau vhona) +Comment[vi]=Thành phần Soạn thảo Văn bản có nhúng được (không có khả năng phân cách tài liệu/khung xem) +Comment[xh]=Ingxenye Yomhleli Wombhalo Olungiselekayo (ngaphandle Koxwebhu/Ulwahlulo Lwemboniselo) +Comment[zh_CN]=可嵌入的文本编辑器部件(不带 文档/查看 分离) +Comment[zh_HK]=可嵌入的文字編輯器元件 (Doc/View 不分開) +Comment[zh_TW]=可嵌入的文字編輯器元件 (Doc/View 不分開) +Comment[zu]=Ilunga Lomlungisi Wombhalo (ngaphandle Kokuhlukana kwe-Doc/Umbukiso) diff --git a/interfaces/tdetexteditor/tdetexteditorplugin.desktop b/interfaces/tdetexteditor/tdetexteditorplugin.desktop new file mode 100644 index 000000000..b2e180a93 --- /dev/null +++ b/interfaces/tdetexteditor/tdetexteditorplugin.desktop @@ -0,0 +1,87 @@ +[Desktop Entry] +Type=ServiceType +X-TDE-ServiceType=KTextEditor/Plugin +X-TDE-Derived= +Comment=KTextEditor Plugin +Comment[af]=KTextEditor Inprop Module +Comment[ar]=مساعد برنامج KTextEditor +Comment[az]=KTextEditor Əlavəsi +Comment[be]=Модуль KTextEditor +Comment[bg]=Приставка KTextEditor +Comment[bn]=কে-টেক্সট-এডিটর প্লাগ-ইন +Comment[br]=Lugent KTextEditor +Comment[bs]=Dodatak za KTextEditor +Comment[ca]=Connector del KTextEditor +Comment[cs]=Modul textového editoru +Comment[csb]=Plugins editora tekstu +Comment[cy]=Atodyn KTextEditor +Comment[da]=KTextEditor-plugin +Comment[de]=KTextEditor-Erweiterung +Comment[el]=Πρόσθετο KTextEditor +Comment[eo]=Ktekstredaktila kromaĵeto +Comment[es]=Plugin de KTextEditor +Comment[et]=KTextEditori plugin +Comment[eu]=KTextEditor plugin-a +Comment[fa]=وصلۀ KTextEditor +Comment[fi]=KTextEditor-lisäosa +Comment[fr]=Module externe KTextEditor +Comment[fy]=KTextFerwurker-plugin +Comment[ga]=Breiseán KTextEditor +Comment[gl]=Plugin KTextEditor +Comment[he]=תוסף KTextEditor +Comment[hi]=के-टेक्स्ट-एडिटर प्लगइन +Comment[hr]=KTextEditor dodatak +Comment[hu]=KTextEditor-bővítőmodul +Comment[id]=Plugin KTextEditor +Comment[is]=KTextEditor-íforrit +Comment[it]=Plugin KTextEditor +Comment[ja]=KTextEditor プラグイン +Comment[ka]=KTextEditor მოდული +Comment[kk]=KTextEditor модулі +Comment[km]=កម្មវិធីជំនួយខាងក្នុង KTextEditor +Comment[ko]=K글월편집기 플러그인 +Comment[lb]=KTextEditor-Plugin +Comment[lt]=KTextEditor priedas +Comment[lv]=KTextEditor spraudnis +Comment[mk]=KTextEditor приклучок +Comment[mn]=Текст засварлагч +Comment[ms]=Plugmasuk KTextEditor +Comment[mt]=Plagin KTextEditor +Comment[nb]=KTextEditor-programtillegg +Comment[nds]=KTextEditor-Plugin +Comment[ne]=KTextEditor प्लगइन +Comment[nl]=KTextEditor-plugin +Comment[nn]=TDE-skriveprogramtillegg +Comment[nso]=Tsenyo ya Mofetosi wa Sengwalwana sa K +Comment[pa]=ਕੇ ਪਾਠਸੰਪਾਦਕ ਪਲੱਗਿੰਨ +Comment[pl]=Wtyczka edytora tekstu +Comment[pt]='Plugin' do KTextEditor +Comment[pt_BR]=Plug-in do Editor de Texto +Comment[ro]=Modul editor de text +Comment[ru]=Модуль KTextEditor +Comment[rw]=Icomeka KMuhinduziUmwandiko +Comment[se]=TDE-čállinprográmma lassemoduvla +Comment[sk]=Modul KTextEditor +Comment[sl]=Vstavek KTextEditor +Comment[sq]=Shtojca KTextEditor +Comment[sr]=KTextEditor прикључак +Comment[sr@Latn]=KTextEditor priključak +Comment[ss]=I-plugini ye KTextEditor +Comment[sv]=Insticksprogram för texteditor +Comment[ta]=கேஉரைதொகுப்பி சொருகுப்பொருள் +Comment[te]=కెటెక్స్ట్ ఎడిటర్ ప్లగిన్ +Comment[tg]=Пуркунандаи KTextEditor +Comment[th]=ปลักอิน KTextEditor +Comment[tr]=KTextEditor Eklentisi +Comment[tt]=KTextEditor Östämäse +Comment[uk]=Втулок KTextEditor +Comment[uz]=KTextEditor plagini +Comment[uz@cyrillic]=KTextEditor плагини +Comment[ven]=Pulagini ya musengulusi wa manwalwa a K +Comment[vi]=Bộ cầm phít Soạn thảo Văn bản +Comment[wa]=Tchôke-divins KTextEditor +Comment[xh]=KTextEditor ye Plagi efakiweyo +Comment[zh_CN]=KTextEditor 插件 +Comment[zh_HK]=KTextEditor 外掛程式 +Comment[zh_TW]=KTextEditor 外掛程式 +Comment[zu]= Ukungena ngaphakathi kwe-KTextEditor diff --git a/interfaces/tdetexteditor/templateinterface.cpp b/interfaces/tdetexteditor/templateinterface.cpp new file mode 100644 index 000000000..ecc34c7e2 --- /dev/null +++ b/interfaces/tdetexteditor/templateinterface.cpp @@ -0,0 +1,197 @@ +/* This file is part of the KDE libraries + Copyright (C) 2004 Joseph Wenninger <[email protected]> + + 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. +*/ + +#include "templateinterface.h" +#include "document.h" +#include <stdaddressbook.h> +#include <addressee.h> +#include <addresseedialog.h> +#include <tqstring.h> +#include <klocale.h> +#include <kglobal.h> +#include <tqdatetime.h> +#include <tqregexp.h> +#include <kmessagebox.h> +#include <kcalendarsystem.h> +#include <unistd.h> + +#include <kdebug.h> + +using namespace KTextEditor; + +unsigned int TemplateInterface::globalTemplateInterfaceNumber = 0; + +TemplateInterface::TemplateInterface() +{ + myTemplateInterfaceNumber = globalTemplateInterfaceNumber++; +} + +TemplateInterface::~TemplateInterface() +{} + +uint TemplateInterface::templateInterfaceNumber () const +{ + return myTemplateInterfaceNumber; +} + +void TemplateInterface::setTemplateInterfaceDCOPSuffix ( const TQCString &suffix ) +{} + +#define INITKABC do { \ + if (addrBook==0) { \ + addrBook=KABC::StdAddressBook::self(); \ + userAddress=addrBook->whoAmI(); \ + if (userAddress.isEmpty()) { \ + if ( KMessageBox::questionYesNo(parentWindow, \ + i18n( "This template uses personal data that is stored in the TDE addressbook, but you have not selected a personal entry. You can still use the template without one, but you will have to type personal data. Would you like to select one now?" ), \ + "Personal data requested", \ + KStdGuiItem::yes(), KStdGuiItem::no(), "select personal data entry") == KMessageBox::Yes ) { \ + userAddress = KABC::AddresseeDialog::getAddressee(parentWindow); \ + if ( ! userAddress.isEmpty() ) \ + KABC::StdAddressBook::self()->setWhoAmI( userAddress ); \ + }\ + /*return false;//no, why??*/ \ + } \ + } \ +} while(false) + +bool TemplateInterface::expandMacros( TQMap<TQString, TQString> &map, TQWidget *parentWindow ) +{ + KABC::StdAddressBook *addrBook = 0; + KABC::Addressee userAddress; + TQDateTime datetime = TQDateTime::currentDateTime(); + TQDate date = TQT_TQDATE_OBJECT(datetime.date()); + TQTime time = TQT_TQTIME_OBJECT(datetime.time()); + + TQMap<TQString,TQString>::Iterator it; + for ( it = map.begin(); it != map.end(); ++it ) + { + TQString placeholder = it.key(); + if ( map[ placeholder ].isEmpty() ) + { + if ( placeholder == "index" ) map[ placeholder ] = "i"; + else if ( placeholder == "loginname" ) + {} + else if ( placeholder == "firstname" ) + { + INITKABC; + if ( !userAddress.isEmpty() ) + map[ placeholder ] = userAddress.givenName(); + } + else if ( placeholder == "lastname" ) + { + INITKABC; + if ( !userAddress.isEmpty() ) + map[ placeholder ] = userAddress.familyName(); + } + else if ( placeholder == "fullname" ) + { + INITKABC; + if ( !userAddress.isEmpty() ) + map[ placeholder ] = userAddress.assembledName(); + } + else if ( placeholder == "email" ) + { + INITKABC; + if ( !userAddress.isEmpty() ) + map[ placeholder ] = userAddress.preferredEmail(); + } + else if ( placeholder == "date" ) + { + map[ placeholder ] = TDEGlobal::locale() ->formatDate( date, true ); + } + else if ( placeholder == "time" ) + { + map[ placeholder ] = TDEGlobal::locale() ->formatTime( time, true, false ); + } + else if ( placeholder == "year" ) + { + map[ placeholder ] = TDEGlobal::locale() ->calendar() ->yearString( date, false ); + } + else if ( placeholder == "month" ) + { + map[ placeholder ] = TQString::number( TDEGlobal::locale() ->calendar() ->month( date ) ); + } + else if ( placeholder == "day" ) + { + map[ placeholder ] = TQString::number( TDEGlobal::locale() ->calendar() ->day( date ) ); + } + else if ( placeholder == "hostname" ) + { + char hostname[ 256 ]; + hostname[ 0 ] = 0; + gethostname( hostname, 255 ); + hostname[ 255 ] = 0; + map[ placeholder ] = TQString::fromLocal8Bit( hostname ); + } + else if ( placeholder == "cursor" ) + { + map[ placeholder ] = "|"; + } + else map[ placeholder ] = placeholder; + } + } + return true; +} + +bool TemplateInterface::insertTemplateText ( uint line, uint column, const TQString &templateString, const TQMap<TQString, TQString> &initialValues, TQWidget *parentWindow ) +{ + TQMap<TQString, TQString> enhancedInitValues( initialValues ); + + TQRegExp rx( "[$%]\\{([^}\\s]+)\\}" ); + rx.setMinimal( true ); + int pos = 0; + int opos = 0; + + while ( pos >= 0 ) + { + pos = rx.search( templateString, pos ); + + if ( pos > -1 ) + { + if ( ( pos - opos ) > 0 ) + { + if ( templateString[ pos - 1 ] == '\\' ) + { + pos = opos = pos + 1; + continue; + } + } + TQString placeholder = rx.cap( 1 ); + if ( ! enhancedInitValues.contains( placeholder ) ) + enhancedInitValues[ placeholder ] = ""; + + pos += rx.matchedLength(); + opos = pos; + } + } + + return expandMacros( enhancedInitValues, parentWindow ) + && insertTemplateTextImplementation( line, column, templateString, enhancedInitValues, parentWindow ); +} + + + +TemplateInterface *KTextEditor::templateInterface ( KTextEditor::Document *doc ) +{ + if ( !doc ) + return 0; + + return dynamic_cast<KTextEditor::TemplateInterface*>( doc ); +} + diff --git a/interfaces/tdetexteditor/templateinterface.h b/interfaces/tdetexteditor/templateinterface.h new file mode 100644 index 000000000..6ffc40e73 --- /dev/null +++ b/interfaces/tdetexteditor/templateinterface.h @@ -0,0 +1,131 @@ +/* This file is part of the KDE libraries + Copyright (C) 2004 Joseph Wenninger <[email protected]> + + 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 __tdetexteditor_templateinterface_h__ +#define __tdetexteditor_templateinterface_h__ + +#include <tqstring.h> +#include <tqmap.h> +#include <tqwidget.h> + +#include <tdelibs_export.h> + +namespace KTextEditor +{ + +class Document; + +/** + * This is an interface for inserting template strings with user editable + * fields into a document. + */ +class KTEXTEDITOR_EXPORT TemplateInterface //should be named AbstractTemplateInterface, but for consistency with the other classes it is not (for the 3.x release series) +{ + friend class PrivateTemplateInterface; + + public: + TemplateInterface(); + virtual ~TemplateInterface(); + + /** + * Parses @p templateString for macros in the form [$%]{NAME} and finds + * the value corresponding to NAME if any. The NAME string may contain + * any non-whitespace character execpt '}' + * @param initialValues a map with the keys for the macros to expand. + * keys with a value are ignored. + * @param parentWindow is used if dialogs have to be shown + * @return true if all macros was sucessfully expanded + * @see insertTemplateText for a list of supported macros + */ + static bool expandMacros( TQMap<TQString, TQString> &initialValues, TQWidget *parentWindow ); + + uint templateInterfaceNumber () const; + + protected: + void setTemplateInterfaceDCOPSuffix (const TQCString &suffix); + + public: + + /** + * Inserts an interactive ediable template text at line "line", column "col". + * @p parentWindow is used if dialogs have to be shown + * @return true if inserting the string succeeded + * + * Use insertTemplateText(numLines(), ...) to append text at end of document + * Template strings look like + * "for( int ${index}=0;${index}<10;${index}++) { ${cursor} };" + * or "%{date}" + * + * This syntax is somewhat similiar to the one found in the Eclipse editor. + * + * There are certain common placeholders (macros), which get assigned a + * default initialValue, If the second parameter does not a given value. + * For all others the initial value is the name of the placeholder. + * + * Placeholder names may only consist of a-zA-Z0-9_ + * Common placeholders and values are + * + * - index: "i" + * - loginname: The current users's loginname + * - firstname: The current user's first name retrieved from kabc + * - lastname: The current user's last name retrieved from kabc + * - fullname: The current user's first and last name retrieved from kabc + * - email: The current user's primary email adress retrieved from kabc + * - date: current date + * - time: current time + * - year: current year + * - month: current month + * - day: current day + * - hostname: hostname of the computer + * - cursor: at this position the cursor will be after editing of the + * template has finished, this has to be taken care of by the actual + * implementation. The placeholder gets a value of "|" assigned. + * + * If a macro is started with a % (persent sign) like "%{date}" it isn't added + * to the list editable strings ( for example TAB key navigation) if a value + * differing from the macro name is found. + * + * If the editor supports some kind of smart indentation, the inserted code + * should be layouted by the indenter. + */ + bool insertTemplateText ( uint line, uint column, const TQString &templateString, const TQMap<TQString,TQString> &initialValues, TQWidget *parentWindow=0); + +protected: + /** + * You must implement this, it is called by insertTemplateText, after all + * default values are inserted. If you are implementing this interface, + * this method should work as described in the documentation for + * insertTemplateText above. + * @return true if any text was inserted. + */ + virtual bool insertTemplateTextImplementation ( uint line, uint column, const TQString &templateString, const TQMap<TQString,TQString> &initialValues, TQWidget *parentWindow=0 )=0; + + /** + * only for the interface itself - REAL PRIVATE + */ + private: + class PrivateTemplateInterface *d; + static uint globalTemplateInterfaceNumber; + uint myTemplateInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT TemplateInterface *templateInterface (Document *doc); + +} + +#endif diff --git a/interfaces/tdetexteditor/texthintinterface.cpp b/interfaces/tdetexteditor/texthintinterface.cpp new file mode 100644 index 000000000..f6aa4f0b3 --- /dev/null +++ b/interfaces/tdetexteditor/texthintinterface.cpp @@ -0,0 +1,66 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + 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. +*/ + + +#include "texthintinterface.h" +#include "view.h" + +using namespace KTextEditor; + +namespace KTextEditor +{ + class PrivateTextHintInterface + { + public: + PrivateTextHintInterface() {} + ~PrivateTextHintInterface(){} + + }; + +unsigned int TextHintInterface::globalTextHintInterfaceNumber = 0; + +TextHintInterface::TextHintInterface() +{ + globalTextHintInterfaceNumber++; + myTextHintInterfaceNumber = globalTextHintInterfaceNumber++; + + d = new PrivateTextHintInterface(); +} + +TextHintInterface::~TextHintInterface() +{ + delete d; +} + +unsigned int TextHintInterface::textHintInterfaceNumber () const +{ + return myTextHintInterfaceNumber; +} + + +TextHintInterface *textHintInterface (View *view) +{ + if (!view) + return 0; + + return dynamic_cast<KTextEditor::TextHintInterface*>(view); +} + + +} + diff --git a/interfaces/tdetexteditor/texthintinterface.h b/interfaces/tdetexteditor/texthintinterface.h new file mode 100644 index 000000000..4e6a5e12c --- /dev/null +++ b/interfaces/tdetexteditor/texthintinterface.h @@ -0,0 +1,79 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Joseph Wenninger <[email protected]> + + 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 __tdetexteditor_texthintinterface_h__ +#define __tdetexteditor_texthintinterface_h__ + +#include <tqstring.h> +#include <tqstringlist.h> + +#include <tdelibs_export.h> + +namespace KTextEditor +{ + +/** + * This is an interface for the KTextEditor::View class. + + */ +class KTEXTEDITOR_EXPORT TextHintInterface +{ + friend class PrivateTextHintInterface; +public: + TextHintInterface(); + virtual ~TextHintInterface(); + + /** + * enable Texthints. If they are enabled a signal needTextHint is emitted, if the mouse + * changed the position and a new character is beneath the mouse cursor. The signal is delayed + * for a certain time, specifiedin the timeout parameter. + */ + virtual void enableTextHints(int timeout)=0; + + /** + * Disable texthints. Per default they are disabled. + */ + virtual void disableTextHints()=0; + + /** + * This method returns a number, unique during one application run + * + */ + unsigned int textHintInterfaceNumber () const; + + + //signals + + /** + * emit this signal, if a tooltip text is needed for displaying. + * I you don't want a tooltip to be displayd set text to an emtpy string in a connected slot, + * otherwise set text to the string you want the editor to display + */ + virtual void needTextHint(int line, int col, TQString &text)=0; + + private: + class PrivateTextHintInterface *d; + static unsigned int globalTextHintInterfaceNumber; + unsigned int myTextHintInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT TextHintInterface *textHintInterface (class View *view); + +} + +#endif diff --git a/interfaces/tdetexteditor/undodcopinterface.cpp b/interfaces/tdetexteditor/undodcopinterface.cpp new file mode 100644 index 000000000..69eb2ebd5 --- /dev/null +++ b/interfaces/tdetexteditor/undodcopinterface.cpp @@ -0,0 +1,57 @@ +#include "undodcopinterface.h" +#include "undointerface.h" + +#include <dcopclient.h> +using namespace KTextEditor; + +UndoDCOPInterface::UndoDCOPInterface( UndoInterface *Parent, const char *name) + : DCOPObject(name) +{ + m_parent = Parent; +} + +UndoDCOPInterface::~UndoDCOPInterface() +{ + +} + +uint UndoDCOPInterface::undoInterfaceNumber () +{ + return m_parent->undoInterfaceNumber(); +} +void UndoDCOPInterface::undo () +{ + m_parent->undo(); +} +void UndoDCOPInterface::redo () +{ + m_parent->redo(); +} +void UndoDCOPInterface::clearUndo () +{ + m_parent->clearUndo(); +} +void UndoDCOPInterface::clearRedo () +{ + m_parent->clearRedo(); +} +uint UndoDCOPInterface::undoCount () +{ + return m_parent->undoCount(); +} +uint UndoDCOPInterface::redoCount () +{ + return m_parent->redoCount(); +} +uint UndoDCOPInterface::undoSteps () +{ + return m_parent->undoSteps(); +} +void UndoDCOPInterface::setUndoSteps ( uint steps ) +{ + m_parent->setUndoSteps(steps); +} +void UndoDCOPInterface::undoChanged () +{ + m_parent->undoChanged(); +} diff --git a/interfaces/tdetexteditor/undodcopinterface.h b/interfaces/tdetexteditor/undodcopinterface.h new file mode 100644 index 000000000..b1a217036 --- /dev/null +++ b/interfaces/tdetexteditor/undodcopinterface.h @@ -0,0 +1,54 @@ +#ifndef Undo_DCOP_INTERFACE_H +#define Undo_DCOP_INTERFACE_H + +#include <dcopobject.h> +#include <dcopref.h> +#include <tqstringlist.h> +#include <tqcstring.h> +//#include "editdcopinterface.moc" +namespace KTextEditor +{ + class UndoInterface; + /** + This is the main interface to the UndoInterface of KTextEdit. + This will provide a consistant dcop interface to all KDE applications that use it. + @short DCOP interface to UndoInterface. + @author Ian Reinhart Geiser <[email protected]> + */ + class KTEXTEDITOR_EXPORT UndoDCOPInterface : virtual public DCOPObject + { + K_DCOP + + public: + /** + Construct a new interface object for the text editor. + @param Parent the parent UndoInterface object + that will provide us with the functions for the interface. + @param name the QObject's name + */ + UndoDCOPInterface( UndoInterface *Parent, const char *name ); + /** + Destructor + Cleans up the object. + */ + virtual ~UndoDCOPInterface(); + k_dcop: + uint undoInterfaceNumber (); + void undo (); + void redo () ; + void clearUndo () ; + void clearRedo () ; + uint undoCount () ; + uint redoCount (); + uint undoSteps () ; + void setUndoSteps ( uint steps ); + void undoChanged (); + + + private: + UndoInterface *m_parent; + }; +} +#endif + + diff --git a/interfaces/tdetexteditor/undointerface.cpp b/interfaces/tdetexteditor/undointerface.cpp new file mode 100644 index 000000000..30a1dd292 --- /dev/null +++ b/interfaces/tdetexteditor/undointerface.cpp @@ -0,0 +1,74 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "undointerface.h" +#include "undodcopinterface.h" +#include "document.h" + +namespace KTextEditor +{ + +class PrivateUndoInterface +{ + public: + PrivateUndoInterface() {interface = 0;} + ~PrivateUndoInterface() {} + UndoDCOPInterface *interface; +}; + +} + +using namespace KTextEditor; + +unsigned int UndoInterface::globalUndoInterfaceNumber = 0; + +UndoInterface::UndoInterface() +{ + globalUndoInterfaceNumber++; + myUndoInterfaceNumber = globalUndoInterfaceNumber++; + + d = new PrivateUndoInterface(); + TQString name = "UndoInterface#" + TQString::number(myUndoInterfaceNumber); + d->interface = new UndoDCOPInterface(this, name.latin1()); +} + +UndoInterface::~UndoInterface() +{ + delete d->interface; + delete d; +} + +unsigned int UndoInterface::undoInterfaceNumber () const +{ + return myUndoInterfaceNumber; +} + +void UndoInterface::setUndoInterfaceDCOPSuffix (const TQCString &suffix) +{ + d->interface->setObjId ("UndoInterface#"+suffix); +} + +UndoInterface *KTextEditor::undoInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::UndoInterface*>(doc); +} diff --git a/interfaces/tdetexteditor/undointerface.h b/interfaces/tdetexteditor/undointerface.h new file mode 100644 index 000000000..33162e43a --- /dev/null +++ b/interfaces/tdetexteditor/undointerface.h @@ -0,0 +1,84 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_undointerface_h__ +#define __tdetexteditor_undointerface_h__ + +#include <tdelibs_export.h> + +class TQCString; + +namespace KTextEditor +{ + +/** +* This is an interface to undo functionality of a Document. +*/ +class KTEXTEDITOR_EXPORT UndoInterface +{ + friend class PrivateUndoInterface; + + public: + UndoInterface (); + virtual ~UndoInterface (); + + unsigned int undoInterfaceNumber () const; + + protected: + void setUndoInterfaceDCOPSuffix (const TQCString &suffix); + + // + // slots !!! + // + public: + virtual void undo () = 0; + + virtual void redo () = 0; + + virtual void clearUndo () = 0; + + virtual void clearRedo () = 0; + + virtual unsigned int undoCount () const = 0; + + virtual unsigned int redoCount () const = 0; + + /** + returns the maximum of undo steps possible, 0 means no limit ! + */ + virtual unsigned int undoSteps () const = 0; + + virtual void setUndoSteps ( unsigned int steps ) = 0; + + // + // signals !!! + // + public: + virtual void undoChanged () = 0; + + private: + class PrivateUndoInterface *d; + static unsigned int globalUndoInterfaceNumber; + unsigned int myUndoInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT UndoInterface *undoInterface (class Document *doc); + +} + +#endif diff --git a/interfaces/tdetexteditor/variableinterface.cpp b/interfaces/tdetexteditor/variableinterface.cpp new file mode 100644 index 000000000..616e0beab --- /dev/null +++ b/interfaces/tdetexteditor/variableinterface.cpp @@ -0,0 +1,48 @@ +/* + 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. + + --- + Copyright (C) 2004, Anders Lund <[email protected]> +*/ + +#include "variableinterface.h" +#include "document.h" + +using namespace KTextEditor; + +unsigned int VariableInterface::globalVariableInterfaceNumber = 0; + +VariableInterface::VariableInterface() +{ + globalVariableInterfaceNumber++; + myVariableInterfaceNumber = globalVariableInterfaceNumber++; +} + +VariableInterface::~VariableInterface() +{ +} + +unsigned int VariableInterface::variableInterfaceNumber() +{ + return myVariableInterfaceNumber; +} + +VariableInterface *KTextEditor::variableInterface( Document *doc ) +{ + if ( ! doc ) + return 0; + + return dynamic_cast<KTextEditor::VariableInterface*>(doc); +} diff --git a/interfaces/tdetexteditor/variableinterface.h b/interfaces/tdetexteditor/variableinterface.h new file mode 100644 index 000000000..31310a43c --- /dev/null +++ b/interfaces/tdetexteditor/variableinterface.h @@ -0,0 +1,72 @@ +/* + 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. + + --- + Copyright (C) 2004, Anders Lund <[email protected]> +*/ +#ifndef _KTEXTEDITOR_VARIABLE_INTERFACE_H_ +#define _KTEXTEDITOR_VARIABLE_INTERFACE_H_ + +#include <tdelibs_export.h> + +class TQString; + +namespace KTextEditor { + +/** + * This interface is designed to provide access to "document variables", + * for example variables defined in files like "kate: variable value;" + * or the emacs style "-*- variable: value -*-". + * + * The purpose is to allow KTE plugins to use variables. + * A document implementing this interface should return values for variable + * that it does not otherwise know how to use, since they could be of interrest + * to plugins. A document implementing this interface must emit the variableChanged() + * signal whenever a variable is set that it will return a value for. + * + * @short KTextEditor interface to Document Variables + */ +class KTEXTEDITOR_EXPORT VariableInterface +{ + public: + VariableInterface(); + virtual ~VariableInterface(); + + unsigned int variableInterfaceNumber(); + + /** + * @return the value of the variable @p name, or an empty string if the + * variable is not set or has no value. + */ + virtual TQString variable( const TQString &name ) const = 0; + + // + // signals!! + // + public: + /** + * Signal: emitted when a variable is set + */ + virtual void variableChanged( const TQString &variable, const TQString &value ) = 0; + + private: + static unsigned int globalVariableInterfaceNumber; + unsigned int myVariableInterfaceNumber; +}; + + +KTEXTEDITOR_EXPORT VariableInterface *variableInterface( class Document * ); +} // namespace KTextEditor +#endif //_KTEXTEDITOR_VARIABLE_INTERFACE_H_ diff --git a/interfaces/tdetexteditor/view.h b/interfaces/tdetexteditor/view.h new file mode 100644 index 000000000..0a807d6b3 --- /dev/null +++ b/interfaces/tdetexteditor/view.h @@ -0,0 +1,68 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_view_h__ +#define __tdetexteditor_view_h__ + +#include <tqwidget.h> +#include <kxmlguiclient.h> + +namespace KTextEditor +{ + +/** + * The View class represents a single view of a Document . + */ + +class KTEXTEDITOR_EXPORT View : public TQWidget, public KXMLGUIClient +{ + friend class PrivateView; + + Q_OBJECT + + public: + /** + * Create a new view to the given document. The document must be non-null. + */ + View ( class Document *, TQWidget *parent, const char *name = 0 ); + virtual ~View (); + + /** + * Returns the number of this view + */ + unsigned int viewNumber () const; + + /** + * Returns the DCOP suffix to allow identification of this view's DCOP interface. + */ + TQCString viewDCOPSuffix () const; + + /** + * Acess the parent Document. + */ + virtual class Document *document () const = 0; + + private: + class PrivateView *d; + static unsigned int globalViewNumber; + unsigned int myViewNumber; +}; + +} + +#endif diff --git a/interfaces/tdetexteditor/viewcursordcopinterface.cpp b/interfaces/tdetexteditor/viewcursordcopinterface.cpp new file mode 100644 index 000000000..f26385414 --- /dev/null +++ b/interfaces/tdetexteditor/viewcursordcopinterface.cpp @@ -0,0 +1,68 @@ +#include "viewcursordcopinterface.h" +#include "viewcursorinterface.h" + +#include <tqpoint.h> + +#include <dcopclient.h> +using namespace KTextEditor; + +ViewCursorDCOPInterface::ViewCursorDCOPInterface( ViewCursorInterface *Parent, const char *name) + : DCOPObject(name) +{ + m_parent = Parent; +} + +ViewCursorDCOPInterface::~ViewCursorDCOPInterface() +{ + +} + +uint ViewCursorDCOPInterface::viewCursorInterfaceNumber () +{ + return m_parent->viewCursorInterfaceNumber (); +} + +::TQPoint ViewCursorDCOPInterface::cursorCoordinates () +{ + return m_parent->cursorCoordinates (); +} + +void ViewCursorDCOPInterface::cursorPosition (uint line, uint col) +{ + m_parent->cursorPosition (&line, &col); +} + +void ViewCursorDCOPInterface::cursorPositionReal (uint line, uint col) +{ + m_parent->cursorPositionReal (&line, &col); +} + +bool ViewCursorDCOPInterface::setCursorPosition (uint line, uint col) +{ + return m_parent->setCursorPosition ( line, col); +} + +bool ViewCursorDCOPInterface::setCursorPositionReal (uint line, uint col) +{ + return m_parent->setCursorPositionReal ( line, col); +} + +uint ViewCursorDCOPInterface::cursorLine () +{ + return m_parent->cursorLine (); +} + +uint ViewCursorDCOPInterface::cursorColumn () +{ + return m_parent->cursorColumn (); +} + +uint ViewCursorDCOPInterface::cursorColumnReal () +{ + return m_parent->cursorColumnReal (); +} + +void ViewCursorDCOPInterface::cursorPositionChanged () +{ + m_parent->cursorPositionChanged (); +} diff --git a/interfaces/tdetexteditor/viewcursordcopinterface.h b/interfaces/tdetexteditor/viewcursordcopinterface.h new file mode 100644 index 000000000..4bae0b520 --- /dev/null +++ b/interfaces/tdetexteditor/viewcursordcopinterface.h @@ -0,0 +1,74 @@ +#ifndef ViewCursor_DCOP_INTERFACE_H +#define ViewCursor_DCOP_INTERFACE_H + +#include <dcopobject.h> +#include <dcopref.h> +#include <tqstringlist.h> +#include <tqcstring.h> +//#include "editdcopinterface.moc" +namespace KTextEditor +{ + class ViewCursorInterface; + /** + This is the main interface to the ViewCursorInterface of KTextEdit. + This will provide a consistant dcop interface to all KDE applications that use it. + @short DCOP interface to ViewCursorInterface. + @author Ian Reinhart Geiser <[email protected]> + */ + class KTEXTEDITOR_EXPORT ViewCursorDCOPInterface : virtual public DCOPObject + { + K_DCOP + + public: + /** + Construct a new interface object for the text editor. + @param Parent the parent ViewCursorInterface object + that will provide us with the functions for the interface. + @param name the QObject's name + */ + ViewCursorDCOPInterface( ViewCursorInterface *Parent, const char *name ); + /** + Destructor + Cleans up the object. + */ + virtual ~ViewCursorDCOPInterface(); + k_dcop: + + uint viewCursorInterfaceNumber (); + /** + * Get the current cursor coordinates in pixels. + */ + class TQPoint cursorCoordinates (); + + /** + * Get the cursor position + */ + void cursorPosition (uint line, uint col); + + /** + * Get the cursor position, calculated with 1 character per tab + */ + void cursorPositionReal (uint line, uint col); + + /** + * Set the cursor position + */ + bool setCursorPosition (uint line, uint col); + + /** + * Set the cursor position, use 1 character per tab + */ + bool setCursorPositionReal (uint line, uint col); + + uint cursorLine (); + uint cursorColumn (); + uint cursorColumnReal (); + void cursorPositionChanged (); + + private: + ViewCursorInterface *m_parent; + }; +} +#endif + + diff --git a/interfaces/tdetexteditor/viewcursorinterface.cpp b/interfaces/tdetexteditor/viewcursorinterface.cpp new file mode 100644 index 000000000..58cea6289 --- /dev/null +++ b/interfaces/tdetexteditor/viewcursorinterface.cpp @@ -0,0 +1,74 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "viewcursorinterface.h" +#include "viewcursordcopinterface.h" +#include "view.h" + +namespace KTextEditor +{ + +class PrivateViewCursorInterface +{ + public: + PrivateViewCursorInterface() {interface=0;} + ~PrivateViewCursorInterface() {} + ViewCursorDCOPInterface *interface; +}; + +} + +using namespace KTextEditor; + +unsigned int ViewCursorInterface::globalViewCursorInterfaceNumber = 0; + +ViewCursorInterface::ViewCursorInterface() +{ + globalViewCursorInterfaceNumber++; + myViewCursorInterfaceNumber = globalViewCursorInterfaceNumber++; + + d = new PrivateViewCursorInterface(); + TQString name = "ViewCursorInterface#" + TQString::number(myViewCursorInterfaceNumber); + d->interface = new ViewCursorDCOPInterface(this, name.latin1()); +} + +ViewCursorInterface::~ViewCursorInterface() +{ + delete d->interface; + delete d; +} + +unsigned int ViewCursorInterface::viewCursorInterfaceNumber () const +{ + return myViewCursorInterfaceNumber; +} + +void ViewCursorInterface::setViewCursorInterfaceDCOPSuffix (const TQCString &suffix) +{ + d->interface->setObjId ("ViewCursorInterface#"+suffix); +} + +ViewCursorInterface *KTextEditor::viewCursorInterface (View *view) +{ + if (!view) + return 0; + + return dynamic_cast<KTextEditor::ViewCursorInterface*>(view); +} diff --git a/interfaces/tdetexteditor/viewcursorinterface.h b/interfaces/tdetexteditor/viewcursorinterface.h new file mode 100644 index 000000000..2fe7241e4 --- /dev/null +++ b/interfaces/tdetexteditor/viewcursorinterface.h @@ -0,0 +1,95 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann ([email protected]) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 __tdetexteditor_viewcursorinterface_h__ +#define __tdetexteditor_viewcursorinterface_h__ + +#include <tdelibs_export.h> + +class TQCString; + +namespace KTextEditor +{ + +/** +* This is an interface to access the text cursor of a View class. +*/ +class KTEXTEDITOR_EXPORT ViewCursorInterface +{ + friend class PrivateViewCursorInterface; + + public: + ViewCursorInterface (); + virtual ~ViewCursorInterface (); + + unsigned int viewCursorInterfaceNumber () const; + + protected: + void setViewCursorInterfaceDCOPSuffix (const TQCString &suffix); + + // + // slots !!! + // + public: + /** + * Get the current cursor coordinates in pixels. + */ + virtual class TQPoint cursorCoordinates () = 0; + + /** + * Get the cursor position + */ + virtual void cursorPosition (unsigned int *line, unsigned int *col) = 0; + + /** + * Get the cursor position, calculated with 1 character per tab + */ + virtual void cursorPositionReal (unsigned int *line, unsigned int *col) = 0; + + /** + * Set the cursor position + */ + virtual bool setCursorPosition (unsigned int line, unsigned int col) = 0; + + /** + * Set the cursor position, use 1 character per tab + */ + virtual bool setCursorPositionReal (unsigned int line, unsigned int col) = 0; + + virtual unsigned int cursorLine () = 0; + virtual unsigned int cursorColumn () = 0; + virtual unsigned int cursorColumnReal () = 0; + + // + // signals !!! + // + public: + virtual void cursorPositionChanged () = 0; + + private: + class PrivateViewCursorInterface *d; + static unsigned int globalViewCursorInterfaceNumber; + unsigned int myViewCursorInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT ViewCursorInterface *viewCursorInterface (class View *view); + +} + +#endif diff --git a/interfaces/tdetexteditor/viewstatusmsgdcopinterface.cpp b/interfaces/tdetexteditor/viewstatusmsgdcopinterface.cpp new file mode 100644 index 000000000..d38b9b938 --- /dev/null +++ b/interfaces/tdetexteditor/viewstatusmsgdcopinterface.cpp @@ -0,0 +1,29 @@ +#include "viewstatusmsgdcopinterface.h" +#include "viewstatusmsginterface.h" + +#include <tqstring.h> + +#include <dcopclient.h> +using namespace KTextEditor; + +ViewStatusMsgDCOPInterface::ViewStatusMsgDCOPInterface( ViewStatusMsgInterface *Parent, const char *name) + : DCOPObject(name) +{ + m_parent = Parent; +} + +ViewStatusMsgDCOPInterface::~ViewStatusMsgDCOPInterface() +{ + +} + +uint ViewStatusMsgDCOPInterface::viewStatusMsgInterfaceNumber () +{ + return m_parent->viewStatusMsgInterfaceNumber (); +} + +void ViewStatusMsgDCOPInterface::viewStatusMsg (TQString msg) +{ + m_parent->viewStatusMsg(msg); +} + diff --git a/interfaces/tdetexteditor/viewstatusmsgdcopinterface.h b/interfaces/tdetexteditor/viewstatusmsgdcopinterface.h new file mode 100644 index 000000000..b4c5cf72e --- /dev/null +++ b/interfaces/tdetexteditor/viewstatusmsgdcopinterface.h @@ -0,0 +1,45 @@ +#ifndef ViewStatusMsg_DCOP_INTERFACE_H +#define ViewStatusMsg_DCOP_INTERFACE_H + +#include <dcopobject.h> +#include <dcopref.h> +#include <tqstringlist.h> +#include <tqcstring.h> +//#include "editdcopinterface.moc" +namespace KTextEditor +{ + class ViewStatusMsgInterface; + /** + This is the main interface to the ViewStatusMsgInterface of KTextEdit. + This will provide a consistant dcop interface to all KDE applications that use it. + @short DCOP interface to ViewStatusMsgInterface. + @author Ian Reinhart Geiser <[email protected]> + */ + class KTEXTEDITOR_EXPORT ViewStatusMsgDCOPInterface : virtual public DCOPObject + { + K_DCOP + + public: + /** + Construct a new interface object for the text editor. + @param Parent the parent ViewStatusMsgInterface object + that will provide us with the functions for the interface. + @param name the QObject's name + */ + ViewStatusMsgDCOPInterface( ViewStatusMsgInterface *Parent, const char *name ); + /** + Destructor + Cleans up the object. + */ + virtual ~ViewStatusMsgDCOPInterface(); + k_dcop: + uint viewStatusMsgInterfaceNumber (); + void viewStatusMsg (class TQString msg) ; + + private: + ViewStatusMsgInterface *m_parent; + }; +} +#endif + + diff --git a/interfaces/tdetexteditor/viewstatusmsginterface.cpp b/interfaces/tdetexteditor/viewstatusmsginterface.cpp new file mode 100644 index 000000000..af8870c80 --- /dev/null +++ b/interfaces/tdetexteditor/viewstatusmsginterface.cpp @@ -0,0 +1,76 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "viewstatusmsginterface.h" +#include "viewstatusmsgdcopinterface.h" +#include "view.h" + +#include <tqstring.h> + +namespace KTextEditor +{ + +class PrivateViewStatusMsgInterface +{ + public: + PrivateViewStatusMsgInterface() {interface=0;} + ~PrivateViewStatusMsgInterface() {} + ViewStatusMsgDCOPInterface *interface; +}; + +} + +using namespace KTextEditor; + +unsigned int ViewStatusMsgInterface::globalViewStatusMsgInterfaceNumber = 0; + +ViewStatusMsgInterface::ViewStatusMsgInterface() +{ + globalViewStatusMsgInterfaceNumber++; + myViewStatusMsgInterfaceNumber = globalViewStatusMsgInterfaceNumber++; + + d = new PrivateViewStatusMsgInterface(); + ::TQString name = "ViewStatusMsgInterface#" + ::TQString::number(myViewStatusMsgInterfaceNumber); + d->interface = new ViewStatusMsgDCOPInterface(this, name.latin1()); +} + +ViewStatusMsgInterface::~ViewStatusMsgInterface() +{ + delete d->interface; + delete d; +} + +unsigned int ViewStatusMsgInterface::viewStatusMsgInterfaceNumber () const +{ + return myViewStatusMsgInterfaceNumber; +} + +void ViewStatusMsgInterface::setViewStatusMsgInterfaceDCOPSuffix (const TQCString &suffix) +{ + d->interface->setObjId ("ViewStatusMsgInterface#"+suffix); +} + +ViewStatusMsgInterface *KTextEditor::viewStatusMsgInterface (View *view) +{ + if (!view) + return 0; + + return dynamic_cast<KTextEditor::ViewStatusMsgInterface*>(view); +} diff --git a/interfaces/tdetexteditor/viewstatusmsginterface.h b/interfaces/tdetexteditor/viewstatusmsginterface.h new file mode 100644 index 000000000..3516f8758 --- /dev/null +++ b/interfaces/tdetexteditor/viewstatusmsginterface.h @@ -0,0 +1,63 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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 __tdetexteditor_viewstatusmsginterface_h__ +#define __tdetexteditor_viewstatusmsginterface_h__ + +#include <tdelibs_export.h> + +class TQString; +class TQCString; + +namespace KTextEditor +{ + +/** +* This is an interface for retrieving status bar messages from the Document class. +*/ +class KTEXTEDITOR_EXPORT ViewStatusMsgInterface +{ + friend class PrivateViewStatusMsgInterface; + + public: + ViewStatusMsgInterface(); + virtual ~ViewStatusMsgInterface(); + + unsigned int viewStatusMsgInterfaceNumber () const; + + protected: + void setViewStatusMsgInterfaceDCOPSuffix (const TQCString &suffix); + + // + // signals !!! + // + public: + virtual void viewStatusMsg (const class TQString &msg) = 0; + + + private: + class PrivateViewStatusMsgInterface *d; + static unsigned int globalViewStatusMsgInterfaceNumber; + unsigned int myViewStatusMsgInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT ViewStatusMsgInterface *viewStatusMsgInterface (class View *view); + +} + +#endif diff --git a/interfaces/tdetexteditor/wordwrapinterface.cpp b/interfaces/tdetexteditor/wordwrapinterface.cpp new file mode 100644 index 000000000..6be76120b --- /dev/null +++ b/interfaces/tdetexteditor/wordwrapinterface.cpp @@ -0,0 +1,70 @@ +/* This file is part of the KDE libraries + Copyright (C) 2001 Christoph Cullmann <[email protected]> + + 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. +*/ + +// $Id$ + +#include "wordwrapinterface.h" +#include "document.h" + + +namespace KTextEditor +{ + +class PrivateWordWrapInterface +{ + public: + PrivateWordWrapInterface() {} + ~PrivateWordWrapInterface() {} +}; + +} + +using namespace KTextEditor; + +unsigned int WordWrapInterface::globalWordWrapInterfaceNumber = 0; + +WordWrapInterface::WordWrapInterface() +{ + globalWordWrapInterfaceNumber++; + myWordWrapInterfaceNumber = globalWordWrapInterfaceNumber++; + + d = new PrivateWordWrapInterface(); +} + +WordWrapInterface::~WordWrapInterface() +{ + delete d; +} + +unsigned int WordWrapInterface::wordWrapInterfaceNumber () const +{ + return myWordWrapInterfaceNumber; +} + +void WordWrapInterface::setWordWrapInterfaceDCOPSuffix (const TQCString &/*suffix*/) +{ + //d->interface->setObjId ("WordWrapInterface#"+suffix); +} + +WordWrapInterface *KTextEditor::wordWrapInterface (Document *doc) +{ + if (!doc) + return 0; + + return dynamic_cast<KTextEditor::WordWrapInterface*>(doc); +} diff --git a/interfaces/tdetexteditor/wordwrapinterface.h b/interfaces/tdetexteditor/wordwrapinterface.h new file mode 100644 index 000000000..55cc2ded9 --- /dev/null +++ b/interfaces/tdetexteditor/wordwrapinterface.h @@ -0,0 +1,66 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Christoph Cullmann ([email protected]) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + 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 __tdetexteditor_wordwrapinterface_h__ +#define __tdetexteditor_wordwrapinterface_h__ + +#include <tdelibs_export.h> + +class TQCString; + +namespace KTextEditor +{ + +/** +* This is an interface to control fixed-column word-wrapping of a Document. +*/ +class KTEXTEDITOR_EXPORT WordWrapInterface +{ + friend class PrivateWordWrapInterface; + + public: + WordWrapInterface (); + virtual ~WordWrapInterface (); + + unsigned int wordWrapInterfaceNumber () const; + + protected: + void setWordWrapInterfaceDCOPSuffix (const TQCString &suffix); + + // + // slots !!! + // + public: + virtual void setWordWrap (bool) = 0; + virtual bool wordWrap () = 0; + + virtual void setWordWrapAt (unsigned int ) = 0; + virtual unsigned int wordWrapAt () = 0; + + private: + class PrivateWordWrapInterface *d; + static unsigned int globalWordWrapInterfaceNumber; + unsigned int myWordWrapInterfaceNumber; +}; + +KTEXTEDITOR_EXPORT WordWrapInterface *wordWrapInterface (class Document *doc); + +} + +#endif |