20#include "KoDocument.h"
21#include "KoDocumentIface.h"
22#include "KoDocumentInfoDlg.h"
23#include "KoDocumentInfo.h"
25#include <tdeapplication.h>
26#include <dcopclient.h>
27#include <kdcopactionproxy.h>
30#include <kdcoppropertyproxy.h>
35 static int s_docIFNumber = 0;
36 TQCString name; name.setNum( s_docIFNumber++ ); name.prepend(
"Document-");
40KoDocumentIface::KoDocumentIface(
KoDocument * doc,
const char * name )
41 :
DCOPObject( name ? TQCString(name) : newIfaceName() )
47KoDocumentIface::~KoDocumentIface()
64 return m_pDoc->
url().url();
79 TQPtrList<KoView> views = m_pDoc->
views();
80 KoView *v = views.at( idx );
89 return DCOPRef( kapp->dcopClient()->appId(), obj->
objId() );
100 TQValueList<TDEAction *> lst = m_actionProxy->
actions();
101 TQValueList<TDEAction *>::ConstIterator it = lst.begin();
102 TQValueList<TDEAction *>::ConstIterator end = lst.end();
103 for (; it != end; ++it )
104 res.append( (*it)->name() );
125void KoDocumentIface::setOutputMimeType(
const TQCString & mimetype )
130TQString KoDocumentIface::documentInfoAuthorName()
const
133 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
136 kdWarning() <<
"Author information not found in documentInfo !" << endl;
140 return authorPage->fullName();
143TQString KoDocumentIface::documentInfoEmail()
const
146 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
149 kdWarning() <<
"Author information not found in documentInfo !" << endl;
153 return authorPage->email();
156TQString KoDocumentIface::documentInfoCompanyName()
const
159 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
162 kdWarning() <<
"Author information not found in documentInfo !" << endl;
166 return authorPage->company();
169TQString KoDocumentIface::documentInfoTelephone()
const
171 kdDebug()<<
" Keep compatibility with koffice <= 1.3 : use documentInfoTelephoneWork\n";
172 return documentInfoTelephoneWork();
175TQString KoDocumentIface::documentInfoTelephoneWork()
const
178 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
181 kdWarning() <<
"Author information not found in documentInfo !" << endl;
185 return authorPage->telephoneWork();
188TQString KoDocumentIface::documentInfoTelephoneHome()
const
191 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
194 kdWarning() <<
"Author information not found in documentInfo !" << endl;
198 return authorPage->telephoneHome();
202TQString KoDocumentIface::documentInfoFax()
const
205 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
208 kdWarning() <<
"Author information not found in documentInfo !" << endl;
212 return authorPage->fax();
215TQString KoDocumentIface::documentInfoCountry()
const
218 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
221 kdWarning() <<
"Author information not found in documentInfo !" << endl;
225 return authorPage->country();
228TQString KoDocumentIface::documentInfoPostalCode()
const
231 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
234 kdWarning() <<
"Author information not found in documentInfo !" << endl;
238 return authorPage->postalCode();
241TQString KoDocumentIface::documentInfoCity()
const
244 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
247 kdWarning() <<
"Author information not found in documentInfo !" << endl;
251 return authorPage->city();
255TQString KoDocumentIface::documentInfoInitial()
const
258 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
261 kdWarning() <<
"Author information not found in documentInfo !" << endl;
265 return authorPage->initial();
268TQString KoDocumentIface::documentInfoAuthorPostion()
const
271 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
274 kdWarning() <<
"Author information not found in documentInfo !" << endl;
278 return authorPage->position();
282TQString KoDocumentIface::documentInfoStreet()
const
285 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
288 kdWarning() <<
"Author information not found in documentInfo !" << endl;
292 return authorPage->street();
296TQString KoDocumentIface::documentInfoTitle()
const
299 KoDocumentInfoAbout * aboutPage =
static_cast<KoDocumentInfoAbout *
>(info->page(
"about" ));
302 kdWarning() <<
"'About' page not found in documentInfo !" << endl;
306 return aboutPage->title();
310TQString KoDocumentIface::documentInfoAbstract()
const
313 KoDocumentInfoAbout * aboutPage =
static_cast<KoDocumentInfoAbout *
>(info->page(
"about" ));
316 kdWarning() <<
"'About' page not found in documentInfo !" << endl;
320 return aboutPage->abstract();
323TQString KoDocumentIface::documentInfoKeywords()
const
326 KoDocumentInfoAbout * aboutPage =
static_cast<KoDocumentInfoAbout *
>(info->page(
"about" ));
329 kdWarning() <<
"'About' page not found in documentInfo !" << endl;
333 return aboutPage->keywords();
336TQString KoDocumentIface::documentInfoSubject()
const
339 KoDocumentInfoAbout * aboutPage =
static_cast<KoDocumentInfoAbout *
>(info->page(
"about" ));
342 kdWarning() <<
"'About' page not found in documentInfo !" << endl;
346 return aboutPage->subject();
348void KoDocumentIface::setDocumentInfoKeywords(
const TQString & text )
351 KoDocumentInfoAbout * aboutPage =
static_cast<KoDocumentInfoAbout *
>(info->page(
"about" ));
354 kdWarning() <<
"'About' page not found in documentInfo !" << endl;
357 aboutPage->setKeywords(text);
360void KoDocumentIface::setDocumentInfoSubject(
const TQString & text)
363 KoDocumentInfoAbout * aboutPage =
static_cast<KoDocumentInfoAbout *
>(info->page(
"about" ));
366 kdWarning() <<
"'About' page not found in documentInfo !" << endl;
369 aboutPage->setSubject(text);
372void KoDocumentIface::setDocumentInfoAuthorName(
const TQString & text)
375 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
378 kdWarning() <<
"Author information not found in documentInfo !" << endl;
381 authorPage->setFullName(text);
385void KoDocumentIface::setDocumentInfoEmail(
const TQString &text)
388 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
391 kdWarning() <<
"Author information not found in documentInfo !" << endl;
394 authorPage->setEmail(text);
397void KoDocumentIface::setDocumentInfoCompanyName(
const TQString &text)
400 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
403 kdWarning() <<
"Author information not found in documentInfo !" << endl;
406 authorPage->setCompany(text);
409void KoDocumentIface::setDocumentInfoAuthorPosition(
const TQString &text)
412 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
415 kdWarning() <<
"Author information not found in documentInfo !" << endl;
418 authorPage->setPosition(text);
422void KoDocumentIface::setDocumentInfoTelephone(
const TQString &text)
424 kdDebug()<<
"Keep compatibility with koffice <= 1.3 : use setDocumentInfoTelephoneWork\n";
425 setDocumentInfoTelephoneWork(text);
428void KoDocumentIface::setDocumentInfoTelephoneWork(
const TQString &text)
431 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
434 kdWarning() <<
"Author information not found in documentInfo !" << endl;
437 authorPage->setTelephoneWork(text);
440void KoDocumentIface::setDocumentInfoTelephoneHome(
const TQString &text)
443 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
446 kdWarning() <<
"Author information not found in documentInfo !" << endl;
449 authorPage->setTelephoneHome(text);
453void KoDocumentIface::setDocumentInfoFax(
const TQString &text)
456 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
459 kdWarning() <<
"Author information not found in documentInfo !" << endl;
462 authorPage->setFax(text);
465void KoDocumentIface::setDocumentInfoCountry(
const TQString &text)
468 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
471 kdWarning() <<
"Author information not found in documentInfo !" << endl;
474 authorPage->setCountry(text);
478void KoDocumentIface::setDocumentInfoTitle(
const TQString & text)
481 KoDocumentInfoAbout * aboutPage =
static_cast<KoDocumentInfoAbout *
>(info->page(
"about" ));
484 kdWarning() <<
"'About' page not found in documentInfo !" << endl;
487 aboutPage->setTitle(text);
490void KoDocumentIface::setDocumentInfoPostalCode(
const TQString &text)
493 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
496 kdWarning() <<
"Author information not found in documentInfo !" << endl;
499 authorPage->setPostalCode(text);
504void KoDocumentIface::setDocumentInfoCity(
const TQString & text)
507 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
510 kdWarning() <<
"Author information not found in documentInfo !" << endl;
513 authorPage->setCity(text);
516void KoDocumentIface::setDocumentInfoInitial(
const TQString & text)
519 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
522 kdWarning() <<
"Author information not found in documentInfo !" << endl;
525 authorPage->setInitial(text);
529void KoDocumentIface::setDocumentInfoStreet(
const TQString &text)
532 KoDocumentInfoAuthor * authorPage =
static_cast<KoDocumentInfoAuthor *
>(info->page(
"author" ));
535 kdWarning() <<
"Author information not found in documentInfo !" << endl;
538 authorPage->setStreet(text);
543void KoDocumentIface::setDocumentInfoAbstract(
const TQString &text)
546 KoDocumentInfoAbout * aboutPage =
static_cast<KoDocumentInfoAbout *
>(info->page(
"about" ));
549 kdWarning() <<
"'About' page not found in documentInfo !" << endl;
552 aboutPage->setAbstract(text);
555QCStringList KoDocumentIface::functionsDynamic()
560bool KoDocumentIface::processDynamic(
const TQCString &fun,
const TQByteArray &data,
561 TQCString& replyType, TQByteArray &replyData )
563 if ( KDCOPPropertyProxy::isPropertyRequest( fun, m_pDoc ) )
564 return KDCOPPropertyProxy::processPropertyRequest( fun, data, replyType, replyData, m_pDoc );
virtual bool processDynamic(const TQCString &fun, const TQByteArray &data, TQCString &replyType, TQByteArray &replyData)
virtual QCStringList functionsDynamic()
virtual TQCString actionObjectId(const TQCString &name) const
virtual TQMap< TQCString, DCOPRef > actionMap(const TQCString &appId=TQCString()) const
virtual TQValueList< TDEAction * > actions() const
virtual bool saveAs(const KURL &url)
virtual TDEActionCollection * actionCollection() const
void saveAs(const TQString &url)
Saves the document under a new name.
void save()
Saves the document under its existing filename.
void openURL(TQString url)
Opens a document stored in url Warning: this is asynchronous.
TQString url()
Returns the URL for this document (empty, real URL, or internal one)
static TQCString newIfaceName()
Generate a name for this interface.
TQMap< TQCString, DCOPRef > actionMap()
DCOPRef action(const TQCString &name)
DCOP-action proxy.
The KOffice document class.
bool isLoading() const
Returns true during loading (openURL can be asynchronous)
virtual bool openURL(const KURL &url)
Reimplemented from KParts::ReadWritePart for internal reasons (for the autosave functionality)
KoDocumentInfo * documentInfo() const
bool isModified() const
Returns true if this document or any of its internal child documents are modified.
void setOutputMimeType(const TQCString &mimeType, int specialOutputFlag=0)
Set the format in which the document should be saved.
const TQPtrList< KoView > & views() const
This class is used to display a KoDocument.
virtual DCOPObject * dcopObject()
Return a DCOP interface for this view KOffice Applications are strongly recommended to reimplement th...