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