lib Library API Documentation

KoDocument Class Reference

The KOffice document class The KOffice document class. More...

#include <koDocument.h>

List of all members.

Public Types

enum  { SaveAsKOffice1dot1 = 1, SaveAsDirectoryStore = 2 }
enum  InitDocFlags { InitDocAppStarting, InitDocFileNew, InitDocFileClose, InitDocEmbedded }

Signals

void childChanged (KoDocumentChild *child)
void sigProgress (int value)
void sigStatusBarMessage (const QString &text)
void sigClearStatusBarMessage ()
void sigBeginOperation ()
void sigEndOperation ()

Public Member Functions

 KoDocument (QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, bool singleViewMode=false)
virtual ~KoDocument ()
bool isSingleViewMode () const
bool isEmbedded () const
virtual KAction * action (const QDomElement &element) const
virtual QDomDocument domDocument () const
virtual void setManager (KParts::PartManager *manager)
virtual bool openURL (const KURL &url)
bool import (const KURL &url)
bool exp0rt (const KURL &url)
virtual void setReadWrite (bool readwrite=true)
virtual QCString nativeFormatMimeType () const
KService::Ptr nativeService ()
QCString mimeType () const
void setMimeType (const QCString &mimeType)
void setOutputMimeType (const QCString &mimeType, int specialOutputFlag=0)
QCString outputMimeType () const
int specialOutputFlag () const
bool confirmNonNativeSave (const bool exporting) const
void setConfirmNonNativeSave (const bool exporting, const bool on)
void setErrorMessage (const QString &errMsg)
KoViewcreateView (QWidget *parent=0, const char *name=0)
virtual void addView (KoView *view)
virtual void removeView (KoView *view)
const QPtrList< KoView > & views () const
int viewCount () const
virtual KParts::Part * hitTest (QWidget *widget, const QPoint &globalPos)
virtual KoDocumenthitTest (const QPoint &pos, const QWMatrix &matrix=QWMatrix())
virtual void paintEverything (QPainter &painter, const QRect &rect, bool transparent=false, KoView *view=0L, double zoomX=1.0, double zoomY=1.0)
virtual QPixmap generatePreview (const QSize &size)
virtual void paintChildren (QPainter &painter, const QRect &rect, KoView *view, double zoomX=1.0, double zoomY=1.0)
virtual void paintChild (KoDocumentChild *child, QPainter &painter, KoView *view, double zoomX=1.0, double zoomY=1.0)
virtual void paintContent (QPainter &painter, const QRect &rect, bool transparent=false, double zoomX=1.0, double zoomY=1.0)=0
bool checkAutoSaveFile ()
virtual bool initDoc ()=0
InitDocFlags initDocFlags () const
void setInitDocFlags (InitDocFlags flags)
virtual void setModified (bool _mod)
virtual void setTitleModified ()
virtual bool isEmpty () const
virtual void setEmpty ()
virtual bool loadFromStore (KoStore *store, const QString &url)
virtual bool saveToStore (KoStore *store, const QString &path)
virtual bool loadXML (QIODevice *, const QDomDocument &doc)=0
virtual QDomDocument saveXML ()
QDomDocument createDomDocument (const QString &tagName, const QString &version) const
virtual bool saveToStream (QIODevice *dev)
virtual bool loadNativeFormat (const QString &file)
virtual bool saveNativeFormat (const QString &file)
void setAutoSave (int delay)
bool isAutosaving ()
void setCheckAutoSaveFile (bool b)
void setAutoErrorHandlingEnabled (bool b)
bool isAutoErrorHandlingEnabled ()
const QPtrList< KoDocumentChild > & children () const
KoDocumentChildchild (KoDocument *doc)
KoDocumentInfo * documentInfo () const
void setViewBuildDocument (KoView *view, const QDomDocument &doc)
QDomDocument viewBuildDocument (KoView *view)
virtual void addShell (KoMainWindow *shell)
virtual void removeShell (KoMainWindow *shell)
const QPtrList< KoMainWindow > & shells () const
int shellCount () const
virtual DCOPObject * dcopObject ()
QCString dcopObjectId () const
void emitProgress (int value)
bool isInOperation ()
virtual void emitBeginOperation ()
virtual void emitEndOperation ()
virtual bool isStoredExtern ()
KoPageLayout pageLayout () const
void removeAutoSaveFiles ()
void setBackupFile (bool _b)
bool backupFile () const
bool isModified ()
int queryCloseExternalChildren ()
int queryCloseDia ()
void setDoNotSaveExtDoc (bool on=true)
void setBackupPath (const QString &_path)
QString backupPath () const
void setCurrent (bool on=true)
void forceCurrent (bool on)
bool isCurrent () const
void setTitleModified (const QString caption, bool mod)
void resetURL ()
void setStoreInternal (bool i)
bool storeInternal () const
bool hasExternURL ()
void setURL (const KURL &url)
QStringfile ()
void setFile (const QString &file)

