libs/main
KoDocument Class Reference
The KOffice document class. More...
#include <KoDocument.h>

Classes | |
| struct | CustomDocumentWidgetItem |
| Struct used in the list created by createCustomDocumentWidgets(). More... | |
Public Types | |
| enum | { SaveAsDirectoryStore = 2, SaveAsFlatXML = 4, SaveEncrypted = 8 } |
| enum | ImportExportType { ForExport, ForImport } |
Public Slots | |
| virtual void | addCommand (QUndoCommand *command) |
| virtual void | beginMacro (const QString &text) |
| virtual void | endMacro () |
| virtual void | initEmpty () |
| virtual void | setDocumentClean (bool clean) |
| virtual void | setModified (bool _mod) |
| KoUndoStack * | undoStack () |
Signals | |
| void | clearStatusBarMessage () |
| void | closeEmbedInitDialog () |
| void | modified (bool) |
| void | sigProgress (int value) |
| void | statusBarMessage (const QString &text) |
| void | unitChanged (KoUnit) |
Public Member Functions | |
| KoDocument (QWidget *parentWidget, QObject *parent, bool singleViewMode=false) | |
| virtual | ~KoDocument () |
| virtual QAction * | action (const QDomElement &element) const |
| virtual void | addShell (KoMainWindow *shell) |
| bool | addVersion (const QString &comment) |
| virtual void | addView (KoView *view) |
| bool | backupFile () const |
| QString | backupPath () const |
| QString | caption () const |
| bool | checkAutoSaveFile () |
| void | clearUndoHistory () |
| bool | confirmNonNativeSave (const bool exporting) const |
| KDE_DEPRECATED QDomDocument | createDomDocument (const QString &tagName, const QString &version) const |
| KoView * | createView (QWidget *parent=0) |
| KoDocumentInfo * | documentInfo () const |
| virtual QDomDocument | domDocument () const |
| void | emitProgress (int value) |
| QString | errorMessage () const |
| bool | exportDocument (const KUrl &url) |
| virtual QStringList | extraNativeMimeTypes (ImportExportType importExportType) const |
| void | forceCurrent (bool on) |
| virtual QPixmap | generatePreview (const QSize &size) |
| KoGridData & | gridData () |
| KoGuidesData & | guidesData () |
| bool | hasExternURL () const |
| virtual KParts::Part * | hitTest (QWidget *widget, const QPoint &globalPos) |
| bool | importDocument (const KUrl &url) |
| bool | isAutoErrorHandlingEnabled () const |
| bool | isAutosaving () const |
| bool | isCurrent () const |
| bool | isEmbedded () const |
| virtual bool | isEmpty () const |
| bool | isLoading () const |
| bool | isModified () const |
| bool | isNativeFormat (const QByteArray &mimetype, ImportExportType importExportType) const |
| bool | isSingleViewMode () const |
| virtual bool | isStoredExtern () const |
| virtual bool | loadFromStore (KoStore *store, const QString &url) |
| virtual bool | loadNativeFormat (const QString &file) |
| bool | loadNativeFormatFromStore (QByteArray &data) |
| virtual bool | loadOasisFromStore (KoStore *store) |
| virtual bool | loadOdf (KoOdfReadStore &odfStore)=0 |
| virtual bool | loadXML (const KoXmlDocument &doc, KoStore *store)=0 |
| QByteArray | mimeType () const |
| virtual QByteArray | nativeFormatMimeType () const |
| QByteArray | nativeOasisMimeType () const |
| virtual bool | openUrl (const KUrl &url) |
| QByteArray | outputMimeType () const |
| virtual int | pageCount () const |
| virtual KoPageLayout | pageLayout (int pageNumber=0) const |
| virtual void | paintContent (QPainter &painter, const QRect &rect)=0 |
| virtual void | paintEverything (QPainter &painter, const QRect &rect, KoView *view=0) |
| int | queryCloseDia () |
| void | removeAutoSaveFiles () |
| virtual void | removeShell (KoMainWindow *shell) |
| virtual void | removeView (KoView *view) |
| void | resetURL () |
| virtual bool | saveNativeFormat (const QString &file) |
| virtual bool | saveOdf (SavingContext &documentContext)=0 |
| virtual bool | saveToStore (KoStore *store, const QString &path) |
| virtual bool | saveToStream (QIODevice *dev) |
| void | saveUnitOdf (KoXmlWriter *settingsWriter) const |
| virtual QDomDocument | saveXML () |
| void | setAutoErrorHandlingEnabled (bool b) |
| void | setAutoSave (int delay) |
| void | setBackupFile (bool _b) |
| void | setBackupPath (const QString &_path) |
| void | setCheckAutoSaveFile (bool b) |
| void | setConfirmNonNativeSave (const bool exporting, const bool on) |
| void | setCurrent (bool on=true) |
| virtual void | setEmpty () |
| void | setErrorMessage (const QString &errMsg) |
| virtual void | setManager (KParts::PartManager *manager) |
| void | setMimeType (const QByteArray &mimeType) |
| void | setMimeTypeAfterLoading (const QString &mimeType) |
| void | setOutputMimeType (const QByteArray &mimeType, int specialOutputFlag=0) |
| virtual void | setPageLayout (const KoPageLayout &pageLayout) |
| virtual void | setReadWrite (bool readwrite=true) |
| void | setStoreInternal (bool i) |
| void | setTemplateType (const QString &_templateType) |
| void | setTitleModified (const QString &caption, bool mod) |
| virtual void | setTitleModified () |
| void | setUnit (KoUnit u) |
| int | shellCount () const |
| const QList< KoMainWindow * > & | shells () const |
| virtual bool | showEmbedInitDialog (QWidget *parent) |
| void | showLoadingErrorDialog () |
| void | showSavingErrorDialog () |
| virtual void | showStartUpWidget (KoMainWindow *parent, bool alwaysShow=false) |
| int | specialOutputFlag () const |
| bool | storeInternal () const |
| virtual int | supportedSpecialFormats () const |
| QString | templateType () const |
| KoUnit | unit () const |
| QString | unitName () const |
| QList< KoVersionInfo > & | versionList () |
| int | viewCount () const |
| QList< KoView * > | views () const |
| virtual bool | wantExportConfirmation () const |
Static Public Member Functions | |
| static QDomDocument | createDomDocument (const QString &appName, const QString &tagName, const QString &version) |
| static int | defaultAutoSave () |
| static QList< KoDocument * > * | documentList () |
| static QStringList | readExtraNativeMimeTypes (const KComponentData &instance=KComponentData()) |
| static QByteArray | readNativeFormatMimeType (const KComponentData &instance=KComponentData()) |
| static KService::Ptr | readNativeService (const KComponentData &instance=KComponentData()) |
| static QString | tagNameToDocumentType (const QString &localName) |
Protected Slots | |
| virtual void | openExistingFile (const KUrl &url) |
| virtual void | openTemplate (const KUrl &url) |
Protected Member Functions | |
| QString | autoSaveFile (const QString &path) const |
| virtual bool | completeLoading (KoStore *store) |
| virtual bool | completeSaving (KoStore *store) |
| virtual QList < CustomDocumentWidgetItem > | createCustomDocumentWidgets (QWidget *parent) |
| KoOpenPane * | createOpenPane (QWidget *parent, const KComponentData &instance, const QString &templateType=QString()) |
| virtual KoView * | createViewInstance (QWidget *parent)=0 |
| virtual KUrl | getOdfUrl () const |
| bool | isExporting () const |
| bool | isImporting () const |
| QString | newObjectName () |
| virtual bool | openFile () |
| virtual bool | saveFile () |
| virtual void | setModified () |
| virtual void | setOdfUrl (const KUrl &url) |
Properties | |
| bool | backupFile |
Detailed Description
The KOffice document class.
This class provides some functionality each KOffice document should have.
The KOffice document class
Definition at line 70 of file KoDocument.h.
Member Enumeration Documentation
| anonymous enum |
Enum values used by specialOutputFlag - note that it's a bitfield for supportedSpecialFormats.
Definition at line 244 of file KoDocument.h.
Definition at line 231 of file KoDocument.h.
Constructor & Destructor Documentation
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. singleViewMode determines whether the document may only have one view. In this case the parentmust be a QWidget derived class. KoDocument will then create a wrapper widget (KoViewWrapperWidget) which is a child ofparentWidget. This widget can be retrieved by calling widget().
Definition at line 251 of file KoDocument.cpp.
| 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 307 of file KoDocument.cpp.
Member Function Documentation
| QAction * 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 592 of file KoDocument.cpp.
| void KoDocument::addCommand | ( | QUndoCommand * | command | ) | [virtual, slot] |
Adds a command to the undo stack and executes it by calling the redo() function.
- Parameters:
-
command command to add to the undo stack
Definition at line 2376 of file KoDocument.cpp.
| 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 do not need to call it.
Definition at line 2010 of file KoDocument.cpp.
| bool KoDocument::addVersion | ( | const QString & | comment | ) |
Adds a new version and then saves the whole document.
- Parameters:
-
comment the comment for the version
- Returns:
- true on success, otherwise false
Definition at line 1647 of file KoDocument.cpp.
| 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 647 of file KoDocument.cpp.
Definition at line 1023 of file KoDocument.cpp.
| bool KoDocument::backupFile | ( | ) | const |
| QString KoDocument::backupPath | ( | ) | const |
- Returns:
- path to the backup document
Definition at line 2112 of file KoDocument.cpp.
| void KoDocument::beginMacro | ( | const QString & | text | ) | [virtual, slot] |
Begins recording of a macro command.
At the end endMacro needs to be called.
- Parameters:
-
text command description
Definition at line 2382 of file KoDocument.cpp.
| QString KoDocument::caption | ( | ) | const |
- Returns:
- caption of the document
Caption is of the form "[title] - [url]", built out of the document info (title) and pretty-printed document URL. If the title is not present, only the URL it returned.
Definition at line 1814 of file KoDocument.cpp.
| bool KoDocument::checkAutoSaveFile | ( | ) |
Called by koApplication to check for an autosave file in $HOME.
Definition at line 1046 of file KoDocument.cpp.
| void KoDocument::clearStatusBarMessage | ( | ) | [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
| void KoDocument::clearUndoHistory | ( | ) |
Definition at line 2398 of file KoDocument.cpp.
| void KoDocument::closeEmbedInitDialog | ( | ) | [signal] |
| 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 1849 of file KoDocument.cpp.
| 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 1854 of file KoDocument.cpp.
| 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 524 of file KoDocument.cpp.
| QList< KoDocument::CustomDocumentWidgetItem > KoDocument::createCustomDocumentWidgets | ( | QWidget * | parent | ) | [protected, virtual] |
Override this method in your derived class to show a widget in the startup 'dialog'.
This widget should allow the user to set settings for a custom document (i.e. one not based on a template). The returned widget should provide its own button (preferably 'Create') and implement the logic to implement the document instance correctly. After initializing the widget should emit a signal called 'documentSelected()' which will remove the startupWidget and show the document.
- Parameters:
-
parent the parent of the to be created widget.
- Returns:
- a list of KoDocument::CustomDocumentWidgetItem.
Definition at line 2343 of file KoDocument.cpp.
| QDomDocument KoDocument::createDomDocument | ( | const QString & | appName, | |
| const QString & | tagName, | |||
| const QString & | version | |||
| ) | [static] |
Return a correctly created QDomDocument for an old (1.3-style) 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 1865 of file KoDocument.cpp.
| 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).
- Deprecated:
- use KoOdfWriteStore::createOasisXmlWriter instead
Definition at line 1859 of file KoDocument.cpp.
| KoOpenPane * KoDocument::createOpenPane | ( | QWidget * | parent, | |
| const KComponentData & | instance, | |||
| const QString & | templateType = QString() | |||
| ) | [protected] |
Creates the open widget showed at application start up.
- Parameters:
-
parent the parent widget instance the KComponentData to be used for KConfig data templateType the template-type (group) that should be selected on creation.
Definition at line 2297 of file KoDocument.cpp.
Create a new view for the document.
Definition at line 343 of file KoDocument.cpp.
| int KoDocument::defaultAutoSave | ( | ) | [static] |
Retrieve the default value for autosave in seconds.
Called by the applications to use the correct default in their config
Definition at line 2440 of file KoDocument.cpp.
| KoDocumentInfo * KoDocument::documentInfo | ( | ) | const |
- Returns:
- the information concerning this document.
- See also:
- KoDocumentInfo
Definition at line 702 of file KoDocument.cpp.
| static QList<KoDocument*>* KoDocument::documentList | ( | ) | [inline, static] |
- Returns:
- the list of all the currently opened documents
Definition at line 592 of file KoDocument.h.
| QDomDocument KoDocument::domDocument | ( | ) | const [virtual] |
Returns the DOM document which describes the GUI of the first view.
Definition at line 607 of file KoDocument.cpp.
| void KoDocument::emitProgress | ( | int | value | ) | [inline] |
Signal the progress of operations such as loading or saving.
Definition at line 599 of file KoDocument.h.
| void KoDocument::endMacro | ( | ) | [virtual, slot] |
Ends the recording of a macro command.
Definition at line 2387 of file KoDocument.cpp.
| QString KoDocument::errorMessage | ( | ) | const |
Return the last error message.
Usually KoDocument takes care of showing it; this method is mostly provided for non-interactive use.
Definition at line 2052 of file KoDocument.cpp.
| bool KoDocument::exportDocument | ( | 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 350 of file KoDocument.cpp.
| QStringList KoDocument::extraNativeMimeTypes | ( | KoDocument::ImportExportType | importExportType | ) | const [virtual] |
Returns a list of the mimetypes considered "native", i.e.
which can be saved by KoDocument without a filter, in *addition* to the main one
Definition at line 1984 of file KoDocument.cpp.
| void KoDocument::forceCurrent | ( | bool | on | ) |
Sets current flag for this document and all its parents.
Definition at line 2140 of file KoDocument.cpp.
Generates a preview picture of the document.
- Note:
- The preview is used in the File Dialog and also to create the Thumbnail
Definition at line 984 of file KoDocument.cpp.
| virtual KUrl KoDocument::getOdfUrl | ( | ) | const [inline, protected, virtual] |
to satisfy KoOdfDocument where it overlaps with kparts
Definition at line 968 of file KoDocument.h.
| KoGridData & KoDocument::gridData | ( | ) |
return the grid data for this document.
Definition at line 2403 of file KoDocument.cpp.
| KoGuidesData & KoDocument::guidesData | ( | ) |
returns the guides data for this document.
Definition at line 2408 of file KoDocument.cpp.
| bool KoDocument::hasExternURL | ( | ) | const |
Definition at line 2166 of file KoDocument.cpp.
Reimplemented from KParts::Part.
Definition at line 685 of file KoDocument.cpp.
| bool KoDocument::importDocument | ( | 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 1075 of file KoDocument.cpp.
| void KoDocument::initEmpty | ( | ) | [virtual, slot] |
Initialize an empty document using default values.
Definition at line 2286 of file KoDocument.cpp.
| bool KoDocument::isAutoErrorHandlingEnabled | ( | ) | const |
Checks whether error message boxes should be shown.
Definition at line 561 of file KoDocument.cpp.
| bool KoDocument::isAutosaving | ( | ) | const |
Checks whether the document is currently in the process of autosaving.
Definition at line 2075 of file KoDocument.cpp.
| bool KoDocument::isCurrent | ( | ) | const |
Definition at line 2150 of file KoDocument.cpp.
| bool KoDocument::isEmbedded | ( | ) | const |
- Returns:
- true if the document is embedded in another odf document
Definition at line 338 of file KoDocument.cpp.
| bool KoDocument::isEmpty | ( | ) | const [virtual] |
- Returns:
- true if the document is empty.
Definition at line 2429 of file KoDocument.cpp.
| 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 546 of file KoDocument.cpp.
| 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 541 of file KoDocument.cpp.
| bool KoDocument::isLoading | ( | ) | const |
Returns true during loading (openUrl can be asynchronous).
Definition at line 2080 of file KoDocument.cpp.
| bool KoDocument::isModified | ( | ) | const |
Returns true if this document or any of its internal child documents are modified.
Definition at line 713 of file KoDocument.cpp.
| bool KoDocument::isNativeFormat | ( | const QByteArray & | mimetype, | |
| ImportExportType | importExportType | |||
| ) | const |
Checks whether a given mimetype can be handled natively.
Definition at line 1977 of file KoDocument.cpp.
| bool KoDocument::isSingleViewMode | ( | ) | const |
Tells whether this document is in singleview mode.
This mode can only be set in the constructor.
Definition at line 333 of file KoDocument.cpp.
| bool KoDocument::isStoredExtern | ( | ) | const [virtual] |
Return true if url() is a real filename, false if url() is an internal url in the store, like "tar:/...".
Definition at line 1721 of file KoDocument.cpp.
| bool KoDocument::loadFromStore | ( | KoStore * | store, | |
| const QString & | url | |||
| ) | [virtual] |
Loads a document from a store.
You should never have to reimplement.
- Parameters:
-
store The store to load from url An internal url, like tar:/1/2
Definition at line 1607 of file KoDocument.cpp.
| 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 1394 of file KoDocument.cpp.
| bool KoDocument::loadNativeFormatFromStore | ( | QByteArray & | data | ) |
Definition at line 1504 of file KoDocument.cpp.
| bool KoDocument::loadOasisFromStore | ( | KoStore * | store | ) | [virtual] |
Loads an OASIS document from a store.
This is used for both the main document and embedded objects.
Definition at line 1638 of file KoDocument.cpp.
| virtual bool KoDocument::loadOdf | ( | KoOdfReadStore & | odfStore | ) | [pure virtual] |
Reimplement this method to load the contents of your KOffice document, from the XML document ("content.xml").
The styles have been parsed already, you can find them in the odfStore.styles(). The store can be used to load images and embedded documents.
| virtual bool KoDocument::loadXML | ( | const KoXmlDocument & | doc, | |
| KoStore * | store | |||
| ) | [pure virtual] |
Reimplement this method to load the contents of your KOffice document, from the XML document.
This is for the pre-Oasis file format (maindoc.xml).
| QByteArray KoDocument::mimeType | ( | ) | const |
Returns the actual mimetype of the document.
Definition at line 498 of file KoDocument.cpp.
| void KoDocument::modified | ( | bool | ) | [signal] |
Emitted when the document is modified.
| QByteArray 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. This comes from the X-KDE-NativeMimeType key in the .desktop file You do NOT have to reimplement this (it is only virtual for kounavail).
Definition at line 1894 of file KoDocument.cpp.
| QByteArray KoDocument::nativeOasisMimeType | ( | ) | const |
Returns the OASIS OpenDocument mimetype of the document, if supported This comes from the X-KDE-NativeOasisMimeType key in the desktop file.
- Returns:
- the oasis mimetype or, if it hasn't one, the nativeformatmimetype.
Definition at line 1916 of file KoDocument.cpp.
| QString KoDocument::newObjectName | ( | ) | [protected] |
Generate a name for the document.
Definition at line 90 of file KoDocument.cpp.
| void KoDocument::openExistingFile | ( | const KUrl & | url | ) | [protected, virtual, slot] |
This slot loads an existing file and deletes the start up widget.
- Parameters:
-
url the file to load
Definition at line 2260 of file KoDocument.cpp.
| 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.
NOTE: this method also creates a new KoView instance!
This method is called from the KReadOnlyPart::openUrl method.
Definition at line 1152 of file KoDocument.cpp.
| void KoDocument::openTemplate | ( | const KUrl & | url | ) | [protected, virtual, slot] |
This slot loads a template and deletes the start up widget.
- Parameters:
-
url the template to load
Definition at line 2266 of file KoDocument.cpp.
| bool KoDocument::openUrl | ( | const KUrl & | url | ) | [virtual] |
Reimplemented from KParts::ReadWritePart for internal reasons (for the autosave functionality).
Definition at line 1098 of file KoDocument.cpp.
| QByteArray KoDocument::outputMimeType | ( | ) | const |
Definition at line 514 of file KoDocument.cpp.
| virtual int KoDocument::pageCount | ( | ) | const [inline, virtual] |
- Returns:
- returns the number of pages in the document.
Definition at line 705 of file KoDocument.h.
| KoPageLayout KoDocument::pageLayout | ( | int | pageNumber = 0 |
) | const [virtual] |
- Returns:
- the page layout associated with this document (margins, pageSize, etc). Override this if you want to provide different sized pages.
- See also:
- KoPageLayout
Definition at line 2198 of file KoDocument.cpp.
Paints the data itself.
Normally called by paintEverything(). It does not paint the children. It's this method that KOffice Parts have to implement.
- Parameters:
-
painter The painter object onto which will be drawn. rect The rect that should be used in the painter object.
- See also:
- paintEverything
| void KoDocument::paintEverything | ( | QPainter & | painter, | |
| const QRect & | rect, | |||
| KoView * | view = 0 | |||
| ) | [virtual] |
Paints the whole document into the given painter object.
- Parameters:
-
painter The painter object onto which will 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, when painting children.
Definition at line 707 of file KoDocument.cpp.
| int KoDocument::queryCloseDia | ( | ) |
Definition at line 1754 of file KoDocument.cpp.
| QStringList KoDocument::readExtraNativeMimeTypes | ( | const KComponentData & | instance = KComponentData() |
) | [static] |
Used by KoMainWindow, when no document exists yet.
With the help of instance or KApplication::componentData() this method figures out which .desktop file matches this application. In this file it searches for the "X-KDE-ExtraNativeMimeTypes" entry and returns it.
- See also:
- KService
- KDesktopFile
Definition at line 1969 of file KoDocument.cpp.
| QByteArray KoDocument::readNativeFormatMimeType | ( | const KComponentData & | instance = KComponentData() |
) | [static] |
Used by KoApplication, and by KoMainWindow, when no document exists yet.
With the help of instance or KApplication::componentData() 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 1950 of file KoDocument.cpp.
| KService::Ptr KoDocument::readNativeService | ( | const KComponentData & | instance = KComponentData() |
) | [static] |
With the help of instance or KApplication::componentData() this method figures out which .desktop file matches this application, and returns the KService instance for it.
Definition at line 1927 of file KoDocument.cpp.
| void KoDocument::removeAutoSaveFiles | ( | ) |
Performs a cleanup of unneeded backup files.
Definition at line 2085 of file KoDocument.cpp.
| void KoDocument::removeShell | ( | KoMainWindow * | shell | ) | [virtual] |
Removes the shell from the list.
That happens automatically if the shell changes its root document. Usually you do not need to call this method.
Definition at line 2019 of file KoDocument.cpp.
| void KoDocument::removeView | ( | KoView * | view | ) | [virtual] |
Removes a view of the document.
Definition at line 663 of file KoDocument.cpp.
| 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 681 of file KoDocument.h.
| 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 399 of file KoDocument.cpp.
| 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 722 of file KoDocument.cpp.
| virtual bool KoDocument::saveOdf | ( | SavingContext & | documentContext | ) | [pure virtual] |
Reimplement this method to save the contents of your KOffice document, using the ODF format.
| 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 921 of file KoDocument.cpp.
| 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 908 of file KoDocument.cpp.
| void KoDocument::saveUnitOdf | ( | KoXmlWriter * | settingsWriter | ) | const |
Save the unit to the settings writer.
- Parameters:
-
settingsWriter
Definition at line 2221 of file KoDocument.cpp.
| 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 1879 of file KoDocument.cpp.
| 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 556 of file KoDocument.cpp.
| void KoDocument::setAutoSave | ( | int | delay | ) |
Activate/deactivate/configure the autosave feature.
- Parameters:
-
delay in seconds, 0 to disable
Definition at line 638 of file KoDocument.cpp.
| void KoDocument::setBackupFile | ( | bool | _b | ) |
Definition at line 2096 of file KoDocument.cpp.
| void KoDocument::setBackupPath | ( | const QString & | _path | ) |
Sets the backup path of the document.
Definition at line 2107 of file KoDocument.cpp.
| 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 551 of file KoDocument.cpp.
| void KoDocument::setConfirmNonNativeSave | ( | const bool | exporting, | |
| const bool | on | |||
| ) |
Definition at line 531 of file KoDocument.cpp.
| 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 2117 of file KoDocument.cpp.
| void KoDocument::setDocumentClean | ( | bool | clean | ) | [virtual, slot] |
Called by the undo stack when the document is saved or all changes has been undone.
- Parameters:
-
clean if the document's undo stack is clean or not
Definition at line 2393 of file KoDocument.cpp.
| void KoDocument::setEmpty | ( | ) | [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 2434 of file KoDocument.cpp.
| 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 2047 of file KoDocument.cpp.
| void KoDocument::setManager | ( | KParts::PartManager * | manager | ) | [virtual] |
| void KoDocument::setMimeType | ( | const QByteArray & | mimeType | ) |
Sets the mime type for the document.
When choosing "save as" this is also the mime type selected by default.
Definition at line 503 of file KoDocument.cpp.
| void KoDocument::setMimeTypeAfterLoading | ( | const QString & | mimeType | ) |
| virtual void KoDocument::setModified | ( | ) | [inline, protected, virtual] |
| void KoDocument::setModified | ( | bool | _mod | ) | [virtual, slot] |
Sets the modified flag on the document.
This means that it has to be saved or not before deleting it.
Definition at line 1726 of file KoDocument.cpp.
| virtual void KoDocument::setOdfUrl | ( | const KUrl & | url | ) | [inline, protected, virtual] |
Definition at line 972 of file KoDocument.h.
| void KoDocument::setOutputMimeType | ( | const QByteArray & | 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:
-
mimeType the mime type (format) to use. specialOutputFlag is for "save as older version" etc.
Definition at line 508 of file KoDocument.cpp.
| void KoDocument::setPageLayout | ( | const KoPageLayout & | pageLayout | ) | [virtual] |
Definition at line 2203 of file KoDocument.cpp.
| 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 625 of file KoDocument.cpp.
| void KoDocument::setStoreInternal | ( | bool | i | ) |
Set when you want an external embedded document to be stored internally.
Definition at line 2160 of file KoDocument.cpp.
| void KoDocument::setTemplateType | ( | const QString & | _templateType | ) |
Set the template type used.
This is used by the start up widget to show the correct templates.
Definition at line 2319 of file KoDocument.cpp.
| void KoDocument::setTitleModified | ( | const QString & | caption, | |
| bool | mod | |||
| ) |
Definition at line 1786 of file KoDocument.cpp.
| 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 1830 of file KoDocument.cpp.
| void KoDocument::setUnit | ( | KoUnit | u | ) |
Sets the unit used to display all measures/distances.
Definition at line 2213 of file KoDocument.cpp.
| int KoDocument::shellCount | ( | ) | const |
- Returns:
- the number of shells for the main window
Definition at line 2030 of file KoDocument.cpp.
| const QList< KoMainWindow * > & KoDocument::shells | ( | ) | const |
- Returns:
- the list of shells for the main window
Definition at line 2025 of file KoDocument.cpp.
| bool KoDocument::showEmbedInitDialog | ( | QWidget * | parent | ) | [virtual] |
Shows the init dialog when embeding.
- Parameters:
-
parent the parent widget
Definition at line 2348 of file KoDocument.cpp.
| void KoDocument::showLoadingErrorDialog | ( | ) |
Show the last error message in a message box.
The dialog box will mention a loading problem. openUrl/openFile takes care of doing it, but not loadNativeFormat itself, so this is often called after loadNativeFormat returned false.
Definition at line 2066 of file KoDocument.cpp.
| void KoDocument::showSavingErrorDialog | ( | ) |
Show the last error message in a message box.
The dialog box will mention a saving problem. Note that save/saveFile takes care of doing it.
Definition at line 2057 of file KoDocument.cpp.
| void KoDocument::showStartUpWidget | ( | KoMainWindow * | parent, | |
| bool | alwaysShow = false | |||
| ) | [virtual] |
Creates and shows the start up widget.
- Parameters:
-
parent the KoMainWindow used as parent for the widget. alwaysShow always show the widget even if the user has configured it to not show.
Definition at line 2231 of file KoDocument.cpp.
| 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.
| int KoDocument::specialOutputFlag | ( | ) | const |
Definition at line 519 of file KoDocument.cpp.
| void KoDocument::statusBarMessage | ( | 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
| bool KoDocument::storeInternal | ( | ) | const |
- Returns:
- true when external embedded documents are stored internally
Definition at line 2155 of file KoDocument.cpp.
| int KoDocument::supportedSpecialFormats | ( | ) | const [virtual] |
Return the set of SupportedSpecialFormats that the application wants to offer in the "Save" file dialog.
Definition at line 1997 of file KoDocument.cpp.
The first thing to do in loadOasis is get hold of the office:body tag, then its child.
If the child isn't the expected one, the error message can indicate what it is instead. This method returns a translated name for the type of document, e.g. i18n("Word Processing") for office:text.
Definition at line 2190 of file KoDocument.cpp.
| QString KoDocument::templateType | ( | ) | const |
Template type used.
This is used by the start up widget to show the correct templates.
Definition at line 2324 of file KoDocument.cpp.
| KoUndoStack * KoDocument::undoStack | ( | ) | [slot] |
Returns the global undo stack.
Definition at line 2371 of file KoDocument.cpp.
| KoUnit KoDocument::unit | ( | ) | const |
Returns the unit used to display all measures/distances.
Definition at line 2208 of file KoDocument.cpp.
| void KoDocument::unitChanged | ( | KoUnit | ) | [signal] |
This signal is emitted when the unit is changed by setUnit().
It is common to connect views to it, in order to change the displayed units (e.g. in the rulers)
| QString KoDocument::unitName | ( | ) | const |
Returns the name of the unit used to display all measures/distances.
Use this method for displaying it in the user interface, but use unit() for everything else (conversions etc.)
Definition at line 2226 of file KoDocument.cpp.
| QList< KoVersionInfo > & KoDocument::versionList | ( | ) |
Definition at line 2366 of file KoDocument.cpp.
| int KoDocument::viewCount | ( | ) | const |
- Returns:
- number of views this document is displayed in
Definition at line 680 of file KoDocument.cpp.
- Returns:
- a list of views this document is displayed in
Definition at line 675 of file KoDocument.cpp.
| bool KoDocument::wantExportConfirmation | ( | ) | const [virtual] |
Definition at line 536 of file KoDocument.cpp.
Property Documentation
bool KoDocument::backupFile [read, write] |
Definition at line 74 of file KoDocument.h.
The documentation for this class was generated from the following files:
