KoApplicationIface.cc
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "KoApplicationIface.h"
00021 #include "koApplication.h"
00022 #include "koDocument.h"
00023 #include "koMainWindow.h"
00024 #include "koView.h"
00025 #include "koQueryTrader.h"
00026 #include "KoDocumentIface.h"
00027 #include <dcopclient.h>
00028 #include <kdebug.h>
00029 #include <stdlib.h>
00030
00031 KoApplicationIface::KoApplicationIface()
00032 : DCOPObject( "KoApplicationIface" )
00033 {
00034 }
00035
00036 KoApplicationIface::~KoApplicationIface()
00037 {
00038 }
00039
00040 DCOPRef KoApplicationIface::createDocument( const QString &nativeFormat )
00041 {
00042 KoDocumentEntry entry = KoDocumentEntry::queryByMimeType( nativeFormat );
00043 if ( entry.isEmpty() )
00044 {
00045 kdError(30003) << "Unknown KOffice MimeType " << nativeFormat << ". Check your installation !" << endl;
00046 ::exit(1);
00047 }
00048 KoDocument* doc = entry.createDoc( 0 );
00049 return DCOPRef( kapp->dcopClient()->appId(), doc->dcopObject()->objId() );
00050 }
00051
00052 QValueList<DCOPRef> KoApplicationIface::getDocuments()
00053 {
00054 QValueList<DCOPRef> lst;
00055 QPtrList<KoDocument> *documents = KoDocument::documentList();
00056 if ( documents )
00057 {
00058 QPtrListIterator<KoDocument> it( *documents );
00059 for (; it.current(); ++it )
00060 lst.append( DCOPRef( kapp->dcopClient()->appId(), it.current()->dcopObject()->objId() ) );
00061 }
00062 return lst;
00063 }
00064
00065 QValueList<DCOPRef> KoApplicationIface::getViews()
00066 {
00067 QValueList<DCOPRef> lst;
00068 QPtrList<KoDocument> *documents = KoDocument::documentList();
00069 if ( documents )
00070 {
00071 QPtrListIterator<KoDocument> it( *documents );
00072 for (; it.current(); ++it )
00073 {
00074 QPtrListIterator<KoView> itview( it.current()->views() );
00075 for ( ; itview.current(); ++itview )
00076 lst.append( DCOPRef( kapp->dcopClient()->appId(), itview.current()->dcopObject()->objId() ) );
00077 }
00078 }
00079 return lst;
00080 }
00081
00082 QValueList<DCOPRef> KoApplicationIface::getWindows()
00083 {
00084 QValueList<DCOPRef> lst;
00085 QPtrList<KMainWindow> *mainWindows = KMainWindow::memberList;
00086 if ( mainWindows )
00087 {
00088 QPtrListIterator<KMainWindow> it( *mainWindows );
00089 for (; it.current(); ++it )
00090 lst.append( DCOPRef( kapp->dcopClient()->appId(),
00091 static_cast<KoMainWindow *>(it.current())->dcopObject()->objId() ) );
00092 }
00093 return lst;
00094 }
This file is part of the documentation for lib Library Version 1.3.5.