Static Public Member Functions

QCString readNativeFormatMimeType (KInstance *instance=0L)
KService::Ptr readNativeService (KInstance *instance=0L)
QDomDocument createDomDocument (const QString &appName, const QString &tagName, const QString &version)
int defaultAutoSave ()
QPtrList< KoDocument > * documentList ()

Protected Member Functions

QString autoSaveFile (const QString &path) const
virtual KoViewcreateViewInstance (QWidget *parent, const char *name)=0
virtual bool openFile ()
virtual bool saveFile ()
bool isImporting () const
bool isExporting () const
virtual bool loadChildren (KoStore *)
virtual bool saveChildren (KoStore *store)
virtual bool completeLoading (KoStore *store)
virtual bool completeSaving (KoStore *store)
virtual void insertChild (KoDocumentChild *child)
virtual void setModified ()
virtual void insertChild (QObject *o)
bool saveExternalChildren ()

Protected Attributes

KoPageLayout m_pageLayout

Properties

QCString dcopObjectId
bool backupFile


Detailed Description

The KOffice document class The KOffice document class.

This class provides some functionality each KOffice document should have.

Definition at line 54 of file koDocument.h.


Constructor & Destructor Documentation

KoDocument::KoDocument QWidget parentWidget,
const char *  widgetName,
QObject parent,
const char *  name,
bool  singleViewMode = false
 

Constructor.

The first 4 arguments are the same as the ones passed to KParts::Factory::createPart.

Parameters:
parentWidget the parent widget, in case we create a wrapper widget (in single view mode). Usually the first argument passed by KParts::Factory::createPart.
parent may be another KoDocument, or anything else. Usually the third argument of KParts::Factory::createPart.
name is used to identify this document via DCOP so you may want to pass a meaningful name here which matches the pattern [A-Za-z_][A-Za-z_0-9]*.
singleViewMode determines whether the document may only have one view. In this case the parent must be a QWidget derived class. KoDocument will then create a wrapper widget (KoViewWrapperWidget) which is a child of parentWidget. This widget can be retrieved by calling widget.

Definition at line 209 of file koDocument.cc.

References KoDocument(), KoPageLayout::ptBottom, KoPageLayout::ptHeight, KoPageLayout::ptLeft, KoPageLayout::ptRight, KoPageLayout::ptTop, KoPageLayout::ptWidth, and setAutoSave().

Referenced by KoDocument().

KoDocument::~KoDocument  )  [virtual]
 

Destructor.

The destructor does not delete any attached KoView objects and it does not delete the attached widget as returned by widget.

Definition at line 254 of file koDocument.cc.


Member Function Documentation

bool KoDocument::isSingleViewMode  )  const
 

Tells whether this document is in singleview mode.

This mode can only be set in the constructor.

Definition at line 286 of file koDocument.cc.

Referenced by insertChild(), and KoView::~KoView().

bool KoDocument::isEmbedded  )  const
 

Is the document embedded?

Definition at line 291 of file koDocument.cc.

Referenced by KoMainWindow::chooseNewDocument(), and setAutoSave().

KAction * KoDocument::action const QDomElement element  )  const [virtual]
 

Returns the action described action object.

In fact only the "name" attribute of element is of interest here. The method searches first in the KActionCollection of the first view and then in the KActionCollection of this document. This allows KOffice applications to define actions in both the view and the document. They should only define view-actions (like zooming and stuff) in the view. Every action which changes the document should be defined in the document.

Please notice that KoDocument indirectly inherits KXMLGUIClient.

See also:
KXMLGUIClient

KXMLGUIClient::actionCollection

KoView::action

Definition at line 543 of file koDocument.cc.

References action().

Referenced by action().

QDomDocument KoDocument::domDocument  )  const [virtual]
 

Returns the DOM document which describes the GUI of the first view.

Definition at line 558 of file koDocument.cc.

bool KoDocument::openURL const KURL &  url  )  [virtual]
 

Reimplemented from KParts::ReadWritePart for internal reasons (for the autosave functionality).

Definition at line 1190 of file koDocument.cc.

References file(), openURL(), and resetURL().

Referenced by checkAutoSaveFile(), import(), and openURL().

bool KoDocument::import const KURL &  url  ) 
 

Opens the document given by url, without storing the URL in the KoDocument.

Call this instead of openURL() to implement KoMainWindow's File --> Import feature.

Note: This will call openURL(). To differentiate this from an ordinary Open operation (in any reimplementation of openURL() or openFile()) call isImporting().

Definition at line 1166 of file koDocument.cc.

References import(), openURL(), resetURL(), and setTitleModified().

Referenced by import().

bool KoDocument::exp0rt const KURL &  url  ) 
 

Saves the document as url without changing the state of the KoDocument (URL, modified flag etc.).

Call this instead of KParts::ReadWritePart::saveAs() to implement KoMainWindow's File --> Export feature.

Note: This will call KoDocument::saveAs(). To differentiate this from an ordinary Save operation (in any reimplementation of saveFile()) call isExporting().

Definition at line 303 of file koDocument.cc.

References exp0rt(), isModified(), mimeType(), and setModified().

Referenced by exp0rt(), and KoMainWindow::saveDocument().

void KoDocument::setReadWrite bool  readwrite = true  )  [virtual]
 

Sets whether the document can be edited or is read only.

This recursively applied to all child documents and KoView::updateReadWrite is called for every attached view.

Definition at line 584 of file koDocument.cc.

References setAutoSave(), and setReadWrite().

Referenced by setReadWrite().

QCString KoDocument::readNativeFormatMimeType KInstance *  instance = 0L  )  [static]
 

Used by KoApplication, when no document exists yet.

With the help of instance or KApplication::instance() this method figures out which .desktop file matches this application. In this file it searches for the "X-KDE-NativeMimeType" entry and returns it.

See also:
KService

KDesktopFile

Definition at line 1871 of file koDocument.cc.

References readNativeFormatMimeType().

Referenced by readNativeFormatMimeType().

QCString KoDocument::nativeFormatMimeType  )  const [virtual]
 

To be preferred when a document exists.

It is fast when calling it multiple times since it caches the result that readNativeFormatMimeType delivers. You do NOT have to reimplement this (it is only virtual for kounavail).

Definition at line 1819 of file koDocument.cc.

Referenced by KoFilterManager::exp0rt(), KoFilterManager::import(), openFile(), KoDocumentChild::save(), KoMainWindow::saveDocument(), saveFile(), and saveNativeFormat().

QCString KoDocument::mimeType  )  const
 

Returns the actual mimetype of the document.

Definition at line 459 of file koDocument.cc.

Referenced by exp0rt(), and KoMainWindow::saveDocument().

void KoDocument::setMimeType const QCString mimeType  ) 
 

Sets the mime type for the document.

When choosing "save as" this is also the mime type selected by default.

Definition at line 464 of file koDocument.cc.

References setMimeType().

Referenced by setMimeType().

void KoDocument::setOutputMimeType const QCString mimeType,
int  specialOutputFlag = 0
 

Set the format in which the document should be saved.

This is called on loading, and in "save as", so you shouldn't have to call it.

Parameters:
specialOutputFlag is for "save as older version" etc.

Definition at line 469 of file koDocument.cc.

References setOutputMimeType().

Referenced by KoMainWindow::saveDocument(), and setOutputMimeType().

bool KoDocument::confirmNonNativeSave const bool  exporting  )  const
 

Returns true if this document was the result of opening a foreign file format and if the user hasn't yet saved the document (in any format).

Used by KoMainWindow to warn the user when s/he lazily presses CTRL+S to save in the same foreign format, putting all his/her formatting at risk (normally an export confirmation only comes up with Save As).

Parameters:
exporting specifies whether this is the setting for a File --> Export or File --> Save/Save As operation.

Definition at line 485 of file koDocument.cc.

References confirmNonNativeSave().

Referenced by confirmNonNativeSave(), and KoMainWindow::saveDocument().

void KoDocument::setErrorMessage const QString errMsg  ) 
 

Sets the error message to be shown to the user (use i18n()!) when loading or saving fails.

If you asked the user about something and he chose "Cancel", set the message to the magic string "USER_CANCELED", to skip the error dialog.

Definition at line 1916 of file koDocument.cc.

References setErrorMessage().

Referenced by setErrorMessage().

KoView * KoDocument::createView QWidget parent = 0,
const char *  name = 0
 

Create a new view for the document.

Definition at line 296 of file koDocument.cc.

References addView(), and createView().

Referenced by createView(), openFile(), and KoMainWindow::setRootDocument().

void KoDocument::addView KoView view  )  [virtual]
 

Adds a view to the document.

This calls KoView::updateReadWrite to tell the new view whether the document is readonly or not.

Definition at line 609 of file koDocument.cc.

References addView(), and KoView::updateReadWrite().

Referenced by addView(), and createView().

void KoDocument::removeView KoView view  )  [virtual]
 

Removes a view of the document.

Definition at line 618 of file koDocument.cc.

References removeView().

Referenced by openFile(), and removeView().

const QPtrList< KoView > & KoDocument::views  )  const
 

Returns:
a list of views this document is displayed in

Definition at line 623 of file koDocument.cc.

int KoDocument::viewCount  )  const
 

Returns:
number of views this document is displayed in

Definition at line 628 of file koDocument.cc.

Referenced by KoMainWindow::setRootDocument().

KParts::Part * KoDocument::hitTest QWidget widget,
const QPoint globalPos
[virtual]
 

Reimplemented from KParts::Part.

Definition at line 675 of file koDocument.cc.

References hitTest().

