Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / offapi / com / sun / star / document / XDocumentRecovery.idl
bloba18e8dde800abe16f48284a3e27ec076490419f9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef __com_sun_star_document_XDocumentRecovery_idl__
21 #define __com_sun_star_document_XDocumentRecovery_idl__
23 #include <com/sun/star/beans/PropertyValue.idl>
24 #include <com/sun/star/io/IOException.idl>
25 #include <com/sun/star/lang/WrappedTargetException.idl>
28 module com { module sun { module star { module document {
31 /** is the interface to be implemented by documents who wish to participate in
32 the document emergency-save / recovery process.
34 interface XDocumentRecovery
36 /** determines whether the document has been modified since the last call to storeToRecoveryFile().
38 <p>If <code>storeToRecoveryFile</code> has not been called before, this method returns whether the document
39 has been modified since it has been loaded respectively created.</p>
41 <p>When saving a session, either in case of a emergency (when OpenOffice.org crashed), or during a
42 periodic session save as configured by the user, storeToRecoveryFile() is called for every
43 document where <code>wasModifiedSinceLastSave</code> returns `TRUE`.</p>
45 <p>It's allowed to implement this method sloppy, by returning `TRUE` in cases where it is not sure whether
46 the document actually has been modified. So, the most simple implementation could simply delegate this call
47 to com::sun::star::util::XModifiable::isModified(). (Well, actually that's the
48 second simple implementation, the <em>most</em> simple one would, still legitimately, always return `TRUE`.)</p>
50 <p>However, in such a case, the document might be saved more often than needed. In particular during the
51 periodic session save, this might become a problem when saving is expensive, for a single document
52 or the sum of all open documents.</p>
54 boolean wasModifiedSinceLastSave();
56 /** does an emergency save of the document
58 <p>A default implementation of this method could simply delegate this call to
59 com::sun::star::frame::XStorable::storeToURL().</p>
61 @param TargetLocation
62 specifies the URL of the location to which the document should be emergency-saved.
64 @param MediaDescriptor
65 contains additional arguments for the save process, for instance an StatusIndicator.
67 @see MediaDescriptor
69 void storeToRecoveryFile(
70 [in] string TargetLocation,
71 [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor
73 raises ( ::com::sun::star::io::IOException,
74 ::com::sun::star::lang::WrappedTargetException
77 /** recovers the document after a previous emergency or session save.
79 <p>The document itself has previously been created, but <em>not</em> loaded
80 (via com::sun::star::frame::XLoadable::load()) or initialized (via
81 com::sun::star::frame::XLoadable::initNew()).</p>
83 <p>Upon successful return, the document must be fully initialized. In particular, the
84 caller is not responsible for calling com::sun::star::frame::XModel::attachResource().
85 Instead, the implementation is responsible to do so, if required.</p>
87 <p>A default implementation of this method could simply delegate this call to
88 ::com::sun::star::frame::XLoadable::load(), followed by
89 com::sun::star::frame::XModel::attachResource().</p>
91 @param SourceLocation
92 specifies the URL of the location to which the document was previously emergency-saved.
94 @param SalvagedFile
95 specifies the original URL of the file which had been emergency-saved. If this is empty,
96 then the file should be recovered from its original location.
98 @param MediaDescriptor
99 contains additional arguments for the load process, for instance an StatusIndicator.
101 @see MediaDescriptor
103 void recoverFromFile(
104 [in] string SourceLocation,
105 [in] string SalvagedFile,
106 [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor
108 raises ( ::com::sun::star::io::IOException,
109 ::com::sun::star::lang::WrappedTargetException
114 }; }; }; };
117 #endif
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */