LibreOffice: XDocumentRecovery Interface Reference

LibreOffice LibreOffice 25.8 SDK API Reference

Loading...
Searching...
No Matches
XDocumentRecovery Interface Reference

is the interface to be implemented by documents who wish to participate in the document emergency-save / recovery process. More...

`import "XDocumentRecovery.idl";`

Inheritance diagram for XDocumentRecovery:

## Public Member Functions
boolean | wasModifiedSinceLastSave ()
| determines whether the document has been modified since the last call to storeToRecoveryFile().
void | storeToRecoveryFile ([in] string TargetLocation, [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor) raises ( ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException )
| does an emergency save of the document
void | recoverFromFile ([in] string SourceLocation, [in] string SalvagedFile, [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor) raises ( ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException )
| recovers the document after a previous emergency or session save.

## Detailed Description

is the interface to be implemented by documents who wish to participate in the document emergency-save / recovery process.

## Member Function Documentation

## ◆ recoverFromFile()

void recoverFromFile | ( | [in] string | SourceLocation,
|  | [in] string | SalvagedFile,
|  | [in] sequence< ::com::sun::star::beans::PropertyValue > | MediaDescriptor )
raises | ( | ::com::sun::star::io::IOException,
|  | ::com::sun::star::lang::WrappedTargetException ) |  |  |

recovers the document after a previous emergency or session save.

The document itself has previously been created, but not loaded (via com::sun::star::frame::XLoadable::load()) or initialized (via com::sun::star::frame::XLoadable::initNew()).

Upon successful return, the document must be fully initialized. In particular, the caller is not responsible for calling com::sun::star::frame::XModel::attachResource(). Instead, the implementation is responsible to do so, if required.

A default implementation of this method could simply delegate this call to com::sun::star::frame::XLoadable::load(), followed by com::sun::star::frame::XModel::attachResource().

Parameters

  SourceLocation | specifies the URL of the location to which the document was previously emergency-saved.
  SalvagedFile | specifies the original URL of the file which had been emergency-saved. If this is empty, then the file should be recovered from its original location.
  MediaDescriptor | contains additional arguments for the load process, for instance a StatusIndicator.

See also
  MediaDescriptor

## ◆ storeToRecoveryFile()

void storeToRecoveryFile | ( | [in] string | TargetLocation,
|  | [in] sequence< ::com::sun::star::beans::PropertyValue > | MediaDescriptor )
raises | ( | ::com::sun::star::io::IOException,
|  | ::com::sun::star::lang::WrappedTargetException ) |  |  |

does an emergency save of the document

A default implementation of this method could simply delegate this call to com::sun::star::frame::XStorable::storeToURL().

Parameters

  TargetLocation | specifies the URL of the location to which the document should be emergency-saved.
  MediaDescriptor | contains additional arguments for the save process, for instance a StatusIndicator.

See also
  MediaDescriptor

## ◆ wasModifiedSinceLastSave()

boolean wasModifiedSinceLastSave | ( |  | ) |

determines whether the document has been modified since the last call to storeToRecoveryFile().

If `storeToRecoveryFile` has not been called before, this method returns whether the document has been modified since it has been loaded respectively created.

When saving a session, either in case of an emergency (when OpenOffice.org crashed), or during a periodic session save as configured by the user, storeToRecoveryFile() is called for every document where `wasModifiedSinceLastSave` returns TRUE.

It's allowed to implement this method sloppy, by returning TRUE in cases where it is not sure whether the document actually has been modified. So, the most simple implementation could simply delegate this call to com::sun::star::util::XModifiable::isModified(). (Well, actually that's the second simple implementation, the most simple one would, still legitimately, always return TRUE.)

However, in such a case, the document might be saved more often than needed. In particular during the periodic session save, this might become a problem when saving is expensive, for a single document or the sum of all open documents.

The documentation for this interface was generated from the following file:

- com/sun/star/document/XDocumentRecovery.idl