Referenced by KoView::hitTest(), and hitTest().

KoDocument * KoDocument::hitTest const QPoint pos,
const QWMatrix matrix = QWMatrix()
[virtual]
 

Find the most nested child document which contains the requested point.

The point is in the coordinate system of this part. If no child document contains this point, then a pointer to this document is returned.

This function has to be overloaded if the document features child documents.

Parameters:
matrix transforms points from the documents coordinate system to the coordinate system of the requested point.
pos is in some unknown coordinate system, but the matrix can be used to transform a point of this parts coordinate system to the coordinate system of p.
Returns:
Pointer to the document which was hit.

Definition at line 693 of file koDocument.cc.

References hitTest().

void KoDocument::paintEverything QPainter painter,
const QRect rect,
bool  transparent = false,
KoView view = 0L,
double  zoomX = 1.0,
double  zoomY = 1.0
[virtual]
 

Paints the whole document into the given painter object.

Parameters:
painter The painter object into that should be drawn.
rect The rect that should be used in the painter object.
transparent If true then the entire rectangle is erased before painting.
view The KoView is needed to fiddle about with the active widget, when painting children.
zoomX The zoom value to be applied to X coordinates when painting.
zoomY The zoom value to be applied to Y coordinates when painting.

Definition at line 754 of file koDocument.cc.

References paintChildren(), paintContent(), and paintEverything().

Referenced by generatePreview(), paintChild(), KoView::paintEverything(), and paintEverything().

QPixmap KoDocument::generatePreview const QSize size  )  [virtual]
 

Generates a preview picture of the document (to be used in the File Dialog).

Definition at line 1067 of file koDocument.cc.

References generatePreview(), paintEverything(), KoPageLayout::ptHeight, and KoPageLayout::ptWidth.

Referenced by generatePreview().

void KoDocument::paintChildren QPainter painter,
const QRect rect,
KoView view,
double  zoomX = 1.0,
double  zoomY = 1.0
[virtual]
 

Paints all of the documents children into the given painter object.

Parameters:
painter The painter object into that should be drawn.
rect The rect that should be used in the painter object.
view The KoView is needed to fiddle about with the active widget.
zoomX The zoom value to be applied to X coordinates when painting.
zoomY The zoom value to be applied to Y coordinates when painting.
See also:
paintChild paintEverything paintContent

Definition at line 760 of file koDocument.cc.

References paintChild(), and paintChildren().

Referenced by paintChildren(), and paintEverything().

void KoDocument::paintChild KoDocumentChild child,
QPainter painter,
KoView view,
double  zoomX = 1.0,
double  zoomY = 1.0
[virtual]
 

Paint a given child.

Normally called by paintChildren.

Parameters:
child The child to be painted.
painter The painter object into that should be drawn.
view The KoView is needed to fiddle about with the active widget.
zoomX The zoom value to be applied to X coordinates when painting.
zoomY The zoom value to be applied to Y coordinates when painting.
See also:
paintEverything paintChildren paintContent

Definition at line 772 of file koDocument.cc.

References KoChild::contentRect(), KoDocumentChild::document(), KoDocumentChild::isDeleted(), KoChild::isTransparent(), KoView::koDocument(), paintChild(), paintEverything(), KoView::partManager(), QPainter::scale(), KoChild::transform(), KoChild::xScaling(), and KoChild::yScaling().

Referenced by paintChild(), and paintChildren().

virtual void KoDocument::paintContent QPainter painter,
const QRect rect,
bool  transparent = false,
double  zoomX = 1.0,
double  zoomY = 1.0
[pure virtual]
 

Paints the data itself.

Normally called by paintEverthing. It does not paint the children. It's this method that KOffice Parts have to implement.

Parameters:
painter The painter object into that should be drawn.
rect The rect that should be used in the painter object.
transparent If true then the entire rectangle is erased before painting.
zoomX The zoom value to be applied to X coordinates when painting.
zoomY The zoom value to be applied to Y coordinates when painting.
See also:
paintEverything

Referenced by paintEverything().

bool KoDocument::checkAutoSaveFile  ) 
 

Called by koApplication to check for an autosave file in $HOME.

Definition at line 1136 of file koDocument.cc.

References openURL(), and resetURL().

Referenced by KoApplication::start().

virtual bool KoDocument::initDoc  )  [pure virtual]
 

Initializes an empty document (display the template dialog!).

You have to overload this method to initialize all your document variables.

Referenced by KoMainWindow::chooseNewDocument(), and KoApplication::start().

KoDocument::InitDocFlags KoDocument::initDocFlags  )  const
 

Return some flags for initDoc (BCI: this should be merged with initDoc) Usually the app will want to show the template dialog with 'everything' if InitDocAppStarting, InitDocFileClose or InitDocEmbedded show the template dialog with 'templates only' if InitDocFileNew.

  • * -

Definition at line 2017 of file koDocument.cc.

