1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 module com
{ module sun
{ module star
{ module document
{
24 /** is the interface to be implemented by documents who wish to participate in
25 the document emergency-save / recovery process.
27 interface XDocumentRecovery
29 /** determines whether the document has been modified since the last call to storeToRecoveryFile().
31 <p>If <code>storeToRecoveryFile</code> has not been called before, this method returns whether the document
32 has been modified since it has been loaded respectively created.</p>
34 <p>When saving a session, either in case of an emergency (when OpenOffice.org crashed), or during a
35 periodic session save as configured by the user, storeToRecoveryFile() is called for every
36 document where <code>wasModifiedSinceLastSave</code> returns `TRUE`.</p>
38 <p>It's allowed to implement this method sloppy, by returning `TRUE` in cases where it is not sure whether
39 the document actually has been modified. So, the most simple implementation could simply delegate this call
40 to com::sun::star::util::XModifiable::isModified(). (Well, actually that's the
41 second simple implementation, the <em>most</em> simple one would, still legitimately, always return `TRUE`.)</p>
43 <p>However, in such a case, the document might be saved more often than needed. In particular during the
44 periodic session save, this might become a problem when saving is expensive, for a single document
45 or the sum of all open documents.</p>
47 boolean wasModifiedSinceLastSave
();
49 /** does an emergency save of the document
51 <p>A default implementation of this method could simply delegate this call to
52 com::sun::star::frame::XStorable::storeToURL().</p>
55 specifies the URL of the location to which the document should be emergency-saved.
57 @param MediaDescriptor
58 contains additional arguments for the save process, for instance a StatusIndicator.
62 void storeToRecoveryFile
(
63 [in] string TargetLocation
,
64 [in] sequence
< ::com
::sun
::star
::beans
::PropertyValue
> MediaDescriptor
66 raises
( ::com
::sun
::star
::io
::IOException
,
67 ::com
::sun
::star
::lang
::WrappedTargetException
70 /** recovers the document after a previous emergency or session save.
72 <p>The document itself has previously been created, but <em>not</em> loaded
73 (via com::sun::star::frame::XLoadable::load()) or initialized (via
74 com::sun::star::frame::XLoadable::initNew()).</p>
76 <p>Upon successful return, the document must be fully initialized. In particular, the
77 caller is not responsible for calling com::sun::star::frame::XModel::attachResource().
78 Instead, the implementation is responsible to do so, if required.</p>
80 <p>A default implementation of this method could simply delegate this call to
81 ::com::sun::star::frame::XLoadable::load(), followed by
82 com::sun::star::frame::XModel::attachResource().</p>
85 specifies the URL of the location to which the document was previously emergency-saved.
88 specifies the original URL of the file which had been emergency-saved. If this is empty,
89 then the file should be recovered from its original location.
91 @param MediaDescriptor
92 contains additional arguments for the load process, for instance a StatusIndicator.
97 [in] string SourceLocation
,
98 [in] string SalvagedFile
,
99 [in] sequence
< ::com
::sun
::star
::beans
::PropertyValue
> MediaDescriptor
101 raises
( ::com
::sun
::star
::io
::IOException
,
102 ::com
::sun
::star
::lang
::WrappedTargetException
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */