interfaces Library API Documentation

selectioninterfaceext.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002 Anders Lund <anders@alweb.dk>
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    $Id: selectioninterfaceext.cpp,v 1.3 2002/07/21 10:25:21 cullmann Exp $
00020 */
00021 
00022 #include "selectioninterfaceext.h"
00023 #include "selectionextdcopinterface.h"
00024 #include "document.h"
00025 #include "view.h"
00026 #include <dcopclient.h>
00027 
00028 using namespace KTextEditor;
00029 
00030 //BEGIN KTextEditor::SelectionInterfaceExt
00031 class KTextEditor::PrivateSelectionInterfaceExt {
00032   public:
00033     PrivateSelectionInterfaceExt() : interface( 0 ) {};
00034     ~PrivateSelectionInterfaceExt() {};
00035     
00036     SelectionExtDCOPInterface *interface;
00037 };
00038 
00039 unsigned int SelectionInterfaceExt::globalSelectionInterfaceExtNumber = 0;
00040 
00041 SelectionInterfaceExt::SelectionInterfaceExt()
00042   : d ( new PrivateSelectionInterfaceExt )
00043 {
00044   globalSelectionInterfaceExtNumber++;
00045   mySelectionInterfaceExtNumber = globalSelectionInterfaceExtNumber;
00046   QString name = "SelectionInterfaceExt#" + QString::number(mySelectionInterfaceExtNumber);
00047   d->interface = new SelectionExtDCOPInterface(this, name.latin1());
00048 }
00049 
00050 SelectionInterfaceExt::~SelectionInterfaceExt()
00051 {
00052   delete d->interface;
00053   delete d;
00054 }
00055 
00056 unsigned int SelectionInterfaceExt::selectionInterfaceExtNumber () const
00057 {
00058   return mySelectionInterfaceExtNumber;
00059 }
00060 
00061 void SelectionInterfaceExt::setSelectionInterfaceExtDCOPSuffix (const QCString &suffix)
00062 {
00063   d->interface->setObjId ("SelectionInterfaceExt#"+suffix);
00064 }
00065 
00066 SelectionInterfaceExt *KTextEditor::selectionInterfaceExt (Document *doc)
00067 {
00068   if (!doc)
00069     return 0;
00070 
00071   return static_cast<SelectionInterfaceExt*>(doc->qt_cast("KTextEditor::SelectionInterfaceExt"));
00072 }
00073 
00074 SelectionInterfaceExt *KTextEditor::selectionInterfaceExt (View *view)
00075 {
00076   if (!view)
00077     return 0;
00078 
00079   return static_cast<SelectionInterfaceExt*>(view->qt_cast("KTextEditor::SelectionInterfaceExt"));
00080 }
00081 
00082 //END KTextEditor::SelectionInterfaceExt
00083 
00084 //BEGIN KTextEditor::SelectionExtDCOPInterface
00085 SelectionExtDCOPInterface::SelectionExtDCOPInterface(
00086                 SelectionInterfaceExt *parent, const char* name )
00087   : DCOPObject( name ),
00088     m_parent( parent )
00089 {
00090 }
00091 
00092 SelectionExtDCOPInterface::~SelectionExtDCOPInterface()
00093 {
00094 }
00095 
00096 int SelectionExtDCOPInterface::selStartLine()
00097 {
00098   return m_parent->selStartLine();
00099 }
00100 
00101 int SelectionExtDCOPInterface::selStartCol()
00102 {
00103   return m_parent->selStartCol();
00104 }
00105 
00106 int SelectionExtDCOPInterface::selEndLine()
00107 {
00108   return m_parent->selEndLine();
00109 }
00110 
00111 int SelectionExtDCOPInterface::selEndCol()
00112 {
00113   return m_parent->selEndCol();
00114 }
00115 //END KTextEditor::SelectionExtDCOPInterface
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 27 22:16:14 2005 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001