interfaces Library API Documentation

ktexteditor.cpp

00001 /* This file is part of the KDE project 00002 Copyright (C) 2001 Christoph Cullmann (cullmann@kde.org) 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #include <config.h> 00021 00022 #include "document.h" 00023 #include "view.h" 00024 #include "plugin.h" 00025 #include "editor.h" 00026 00027 #include <kaction.h> 00028 #include <kparts/factory.h> 00029 #include <kparts/componentfactory.h> 00030 00031 #include "document.moc" 00032 #include "view.moc" 00033 #include "plugin.moc" 00034 #include "editor.moc" 00035 00036 using namespace KTextEditor; 00037 00038 namespace KTextEditor 00039 { 00040 class PrivateDocument 00041 { 00042 public: 00043 PrivateDocument () 00044 { 00045 } 00046 00047 ~PrivateDocument() 00048 { 00049 } 00050 }; 00051 00052 class PrivateView 00053 { 00054 public: 00055 PrivateView () 00056 { 00057 } 00058 00059 ~PrivateView() 00060 { 00061 } 00062 }; 00063 00064 class PrivatePlugin 00065 { 00066 public: 00067 PrivatePlugin () 00068 { 00069 } 00070 00071 ~PrivatePlugin () 00072 { 00073 } 00074 00075 class Document *m_doc; 00076 }; 00077 00078 class PrivatePluginViewInterface 00079 { 00080 public: 00081 PrivatePluginViewInterface () 00082 { 00083 } 00084 00085 ~PrivatePluginViewInterface () 00086 { 00087 } 00088 }; 00089 00090 class PrivateEditor 00091 { 00092 public: 00093 PrivateEditor () 00094 { 00095 } 00096 00097 ~PrivateEditor() 00098 { 00099 } 00100 }; 00101 } 00102 00103 unsigned int Document::globalDocumentNumber = 0; 00104 unsigned int View::globalViewNumber = 0; 00105 unsigned int Plugin::globalPluginNumber = 0; 00106 unsigned int PluginViewInterface::globalPluginViewInterfaceNumber = 0; 00107 unsigned int Editor::globalEditorNumber = 0; 00108 00109 Document::Document( QObject *parent, const char *name ) : KTextEditor::Editor (parent, name ) 00110 { 00111 globalDocumentNumber++; 00112 myDocumentNumber = globalDocumentNumber; 00113 } 00114 00115 Document::~Document() 00116 { 00117 } 00118 00119 unsigned int Document::documentNumber () const 00120 { 00121 return myDocumentNumber; 00122 } 00123 00124 QCString Document::documentDCOPSuffix () const 00125 { 00126 QCString num; 00127 num.setNum (documentNumber()); 00128 00129 return num; 00130 } 00131 00132 View::View( Document *, QWidget *parent, const char *name ) : QWidget( parent, name ) 00133 { 00134 globalViewNumber++; 00135 myViewNumber = globalViewNumber; 00136 } 00137 00138 View::~View() 00139 { 00140 } 00141 00142 unsigned int View::viewNumber () const 00143 { 00144 return myViewNumber; 00145 } 00146 00147 QCString View::viewDCOPSuffix () const 00148 { 00149 QCString num1, num2; 00150 num1.setNum (viewNumber()); 00151 num2.setNum (document()->documentNumber()); 00152 00153 return num2 + "-" + num1; 00154 } 00155 00156 Plugin::Plugin( Document *document, const char *name ) : QObject (document, name ) 00157 { 00158 globalPluginNumber++; 00159 myPluginNumber = globalPluginNumber; 00160 d = new PrivatePlugin (); 00161 d->m_doc = document; 00162 } 00163 00164 Plugin::~Plugin() 00165 { 00166 } 00167 00168 unsigned int Plugin::pluginNumber () const 00169 { 00170 return myPluginNumber; 00171 } 00172 00173 Document *Plugin::document () const 00174 { 00175 return d->m_doc; 00176 } 00177 00178 PluginViewInterface::PluginViewInterface() 00179 { 00180 globalPluginViewInterfaceNumber++; 00181 myPluginViewInterfaceNumber = globalPluginViewInterfaceNumber; 00182 } 00183 00184 PluginViewInterface::~PluginViewInterface() 00185 { 00186 } 00187 00188 unsigned int PluginViewInterface::pluginViewInterfaceNumber () const 00189 { 00190 return myPluginViewInterfaceNumber; 00191 } 00192 00193 Editor::Editor( QObject *parent, const char *name ) : KParts::ReadWritePart( parent, name ) 00194 { 00195 globalEditorNumber++; 00196 myEditorNumber = globalEditorNumber; 00197 } 00198 00199 Editor::~Editor() 00200 { 00201 } 00202 00203 unsigned int Editor::editorNumber () const 00204 { 00205 return myEditorNumber; 00206 } 00207 00208 Editor *KTextEditor::createEditor ( const char* libname, QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name ) 00209 { 00210 return KParts::ComponentFactory::createPartInstanceFromLibrary<Editor>( libname, parentWidget, widgetName, parent, name ); 00211 } 00212 00213 Document *KTextEditor::createDocument ( const char* libname, QObject *parent, const char *name ) 00214 { 00215 return KParts::ComponentFactory::createPartInstanceFromLibrary<Document>( libname, 0, 0, parent, name ); 00216 } 00217 00218 Plugin *KTextEditor::createPlugin ( const char* libname, Document *document, const char *name ) 00219 { 00220 return KParts::ComponentFactory::createInstanceFromLibrary<Plugin>( libname, document, name ); 00221 } 00222 00223 PluginViewInterface *KTextEditor::pluginViewInterface (Plugin *plugin) 00224 { 00225 if (!plugin) 00226 return 0; 00227 00228 return static_cast<PluginViewInterface*>(plugin->qt_cast("KTextEditor::PluginViewInterface")); 00229 } 00230
KDE Logo
This file is part of the documentation for interfaces Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 17 11:32:15 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003