1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef DBACCESS_MIGRATIONENGINE_HXX
29 #define DBACCESS_MIGRATIONENGINE_HXX
30 
31 /** === begin UNO includes === **/
32 #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
33 /** === end UNO includes === **/
34 
35 #include <comphelper/componentcontext.hxx>
36 
37 #include <memory>
38 
39 namespace comphelper {
40     class ComponentContext;
41 }
42 
43 //........................................................................
44 namespace dbmm
45 {
46 //........................................................................
47 
48     class IMigrationProgress;
49     class MigrationLog;
50 
51     //====================================================================
52 	//= MigrationEngine
53 	//====================================================================
54     class MigrationEngine_Impl;
55 	class MigrationEngine
56 	{
57     public:
58         /** creates the migration engine
59             @param  _rxDocument
60                 the document whose macros/scripts should be migrated
61             @param  _rProgress
62                 a callback for notifying progress. Beware of lifetimes here: The progress callback,
63                 passed herein as reference, must live as long as the engine instance lives.
64         */
65         MigrationEngine(
66             const ::comphelper::ComponentContext& _rContext,
67             const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XOfficeDatabaseDocument >& _rxDocument,
68             IMigrationProgress& _rProgress,
69             MigrationLog& _rLogger
70         );
71 
72         ~MigrationEngine();
73 
74         sal_Int32   getFormCount() const;
75         sal_Int32   getReportCount() const;
76 
77         /** starts migrating the scripts and macros in the forms/reports to the database
78             document.
79 
80             This process cannot be cancelled, as it would leave the document in an inconsistent
81             state.
82 
83             When the function returns, then the migration is finished.
84 
85             @return
86                 whether or not the migration was successful. If it wasn't, then an error has been reported
87                 to the user, using the document's interaction handler. If no such interaction handler
88                 was present, then the error has been silenced.
89         */
90         bool    migrateAll();
91 
92     private:
93         ::std::auto_ptr< MigrationEngine_Impl > m_pImpl;
94 	};
95 
96 //........................................................................
97 } // namespace dbmm
98 //........................................................................
99 
100 #endif // DBACCESS_MIGRATIONENGINE_HXX
101