void KoDocument::setInitDocFlags InitDocFlags  flags  ) 
 

For KoMainWindow only - don't use!

Definition at line 2022 of file koDocument.cc.

References setInitDocFlags().

Referenced by KoMainWindow::chooseNewDocument(), setInitDocFlags(), and KoApplication::start().

void KoDocument::setModified bool  _mod  )  [virtual]
 

Sets the modified flag on the document.

This means that it has to be saved or not before deleting it.

Definition at line 1625 of file koDocument.cc.

References isAutosaving(), setModified(), and setTitleModified().

Referenced by exp0rt(), insertChild(), KoMainWindow::queryClose(), saveChildren(), KoMainWindow::saveDocument(), setModified(), and KoMainWindow::slotDocumentInfo().

void KoDocument::setTitleModified  )  [virtual]
 

Tells the document that its title has been modified, either because the modified status changes (this is done by setModified) or because the URL or the document-info's title changed.

Definition at line 1732 of file koDocument.cc.

References documentInfo(), isModified(), and isStoredExtern().

Referenced by import(), KoMainWindow::saveDocument(), setCurrent(), setModified(), KoMainWindow::slotDocumentInfo(), and KoApplication::start().

virtual bool KoDocument::isEmpty  )  const [inline, virtual]
 

Returns:
true if the document is empty.

Definition at line 395 of file koDocument.h.

Referenced by KoMainWindow::chooseNewDocument(), KoMainWindow::saveDocument(), and KoMainWindow::slotReloadFile().

virtual void KoDocument::setEmpty  )  [inline, virtual]
 

Sets the document to empty.

Used after loading a template (which is not empty, but not the user's input).

See also:
isEmpty

Definition at line 403 of file koDocument.h.

Referenced by KoApplication::start().

bool KoDocument::loadFromStore KoStore store,
const QString url
[virtual]
 

Loads a document from a store.

You should never have to reimplement.

Parameters:
url An internal url, like tar:/1/2

Definition at line 1554 of file koDocument.cc.

References KoStore::close(), completeLoading(), KoStore::device(), KoStore::enterDirectory(), loadChildren(), loadFromStore(), loadXML(), KoStore::open(), KoStore::popDirectory(), and KoStore::pushDirectory().

Referenced by loadFromStore().

bool KoDocument::saveToStore KoStore store,
const QString path
[virtual]
 

Saves a document to a store.

You should not have to reimplement this - but call it in saveChildren.

Definition at line 1006 of file koDocument.cc.

References KoStore::close(), completeSaving(), KoStore::enterDirectory(), KoStore::open(), KoStore::popDirectory(), KoStore::pushDirectory(), saveChildren(), saveToStore(), and saveToStream().

Referenced by saveChildren(), and saveToStore().

virtual bool KoDocument::loadXML QIODevice ,
const QDomDocument doc
[pure virtual]
 

Reimplement this method to load the contents of your KOffice document, from the XML document.

You are supposed to use the QDomDocument. The QIODevice is provided only for the cases where some pre-processing is needed, like kpresenter's kprconverter. Note that the QIODevice could be 0L, when called from an import filter.

Referenced by loadFromStore(), and loadNativeFormat().

QDomDocument KoDocument::saveXML  )  [virtual]
 

Reimplement this to save the contents of the KOffice document into a QDomDocument.

The framework takes care of saving it to the store.

Definition at line 1804 of file koDocument.cc.

Referenced by saveToStream().

QDomDocument KoDocument::createDomDocument const QString tagName,
const QString version
const
 

Return a correctly created QDomDocument for this KoDocument, including processing instruction, complete DOCTYPE tag (with systemId and publicId), and root element.

Parameters:
tagName the name of the tag for the root element
version the DTD version (usually the application's version).

Definition at line 1784 of file koDocument.cc.

References createDomDocument().

Referenced by createDomDocument().

QDomDocument KoDocument::createDomDocument const QString appName,
const QString tagName,
const QString version
[static]
 

Return a correctly created QDomDocument for a KOffice document, including processing instruction, complete DOCTYPE tag (with systemId and publicId), and root element.

This static method can be used e.g. by filters.

Parameters:
appName the app's instance name, e.g. kword, kspread, kpresenter etc.
tagName the name of the tag for the root element, e.g. DOC for kword/kpresenter.
version the DTD version (usually the application's version).

Definition at line 1790 of file koDocument.cc.

References createDomDocument().

bool KoDocument::saveToStream QIODevice dev  )  [virtual]
 

Save the document.

The default implementation is to call saveXML. This method exists only for applications that don't use QDomDocument for saving, i.e. kword and kpresenter.

Definition at line 993 of file koDocument.cc.

References saveToStream(), and saveXML().

Referenced by saveNativeFormat(), saveToStore(), and saveToStream().

bool KoDocument::loadNativeFormat const QString file  )  [virtual]
 

Loads a document in the native format from a given URL.

Reimplement if your native format isn't XML.

Parameters:
file the file to load - usually KReadOnlyPart::m_file or the result of a filter

Definition at line 1408 of file koDocument.cc.

References KoStore::bad(), KoStore::close(), completeLoading(), KoStore::device(), loadChildren(), loadNativeFormat(), loadXML(), and KoStore::open().

Referenced by loadNativeFormat(), and openFile().

bool KoDocument::saveNativeFormat const QString file  )  [virtual]
 

Saves the document in native format, to a given file You should never have to reimplement.

Made public for writing templates.

Definition at line 911 of file koDocument.cc.

References KoStore::bad(), KoStore::close(), completeSaving(), file(), nativeFormatMimeType(), KoStore::open(), saveChildren(), saveExternalChildren(), saveNativeFormat(), saveToStream(), and KoStoreDevice::writeBlock().

Referenced by saveFile(), and saveNativeFormat().

void KoDocument::setAutoSave int  delay  ) 
 

Activate/deactivate/configure the autosave feature.

Parameters:
delay in seconds, 0 to disable

Definition at line 600 of file koDocument.cc.

References isEmbedded(), and setAutoSave().

Referenced by KoDocument(), saveFile(), setAutoSave(), and setReadWrite().

bool KoDocument::isAutosaving  ) 
 

Checks whether the document is currently in the process of autosaving.

Definition at line 1921 of file koDocument.cc.

Referenced by setModified().

void KoDocument::setCheckAutoSaveFile bool  b  ) 
 

Set whether the next openURL call should check for an auto-saved file and offer to open it.

This is usually true, but can be turned off (e.g. for the preview module).

Definition at line 507 of file koDocument.cc.

References setCheckAutoSaveFile().

Referenced by setCheckAutoSaveFile().

void KoDocument::setAutoErrorHandlingEnabled bool  b  ) 
 

Set whether the next openURL call should show error message boxes in case of errors.

This is usually the case, but e.g. not when generating thumbnail previews.

Definition at line 512 of file koDocument.cc.

References setAutoErrorHandlingEnabled().

Referenced by setAutoErrorHandlingEnabled().

bool KoDocument::isAutoErrorHandlingEnabled  ) 
 

Checks whether error message boxes should be shown.

Since:
1.3.1

Definition at line 517 of file koDocument.cc.

Referenced by KoFilterManager::import().

int KoDocument::defaultAutoSave  )  [inline, static]
 

Retrieve the default value for autosave in seconds.

Called by the applications to use the correct default in their config

Definition at line 509 of file koDocument.h.

const QPtrList< KoDocumentChild > & KoDocument::children  )  const
 

Returns:
the list of all children. Do not modify the returned list.

Definition at line 670 of file koDocument.cc.

Referenced by isModified(), saveChildren(), and saveExternalChildren().

KoDocumentChild * KoDocument::child KoDocument doc  ) 
 

Returns:
the KoDocumentChild associated with the given Document, but only if doc is a direct child of this document.
This is a convenience function. You could get the same result by traversing the list returned by children.

Definition at line 706 of file koDocument.cc.

References child().

Referenced by KoView::activeChild(), child(), KoView::partActivateEvent(), KoView::partSelectEvent(), and KoView::selectedChild().

KoDocumentInfo * KoDocument::documentInfo  )  const
 

Returns:
the information concerning this document.
See also:
KoDocumentInfo

Definition at line 716 of file koDocument.cc.

Referenced by KoMainWindow::print(), KoMainWindow::queryClose(), setTitleModified(), KoMainWindow::slotDocumentInfo(), and KoMainWindow::updateCaption().

void KoDocument::addShell KoMainWindow shell  )  [virtual]
 

Appends the shell to the list of shells which show this document as their root document.

This method is automatically called from KoMainWindow::setRootDocument, so you dont need to call it.

Definition at line 1879 of file koDocument.cc.

References addShell().

Referenced by addShell(), and KoApplication::start().

void KoDocument::removeShell KoMainWindow shell  )  [virtual]
 

Removes the shell from the list.

That happens automatically if the shell changes its root document. Usually you dont need to call this method.

Definition at line 1888 of file koDocument.cc.

References removeShell().

Referenced by removeShell(), and KoMainWindow::setRootDocument().

const QPtrList< KoMainWindow > & KoDocument::shells  )  const
 

Returns:
the list of shells for the main window

Definition at line 1894 of file koDocument.cc.

Referenced by saveFile().

int KoDocument::shellCount  )  const
 

Returns:
the number of shells for the main window

Definition at line 1899 of file koDocument.cc.

Referenced by KoMainWindow::queryClose().

QPtrList<KoDocument>* KoDocument::documentList  )  [inline, static]
 

Returns:
the list of all the currently opened documents

Definition at line 563 of file koDocument.h.

DCOPObject * KoDocument::dcopObject  )  [virtual]
 

