1*96de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*96de5490SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*96de5490SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*96de5490SAndrew Rist  * distributed with this work for additional information
6*96de5490SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*96de5490SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*96de5490SAndrew Rist  * "License"); you may not use this file except in compliance
9*96de5490SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*96de5490SAndrew Rist  *
11*96de5490SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*96de5490SAndrew Rist  *
13*96de5490SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*96de5490SAndrew Rist  * software distributed under the License is distributed on an
15*96de5490SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96de5490SAndrew Rist  * KIND, either express or implied.  See the License for the
17*96de5490SAndrew Rist  * specific language governing permissions and limitations
18*96de5490SAndrew Rist  * under the License.
19*96de5490SAndrew Rist  *
20*96de5490SAndrew Rist  *************************************************************/
21*96de5490SAndrew Rist 
22*96de5490SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "dbaccess_helpid.hrc"
28cdf0e10cSrcweir #include "dbmm_module.hxx"
29cdf0e10cSrcweir #include "dbmm_global.hrc"
30cdf0e10cSrcweir #include "macromigration.hrc"
31cdf0e10cSrcweir #include "macromigrationpages.hxx"
32cdf0e10cSrcweir #include "macromigrationdialog.hxx"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir /** === begin UNO includes === **/
35cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
36cdf0e10cSrcweir /** === end UNO includes === **/
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include <tools/urlobj.hxx>
39cdf0e10cSrcweir #include <tools/diagnose_ex.h>
40cdf0e10cSrcweir #include <vcl/metric.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //........................................................................
43cdf0e10cSrcweir namespace dbmm
44cdf0e10cSrcweir {
45cdf0e10cSrcweir //........................................................................
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 	/** === begin UNO using === **/
48cdf0e10cSrcweir 	using ::com::sun::star::uno::Reference;
49cdf0e10cSrcweir 	using ::com::sun::star::uno::XInterface;
50cdf0e10cSrcweir 	using ::com::sun::star::uno::UNO_QUERY;
51cdf0e10cSrcweir 	using ::com::sun::star::uno::UNO_QUERY_THROW;
52cdf0e10cSrcweir 	using ::com::sun::star::uno::UNO_SET_THROW;
53cdf0e10cSrcweir 	using ::com::sun::star::uno::Exception;
54cdf0e10cSrcweir 	using ::com::sun::star::uno::RuntimeException;
55cdf0e10cSrcweir 	using ::com::sun::star::uno::Any;
56cdf0e10cSrcweir 	using ::com::sun::star::uno::makeAny;
57cdf0e10cSrcweir     using ::com::sun::star::uno::Sequence;
58cdf0e10cSrcweir     using ::com::sun::star::frame::XModel;
59cdf0e10cSrcweir 	/** === end UNO using === **/
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	//====================================================================
62cdf0e10cSrcweir 	//= MacroMigrationPage
63cdf0e10cSrcweir 	//====================================================================
64cdf0e10cSrcweir 	//--------------------------------------------------------------------
MacroMigrationPage(MacroMigrationDialog & _rParentDialog,const ResId & _rRes)65cdf0e10cSrcweir     MacroMigrationPage::MacroMigrationPage( MacroMigrationDialog& _rParentDialog, const ResId& _rRes )
66cdf0e10cSrcweir         :MacroMigrationPage_Base( &_rParentDialog, _rRes )
67cdf0e10cSrcweir         ,m_aHeader( this, MacroMigrationResId( FT_HEADER ) )
68cdf0e10cSrcweir     {
69cdf0e10cSrcweir         Font aFont( m_aHeader.GetFont() );
70cdf0e10cSrcweir         aFont.SetWeight( WEIGHT_BOLD );
71cdf0e10cSrcweir         m_aHeader.SetFont( aFont );
72cdf0e10cSrcweir     }
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     //--------------------------------------------------------------------
~MacroMigrationPage()75cdf0e10cSrcweir     MacroMigrationPage::~MacroMigrationPage()
76cdf0e10cSrcweir     {
77cdf0e10cSrcweir     }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     //--------------------------------------------------------------------
getDialog() const80cdf0e10cSrcweir     const MacroMigrationDialog& MacroMigrationPage::getDialog() const
81cdf0e10cSrcweir     {
82cdf0e10cSrcweir         return *dynamic_cast< const MacroMigrationDialog* >( GetParent() );
83cdf0e10cSrcweir     }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     //--------------------------------------------------------------------
getDialog()86cdf0e10cSrcweir     MacroMigrationDialog& MacroMigrationPage::getDialog()
87cdf0e10cSrcweir     {
88cdf0e10cSrcweir         return *dynamic_cast< MacroMigrationDialog* >( GetParent() );
89cdf0e10cSrcweir     }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	//====================================================================
92cdf0e10cSrcweir 	//= PreparationPage
93cdf0e10cSrcweir 	//====================================================================
94cdf0e10cSrcweir 	//--------------------------------------------------------------------
PreparationPage(MacroMigrationDialog & _rParentDialog)95cdf0e10cSrcweir     PreparationPage::PreparationPage( MacroMigrationDialog& _rParentDialog )
96cdf0e10cSrcweir         :MacroMigrationPage( _rParentDialog, MacroMigrationResId( TP_PREPARE ) )
97cdf0e10cSrcweir         ,m_aIntroduction ( this, MacroMigrationResId( FT_INTRODUCTION    ) )
98cdf0e10cSrcweir         ,m_aCloseDocError( this, MacroMigrationResId( FT_CLOSE_DOC_ERROR ) )
99cdf0e10cSrcweir     {
100cdf0e10cSrcweir         FreeResource();
101cdf0e10cSrcweir     }
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	//--------------------------------------------------------------------
showCloseDocsError(bool _bShow)104cdf0e10cSrcweir     void PreparationPage::showCloseDocsError( bool _bShow )
105cdf0e10cSrcweir     {
106cdf0e10cSrcweir         m_aCloseDocError.Show( _bShow );
107cdf0e10cSrcweir     }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir     //--------------------------------------------------------------------
Create(::svt::RoadmapWizard & _rParentDialog)110cdf0e10cSrcweir     TabPage* PreparationPage::Create( ::svt::RoadmapWizard& _rParentDialog )
111cdf0e10cSrcweir     {
112cdf0e10cSrcweir         return new PreparationPage( dynamic_cast< MacroMigrationDialog& >( _rParentDialog ) );
113cdf0e10cSrcweir     }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	//====================================================================
116cdf0e10cSrcweir 	//= SaveDBDocPage
117cdf0e10cSrcweir 	//====================================================================
118cdf0e10cSrcweir 	//--------------------------------------------------------------------
SaveDBDocPage(MacroMigrationDialog & _rParentDialog)119cdf0e10cSrcweir     SaveDBDocPage::SaveDBDocPage( MacroMigrationDialog& _rParentDialog )
120cdf0e10cSrcweir         :MacroMigrationPage( _rParentDialog, MacroMigrationResId( TP_SAVE_DBDOC_AS ) )
121cdf0e10cSrcweir         ,m_aExplanation         ( this, MacroMigrationResId( FT_EXPLANATION             ) )
122cdf0e10cSrcweir         ,m_aSaveAsLabel         ( this, MacroMigrationResId( FT_SAVE_AS_LABEL           ) )
123cdf0e10cSrcweir         ,m_aSaveAsLocation      ( this, MacroMigrationResId( ED_SAVE_AS_LOCATION        ) )
124cdf0e10cSrcweir         ,m_aBrowseSaveAsLocation( this, MacroMigrationResId( PB_BROWSE_SAVE_AS_LOCATION ) )
125cdf0e10cSrcweir         ,m_aStartMigration      ( this, MacroMigrationResId( FT_START_MIGRATION         ) )
126cdf0e10cSrcweir         ,m_aLocationController( _rParentDialog.getComponentContext(), m_aSaveAsLocation, m_aBrowseSaveAsLocation )
127cdf0e10cSrcweir     {
128cdf0e10cSrcweir         FreeResource();
129cdf0e10cSrcweir 
130cdf0e10cSrcweir         m_aSaveAsLocation.SetModifyHdl( LINK( this, SaveDBDocPage, OnLocationModified ) );
131cdf0e10cSrcweir         m_aSaveAsLocation.SetDropDownLineCount( 20 );
132cdf0e10cSrcweir 
133cdf0e10cSrcweir         m_aSaveAsLocation.SetHelpId( HID_MACRO_MIGRATION_BACKUP_LOCATION );
134cdf0e10cSrcweir 
135cdf0e10cSrcweir         impl_updateLocationDependentItems();
136cdf0e10cSrcweir     }
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 	//--------------------------------------------------------------------
impl_updateLocationDependentItems()139cdf0e10cSrcweir     void SaveDBDocPage::impl_updateLocationDependentItems()
140cdf0e10cSrcweir     {
141cdf0e10cSrcweir         updateDialogTravelUI();
142cdf0e10cSrcweir         m_aStartMigration.Show( m_aSaveAsLocation.GetText().Len() > 0 );
143cdf0e10cSrcweir     }
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	//--------------------------------------------------------------------
146cdf0e10cSrcweir     IMPL_LINK( SaveDBDocPage, OnLocationModified, Edit*, /**/ )
147cdf0e10cSrcweir     {
148cdf0e10cSrcweir         impl_updateLocationDependentItems();
149cdf0e10cSrcweir         return 0L;
150cdf0e10cSrcweir     }
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	//--------------------------------------------------------------------
initializePage()153cdf0e10cSrcweir     void SaveDBDocPage::initializePage()
154cdf0e10cSrcweir     {
155cdf0e10cSrcweir         OWizardPage::initializePage();
156cdf0e10cSrcweir 
157cdf0e10cSrcweir         try
158cdf0e10cSrcweir         {
159cdf0e10cSrcweir             // get the document's current URL
160cdf0e10cSrcweir             Reference< XModel > xDocument( getDialog().getDocument(), UNO_QUERY_THROW );
161cdf0e10cSrcweir             INetURLObject aURLParser( xDocument->getURL() );
162cdf0e10cSrcweir             OSL_ENSURE( aURLParser.GetProtocol() != INET_PROT_NOT_VALID, "SaveDBDocPage::initializePage: illegal document URL!" );
163cdf0e10cSrcweir 
164cdf0e10cSrcweir             ::rtl::OUStringBuffer aBaseName( aURLParser.getBase() );
165cdf0e10cSrcweir             aBaseName.appendAscii( ".backup" );
166cdf0e10cSrcweir             aURLParser.setBase( aBaseName.makeStringAndClear() );
167cdf0e10cSrcweir 
168cdf0e10cSrcweir             m_aLocationController.setURL( aURLParser.GetMainURL( INetURLObject::NO_DECODE ) );
169cdf0e10cSrcweir             impl_updateLocationDependentItems();
170cdf0e10cSrcweir         }
171cdf0e10cSrcweir         catch( const Exception& )
172cdf0e10cSrcweir         {
173cdf0e10cSrcweir         	DBG_UNHANDLED_EXCEPTION();
174cdf0e10cSrcweir         }
175cdf0e10cSrcweir     }
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 	//--------------------------------------------------------------------
canAdvance() const178cdf0e10cSrcweir     bool SaveDBDocPage::canAdvance() const
179cdf0e10cSrcweir     {
180cdf0e10cSrcweir         if ( !MacroMigrationPage::canAdvance() )
181cdf0e10cSrcweir             return false;
182cdf0e10cSrcweir 
183cdf0e10cSrcweir         return m_aSaveAsLocation.GetText().Len() > 0;
184cdf0e10cSrcweir     }
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 	//--------------------------------------------------------------------
commitPage(::svt::WizardTypes::CommitPageReason _eReason)187cdf0e10cSrcweir     sal_Bool SaveDBDocPage::commitPage( ::svt::WizardTypes::CommitPageReason _eReason )
188cdf0e10cSrcweir     {
189cdf0e10cSrcweir         if ( !MacroMigrationPage::commitPage( _eReason ) )
190cdf0e10cSrcweir             return sal_False;
191cdf0e10cSrcweir 
192cdf0e10cSrcweir         if ( ::svt::WizardTypes::eTravelBackward == _eReason )
193cdf0e10cSrcweir             return sal_True;
194cdf0e10cSrcweir 
195cdf0e10cSrcweir         if ( !m_aLocationController.prepareCommit() )
196cdf0e10cSrcweir             return sal_False;
197cdf0e10cSrcweir 
198cdf0e10cSrcweir         return sal_True;
199cdf0e10cSrcweir     }
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 	//--------------------------------------------------------------------
Create(::svt::RoadmapWizard & _rParentDialog)202cdf0e10cSrcweir     TabPage* SaveDBDocPage::Create( ::svt::RoadmapWizard& _rParentDialog )
203cdf0e10cSrcweir     {
204cdf0e10cSrcweir         return new SaveDBDocPage( dynamic_cast< MacroMigrationDialog& >( _rParentDialog ) );
205cdf0e10cSrcweir     }
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 	//====================================================================
208cdf0e10cSrcweir 	//= ProgressPage
209cdf0e10cSrcweir 	//====================================================================
210cdf0e10cSrcweir 	//--------------------------------------------------------------------
ProgressPage(MacroMigrationDialog & _rParentDialog)211cdf0e10cSrcweir     ProgressPage::ProgressPage( MacroMigrationDialog& _rParentDialog )
212cdf0e10cSrcweir         :MacroMigrationPage( _rParentDialog, MacroMigrationResId( TP_MIGRATE ) )
213cdf0e10cSrcweir         ,m_aObjectCount             ( this, MacroMigrationResId( FT_OBJECT_COUNT            ) )
214cdf0e10cSrcweir         ,m_aCurrentObjectLabel      ( this, MacroMigrationResId( FT_CURRENT_OBJECT_LABEL    ) )
215cdf0e10cSrcweir         ,m_aCurrentObject           ( this, MacroMigrationResId( FT_CURRENT_OBJECT          ) )
216cdf0e10cSrcweir         ,m_aCurrentActionLabel      ( this, MacroMigrationResId( FT_CURRENT_PROGRESS_LABEL  ) )
217cdf0e10cSrcweir         ,m_aCurrentAction           ( this, MacroMigrationResId( FT_CURRENT_PROGRESS        ) )
218cdf0e10cSrcweir         ,m_aCurrentProgress         ( this, MacroMigrationResId( WND_CURRENT_PROGRESS       ) )
219cdf0e10cSrcweir         ,m_aAllProgressLabel        ( this, MacroMigrationResId( FT_ALL_PROGRESS_LABEL      ) )
220cdf0e10cSrcweir         ,m_aAllProgressText         ( this, MacroMigrationResId( FT_OBJECT_COUNT_PROGRESS   ) )
221cdf0e10cSrcweir         ,m_aAllProgress             ( this, MacroMigrationResId( WND_ALL_PROGRESS           ) )
222cdf0e10cSrcweir         ,m_aMigrationDone           ( this, MacroMigrationResId( FT_MIGRATION_DONE          ) )
223cdf0e10cSrcweir     {
224cdf0e10cSrcweir         FreeResource();
225cdf0e10cSrcweir     }
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 	//--------------------------------------------------------------------
Create(::svt::RoadmapWizard & _rParentDialog)228cdf0e10cSrcweir     TabPage* ProgressPage::Create( ::svt::RoadmapWizard& _rParentDialog )
229cdf0e10cSrcweir     {
230cdf0e10cSrcweir         return new ProgressPage( dynamic_cast< MacroMigrationDialog& >( _rParentDialog ) );
231cdf0e10cSrcweir     }
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 	//--------------------------------------------------------------------
setDocumentCounts(const sal_Int32 _nForms,const sal_Int32 _nReports)234cdf0e10cSrcweir     void ProgressPage::setDocumentCounts( const sal_Int32 _nForms, const sal_Int32 _nReports )
235cdf0e10cSrcweir     {
236cdf0e10cSrcweir         String sText( m_aObjectCount.GetText() );
237cdf0e10cSrcweir         sText.SearchAndReplaceAscii( "$forms$", String::CreateFromInt32( _nForms ) );
238cdf0e10cSrcweir         sText.SearchAndReplaceAscii( "$reports$", String::CreateFromInt32( _nReports ) );
239cdf0e10cSrcweir         m_aObjectCount.SetText( sText );
240cdf0e10cSrcweir     }
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 	//--------------------------------------------------------------------
onFinishedSuccessfully()243cdf0e10cSrcweir     void ProgressPage::onFinishedSuccessfully()
244cdf0e10cSrcweir     {
245cdf0e10cSrcweir         m_aMigrationDone.Show();
246cdf0e10cSrcweir     }
247cdf0e10cSrcweir 
248cdf0e10cSrcweir 	//--------------------------------------------------------------------
startObject(const::rtl::OUString & _rObjectName,const::rtl::OUString & _rCurrentAction,const sal_uInt32 _nRange)249cdf0e10cSrcweir     void ProgressPage::startObject( const ::rtl::OUString& _rObjectName, const ::rtl::OUString& _rCurrentAction, const sal_uInt32 _nRange )
250cdf0e10cSrcweir     {
251cdf0e10cSrcweir         m_aCurrentObject.SetText( _rObjectName );
252cdf0e10cSrcweir         m_aCurrentAction.SetText( _rCurrentAction );
253cdf0e10cSrcweir         m_aCurrentProgress.SetRange( _nRange );
254cdf0e10cSrcweir         m_aCurrentProgress.SetValue( (sal_uInt32)0 );
255cdf0e10cSrcweir 
256cdf0e10cSrcweir         // since this is currently called from the main thread, which does not have the chance
257cdf0e10cSrcweir         // to re-schedule, we need to explicitly update the display
258cdf0e10cSrcweir         m_aCurrentObject.Update();
259cdf0e10cSrcweir         m_aCurrentAction.Update();
260cdf0e10cSrcweir         Update();
261cdf0e10cSrcweir     }
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 	//--------------------------------------------------------------------
setObjectProgressText(const::rtl::OUString & _rText)264cdf0e10cSrcweir     void ProgressPage::setObjectProgressText( const ::rtl::OUString& _rText )
265cdf0e10cSrcweir     {
266cdf0e10cSrcweir         m_aCurrentAction.SetText( _rText );
267cdf0e10cSrcweir         m_aCurrentAction.Update();
268cdf0e10cSrcweir         Update();
269cdf0e10cSrcweir     }
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 	//--------------------------------------------------------------------
setObjectProgressValue(const sal_uInt32 _nValue)272cdf0e10cSrcweir     void ProgressPage::setObjectProgressValue( const sal_uInt32 _nValue )
273cdf0e10cSrcweir     {
274cdf0e10cSrcweir         m_aCurrentProgress.SetValue( _nValue );
275cdf0e10cSrcweir         Update();
276cdf0e10cSrcweir     }
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 	//--------------------------------------------------------------------
endObject()279cdf0e10cSrcweir     void ProgressPage::endObject()
280cdf0e10cSrcweir     {
281cdf0e10cSrcweir         m_aCurrentAction.SetText( String() );
282cdf0e10cSrcweir         m_aCurrentProgress.SetValue( m_aCurrentProgress.GetRange() );
283cdf0e10cSrcweir         m_aCurrentAction.Update();
284cdf0e10cSrcweir         Update();
285cdf0e10cSrcweir     }
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 	//--------------------------------------------------------------------
start(const sal_uInt32 _nOverallRange)288cdf0e10cSrcweir     void ProgressPage::start( const sal_uInt32 _nOverallRange )
289cdf0e10cSrcweir     {
290cdf0e10cSrcweir         m_aAllProgress.SetRange( _nOverallRange );
291cdf0e10cSrcweir         Update();
292cdf0e10cSrcweir     }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 	//--------------------------------------------------------------------
setOverallProgressText(const::rtl::OUString & _rText)295cdf0e10cSrcweir     void ProgressPage::setOverallProgressText( const ::rtl::OUString& _rText )
296cdf0e10cSrcweir     {
297cdf0e10cSrcweir         m_aAllProgressText.SetText( _rText );
298cdf0e10cSrcweir         Update();
299cdf0e10cSrcweir     }
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 	//--------------------------------------------------------------------
setOverallProgressValue(const sal_uInt32 _nValue)302cdf0e10cSrcweir     void ProgressPage::setOverallProgressValue( const sal_uInt32 _nValue )
303cdf0e10cSrcweir     {
304cdf0e10cSrcweir         m_aAllProgress.SetValue( _nValue );
305cdf0e10cSrcweir         Update();
306cdf0e10cSrcweir     }
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 	//====================================================================
309cdf0e10cSrcweir 	//= ResultPage
310cdf0e10cSrcweir 	//====================================================================
311cdf0e10cSrcweir 	//--------------------------------------------------------------------
ResultPage(MacroMigrationDialog & _rParentDialog)312cdf0e10cSrcweir     ResultPage::ResultPage( MacroMigrationDialog& _rParentDialog )
313cdf0e10cSrcweir         :MacroMigrationPage( _rParentDialog, MacroMigrationResId( TP_SUMMARY ) )
314cdf0e10cSrcweir         ,m_aChangesLabel( this, MacroMigrationResId( FT_CHANGES_LABEL ) )
315cdf0e10cSrcweir         ,m_aChanges     ( this, MacroMigrationResId( ED_CHANGES       ) )
316cdf0e10cSrcweir         ,m_aSuccessful  (       MacroMigrationResId( STR_SUCCESSFUL   ) )
317cdf0e10cSrcweir         ,m_aUnsuccessful(       MacroMigrationResId( STR_UNSUCCESSFUL ) )
318cdf0e10cSrcweir     {
319cdf0e10cSrcweir         FreeResource();
320cdf0e10cSrcweir     }
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 	//--------------------------------------------------------------------
Create(::svt::RoadmapWizard & _rParentDialog)323cdf0e10cSrcweir     TabPage* ResultPage::Create( ::svt::RoadmapWizard& _rParentDialog )
324cdf0e10cSrcweir     {
325cdf0e10cSrcweir         return new ResultPage( dynamic_cast< MacroMigrationDialog& >( _rParentDialog ) );
326cdf0e10cSrcweir     }
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 	//--------------------------------------------------------------------
displayMigrationLog(const bool _bSuccessful,const String & _rSummary)329cdf0e10cSrcweir     void ResultPage::displayMigrationLog( const bool _bSuccessful, const String& _rSummary )
330cdf0e10cSrcweir     {
331cdf0e10cSrcweir         m_aChangesLabel.SetText( _bSuccessful ? m_aSuccessful : m_aUnsuccessful );
332cdf0e10cSrcweir         m_aChanges.SetText( _rSummary );
333cdf0e10cSrcweir 
334cdf0e10cSrcweir         // resize m_aChangesLabel and m_aChances as needed for the label text to fit
335cdf0e10cSrcweir         Rectangle aOriginalLabelSize( m_aChangesLabel.GetPosPixel(), m_aChangesLabel.GetSizePixel() );
336cdf0e10cSrcweir         // assume 3 lines, at most
337cdf0e10cSrcweir         Rectangle aNewLabelSize( aOriginalLabelSize );
338cdf0e10cSrcweir         aNewLabelSize.Bottom() = aNewLabelSize.Top() + m_aChangesLabel.LogicToPixel( Size( 0, 3*8 ), MAP_APPFONT ).Height();
339cdf0e10cSrcweir         TextRectInfo aInfo;
340cdf0e10cSrcweir         aNewLabelSize = m_aChangesLabel.GetTextRect( aNewLabelSize, m_aChangesLabel.GetText(), TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK, &aInfo );
341cdf0e10cSrcweir         aNewLabelSize.Bottom() = aNewLabelSize.Top() + m_aChangesLabel.LogicToPixel( Size( 0, aInfo.GetLineCount() * 8 ), MAP_APPFONT ).Height();
342cdf0e10cSrcweir 
343cdf0e10cSrcweir         m_aChangesLabel.SetSizePixel( aNewLabelSize.GetSize() );
344cdf0e10cSrcweir 
345cdf0e10cSrcweir         long nChangesDiff = aNewLabelSize.GetHeight() - aOriginalLabelSize.GetHeight();
346cdf0e10cSrcweir         Size aChangesSize( m_aChanges.GetSizePixel() );
347cdf0e10cSrcweir         aChangesSize.Height() -= nChangesDiff;
348cdf0e10cSrcweir         m_aChanges.SetSizePixel( aChangesSize );
349cdf0e10cSrcweir 
350cdf0e10cSrcweir         Point aChangesPos( m_aChanges.GetPosPixel() );
351cdf0e10cSrcweir         aChangesPos.Y() += nChangesDiff;
352cdf0e10cSrcweir         m_aChanges.SetPosPixel( aChangesPos );
353cdf0e10cSrcweir     }
354cdf0e10cSrcweir 
355cdf0e10cSrcweir //........................................................................
356cdf0e10cSrcweir } // namespace dbmm
357cdf0e10cSrcweir //........................................................................
358