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_MACROMIGRATIONPAGES_HXX
29 #define DBACCESS_MACROMIGRATIONPAGES_HXX
30 
31 #include "migrationprogress.hxx"
32 #include "rangeprogressbar.hxx"
33 
34 #include <svtools/svmedit.hxx>
35 #include <svtools/urlcontrol.hxx>
36 #include <svtools/wizardmachine.hxx>
37 #include <svx/databaselocationinput.hxx>
38 #include <vcl/fixed.hxx>
39 #include <vcl/edit.hxx>
40 
41 namespace svt
42 {
43     class RoadmapWizard;
44 }
45 
46 //........................................................................
47 namespace dbmm
48 {
49 //........................................................................
50 
51     class MacroMigrationDialog;
52 
53 	//====================================================================
54 	//= MacroMigrationPage
55 	//====================================================================
56     typedef ::svt::OWizardPage  MacroMigrationPage_Base;
57     class MacroMigrationPage : public MacroMigrationPage_Base
58 	{
59     public:
60         MacroMigrationPage( MacroMigrationDialog& _rParentDialog, const ResId& _rRes );
61         ~MacroMigrationPage();
62 
63     protected:
64         const MacroMigrationDialog& getDialog() const;
65               MacroMigrationDialog& getDialog()      ;
66 
67     protected:
68         FixedText   m_aHeader;
69 	};
70 
71 	//====================================================================
72 	//= PreparationPage
73 	//====================================================================
74     class PreparationPage : public MacroMigrationPage
75     {
76     public:
77         PreparationPage( MacroMigrationDialog& _rParentDialog );
78 
79         static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
80 
81     public:
82         void    showCloseDocsError( bool _bShow );
83 
84     protected:
85         FixedText   m_aIntroduction;
86         FixedText   m_aCloseDocError;
87     };
88 
89 	//====================================================================
90 	//= SaveDBDocPage
91 	//====================================================================
92     class SaveDBDocPage : public MacroMigrationPage
93     {
94     public:
95         SaveDBDocPage( MacroMigrationDialog& _rParentDialog );
96         static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
97 
98     public:
99         ::rtl::OUString getBackupLocation() const { return m_aLocationController.getURL(); }
100         void            grabLocationFocus() { m_aSaveAsLocation.GrabFocus(); }
101 
102     protected:
103         FixedText               m_aExplanation;
104         FixedText               m_aSaveAsLabel;
105 		::svt::OFileURLControl	m_aSaveAsLocation;
106         PushButton              m_aBrowseSaveAsLocation;
107         FixedText               m_aStartMigration;
108         ::svx::DatabaseLocationInputController
109                                 m_aLocationController;
110 
111     protected:
112         // IWizardPageController overridables
113 		virtual void        initializePage();
114         virtual sal_Bool    commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
115 		virtual bool        canAdvance() const;
116 
117     private:
118         DECL_LINK( OnLocationModified, Edit* );
119         void impl_updateLocationDependentItems();
120     };
121 
122 	//====================================================================
123 	//= ProgressPage
124 	//====================================================================
125     class ProgressPage : public MacroMigrationPage, public IMigrationProgress
126     {
127     public:
128         ProgressPage( MacroMigrationDialog& _rParentDialog );
129 
130         static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
131 
132         void    setDocumentCounts( const sal_Int32 _nForms, const sal_Int32 _nReports );
133         void    onFinishedSuccessfully();
134 
135     protected:
136         // IMigrationProgress
137         virtual void    startObject( const ::rtl::OUString& _rObjectName, const ::rtl::OUString& _rCurrentAction, const sal_uInt32 _bRange );
138         virtual void    setObjectProgressText( const ::rtl::OUString& _rText );
139         virtual void    setObjectProgressValue( const sal_uInt32 _nValue );
140         virtual void    endObject();
141         virtual void    start( const sal_uInt32 _nOverallRange );
142         virtual void    setOverallProgressText( const ::rtl::OUString& _rText );
143         virtual void    setOverallProgressValue( const sal_uInt32 _nValue );
144 
145     private:
146         FixedText           m_aObjectCount;
147         FixedText           m_aCurrentObjectLabel;
148         FixedText           m_aCurrentObject;
149         FixedText           m_aCurrentActionLabel;
150         FixedText           m_aCurrentAction;
151         RangeProgressBar    m_aCurrentProgress;
152         FixedText           m_aAllProgressLabel;
153         FixedText           m_aAllProgressText;
154         RangeProgressBar    m_aAllProgress;
155         FixedText           m_aMigrationDone;
156     };
157 
158 	//====================================================================
159 	//= ResultPage
160 	//====================================================================
161     class ResultPage : public MacroMigrationPage
162     {
163     public:
164         ResultPage( MacroMigrationDialog& _rParentDialog );
165 
166         static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
167 
168         void            displayMigrationLog( const bool _bSuccessful, const String& _rLog );
169 
170     private:
171         FixedText       m_aChangesLabel;
172         MultiLineEdit   m_aChanges;
173         String          m_aSuccessful;
174         String          m_aUnsuccessful;
175     };
176 
177 //........................................................................
178 } // namespace dbmm
179 //........................................................................
180 
181 #endif // DBACCESS_MACROMIGRATIONPAGES_HXX
182