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 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_desktop.hxx" 30 31 #include "pages.hxx" 32 #include "wizard.hrc" 33 #include "wizard.hxx" 34 #include "migration.hxx" 35 #include <vcl/msgbox.hxx> 36 #include <vcl/mnemonic.hxx> 37 #include <vos/security.hxx> 38 #include <app.hxx> 39 #include <rtl/ustring.hxx> 40 #include <osl/file.hxx> 41 #include <unotools/bootstrap.hxx> 42 #include <unotools/configmgr.hxx> 43 #include <unotools/regoptions.hxx> 44 #include <unotools/useroptions.hxx> 45 #include <sfx2/basedlgs.hxx> 46 #include <comphelper/processfactory.hxx> 47 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 48 #include <com/sun/star/lang/XInitialization.hpp> 49 #include <com/sun/star/frame/XDesktop.hpp> 50 #include <com/sun/star/beans/XMaterialHolder.hpp> 51 #include <com/sun/star/beans/NamedValue.hpp> 52 #include <com/sun/star/container/XNameReplace.hpp> 53 #include <com/sun/star/task/XJobExecutor.hpp> 54 #include <comphelper/configurationhelper.hxx> 55 #include <rtl/bootstrap.hxx> 56 #include <rtl/ustrbuf.hxx> 57 #include <osl/file.hxx> 58 #include <osl/thread.hxx> 59 #include <unotools/bootstrap.hxx> 60 #include <tools/config.hxx> 61 62 using namespace rtl; 63 using namespace osl; 64 using namespace utl; 65 using namespace svt; 66 using namespace com::sun::star; 67 using namespace com::sun::star::frame; 68 using namespace com::sun::star::lang; 69 using namespace com::sun::star::util; 70 using namespace com::sun::star::beans; 71 using namespace com::sun::star::uno; 72 using namespace com::sun::star::container; 73 74 #define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) 75 76 namespace desktop { 77 78 static void _setBold(FixedText& ft) 79 { 80 Font f = ft.GetControlFont(); 81 f.SetWeight(WEIGHT_BOLD); 82 ft.SetControlFont(f); 83 } 84 85 WelcomePage::WelcomePage( svt::OWizardMachine* parent, const ResId& resid, sal_Bool bLicenseNeedsAcceptance ) 86 : OWizardPage(parent, resid) 87 , m_ftHead(this, WizardResId(FT_WELCOME_HEADER)) 88 , m_ftBody(this, WizardResId(FT_WELCOME_BODY)) 89 , m_pParent(parent) 90 , m_bLicenseNeedsAcceptance( bLicenseNeedsAcceptance ) 91 , bIsEvalVersion(false) 92 , bNoEvalText(false) 93 { 94 FreeResource(); 95 96 _setBold(m_ftHead); 97 98 checkEval(); 99 100 // check for migration 101 if (Migration::checkMigration()) 102 { 103 String aText(WizardResId(STR_WELCOME_MIGRATION)); 104 // replace %OLDPRODUCT with found version name 105 aText.SearchAndReplaceAll( UniString::CreateFromAscii("%OLD_VERSION"), Migration::getOldVersionName()); 106 m_ftBody.SetText( aText ); 107 } 108 else if ( ! m_bLicenseNeedsAcceptance ) 109 { 110 String aText(WizardResId(STR_WELCOME_WITHOUT_LICENSE)); 111 m_ftBody.SetText( aText ); 112 } 113 } 114 115 116 void WelcomePage::checkEval() 117 { 118 Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); 119 Reference< XMaterialHolder > xHolder(xFactory->createInstance( 120 OUString::createFromAscii("com.sun.star.tab.tabreg")), UNO_QUERY); 121 if (xHolder.is()) { 122 Any aData = xHolder->getMaterial(); 123 Sequence < NamedValue > aSeq; 124 if (aData >>= aSeq) { 125 bIsEvalVersion = true; 126 for (int i=0; i< aSeq.getLength(); i++) { 127 if (aSeq[i].Name.equalsAscii("NoEvalText")) { 128 aSeq[i].Value >>= bNoEvalText; 129 } 130 } 131 } 132 } 133 } 134 135 136 void WelcomePage::ActivatePage() 137 { 138 OWizardPage::ActivatePage(); 139 // this page has no controls, so forwarding to default 140 // button (next) won't work if we grap focus 141 // GrabFocus(); 142 } 143 144 LicensePage::LicensePage( svt::OWizardMachine* parent, const ResId& resid, const rtl::OUString &rLicensePath ) 145 : OWizardPage(parent, resid) 146 , m_pParent(parent) 147 , m_ftHead(this, WizardResId(FT_LICENSE_HEADER)) 148 , m_ftBody1(this, WizardResId(FT_LICENSE_BODY_1)) 149 , m_ftBody1Txt(this, WizardResId(FT_LICENSE_BODY_1_TXT)) 150 , m_ftBody2(this, WizardResId(FT_LICENSE_BODY_2)) 151 , m_ftBody2Txt(this, WizardResId(FT_LICENSE_BODY_2_TXT)) 152 , m_mlLicense(this, WizardResId(ML_LICENSE)) 153 , m_pbDown(this, WizardResId(PB_LICENSE_DOWN)) 154 , m_bLicenseRead(sal_False) 155 { 156 FreeResource(); 157 158 _setBold(m_ftHead); 159 160 m_mlLicense.SetEndReachedHdl( LINK(this, LicensePage, EndReachedHdl) ); 161 m_mlLicense.SetScrolledHdl( LINK(this, LicensePage, ScrolledHdl) ); 162 m_pbDown.SetClickHdl( LINK(this, LicensePage, PageDownHdl) ); 163 164 // We want a automatic repeating page down button 165 WinBits aStyle = m_pbDown.GetStyle(); 166 aStyle |= WB_REPEAT; 167 m_pbDown.SetStyle( aStyle ); 168 169 // replace %PAGEDOWN in text2 with button text 170 String aText = m_ftBody1Txt.GetText(); 171 aText.SearchAndReplaceAll( UniString::CreateFromAscii("%PAGEDOWN"), 172 MnemonicGenerator::EraseAllMnemonicChars(m_pbDown.GetText())); 173 174 m_ftBody1Txt.SetText( aText ); 175 176 // load license text 177 File aLicenseFile(rLicensePath); 178 if ( aLicenseFile.open(OpenFlag_Read) == FileBase::E_None) 179 { 180 DirectoryItem d; 181 DirectoryItem::get(rLicensePath, d); 182 FileStatus fs(FileStatusMask_FileSize); 183 d.getFileStatus(fs); 184 sal_uInt64 nBytesRead = 0; 185 sal_uInt64 nPosition = 0; 186 sal_uInt32 nBytes = (sal_uInt32)fs.getFileSize(); 187 sal_Char *pBuffer = new sal_Char[nBytes]; 188 // FileBase RC r = FileBase::E_None; 189 while (aLicenseFile.read(pBuffer+nPosition, nBytes-nPosition, nBytesRead) == FileBase::E_None 190 && nPosition + nBytesRead < nBytes) 191 { 192 nPosition += nBytesRead; 193 } 194 OUString aLicenseString(pBuffer, nBytes, RTL_TEXTENCODING_UTF8, 195 OSTRING_TO_OUSTRING_CVTFLAGS | RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE); 196 delete[] pBuffer; 197 m_mlLicense.SetText(aLicenseString); 198 199 } 200 } 201 202 void LicensePage::ActivatePage() 203 { 204 OWizardPage::ActivatePage(); 205 m_bLicenseRead = m_mlLicense.IsEndReached(); 206 m_pbDown.GrabFocus(); 207 updateDialogTravelUI(); 208 } 209 210 bool LicensePage::canAdvance() const 211 { 212 if (m_mlLicense.IsEndReached()) 213 const_cast< LicensePage* >( this )->m_pbDown.Disable(); 214 else 215 const_cast< LicensePage* >( this )->m_pbDown.Enable(); 216 217 return m_bLicenseRead; 218 } 219 220 IMPL_LINK( LicensePage, PageDownHdl, PushButton *, EMPTYARG ) 221 { 222 m_mlLicense.ScrollDown( SCROLL_PAGEDOWN ); 223 return 0; 224 } 225 226 IMPL_LINK( LicensePage, EndReachedHdl, LicenseView *, EMPTYARG ) 227 { 228 m_bLicenseRead = sal_True; 229 updateDialogTravelUI(); 230 return 0; 231 } 232 233 IMPL_LINK( LicensePage, ScrolledHdl, LicenseView *, EMPTYARG ) 234 { 235 updateDialogTravelUI(); 236 return 0; 237 } 238 239 240 LicenseView::LicenseView( Window* pParent, const ResId& rResId ) 241 : MultiLineEdit( pParent, rResId ) 242 { 243 SetLeftMargin( 5 ); 244 mbEndReached = IsEndReached(); 245 StartListening( *GetTextEngine() ); 246 } 247 248 LicenseView::~LicenseView() 249 { 250 maEndReachedHdl = Link(); 251 maScrolledHdl = Link(); 252 EndListeningAll(); 253 } 254 255 void LicenseView::ScrollDown( ScrollType eScroll ) 256 { 257 ScrollBar* pScroll = GetVScrollBar(); 258 if ( pScroll ) 259 pScroll->DoScrollAction( eScroll ); 260 } 261 262 sal_Bool LicenseView::IsEndReached() const 263 { 264 sal_Bool bEndReached; 265 266 ExtTextView* pView = GetTextView(); 267 ExtTextEngine* pEdit = GetTextEngine(); 268 sal_uLong nHeight = pEdit->GetTextHeight(); 269 Size aOutSize = pView->GetWindow()->GetOutputSizePixel(); 270 Point aBottom( 0, aOutSize.Height() ); 271 272 if ( (sal_uLong) pView->GetDocPos( aBottom ).Y() >= nHeight - 1 ) 273 bEndReached = sal_True; 274 else 275 bEndReached = sal_False; 276 277 return bEndReached; 278 } 279 280 void LicenseView::Notify( SfxBroadcaster&, const SfxHint& rHint ) 281 { 282 if ( rHint.IsA( TYPE(TextHint) ) ) 283 { 284 sal_Bool bLastVal = EndReached(); 285 sal_uLong nId = ((const TextHint&)rHint).GetId(); 286 287 if ( nId == TEXT_HINT_PARAINSERTED ) 288 { 289 if ( bLastVal ) 290 mbEndReached = IsEndReached(); 291 } 292 else if ( nId == TEXT_HINT_VIEWSCROLLED ) 293 { 294 if ( ! mbEndReached ) 295 mbEndReached = IsEndReached(); 296 maScrolledHdl.Call( this ); 297 } 298 299 if ( EndReached() && !bLastVal ) 300 { 301 maEndReachedHdl.Call( this ); 302 } 303 } 304 } 305 306 307 308 // ------------------------------------------------------------------- 309 310 class MigrationThread : public ::osl::Thread 311 { 312 public: 313 MigrationThread(); 314 315 virtual void SAL_CALL run(); 316 virtual void SAL_CALL onTerminated(); 317 }; 318 319 MigrationThread::MigrationThread() 320 { 321 } 322 323 void MigrationThread::run() 324 { 325 try 326 { 327 Migration::doMigration(); 328 } 329 catch ( uno::Exception& ) 330 { 331 } 332 } 333 334 void MigrationThread::onTerminated() 335 { 336 } 337 338 // ------------------------------------------------------------------- 339 340 MigrationPage::MigrationPage( 341 svt::OWizardMachine* parent, 342 const ResId& resid, Throbber& i_throbber ) 343 : OWizardPage(parent, resid) 344 , m_ftHead(this, WizardResId(FT_MIGRATION_HEADER)) 345 , m_ftBody(this, WizardResId(FT_MIGRATION_BODY)) 346 , m_cbMigration(this, WizardResId(CB_MIGRATION)) 347 , m_rThrobber(i_throbber) 348 , m_bMigrationDone(sal_False) 349 { 350 FreeResource(); 351 _setBold(m_ftHead); 352 353 // replace %OLDPRODUCT with found version name 354 String aText = m_ftBody.GetText(); 355 aText.SearchAndReplaceAll( UniString::CreateFromAscii("%OLDPRODUCT"), Migration::getOldVersionName()); 356 m_ftBody.SetText( aText ); 357 } 358 359 sal_Bool MigrationPage::commitPage( svt::WizardTypes::CommitPageReason _eReason ) 360 { 361 if (_eReason == svt::WizardTypes::eTravelForward && m_cbMigration.IsChecked() && !m_bMigrationDone) 362 { 363 GetParent()->EnterWait(); 364 FirstStartWizard* pWizard = dynamic_cast< FirstStartWizard* >( GetParent() ); 365 if ( pWizard ) 366 pWizard->DisableButtonsWhileMigration(); 367 368 m_rThrobber.Show(); 369 m_rThrobber.start(); 370 MigrationThread* pMigThread = new MigrationThread(); 371 pMigThread->create(); 372 373 while ( pMigThread->isRunning() ) 374 { 375 Application::Reschedule(); 376 } 377 378 m_rThrobber.stop(); 379 GetParent()->LeaveWait(); 380 // Next state will enable buttons - so no EnableButtons necessary! 381 m_rThrobber.Hide(); 382 pMigThread->join(); 383 delete pMigThread; 384 m_bMigrationDone = sal_True; 385 } 386 else 387 Migration::cancelMigration(); 388 return sal_True; 389 } 390 391 void MigrationPage::ActivatePage() 392 { 393 OWizardPage::ActivatePage(); 394 GrabFocus(); 395 } 396 397 UserPage::UserPage( svt::OWizardMachine* parent, const ResId& resid) 398 : OWizardPage(parent, resid) 399 , m_ftHead(this, WizardResId(FT_USER_HEADER)) 400 , m_ftBody(this, WizardResId(FT_USER_BODY)) 401 , m_ftFirst(this, WizardResId(FT_USER_FIRST)) 402 , m_edFirst(this, WizardResId(ED_USER_FIRST)) 403 , m_ftLast(this, WizardResId(FT_USER_LAST)) 404 , m_edLast(this, WizardResId(ED_USER_LAST)) 405 , m_ftInitials(this, WizardResId(FT_USER_INITIALS)) 406 , m_edInitials(this, WizardResId(ED_USER_INITIALS)) 407 , m_ftFather(this, WizardResId(FT_USER_FATHER)) 408 , m_edFather(this, WizardResId(ED_USER_FATHER)) 409 , m_lang(Application::GetSettings().GetUILanguage()) 410 { 411 FreeResource(); 412 _setBold(m_ftHead); 413 414 // check whether this is a russian version. otherwise 415 // we'll hide the 'Fathers name' field 416 SvtUserOptions aUserOpt; 417 m_edFirst.SetText(aUserOpt.GetFirstName()); 418 m_edLast.SetText(aUserOpt.GetLastName()); 419 #if 0 420 rtl::OUString aUserName; 421 vos::OSecurity().getUserName( aUserName ); 422 aUserOpt.SetID( aUserName ); 423 #endif 424 425 m_edInitials.SetText(aUserOpt.GetID()); 426 if (m_lang == LANGUAGE_RUSSIAN) 427 { 428 m_ftFather.Show(); 429 m_edFather.Show(); 430 m_edFather.SetText(aUserOpt.GetFathersName()); 431 } 432 } 433 434 sal_Bool UserPage::commitPage( svt::WizardTypes::CommitPageReason ) 435 { 436 SvtUserOptions aUserOpt; 437 aUserOpt.SetFirstName(m_edFirst.GetText()); 438 aUserOpt.SetLastName(m_edLast.GetText()); 439 aUserOpt.SetID( m_edInitials.GetText()); 440 441 if (m_lang == LANGUAGE_RUSSIAN) 442 aUserOpt.SetFathersName(m_edFather.GetText()); 443 444 return sal_True; 445 } 446 447 void UserPage::ActivatePage() 448 { 449 OWizardPage::ActivatePage(); 450 GrabFocus(); 451 } 452 453 // ------------------------------------------------------------------- 454 UpdateCheckPage::UpdateCheckPage( svt::OWizardMachine* parent, const ResId& resid) 455 : OWizardPage(parent, resid) 456 , m_ftHead(this, WizardResId(FT_UPDATE_CHECK_HEADER)) 457 , m_ftBody(this, WizardResId(FT_UPDATE_CHECK_BODY)) 458 , m_cbUpdateCheck(this, WizardResId(CB_UPDATE_CHECK)) 459 { 460 FreeResource(); 461 _setBold(m_ftHead); 462 } 463 464 sal_Bool UpdateCheckPage::commitPage( svt::WizardTypes::CommitPageReason _eReason ) 465 { 466 if ( _eReason == svt::WizardTypes::eTravelForward ) 467 { 468 try { 469 Reference < XNameReplace > xUpdateAccess; 470 Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); 471 472 xUpdateAccess = Reference < XNameReplace >( 473 xFactory->createInstance( UNISTRING( "com.sun.star.setup.UpdateCheckConfig" ) ), UNO_QUERY_THROW ); 474 475 if ( !xUpdateAccess.is() ) 476 return sal_False; 477 478 sal_Bool bAutoUpdChk = m_cbUpdateCheck.IsChecked(); 479 xUpdateAccess->replaceByName( UNISTRING("AutoCheckEnabled"), makeAny( bAutoUpdChk ) ); 480 481 Reference< XChangesBatch > xChangesBatch( xUpdateAccess, UNO_QUERY); 482 if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() ) 483 xChangesBatch->commitChanges(); 484 } catch (RuntimeException) 485 { 486 } 487 } 488 489 return sal_True; 490 } 491 492 void UpdateCheckPage::ActivatePage() 493 { 494 OWizardPage::ActivatePage(); 495 GrabFocus(); 496 } 497 498 // ------------------------------------------------------------------- 499 RegistrationPage::RegistrationPage( Window* pParent, const ResId& rResid ) 500 : OWizardPage( pParent, rResid ) 501 , m_ftHeader(this, WizardResId(FT_REGISTRATION_HEADER)) 502 , m_ftBody(this, WizardResId(FT_REGISTRATION_BODY)) 503 , m_rbNow(this, WizardResId(RB_REGISTRATION_NOW)) 504 , m_rbLater(this, WizardResId(RB_REGISTRATION_LATER)) 505 , m_rbNever(this, WizardResId(RB_REGISTRATION_NEVER)) 506 , m_flSeparator(this, WizardResId(FL_REGISTRATION)) 507 , m_ftEnd(this, WizardResId(FT_REGISTRATION_END)) 508 , m_bNeverVisible( sal_True ) 509 { 510 FreeResource(); 511 512 // another text for OOo 513 sal_Int32 nOpenSourceContext = 0; 514 try 515 { 516 ::utl::ConfigManager::GetDirectConfigProperty( 517 ::utl::ConfigManager::OPENSOURCECONTEXT ) >>= nOpenSourceContext; 518 } 519 catch( Exception& ) 520 { 521 DBG_ERRORFILE( "RegistrationPage::RegistrationPage(): error while getting open source context" ); 522 } 523 524 if ( nOpenSourceContext > 0 ) 525 { 526 String sBodyText( WizardResId( STR_REGISTRATION_OOO ) ); 527 m_ftBody.SetText( sBodyText ); 528 } 529 530 // calculate height of body text and rearrange the buttons 531 Size aSize = m_ftBody.GetSizePixel(); 532 Size aMinSize = m_ftBody.CalcMinimumSize( aSize.Width() ); 533 long nTxtH = aMinSize.Height(); 534 long nCtrlH = aSize.Height(); 535 long nDelta = ( nCtrlH - nTxtH ); 536 aSize.Height() -= nDelta; 537 m_ftBody.SetSizePixel( aSize ); 538 Window* pWins[] = { &m_rbNow, &m_rbLater, &m_rbNever }; 539 Window** pCurrent = pWins; 540 for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) 541 { 542 Point aNewPos = (*pCurrent)->GetPosPixel(); 543 aNewPos.Y() -= nDelta; 544 (*pCurrent)->SetPosPixel( aNewPos ); 545 } 546 547 _setBold(m_ftHeader); 548 impl_retrieveConfigurationData(); 549 updateButtonStates(); 550 } 551 552 bool RegistrationPage::canAdvance() const 553 { 554 return false; 555 } 556 557 void RegistrationPage::ActivatePage() 558 { 559 OWizardPage::ActivatePage(); 560 GrabFocus(); 561 } 562 563 void RegistrationPage::impl_retrieveConfigurationData() 564 { 565 static ::rtl::OUString PACKAGE = ::rtl::OUString::createFromAscii("org.openoffice.FirstStartWizard"); 566 static ::rtl::OUString PATH = ::rtl::OUString::createFromAscii("TabPages/Registration/RegistrationOptions/NeverButton"); 567 static ::rtl::OUString KEY = ::rtl::OUString::createFromAscii("Visible"); 568 569 ::com::sun::star::uno::Any aValue; 570 try 571 { 572 aValue = ::comphelper::ConfigurationHelper::readDirectKey( 573 ::comphelper::getProcessServiceFactory(), 574 PACKAGE, 575 PATH, 576 KEY, 577 ::comphelper::ConfigurationHelper::E_READONLY); 578 } 579 catch(const ::com::sun::star::uno::Exception&) 580 { aValue.clear(); } 581 582 aValue >>= m_bNeverVisible; 583 } 584 585 void RegistrationPage::updateButtonStates() 586 { 587 m_rbNever.Show( m_bNeverVisible ); 588 } 589 590 sal_Bool RegistrationPage::commitPage( svt::WizardTypes::CommitPageReason _eReason ) 591 { 592 if ( _eReason == svt::WizardTypes::eFinish ) 593 { 594 ::utl::RegOptions aOptions; 595 rtl::OUString aEvent; 596 597 if ( m_rbNow.IsChecked()) 598 { 599 aEvent = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RegistrationRequired" ) ); 600 } 601 else if (m_rbLater.IsChecked()) 602 { 603 aOptions.activateReminder(7); 604 // avtivate a reminder job... 605 } 606 // aOptions.markSessionDone(); 607 608 try 609 { 610 // create the Desktop component which can load components 611 Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); 612 if( xFactory.is() ) 613 { 614 Reference< com::sun::star::task::XJobExecutor > xProductRegistration( 615 xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.setup.ProductRegistration" ) ) ), 616 UNO_QUERY_THROW ); 617 618 // tell it that the user wants to register 619 xProductRegistration->trigger( aEvent ); 620 } 621 } 622 catch( const Exception& ) 623 { 624 } 625 } 626 return sal_True; 627 } 628 629 RegistrationPage::RegistrationMode RegistrationPage::getRegistrationMode() const 630 { 631 RegistrationPage::RegistrationMode eMode = rmNow; 632 if ( m_rbLater.IsChecked() ) 633 eMode = rmLater; 634 else if ( m_rbNever.IsChecked() ) 635 eMode = rmNever; 636 return eMode; 637 } 638 639 void RegistrationPage::prepareSingleMode() 640 { 641 // remove wizard text (hide and cut) 642 m_flSeparator.Hide(); 643 m_ftEnd.Hide(); 644 Size aNewSize = GetSizePixel(); 645 aNewSize.Height() -= ( aNewSize.Height() - m_flSeparator.GetPosPixel().Y() ); 646 SetSizePixel( aNewSize ); 647 } 648 649 bool RegistrationPage::hasReminderDateCome() 650 { 651 return ::utl::RegOptions().hasReminderDateCome(); 652 } 653 654 void RegistrationPage::executeSingleMode() 655 { 656 // opens the page in a single tabdialog 657 SfxSingleTabDialog aSingleDlg( NULL, TP_REGISTRATION ); 658 RegistrationPage* pPage = new RegistrationPage( &aSingleDlg, WizardResId( TP_REGISTRATION ) ); 659 pPage->prepareSingleMode(); 660 aSingleDlg.SetPage( pPage ); 661 aSingleDlg.SetText( pPage->getSingleModeTitle() ); 662 aSingleDlg.Execute(); 663 // the registration modes "Now" and "Later" are handled by the page 664 RegistrationPage::RegistrationMode eMode = pPage->getRegistrationMode(); 665 if ( eMode == RegistrationPage::rmNow || eMode == RegistrationPage::rmLater ) 666 pPage->commitPage( WizardTypes::eFinish ); 667 if ( eMode != RegistrationPage::rmLater ) 668 ::utl::RegOptions().removeReminder(); 669 } 670 671 } // namespace desktop 672