kate
katedocmanageriface.cpp
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 2003 Ian Reinhart Geiser <geiseri@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 version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #include "katedocmanageriface.h" 00020 00021 #include "katedocmanager.h" 00022 00023 #include <kdebug.h> 00024 00025 KateDocManagerDCOPIface::KateDocManagerDCOPIface (KateDocManager *dm) : DCOPObject ("KateDocumentManager"), m_dm (dm) 00026 { 00027 00028 } 00029 00030 // bit more error save than the forcing c cast ;() 00031 DCOPRef KateDocManagerDCOPIface::document (uint n) 00032 { 00033 Kate::Document *doc = m_dm->document(n); 00034 00035 if (!doc) 00036 return DCOPRef (); 00037 00038 DCOPObject *obj = static_cast<DCOPObject*>(doc->qt_cast("DCOPObject")); 00039 00040 if (!obj) 00041 return DCOPRef (); 00042 00043 return DCOPRef (obj); 00044 } 00045 00046 DCOPRef KateDocManagerDCOPIface::activeDocument () 00047 { 00048 Kate::Document *doc = m_dm->activeDocument(); 00049 00050 if (!doc) 00051 return DCOPRef (); 00052 00053 DCOPObject *obj = static_cast<DCOPObject*>(doc->qt_cast("DCOPObject")); 00054 00055 if (!obj) 00056 return DCOPRef (); 00057 00058 return DCOPRef (obj); 00059 } 00060 00061 uint KateDocManagerDCOPIface::activeDocumentNumber () 00062 { 00063 Kate::Document *doc = m_dm->activeDocument(); 00064 00065 if (doc) 00066 return doc->documentNumber (); 00067 00068 return 0; 00069 } 00070 00071 DCOPRef KateDocManagerDCOPIface::documentWithID (uint id) 00072 { 00073 Kate::Document *doc = m_dm->documentWithID (id); 00074 00075 if (!doc) 00076 return DCOPRef (); 00077 00078 DCOPObject *obj = static_cast<DCOPObject*>(doc->qt_cast("DCOPObject")); 00079 00080 if (!obj) 00081 return DCOPRef (); 00082 00083 return DCOPRef (obj); 00084 } 00085 00086 DCOPRef KateDocManagerDCOPIface::openURL (KURL url, QString encoding) 00087 { 00088 Kate::Document *doc = m_dm->openURL (url, encoding); 00089 00090 if (!doc) 00091 return DCOPRef (); 00092 00093 DCOPObject *obj = static_cast<DCOPObject*>(doc->qt_cast("DCOPObject")); 00094 00095 if (!obj) 00096 return DCOPRef (); 00097 00098 return DCOPRef (obj); 00099 } 00100 00101 bool KateDocManagerDCOPIface::closeDocument(uint n) 00102 { 00103 return m_dm->closeDocument(n); 00104 } 00105 00106 bool KateDocManagerDCOPIface::closeDocumentWithID(uint id) 00107 { 00108 return m_dm->closeDocumentWithID (id); 00109 } 00110 00111 bool KateDocManagerDCOPIface::closeAllDocuments() 00112 { 00113 return m_dm->closeAllDocuments(); 00114 } 00115 00116 bool KateDocManagerDCOPIface::isOpen(KURL url) 00117 { 00118 return m_dm->isOpen (url); 00119 } 00120 00121 uint KateDocManagerDCOPIface::documents () 00122 { 00123 return m_dm->documents(); 00124 } 00125 00126 int KateDocManagerDCOPIface::findDocument (KURL url) 00127 { 00128 return m_dm->findDocument (url); 00129 } 00130 00131