1 /*************************************************************************
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * Copyright 2009 by Sun Microsystems, Inc.
5 *
6 * OpenOffice.org - a multi-platform office productivity suite
7 *
8 * This file is part of OpenOffice.org.
9 *
10 * OpenOffice.org is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License version 3
12 * only, as published by the Free Software Foundation.
13 *
14 * OpenOffice.org is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU Lesser General Public License version 3 for more details
18 * (a copy is included in the LICENSE file that accompanied this code).
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * version 3 along with OpenOffice.org.  If not, see
22 * <http://www.openoffice.org/license.html>
23 * for a copy of the LGPLv3 License.
24 ************************************************************************/
25 
26 #ifndef DBACCESS_DBDOCRECOVERY_HXX
27 #define DBACCESS_DBDOCRECOVERY_HXX
28 
29 #include "dbaccessdllapi.h"
30 
31 /** === begin UNO includes === **/
32 #include <com/sun/star/embed/XStorage.hpp>
33 #include <com/sun/star/frame/XController.hpp>
34 /** === end UNO includes === **/
35 
36 #include <vector>
37 #include <memory>
38 
39 namespace comphelper
40 {
41     class ComponentContext;
42 }
43 
44 //........................................................................
45 namespace dbaccess
46 {
47 //........................................................................
48 
49 	//====================================================================
50 	//= DatabaseDocumentRecovery
51 	//====================================================================
52     struct DatabaseDocumentRecovery_Data;
53 	class DBACCESS_DLLPRIVATE DatabaseDocumentRecovery
54 	{
55     public:
56         DatabaseDocumentRecovery(
57             const ::comphelper::ComponentContext& i_rContext
58         );
59         ~DatabaseDocumentRecovery();
60 
61         /** saves the modified sub components of the given controller(s) to the "recovery" sub storage of the document
62             storage.
63 
64             @throws ::com::sun::star::uno::Exception
65                 in case of an error.
66         */
67         void saveModifiedSubComponents(
68                 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rTargetStorage,
69                 const ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > >& i_rControllers
70             );
71 
72         /** recovery sub components from the given document storage, if applicable
73 
74             If the given document storage does not contain a recovery folder, the method silently returns.
75 
76             @throws ::com::sun::star::uno::Exception
77                 in case of an error.
78         */
79         void recoverSubDocuments(
80                 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rDocumentStorage,
81                 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& i_rTargetController
82             );
83 
84     private:
85         const ::std::auto_ptr< DatabaseDocumentRecovery_Data >  m_pData;
86 	};
87 
88 //........................................................................
89 } // namespace dbaccess
90 //........................................................................
91 
92 #endif // DBACCESS_DBDOCRECOVERY_HXX
93