summaryrefslogtreecommitdiffstats
path: root/interfaces/ktexteditor/ktexteditor.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /interfaces/ktexteditor/ktexteditor.cpp
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'interfaces/ktexteditor/ktexteditor.cpp')
-rw-r--r--interfaces/ktexteditor/ktexteditor.cpp231
1 files changed, 231 insertions, 0 deletions
diff --git a/interfaces/ktexteditor/ktexteditor.cpp b/interfaces/ktexteditor/ktexteditor.cpp
new file mode 100644
index 000000000..be92cdedb
--- /dev/null
+++ b/interfaces/ktexteditor/ktexteditor.cpp
@@ -0,0 +1,231 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001 Christoph Cullmann (cullmann@kde.org)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License 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 <kparts/factory.h>
+#include <kparts/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( QObject *parent, const char *name ) : KTextEditor::Editor (parent, name )
+{
+ globalDocumentNumber++;
+ myDocumentNumber = globalDocumentNumber;
+}
+
+Document::~Document()
+{
+}
+
+unsigned int Document::documentNumber () const
+{
+ return myDocumentNumber;
+}
+
+QCString Document::documentDCOPSuffix () const
+{
+ QCString num;
+ num.setNum (documentNumber());
+
+ return num;
+}
+
+View::View( Document *, QWidget *parent, const char *name ) : QWidget( parent, name )
+{
+ globalViewNumber++;
+ myViewNumber = globalViewNumber;
+}
+
+View::~View()
+{
+}
+
+unsigned int View::viewNumber () const
+{
+ return myViewNumber;
+}
+
+QCString View::viewDCOPSuffix () const
+{
+ QCString num1, num2;
+ num1.setNum (viewNumber());
+ num2.setNum (document()->documentNumber());
+
+ return num2 + "-" + num1;
+}
+
+Plugin::Plugin( Document *document, const char *name ) : QObject (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( QObject *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, QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name )
+{
+ return KParts::ComponentFactory::createPartInstanceFromLibrary<Editor>( libname, parentWidget, widgetName, parent, name );
+}
+
+Document *KTextEditor::createDocument ( const char* libname, QObject *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 static_cast<PluginViewInterface*>(plugin->qt_cast("KTextEditor::PluginViewInterface"));
+}
+