F:/KPlato/koffice/libs/kofficecore/KoDocumentAdaptor.cpp

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    Copyright (C) 2006 Fredrik Edemar <f_edemar@linux.se>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "KoDocument.h"
00022 #include "KoDocumentAdaptor.h"
00023 #include "KoDocumentInfoDlg.h"
00024 #include "KoDocumentInfo.h"
00025 #include "KoView.h"
00026 #include <kapplication.h>
00027 #include <kaction.h>
00028 #include <kactioncollection.h>
00029 #include <kdebug.h>
00030 //Added by qt3to4:
00031 #include <Q3ValueList>
00032 #include <Q3PtrList>
00033 
00034 
00035 KoDocumentAdaptor::KoDocumentAdaptor( KoDocument * doc )
00036     : QDBusAbstractAdaptor( doc )
00037 {
00038     setAutoRelaySignals(true);
00039     m_pDoc = doc;
00040 //   m_actionProxy = new KDCOPActionProxy( doc->actionCollection(), this );
00041 }
00042 
00043 KoDocumentAdaptor::~KoDocumentAdaptor()
00044 {
00045 //     delete m_actionProxy;
00046 }
00047 
00048 void KoDocumentAdaptor::openURL( const QString & url )
00049 {
00050   m_pDoc->openURL( KUrl( url ) );
00051 }
00052 
00053 bool KoDocumentAdaptor::isLoading()
00054 {
00055   return m_pDoc->isLoading();
00056 }
00057 
00058 QString KoDocumentAdaptor::url()
00059 {
00060   return m_pDoc->url().url();
00061 }
00062 
00063 bool KoDocumentAdaptor::isModified()
00064 {
00065   return m_pDoc->isModified();
00066 }
00067 
00068 int KoDocumentAdaptor::viewCount()
00069 {
00070   return m_pDoc->viewCount();
00071 }
00072 
00073 QString KoDocumentAdaptor::view( int idx )
00074 {
00075   QList<KoView*> views = m_pDoc->views();
00076   KoView *v = views.at( idx );
00077   if ( !v )
00078     return QString();
00079 
00080   return v->objectName();
00081 }
00082 
00083 // DCOPRef KoDocumentAdaptor::action( const DCOPCString &name )
00084 // {
00085 //     return DCOPRef( kapp->dcopClient()->appId(), m_actionProxy->actionObjectId( name ) );
00086 // }
00087 
00088 QStringList KoDocumentAdaptor::actions()
00089 {
00090 //     DCOPCStringList res;
00091 //     Q3ValueList<KAction *> lst = m_actionProxy->actions();
00092 //     Q3ValueList<KAction *>::ConstIterator it = lst.begin();
00093 //     Q3ValueList<KAction *>::ConstIterator end = lst.end();
00094 //     for (; it != end; ++it )
00095 //         res.append( (*it)->objectName().toUtf8() );
00096 // 
00097 //     return res;
00098     QStringList tmp_actions;
00099     QList<KAction *> lst = m_pDoc->actionCollection()->actions();
00100     foreach( KAction* it, lst ) {
00101         if (it->isPlugged())
00102             tmp_actions.append( it->objectName() );
00103     }
00104     return tmp_actions;
00105 }
00106 
00107 // QMap<DCOPCString,DCOPRef> KoDocumentAdaptor::actionMap()
00108 // {
00109 //     return m_actionProxy->actionMap();
00110 // }
00111 
00112 void KoDocumentAdaptor::save()
00113 {
00114     m_pDoc->save();
00115 }
00116 
00117 void KoDocumentAdaptor::saveAs( const QString & url )
00118 {
00119     m_pDoc->saveAs( KUrl( url ) );
00120     m_pDoc->waitSaveComplete(); // see ReadWritePart
00121 }
00122 
00123 void KoDocumentAdaptor::setOutputMimeType( const QByteArray& mimetype )
00124 {
00125     m_pDoc->setOutputMimeType( mimetype );
00126 }
00127 
00128 QString KoDocumentAdaptor::documentInfoAuthorName() const
00129 {
00130     return m_pDoc->documentInfo()->authorInfo( "creator" );
00131 }
00132 
00133 QString KoDocumentAdaptor::documentInfoEmail() const
00134 {
00135     return m_pDoc->documentInfo()->authorInfo( "email" );
00136 }
00137 
00138 QString KoDocumentAdaptor::documentInfoCompanyName() const
00139 {
00140     return m_pDoc->documentInfo()->authorInfo( "company" );
00141 }
00142 
00143 QString KoDocumentAdaptor::documentInfoTelephone() const
00144 {
00145     kDebug()<<" Keep compatibility with koffice <= 1.3 : use documentInfoTelephoneWork\n";
00146     return documentInfoTelephoneWork();
00147 }
00148 
00149 QString KoDocumentAdaptor::documentInfoTelephoneWork() const
00150 {
00151     return m_pDoc->documentInfo()->authorInfo( "telephone-work" );
00152 }
00153 
00154 QString KoDocumentAdaptor::documentInfoTelephoneHome() const
00155 {
00156     return m_pDoc->documentInfo()->authorInfo( "telephone-home" );
00157 }
00158 
00159 
00160 QString KoDocumentAdaptor::documentInfoFax() const
00161 {
00162     return m_pDoc->documentInfo()->authorInfo( "fax" );
00163 
00164 }
00165 QString KoDocumentAdaptor::documentInfoCountry() const
00166 {
00167     return m_pDoc->documentInfo()->authorInfo( "country" );
00168 
00169 }
00170 QString KoDocumentAdaptor::documentInfoPostalCode() const
00171 {
00172     return m_pDoc->documentInfo()->authorInfo( "postal-code" );
00173 
00174 }
00175 QString KoDocumentAdaptor::documentInfoCity() const
00176 {
00177     return m_pDoc->documentInfo()->authorInfo( "city" );
00178 }
00179 
00180 QString KoDocumentAdaptor::documentInfoInitial() const
00181 {
00182     return m_pDoc->documentInfo()->authorInfo( "initial" );
00183 }
00184 
00185 QString KoDocumentAdaptor::documentInfoAuthorPostion() const
00186 {
00187     return m_pDoc->documentInfo()->authorInfo( "position" );
00188 }
00189 
00190 QString KoDocumentAdaptor::documentInfoStreet() const
00191 {
00192     return m_pDoc->documentInfo()->authorInfo( "street" );
00193 }
00194 
00195 QString KoDocumentAdaptor::documentInfoTitle() const
00196 {
00197     return m_pDoc->documentInfo()->aboutInfo( "title" );
00198 }
00199 
00200 QString KoDocumentAdaptor::documentInfoAbstract() const
00201 {
00202     return m_pDoc->documentInfo()->aboutInfo( "comments" );
00203 }
00204 
00205 QString KoDocumentAdaptor::documentInfoKeywords() const
00206 {
00207     return m_pDoc->documentInfo()->aboutInfo( "keywords" );
00208 }
00209 
00210 QString KoDocumentAdaptor::documentInfoSubject() const
00211 {
00212     return m_pDoc->documentInfo()->aboutInfo( "subject" );
00213 }
00214 void KoDocumentAdaptor::setDocumentInfoKeywords(const QString & text )
00215 {
00216     m_pDoc->documentInfo()->setAboutInfo( "keywords", text );
00217 }
00218 
00219 void KoDocumentAdaptor::setDocumentInfoSubject(const QString & text)
00220 {
00221     m_pDoc->documentInfo()->setAboutInfo( "subject", text );
00222 }
00223 
00224 void KoDocumentAdaptor::setDocumentInfoAuthorName(const QString & text)
00225 {
00226     m_pDoc->documentInfo()->setAuthorInfo( "creator", text );
00227 }
00228 
00229 void KoDocumentAdaptor::setDocumentInfoEmail(const QString &text)
00230 {
00231     m_pDoc->documentInfo()->setAuthorInfo( "email", text );
00232 }
00233 
00234 void KoDocumentAdaptor::setDocumentInfoCompanyName(const QString &text)
00235 {
00236     m_pDoc->documentInfo()->setAuthorInfo( "company", text );
00237 }
00238 
00239 void KoDocumentAdaptor::setDocumentInfoAuthorPosition(const QString &text)
00240 {
00241     m_pDoc->documentInfo()->setAuthorInfo( "position", text );
00242 }
00243 
00244 
00245 void KoDocumentAdaptor::setDocumentInfoTelephone(const QString &text)
00246 {
00247     kDebug()<<"Keep compatibility with koffice <= 1.3 : use setDocumentInfoTelephoneWork\n";
00248     setDocumentInfoTelephoneWork(text);
00249 }
00250 
00251 void KoDocumentAdaptor::setDocumentInfoTelephoneWork(const QString &text)
00252 {
00253     m_pDoc->documentInfo()->setAuthorInfo( "telephone-work", text );
00254 }
00255 
00256 void KoDocumentAdaptor::setDocumentInfoTelephoneHome(const QString &text)
00257 {
00258     m_pDoc->documentInfo()->setAuthorInfo( "telephone", text );
00259 }
00260 
00261 void KoDocumentAdaptor::setDocumentInfoFax(const QString &text)
00262 {
00263     m_pDoc->documentInfo()->setAuthorInfo( "fax", text );
00264 }
00265 
00266 void KoDocumentAdaptor::setDocumentInfoCountry(const QString &text)
00267 {
00268     m_pDoc->documentInfo()->setAuthorInfo( "country", text );
00269 }
00270 
00271 void KoDocumentAdaptor::setDocumentInfoTitle(const QString & text)
00272 {
00273     m_pDoc->documentInfo()->setAboutInfo( "title", text );
00274 }
00275 
00276 void KoDocumentAdaptor::setDocumentInfoPostalCode(const QString &text)
00277 {
00278     m_pDoc->documentInfo()->setAuthorInfo( "postal-code", text );
00279 }
00280 
00281 void KoDocumentAdaptor::setDocumentInfoCity(const QString & text)
00282 {
00283     m_pDoc->documentInfo()->setAuthorInfo( "city", text );
00284 }
00285 
00286 void KoDocumentAdaptor::setDocumentInfoInitial(const QString & text)
00287 {
00288     m_pDoc->documentInfo()->setAuthorInfo( "initial", text );
00289 }
00290 
00291 void KoDocumentAdaptor::setDocumentInfoStreet(const QString &text)
00292 {
00293     m_pDoc->documentInfo()->setAuthorInfo( "street", text );
00294 }
00295 
00296 void KoDocumentAdaptor::setDocumentInfoAbstract(const QString &text)
00297 {
00298     m_pDoc->documentInfo()->setAboutInfo( "comments", text );
00299 }
00300 
00301 // DCOPCStringList KoDocumentAdaptor::functionsDynamic()
00302 // {
00303 //     return DCOPObject::functionsDynamic() + KDCOPPropertyProxy::functions( m_pDoc );
00304 // }
00305 // 
00306 // bool KoDocumentAdaptor::processDynamic( const DCOPCString &fun, const QByteArray &data,
00307 //                                       DCOPCString& replyType, QByteArray &replyData )
00308 // {
00309 //     if ( KDCOPPropertyProxy::isPropertyRequest( fun, m_pDoc ) )
00310 //         return KDCOPPropertyProxy::processPropertyRequest( fun, data, replyType, replyData, m_pDoc );
00311 // 
00312 //     return DCOPObject::processDynamic( fun, data, replyType, replyData );
00313 // }
00314 
00315 #include "KoDocumentAdaptor.moc"

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