00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
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
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
00041 }
00042
00043 KoDocumentAdaptor::~KoDocumentAdaptor()
00044 {
00045
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
00084
00085
00086
00087
00088 QStringList KoDocumentAdaptor::actions()
00089 {
00090
00091
00092
00093
00094
00095
00096
00097
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
00108
00109
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();
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
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315 #include "KoDocumentAdaptor.moc"