/************************************************************** * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * *************************************************************/ #ifndef __offapcom_sun_star_document_XDocumentRecovery_idl__ #define __offapcom_sun_star_document_XDocumentRecovery_idl__ #include #include #include //============================================================================= module com { module sun { module star { module document { //============================================================================= /** is the interface to be implemented by documents who wish to participate in the document emergency-save / recovery process. */ interface XDocumentRecovery { /** 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 a 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 .

It's allowed to implement this method sloppy, by returning 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 XModifiable::isModified. (Well, actually that's the second simple implementation, the most simple one would, still egitimately, always return .)

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.

*/ boolean wasModifiedSinceLastSave(); /** does an emergency save of the document

A default implementation of this method could simply delegate this call to XStorable::storeToURL.

@param TargetLocation specifies the URL of the location to which the document should be emergency-saved. @param MediaDescriptor contains additional arguments for the save process, for instance an StatusIndicator. @see MediaDescriptor */ void storeToRecoveryFile( [in] string TargetLocation, [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 XLoadable::load) or initialized (via XLoadable::initNew).

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

A default implementation of this method could simply delegate this call to XLodable::load, followed by XModel::attachResource.

@param SourceLocation specifies the URL of the location to which the document was previously emergency-saved. @param 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. @param MediaDescriptor contains additional arguments for the load process, for instance an StatusIndicator. @see MediaDescriptor */ 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 ); }; //============================================================================= }; }; }; }; //============================================================================= #endif