1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24#ifndef __offapcom_sun_star_document_XDocumentRecovery_idl__ 25#define __offapcom_sun_star_document_XDocumentRecovery_idl__ 26 27#include <com/sun/star/beans/PropertyValue.idl> 28#include <com/sun/star/io/IOException.idl> 29#include <com/sun/star/lang/WrappedTargetException.idl> 30 31//============================================================================= 32 33module com { module sun { module star { module document { 34 35//============================================================================= 36 37/** is the interface to be implemented by documents who wish to participate in 38 the document emergency-save / recovery process. 39 */ 40interface XDocumentRecovery 41{ 42 /** determines whether the document has been modified since the last call to <member>storeToRecoveryFile</member>. 43 44 <p>If <code>storeToRecoveryFile</code> has not been called before, this method returns whether the document 45 has been modified since it has been loaded respectively created.</p> 46 47 <p>When saving a session, either in case of a emergency (when OpenOffice.org crashed), or during a 48 periodic session save as configured by the user, <member>storeToRecoveryFile</member> is called for every 49 document where <code>wasModifiedSinceLastSave</code> returns <TRUE/>.</p> 50 51 <p>It's allowed to implement this method sloppy, by returning <TRUE/> in cases where it is not sure whether 52 the document actually has been modified. So, the most simple implementation could simply delegate this call 53 to <member scope="com::sun::star::util">XModifiable::isModified</member>. (Well, actually that's the 54 second simple implementation, the <em>most</em> simple one would, still egitimately, always return <TRUE/>.)</p> 55 56 <p>However, in such a case, the document might be saved more often than needed. In particular during the 57 periodic session save, this might become a problem when saving is expensive, for a single document 58 or the sum of all open documents.</p> 59 */ 60 boolean wasModifiedSinceLastSave(); 61 62 /** does an emergency save of the document 63 64 <p>A default implementation of this method could simply delegate this call to 65 <member scope="com::sun::star::frame">XStorable::storeToURL</member>.</p> 66 67 @param TargetLocation 68 specifies the URL of the location to which the document should be emergency-saved. 69 70 @param MediaDescriptor 71 contains additional arguments for the save process, for instance an StatusIndicator. 72 73 @see MediaDescriptor 74 */ 75 void storeToRecoveryFile( 76 [in] string TargetLocation, 77 [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor 78 ) 79 raises ( ::com::sun::star::io::IOException, 80 ::com::sun::star::lang::WrappedTargetException 81 ); 82 83 /** recovers the document after a previous emergency or session save. 84 85 <p>The document itself has previously been created, but <em>not</em> loaded 86 (via <member scope="com::sun::star::frame">XLoadable::load</member>) or initialized (via 87 <member scope="com::sun::star::frame">XLoadable::initNew</member>).</p> 88 89 <p>Upon successful return, the document must be fully initialized. In particular, the 90 caller is not responsible for calling <member scope="com::sun::star::frame">XModel::attachResource</member>. 91 Instead, the implementation is responsible to do so, if required.</p> 92 93 <p>A default implementation of this method could simply delegate this call to 94 <member scope="::com::sun::star::frame:">XLodable::load</member>, followed by 95 <member scope="com::sun::star::frame">XModel::attachResource</member>.</p> 96 97 @param SourceLocation 98 specifies the URL of the location to which the document was previously emergency-saved. 99 100 @param SalvagedFile 101 specifies the original URL of the file which had been emergency-saved. If this is empty, 102 then the file should be recovered from its original location. 103 104 @param MediaDescriptor 105 contains additional arguments for the load process, for instance an StatusIndicator. 106 107 @see MediaDescriptor 108 */ 109 void recoverFromFile( 110 [in] string SourceLocation, 111 [in] string SalvagedFile, 112 [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor 113 ) 114 raises ( ::com::sun::star::io::IOException, 115 ::com::sun::star::lang::WrappedTargetException 116 ); 117}; 118 119//============================================================================= 120 121}; }; }; }; 122 123//============================================================================= 124 125#endif 126