1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef DBACCESS_MACROMIGRATIONPAGES_HXX
25 #define DBACCESS_MACROMIGRATIONPAGES_HXX
26 
27 #include "migrationprogress.hxx"
28 #include "rangeprogressbar.hxx"
29 
30 #include <svtools/svmedit.hxx>
31 #include <svtools/urlcontrol.hxx>
32 #include <svtools/wizardmachine.hxx>
33 #include <svx/databaselocationinput.hxx>
34 #include <vcl/fixed.hxx>
35 #include <vcl/edit.hxx>
36 
37 namespace svt
38 {
39     class RoadmapWizard;
40 }
41 
42 //........................................................................
43 namespace dbmm
44 {
45 //........................................................................
46 
47     class MacroMigrationDialog;
48 
49 	//====================================================================
50 	//= MacroMigrationPage
51 	//====================================================================
52     typedef ::svt::OWizardPage  MacroMigrationPage_Base;
53     class MacroMigrationPage : public MacroMigrationPage_Base
54 	{
55     public:
56         MacroMigrationPage( MacroMigrationDialog& _rParentDialog, const ResId& _rRes );
57         ~MacroMigrationPage();
58 
59     protected:
60         const MacroMigrationDialog& getDialog() const;
61               MacroMigrationDialog& getDialog()      ;
62 
63     protected:
64         FixedText   m_aHeader;
65 	};
66 
67 	//====================================================================
68 	//= PreparationPage
69 	//====================================================================
70     class PreparationPage : public MacroMigrationPage
71     {
72     public:
73         PreparationPage( MacroMigrationDialog& _rParentDialog );
74 
75         static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
76 
77     public:
78         void    showCloseDocsError( bool _bShow );
79 
80     protected:
81         FixedText   m_aIntroduction;
82         FixedText   m_aCloseDocError;
83     };
84 
85 	//====================================================================
86 	//= SaveDBDocPage
87 	//====================================================================
88     class SaveDBDocPage : public MacroMigrationPage
89     {
90     public:
91         SaveDBDocPage( MacroMigrationDialog& _rParentDialog );
92         static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
93 
94     public:
getBackupLocation() const95         ::rtl::OUString getBackupLocation() const { return m_aLocationController.getURL(); }
grabLocationFocus()96         void            grabLocationFocus() { m_aSaveAsLocation.GrabFocus(); }
97 
98     protected:
99         FixedText               m_aExplanation;
100         FixedText               m_aSaveAsLabel;
101 		::svt::OFileURLControl	m_aSaveAsLocation;
102         PushButton              m_aBrowseSaveAsLocation;
103         FixedText               m_aStartMigration;
104         ::svx::DatabaseLocationInputController
105                                 m_aLocationController;
106 
107     protected:
108         // IWizardPageController overridables
109 		virtual void        initializePage();
110         virtual sal_Bool    commitPage( ::svt::WizardTypes::CommitPageReason _eReason );
111 		virtual bool        canAdvance() const;
112 
113     private:
114         DECL_LINK( OnLocationModified, Edit* );
115         void impl_updateLocationDependentItems();
116     };
117 
118 	//====================================================================
119 	//= ProgressPage
120 	//====================================================================
121     class ProgressPage : public MacroMigrationPage, public IMigrationProgress
122     {
123     public:
124         ProgressPage( MacroMigrationDialog& _rParentDialog );
125 
126         static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
127 
128         void    setDocumentCounts( const sal_Int32 _nForms, const sal_Int32 _nReports );
129         void    onFinishedSuccessfully();
130 
131     protected:
132         // IMigrationProgress
133         virtual void    startObject( const ::rtl::OUString& _rObjectName, const ::rtl::OUString& _rCurrentAction, const sal_uInt32 _bRange );
134         virtual void    setObjectProgressText( const ::rtl::OUString& _rText );
135         virtual void    setObjectProgressValue( const sal_uInt32 _nValue );
136         virtual void    endObject();
137         virtual void    start( const sal_uInt32 _nOverallRange );
138         virtual void    setOverallProgressText( const ::rtl::OUString& _rText );
139         virtual void    setOverallProgressValue( const sal_uInt32 _nValue );
140 
141     private:
142         FixedText           m_aObjectCount;
143         FixedText           m_aCurrentObjectLabel;
144         FixedText           m_aCurrentObject;
145         FixedText           m_aCurrentActionLabel;
146         FixedText           m_aCurrentAction;
147         RangeProgressBar    m_aCurrentProgress;
148         FixedText           m_aAllProgressLabel;
149         FixedText           m_aAllProgressText;
150         RangeProgressBar    m_aAllProgress;
151         FixedText           m_aMigrationDone;
152     };
153 
154 	//====================================================================
155 	//= ResultPage
156 	//====================================================================
157     class ResultPage : public MacroMigrationPage
158     {
159     public:
160         ResultPage( MacroMigrationDialog& _rParentDialog );
161 
162         static TabPage* Create( ::svt::RoadmapWizard& _rParentDialog );
163 
164         void            displayMigrationLog( const bool _bSuccessful, const String& _rLog );
165 
166     private:
167         FixedText       m_aChangesLabel;
168         MultiLineEdit   m_aChanges;
169         String          m_aSuccessful;
170         String          m_aUnsuccessful;
171     };
172 
173 //........................................................................
174 } // namespace dbmm
175 //........................................................................
176 
177 #endif // DBACCESS_MACROMIGRATIONPAGES_HXX
178