| # interfaces Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# 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   delete d;
    00167 }
    00168
    00169 unsigned int Plugin::pluginNumber () const
    00170 {
    00171   return myPluginNumber;
    00172 }
    00173
    00174 Document *Plugin::document () const
    00175 {
    00176   return d->m_doc;
    00177 }
    00178
    00179 PluginViewInterface::PluginViewInterface()
    00180 {
    00181   globalPluginViewInterfaceNumber++;
    00182   myPluginViewInterfaceNumber = globalPluginViewInterfaceNumber;
    00183 }
    00184
    00185 PluginViewInterface::~PluginViewInterface()
    00186 {
    00187 }
    00188
    00189 unsigned int PluginViewInterface::pluginViewInterfaceNumber () const
    00190 {
    00191   return myPluginViewInterfaceNumber;
    00192 }
    00193
    00194 Editor::Editor( QObject *parent, const char *name ) : KParts::ReadWritePart( parent, name )
    00195 {
    00196   globalEditorNumber++;
    00197   myEditorNumber = globalEditorNumber;
    00198 }
    00199
    00200 Editor::~Editor()
    00201 {
    00202 }
    00203
    00204 unsigned int Editor::editorNumber () const
    00205 {
    00206   return myEditorNumber;
    00207 }
    00208
    00209 Editor *KTextEditor::createEditor ( const char* libname, QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name )
    00210 {
    00211   return KParts::ComponentFactory::createPartInstanceFromLibrary<Editor>( libname, parentWidget, widgetName, parent, name );
    00212 }
    00213
    00214 Document *KTextEditor::createDocument ( const char* libname, QObject *parent, const char *name )
    00215 {
    00216   return KParts::ComponentFactory::createPartInstanceFromLibrary<Document>( libname, 0, 0, parent, name );
    00217 }
    00218
    00219 Plugin *KTextEditor::createPlugin ( const char* libname, Document *document, const char *name )
    00220 {
    00221   return KParts::ComponentFactory::createInstanceFromLibrary<Plugin>( libname, document, name );
    00222 }
    00223
    00224 PluginViewInterface *KTextEditor::pluginViewInterface (Plugin *plugin)
    00225 {
    00226   if (!plugin)
    00227     return 0;
    00228
    00229   return static_cast<PluginViewInterface*>(plugin->qt_cast("KTextEditor::PluginViewInterface"));
    00230 }
    00231

This file is part of the documentation for interfaces Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:34:56 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003