Return a DCOP interface for this document KOffice parts are strongly recommended to reimplement this method, so that their DCOP interface provides more functionality than the basic KoDocumentIface.

Definition at line 1904 of file koDocument.cc.

QCString KoDocument::dcopObjectId  )  const
 

Returns:
the ID of the DCOP interface for this document.

void KoDocument::emitProgress int  value  )  [inline]
 

Signal the progress of operations such as loading or saving.

Definition at line 580 of file koDocument.h.

References sigProgress().

bool KoDocument::isStoredExtern  )  [virtual]
 

Return true if url() is a real filename, false if url() is an internal url in the store, like "tar:/...".

Definition at line 1620 of file koDocument.cc.

References storeInternal().

Referenced by saveChildren(), saveExternalChildren(), setCurrent(), and setTitleModified().

KoPageLayout KoDocument::pageLayout  )  const [inline]
 

Returns:
the page layout associated with this document (margins, paper, etc).
See also:
KoPageLayout

Definition at line 597 of file koDocument.h.

void KoDocument::removeAutoSaveFiles  ) 
 

Performs a cleanup of unneeded backup files.

Definition at line 1926 of file koDocument.cc.

Referenced by KoMainWindow::queryClose(), and saveFile().

bool KoDocument::isModified  ) 
 

Returns true if this document or any of its internal child documents are modified.

Definition at line 832 of file koDocument.cc.

References children().

Referenced by exp0rt(), saveExternalChildren(), setTitleModified(), and KoMainWindow::slotReloadFile().

void KoDocument::setDoNotSaveExtDoc bool  on = true  ) 
 

Set when we do not want to save external children when saving our 'main' doc.

This makes it possible to save 'main' doc + all its internal children first, then go on to save external children. Typically used by query close. Use: doc->setDoNotSaveExtDoc(); doc->save(); // saves doc and its internal children, //also calls saveExternalChildren() which sets setDoNotSaveExtDoc(false) doc->saveExternalChildren();

Definition at line 1645 of file koDocument.cc.

References setDoNotSaveExtDoc().

Referenced by saveExternalChildren(), and setDoNotSaveExtDoc().

void KoDocument::setBackupPath const QString _path  ) 
 

Sets the backup path of the document.

Definition at line 1948 of file koDocument.cc.

References setBackupPath().

Referenced by setBackupPath().

QString KoDocument::backupPath  )  const
 

Returns:
path to the backup document

Definition at line 1953 of file koDocument.cc.

void KoDocument::setCurrent bool  on = true  ) 
 

Indicates that this document is currently viewed and thus should control the title caption.

Also resets current flag for all parents.

Definition at line 1958 of file koDocument.cc.

References forceCurrent(), isStoredExtern(), setCurrent(), and setTitleModified().

Referenced by setCurrent().

void KoDocument::forceCurrent bool  on  ) 
 

Sets current flag for this document and all its parents.

Definition at line 1985 of file koDocument.cc.

References forceCurrent().

Referenced by forceCurrent(), and setCurrent().

void KoDocument::resetURL  )  [inline]
 

Sets the document URL to empty URL KParts doesn't allow this, but KOffice apps have e.g.

templates After using loadNativeFormat on a template, one wants to set the url to KURL()

Definition at line 660 of file koDocument.h.

Referenced by checkAutoSaveFile(), import(), openFile(), openURL(), saveFile(), and KoApplication::start().

void KoDocument::setStoreInternal bool  i  ) 
 

Set when you want an external embedded document to be stored internally.

Definition at line 2006 of file koDocument.cc.

References setStoreInternal().

Referenced by setStoreInternal().

bool KoDocument::storeInternal  )  const
 

Returns:
true when external embedded documents are stored internally

Definition at line 2001 of file koDocument.cc.

Referenced by isStoredExtern().

void KoDocument::setURL const KURL &  url  )  [inline]
 

Sets the document URL to url KParts doesn't really allow this, but it is needed for undo of setStoreInternal().

Definition at line 678 of file koDocument.h.

Referenced by KoMainWindow::saveDocument().

QString& KoDocument::file  )  [inline]
 

_Only_ use these functions to restore m_file (in KoMainWindow) after a failed save (remember to use setURL() to restore the URL as well).

Do _not_ use these functions for any other purpose.

Definition at line 688 of file koDocument.h.

Referenced by openURL(), KoMainWindow::saveDocument(), and saveNativeFormat().

void KoDocument::childChanged KoDocumentChild child  )  [signal]
 

This signal is emitted when a direct or indirect child document changes and needs to be updated in all views.

If one of your child documents emits the childChanged signal, then you may usually just want to redraw this child. In this case you can ignore the parameter passed by the signal.

void KoDocument::sigProgress int  value  )  [signal]
 

Progress info while loading or saving.

The value is in percents (i.e. a number between 0 and 100) Your KoDocument-derived class should emit the signal now and then during load/save. KoMainWindow will take care of displaying a progress bar automatically.

Referenced by emitProgress().

void KoDocument::sigStatusBarMessage const QString text  )  [signal]
 

Emitted e.g.

at the beginning of a save operation This is emitted by KoDocument and used by KoView to display a statusbar message

Referenced by saveFile().

void KoDocument::sigClearStatusBarMessage  )  [signal]
 

Emitted e.g.

at the end of a save operation This is emitted by KoDocument and used by KoView to clear the statusbar message

Referenced by saveFile().

bool KoDocument::openFile  )  [protected, virtual]
 

Loads a document from KReadOnlyPart::m_file (KParts takes care of downloading remote documents).

Applies a filter if necessary, and calls loadNativeFormat in any case You should not have to reimplement, except for very special cases.

This method is called from the KReadOnlyPart::openURL method.

Definition at line 1245 of file koDocument.cc.

References createView(), loadNativeFormat(), nativeFormatMimeType(), removeView(), and resetURL().

bool KoDocument::saveFile  )  [protected, virtual]
 

Saves a document to KReadOnlyPart::m_file (KParts takes care of uploading remote documents) Applies a filter if necessary, and calls saveNativeFormat in any case You should not have to reimplement, except for very special cases.

Definition at line 353 of file koDocument.cc.

References isExporting(), nativeFormatMimeType(), removeAutoSaveFiles(), resetURL(), saveNativeFormat(), setAutoSave(), shells(), sigClearStatusBarMessage(), and sigStatusBarMessage().

bool KoDocument::isImporting  )  const [protected]
 

Returns whether or not the current openURL() or openFile() call is actually an import operation (like File --> Import).

This is for informational purposes only.

Definition at line 497 of file koDocument.cc.

bool KoDocument::isExporting  )  const [protected]
 

Returns whether or not the current saveFile() call is actually an export operation (like File --> Export).

If this function returns true during saveFile() and you are changing some sort of state, you _must_ restore it before the end of saveFile(); otherwise, File --> Export will not work properly.

Definition at line 502 of file koDocument.cc.

Referenced by saveChildren(), and saveFile().

bool KoDocument::loadChildren KoStore  )  [protected, virtual]
 

You need to overload this function if your document may contain embedded documents.

This function is called to load embedded documents.

An example implementation may look like this:

  QPtrListIterator<KoDocumentChild> it( children() );
  for( ; it.current(); ++it )
  {
    if ( !it.current()->loadDocument( _store ) )
    {
      return false;
    }
  }
  return true;
  

Definition at line 1769 of file koDocument.cc.

References loadChildren().

Referenced by loadChildren(), loadFromStore(), and loadNativeFormat().

bool KoDocument::saveChildren KoStore store  )  [protected, virtual]
 

Saves all internal children (only!).

See also:
saveExternalChildren if you have external children. Returns true on success.

Definition at line 853 of file koDocument.cc.

References children(), isExporting(), isStoredExtern(), saveChildren(), saveToStore(), and setModified().

Referenced by saveChildren(), saveNativeFormat(), and saveToStore().

bool KoDocument::completeLoading KoStore store  )  [protected, virtual]
 

Overload this function if you have to load additional files from a store.

This function is called after loadXML and after loadChildren have been called.

Definition at line 1774 of file koDocument.cc.

References completeLoading().

Referenced by completeLoading(), loadFromStore(), and loadNativeFormat().

bool KoDocument::completeSaving KoStore store  )  [protected, virtual]
 

If you want to write additional files to a store, then you must do it here.

In the implementation, you should prepend the document url (using url().url()) before the filename, so that everything is kept relative to this document. For instance it will produce urls such as tar:/1/pictures/picture0.png, if the doc url is tar:/1 But do this ONLY if the document is not stored extern (see isStoredExtern). If it is, then the pictures should be saved to tar:/pictures.

Definition at line 1779 of file koDocument.cc.

References completeSaving().

Referenced by completeSaving(), saveNativeFormat(), and saveToStore().

void KoDocument::insertChild KoDocumentChild child  )  [protected, virtual]
 

Inserts the new child in the list of children and emits the childChanged signal.

At the same time this method marks this document as modified.

To remove a child, just delete it. KoDocument will detect this and remove the child from its lists.

See also:
isModified

Definition at line 633 of file koDocument.cc.

References KoDocumentChild::document(), insertChild(), isSingleViewMode(), and setModified().

Referenced by insertChild().

bool KoDocument::saveExternalChildren  )  [protected]
 

Saves all externally stored children.

Returns true on success.

See also:
saveChildren for internal children

Definition at line 877 of file koDocument.cc.

References children(), KoDocumentChild::document(), KoDocumentChild::isDeleted(), isModified(), isStoredExtern(), and setDoNotSaveExtDoc().

Referenced by saveNativeFormat().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for lib Library Version 1.3.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Sep 28 04:04:04 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003