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_MACROMIGRATIONDIALOG_HXX
29 #define DBACCESS_MACROMIGRATIONDIALOG_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 #include <svtools/roadmapwizard.hxx>
37 
38 #include <memory>
39 
40 //........................................................................
41 namespace dbmm
42 {
43 //........................................................................
44 
45     //====================================================================
46     //= MacroMigrationDialog
47     //====================================================================
48     struct MacroMigrationDialog_Data;
49     typedef ::svt::RoadmapWizard    MacroMigrationDialog_Base;
50     class MacroMigrationDialog : public MacroMigrationDialog_Base
51     {
52     public:
53         MacroMigrationDialog(
54             Window* _pParent,
55             const ::comphelper::ComponentContext& _rContext,
56             const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XOfficeDatabaseDocument >& _rxDocument
57         );
58         virtual ~MacroMigrationDialog();
59 
60         const ::comphelper::ComponentContext&
61                 getComponentContext() const;
62         const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XOfficeDatabaseDocument >&
63                 getDocument() const;
64 
65     protected:
66         // OWizardMachine overridables
67         virtual void            enterState( WizardState _nState );
68         virtual sal_Bool        prepareLeaveCurrentState( CommitPageReason _eReason );
69         virtual sal_Bool        leaveState( WizardState _nState );
70         virtual WizardState     determineNextState( WizardState _nCurrentState ) const;
71         virtual sal_Bool        onFinish();
72 
73         // Dialog overridables
74         virtual sal_Bool    Close();
75 	    virtual short	Execute();
76 
77     private:
78         void    impl_showCloseDocsError( bool _bShow );
79         bool    impl_closeSubDocs_nothrow();
80         bool    impl_backupDocument_nothrow() const;
81         void    impl_reloadDocument_nothrow( bool _bMigrationSuccess );
82 
83     private:
84         DECL_LINK( OnStartMigration, void* );
85 
86     private:
87         ::std::auto_ptr< MacroMigrationDialog_Data >    m_pData;
88     };
89 
90 //........................................................................
91 } // namespace dbmm
92 //........................................................................
93 
94 #endif // DBACCESS_MACROMIGRATIONDIALOG_HXX
95