F:/KPlato/koffice/libs/kofficecore/KoApplicationIface.cc

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2000 David Faure <faure@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.
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., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 
00021 #include <dcopclient.h>
00022 #include <kdebug.h>
00023 #include <klocale.h>
00024 #include <kmessagebox.h>
00025 
00026 #include "KoApplication.h"
00027 #include "KoApplicationIface.h"
00028 #include "KoDocument.h"
00029 #include "KoDocumentIface.h"
00030 #include "KoMainWindow.h"
00031 #include "KoQueryTrader.h"
00032 #include "KoView.h"
00033 //Added by qt3to4:
00034 #include <Q3ValueList>
00035 #include <Q3PtrList>
00036 
00037 KoApplicationIface::KoApplicationIface()
00038  : DCOPObject( "KoApplicationIface" )
00039 {
00040 }
00041 
00042 KoApplicationIface::~KoApplicationIface()
00043 {
00044 }
00045 
00046 DCOPRef KoApplicationIface::createDocument( const QString &nativeFormat )
00047 {
00048     KoDocumentEntry entry = KoDocumentEntry::queryByMimeType( nativeFormat );
00049     if ( entry.isEmpty() )
00050     {
00051         KMessageBox::questionYesNo( 0, i18n( "Unknown KOffice MimeType %s. Check your installation.", nativeFormat ) );
00052         return DCOPRef();
00053     }
00054     KoDocument* doc = entry.createDoc( 0 );
00055     return DCOPRef( kapp->dcopClient()->appId(), doc->dcopObject()->objId() );
00056 }
00057 
00058 Q3ValueList<DCOPRef> KoApplicationIface::getDocuments()
00059 {
00060     Q3ValueList<DCOPRef> lst;
00061     Q3PtrList<KoDocument> *documents = KoDocument::documentList();
00062     if ( documents )
00063     {
00064       Q3PtrListIterator<KoDocument> it( *documents );
00065       for (; it.current(); ++it )
00066         lst.append( DCOPRef( kapp->dcopClient()->appId(), it.current()->dcopObject()->objId() ) );
00067     }
00068     return lst;
00069 }
00070 
00071 Q3ValueList<DCOPRef> KoApplicationIface::getViews()
00072 {
00073     Q3ValueList<DCOPRef> lst;
00074     Q3PtrList<KoDocument> *documents = KoDocument::documentList();
00075     if ( documents )
00076     {
00077       Q3PtrListIterator<KoDocument> it( *documents );
00078       for (; it.current(); ++it )
00079       {
00080           foreach ( KoView* view, it.current()->views() )
00081               lst.append( DCOPRef( kapp->dcopClient()->appId(), view->dcopObject()->objId() ) );
00082       }
00083     }
00084     return lst;
00085 }
00086 
00087 Q3ValueList<DCOPRef> KoApplicationIface::getWindows()
00088 {
00089     Q3ValueList<DCOPRef> lst;
00090     QList<KMainWindow*> mainWindows = KMainWindow::memberList();
00091     if ( !mainWindows.isEmpty() )
00092     {
00093         foreach ( KMainWindow* mainWindow, mainWindows )
00094             lst.append( DCOPRef( kapp->dcopClient()->appId(),
00095                         static_cast<KoMainWindow*>(mainWindow)->dcopObject()->objId() ) );
00096     }
00097     return lst;
00098 }

Généré le Wed Nov 22 23:41:02 2006 pour KPlato par  doxygen 1.5.1-p1