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 <migration.hxx> 32 #include "wizard.hxx" 33 #include "wizard.hrc" 34 #include "pages.hxx" 35 #include "app.hxx" 36 37 #include <rtl/ustring.hxx> 38 #include <rtl/ustrbuf.hxx> 39 #include <rtl/string.hxx> 40 #include <rtl/strbuf.hxx> 41 #include <rtl/bootstrap.hxx> 42 43 #include <comphelper/processfactory.hxx> 44 #include <tools/date.hxx> 45 #include <tools/time.hxx> 46 #include <tools/datetime.hxx> 47 #include <osl/file.hxx> 48 #include <osl/time.h> 49 #include <osl/module.hxx> 50 #include <unotools/bootstrap.hxx> 51 #include <vcl/msgbox.hxx> 52 53 #include <com/sun/star/uno/Any.hxx> 54 #include <com/sun/star/uno/Sequence.hxx> 55 #include <com/sun/star/beans/NamedValue.hpp> 56 #include <com/sun/star/beans/XPropertySet.hpp> 57 #include <com/sun/star/beans/XPropertyState.hpp> 58 #include <com/sun/star/frame/XDesktop.hpp> 59 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 60 #include <com/sun/star/lang/XInitialization.hpp> 61 #include <com/sun/star/lang/XComponent.hpp> 62 #include <com/sun/star/util/XChangesBatch.hpp> 63 #include <com/sun/star/container/XNameReplace.hpp> 64 #include <com/sun/star/awt/WindowDescriptor.hpp> 65 #include <com/sun/star/awt/WindowAttribute.hpp> 66 67 using namespace svt; 68 using namespace rtl; 69 using namespace osl; 70 using namespace utl; 71 using namespace com::sun::star; 72 using namespace com::sun::star::uno; 73 using namespace com::sun::star::lang; 74 using namespace com::sun::star::beans; 75 using namespace com::sun::star::util; 76 using namespace com::sun::star::container; 77 78 #define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) 79 80 namespace desktop 81 { 82 83 const FirstStartWizard::WizardState FirstStartWizard::STATE_WELCOME = 0; 84 const FirstStartWizard::WizardState FirstStartWizard::STATE_LICENSE = 1; 85 const FirstStartWizard::WizardState FirstStartWizard::STATE_MIGRATION = 2; 86 const FirstStartWizard::WizardState FirstStartWizard::STATE_USER = 3; 87 const FirstStartWizard::WizardState FirstStartWizard::STATE_UPDATE_CHECK = 4; 88 const FirstStartWizard::WizardState FirstStartWizard::STATE_REGISTRATION = 5; 89 90 static sal_Int32 getBuildId() 91 { 92 ::rtl::OUString aDefault; 93 ::rtl::OUString aBuildIdData = utl::Bootstrap::getBuildIdData( aDefault ); 94 sal_Int32 nBuildId( 0 ); 95 sal_Int32 nIndex1 = aBuildIdData.indexOf(':'); 96 sal_Int32 nIndex2 = aBuildIdData.indexOf(')'); 97 if (( nIndex1 > 0 ) && ( nIndex2 > 0 ) && ( nIndex2-1 > nIndex1+1 )) 98 { 99 ::rtl::OUString aBuildId = aBuildIdData.copy( nIndex1+1, nIndex2-nIndex1-1 ); 100 nBuildId = aBuildId.toInt32(); 101 } 102 return nBuildId; 103 } 104 105 WizardResId::WizardResId( sal_uInt16 nId ) : 106 ResId( nId, *FirstStartWizard::GetResManager() ) 107 { 108 } 109 110 ResMgr *FirstStartWizard::pResMgr = 0; 111 112 ResMgr *FirstStartWizard::GetResManager() 113 { 114 if ( !FirstStartWizard::pResMgr ) 115 { 116 String aMgrName = String::CreateFromAscii( "dkt" ); 117 FirstStartWizard::pResMgr = ResMgr::CreateResMgr( OUStringToOString( aMgrName, RTL_TEXTENCODING_UTF8 )); 118 } 119 return FirstStartWizard::pResMgr; 120 } 121 122 FirstStartWizard::FirstStartWizard( Window* pParent, sal_Bool bLicenseNeedsAcceptance, const rtl::OUString &rLicensePath ) 123 :RoadmapWizard( pParent, WizardResId(DLG_FIRSTSTART_WIZARD), 124 WZB_NEXT|WZB_PREVIOUS|WZB_FINISH|WZB_CANCEL|WZB_HELP) 125 ,m_bOverride(sal_False) 126 ,m_aDefaultPath(0) 127 ,m_aMigrationPath(0) 128 ,m_bDone(sal_False) 129 ,m_bLicenseNeedsAcceptance( bLicenseNeedsAcceptance ) 130 ,m_bLicenseWasAccepted(sal_False) 131 ,m_bAutomaticUpdChk(sal_True) 132 ,m_aThrobber(this, WizardResId(CTRL_THROBBER)) 133 ,m_aLicensePath( rLicensePath ) 134 { 135 FreeResource(); 136 // --- 137 // enableState(STATE_USER, sal_False); 138 // enableState(STATE_REGISTRATION, sal_False); 139 140 Size aTPSize(TP_WIDTH, TP_HEIGHT); 141 SetPageSizePixel(LogicToPixel(aTPSize, MAP_APPFONT)); 142 143 //set help id 144 m_pPrevPage->SetHelpId(HID_FIRSTSTART_PREV); 145 m_pNextPage->SetHelpId(HID_FIRSTSTART_NEXT); 146 m_pCancel->SetHelpId(HID_FIRSTSTART_CANCEL); 147 m_pFinish->SetHelpId(HID_FIRSTSTART_FINISH); 148 // m_pHelp->SetUniqueId(UID_FIRSTSTART_HELP); 149 m_pHelp->Hide(); 150 m_pHelp->Disable(); 151 152 // save button lables 153 m_sNext = m_pNextPage->GetText(); 154 m_sCancel = m_pCancel->GetText(); 155 156 // save cancel click handler 157 m_lnkCancel = m_pCancel->GetClickHdl(); 158 159 m_aDefaultPath = defineWizardPagesDependingFromContext(); 160 activatePath(m_aDefaultPath, sal_True); 161 162 ActivatePage(); 163 164 // set text of finish putton: 165 m_pFinish->SetText(String(WizardResId(STR_FINISH))); 166 // disable "finish button" 167 enableButtons(WZB_FINISH, sal_False); 168 defaultButton(WZB_NEXT); 169 } 170 171 void FirstStartWizard::DisableButtonsWhileMigration() 172 { 173 enableButtons(0xff, sal_False); 174 } 175 176 ::svt::RoadmapWizardTypes::PathId FirstStartWizard::defineWizardPagesDependingFromContext() 177 { 178 ::svt::RoadmapWizardTypes::PathId aDefaultPath = 0; 179 180 sal_Bool bPage_Welcome = sal_True; 181 sal_Bool bPage_License = sal_True; 182 sal_Bool bPage_Migration = sal_True; 183 sal_Bool bPage_User = sal_True; 184 sal_Bool bPage_UpdateCheck = sal_True; 185 sal_Bool bPage_Registration = sal_True; 186 187 bPage_License = m_bLicenseNeedsAcceptance; 188 bPage_Migration = Migration::checkMigration(); 189 bPage_UpdateCheck = showOnlineUpdatePage(); 190 191 WizardPath aPath; 192 if (bPage_Welcome) 193 aPath.push_back(STATE_WELCOME); 194 if (bPage_License) 195 aPath.push_back(STATE_LICENSE); 196 if (bPage_Migration) 197 aPath.push_back(STATE_MIGRATION); 198 if (bPage_User) 199 aPath.push_back(STATE_USER); 200 if (bPage_UpdateCheck) 201 aPath.push_back(STATE_UPDATE_CHECK); 202 if (bPage_Registration) 203 aPath.push_back(STATE_REGISTRATION); 204 205 declarePath(aDefaultPath, aPath); 206 207 // a) If license must be accepted by the user, all direct links 208 // to wizard tab pages must be disabled. Because such pages 209 // should be accessible only in case license was accepted ! 210 // b) But if no license should be shown at all ... 211 // such direct links can be enabled by default. 212 sal_Bool bAllowDirectLink = ( ! bPage_License); 213 214 if (bPage_User) 215 enableState(STATE_USER, bAllowDirectLink); 216 if (bPage_UpdateCheck) 217 enableState(STATE_UPDATE_CHECK, bAllowDirectLink); 218 if (bPage_Migration) 219 enableState(STATE_MIGRATION, bAllowDirectLink); 220 if (bPage_Registration) 221 enableState(STATE_REGISTRATION, bAllowDirectLink); 222 223 return aDefaultPath; 224 } 225 226 // catch F1 and disable help 227 long FirstStartWizard::PreNotify( NotifyEvent& rNEvt ) 228 { 229 if( rNEvt.GetType() == EVENT_KEYINPUT ) 230 { 231 const KeyCode& rKey = rNEvt.GetKeyEvent()->GetKeyCode(); 232 if( rKey.GetCode() == KEY_F1 && ! rKey.GetModifier() ) 233 return sal_True; 234 } 235 return RoadmapWizard::PreNotify(rNEvt); 236 } 237 238 239 void FirstStartWizard::enterState(WizardState _nState) 240 { 241 RoadmapWizard::enterState(_nState); 242 // default state 243 // all on 244 enableButtons(0xff, sal_True); 245 // finish off 246 enableButtons(WZB_FINISH, sal_False); 247 // default text 248 m_pCancel->SetText(m_sCancel); 249 m_pCancel->SetClickHdl(m_lnkCancel); 250 m_pNextPage->SetText(m_sNext); 251 252 // default 253 defaultButton(WZB_NEXT); 254 255 // specialized state 256 switch (_nState) 257 { 258 case STATE_WELCOME: 259 enableButtons(WZB_PREVIOUS, sal_False); 260 break; 261 case STATE_LICENSE: 262 m_pCancel->SetText(String(WizardResId(STR_LICENSE_DECLINE))); 263 m_pNextPage->SetText(String(WizardResId(STR_LICENSE_ACCEPT))); 264 enableButtons(WZB_NEXT, sal_False); 265 // attach warning dialog to cancel/decline button 266 m_pCancel->SetClickHdl( LINK(this, FirstStartWizard, DeclineHdl) ); 267 break; 268 case STATE_REGISTRATION: 269 enableButtons(WZB_NEXT, sal_False); 270 enableButtons(WZB_FINISH, sal_True); 271 defaultButton(WZB_FINISH); 272 break; 273 } 274 275 // focus 276 277 } 278 279 IMPL_LINK( FirstStartWizard, DeclineHdl, PushButton *, EMPTYARG ) 280 { 281 QueryBox aBox(this, WizardResId(QB_ASK_DECLINE)); 282 sal_Int32 ret = aBox.Execute(); 283 if ( ret == BUTTON_OK || ret == BUTTON_YES) 284 { 285 Close(); 286 return sal_False; 287 } 288 else 289 return sal_True; 290 } 291 292 293 TabPage* FirstStartWizard::createPage(WizardState _nState) 294 { 295 TabPage *pTabPage = 0; 296 switch (_nState) 297 { 298 case STATE_WELCOME: 299 pTabPage = new WelcomePage(this, WizardResId(TP_WELCOME), m_bLicenseNeedsAcceptance); 300 break; 301 case STATE_LICENSE: 302 pTabPage = new LicensePage(this, WizardResId(TP_LICENSE), m_aLicensePath); 303 break; 304 case STATE_MIGRATION: 305 pTabPage = new MigrationPage(this, WizardResId(TP_MIGRATION), m_aThrobber); 306 break; 307 case STATE_USER: 308 pTabPage = new UserPage(this, WizardResId(TP_USER)); 309 break; 310 case STATE_UPDATE_CHECK: 311 pTabPage = new UpdateCheckPage(this, WizardResId(TP_UPDATE_CHECK)); 312 break; 313 case STATE_REGISTRATION: 314 pTabPage = new RegistrationPage(this, WizardResId(TP_REGISTRATION)); 315 break; 316 } 317 pTabPage->Show(); 318 319 return pTabPage; 320 } 321 322 String FirstStartWizard::getStateDisplayName( WizardState _nState ) const 323 { 324 String sName; 325 switch(_nState) 326 { 327 case STATE_WELCOME: 328 sName = String(WizardResId(STR_STATE_WELCOME)); 329 break; 330 case STATE_LICENSE: 331 sName = String(WizardResId(STR_STATE_LICENSE)); 332 break; 333 case STATE_MIGRATION: 334 sName = String(WizardResId(STR_STATE_MIGRATION)); 335 break; 336 case STATE_USER: 337 sName = String(WizardResId(STR_STATE_USER)); 338 break; 339 case STATE_UPDATE_CHECK: 340 sName = String(WizardResId(STR_STATE_UPDATE_CHECK)); 341 break; 342 case STATE_REGISTRATION: 343 sName = String(WizardResId(STR_STATE_REGISTRATION)); 344 break; 345 } 346 return sName; 347 } 348 349 sal_Bool FirstStartWizard::prepareLeaveCurrentState( CommitPageReason _eReason ) 350 { 351 // the license acceptance is handled here, because it needs to change the state 352 // of the roadmap wizard which the page implementation does not know. 353 if ( 354 (_eReason == eTravelForward) && 355 (getCurrentState() == STATE_LICENSE ) && 356 (m_bLicenseWasAccepted == sal_False ) 357 ) 358 { 359 if (Migration::checkMigration()) 360 enableState(FirstStartWizard::STATE_MIGRATION, sal_True); 361 if ( showOnlineUpdatePage() ) 362 enableState(FirstStartWizard::STATE_UPDATE_CHECK, sal_True); 363 enableState(FirstStartWizard::STATE_USER, sal_True); 364 enableState(FirstStartWizard::STATE_REGISTRATION, sal_True); 365 366 storeAcceptDate(); 367 m_bLicenseWasAccepted = sal_True; 368 } 369 370 return svt::RoadmapWizard::prepareLeaveCurrentState(_eReason); 371 } 372 373 sal_Bool FirstStartWizard::leaveState(WizardState) 374 { 375 if (( getCurrentState() == STATE_MIGRATION ) && m_bLicenseWasAccepted ) 376 { 377 // Store accept date and patch level now as it has been 378 // overwritten by the migration process! 379 storeAcceptDate(); 380 setPatchLevel(); 381 } 382 383 return sal_True; 384 } 385 386 sal_Bool FirstStartWizard::onFinish() 387 { 388 // return sal_True; 389 if ( svt::RoadmapWizard::onFinish() ) 390 { 391 #ifndef OS2 // cannot enable quickstart on first startup, see shutdownicon.cxx comments. 392 enableQuickstart(); 393 #endif 394 disableWizard(); 395 return sal_True; 396 } 397 else 398 return sal_False; 399 } 400 401 short FirstStartWizard::Execute() 402 { 403 return svt::RoadmapWizard::Execute(); 404 } 405 406 static OUString _makeDateTimeString (const DateTime& aDateTime, sal_Bool bUTC = sal_False) 407 { 408 OStringBuffer aDateTimeString; 409 aDateTimeString.append((sal_Int32)aDateTime.GetYear()); 410 aDateTimeString.append("-"); 411 if (aDateTime.GetMonth()<10) aDateTimeString.append("0"); 412 aDateTimeString.append((sal_Int32)aDateTime.GetMonth()); 413 aDateTimeString.append("-"); 414 if (aDateTime.GetDay()<10) aDateTimeString.append("0"); 415 aDateTimeString.append((sal_Int32)aDateTime.GetDay()); 416 aDateTimeString.append("T"); 417 if (aDateTime.GetHour()<10) aDateTimeString.append("0"); 418 aDateTimeString.append((sal_Int32)aDateTime.GetHour()); 419 aDateTimeString.append(":"); 420 if (aDateTime.GetMin()<10) aDateTimeString.append("0"); 421 aDateTimeString.append((sal_Int32)aDateTime.GetMin()); 422 aDateTimeString.append(":"); 423 if (aDateTime.GetSec()<10) aDateTimeString.append("0"); 424 aDateTimeString.append((sal_Int32)aDateTime.GetSec()); 425 if (bUTC) aDateTimeString.append("Z"); 426 427 return OStringToOUString(aDateTimeString.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); 428 } 429 430 static OUString _getCurrentDateString() 431 { 432 OUString aString; 433 return _makeDateTimeString(DateTime()); 434 } 435 436 437 static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); 438 static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ); 439 static const OUString sReadSrvc ( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" ) ); 440 441 void FirstStartWizard::storeAcceptDate() 442 { 443 444 try { 445 Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); 446 // get configuration provider 447 Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( 448 xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); 449 Sequence< Any > theArgs(1); 450 NamedValue v(OUString::createFromAscii("NodePath"), 451 makeAny(OUString::createFromAscii("org.openoffice.Setup/Office"))); 452 theArgs[0] <<= v; 453 Reference< XPropertySet > pset = Reference< XPropertySet >( 454 theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); 455 Any result = pset->getPropertyValue(OUString::createFromAscii("LicenseAcceptDate")); 456 457 OUString aAcceptDate = _getCurrentDateString(); 458 pset->setPropertyValue(OUString::createFromAscii("LicenseAcceptDate"), makeAny(aAcceptDate)); 459 Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges(); 460 461 // since the license is accepted the local user registry can be cleaned if required 462 cleanOldOfficeRegKeys(); 463 } catch (const Exception&) 464 { 465 } 466 467 } 468 469 void FirstStartWizard::setPatchLevel() 470 { 471 try { 472 Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); 473 // get configuration provider 474 Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( 475 xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); 476 Sequence< Any > theArgs(1); 477 NamedValue v(OUString::createFromAscii("NodePath"), 478 makeAny(OUString::createFromAscii("org.openoffice.Office.Common/Help/Registration"))); 479 theArgs[0] <<= v; 480 Reference< XPropertySet > pset = Reference< XPropertySet >( 481 theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); 482 Any result = pset->getPropertyValue(OUString::createFromAscii("ReminderDate")); 483 484 OUString aPatchLevel( RTL_CONSTASCII_USTRINGPARAM( "Patch" )); 485 aPatchLevel += OUString::valueOf( getBuildId(), 10 ); 486 pset->setPropertyValue(OUString::createFromAscii("ReminderDate"), makeAny(aPatchLevel)); 487 Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges(); 488 } catch (const Exception&) 489 { 490 } 491 } 492 493 #ifdef WNT 494 typedef int ( __stdcall * CleanCurUserRegProc ) ( wchar_t* ); 495 #endif 496 497 void FirstStartWizard::cleanOldOfficeRegKeys() 498 { 499 #ifdef WNT 500 // after the wizard is completed clean OOo1.1.x entries in the current user registry if required 501 // issue i47658 502 503 OUString aBaseLocationPath; 504 OUString aSharedLocationPath; 505 OUString aInstallMode; 506 507 ::utl::Bootstrap::PathStatus aBaseLocateResult = 508 ::utl::Bootstrap::locateBaseInstallation( aBaseLocationPath ); 509 ::utl::Bootstrap::PathStatus aSharedLocateResult = 510 ::utl::Bootstrap::locateSharedData( aSharedLocationPath ); 511 aInstallMode = ::utl::Bootstrap::getAllUsersValue( ::rtl::OUString() ); 512 513 // TODO: replace the checking for install mode 514 if ( aBaseLocateResult == ::utl::Bootstrap::PATH_EXISTS && aSharedLocateResult == ::utl::Bootstrap::PATH_EXISTS 515 && aInstallMode.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "1" ) ) ) ) 516 { 517 ::rtl::OUString aDeregCompletePath = 518 aBaseLocationPath + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/program/regcleanold.dll" ) ); 519 ::rtl::OUString aExecCompletePath = 520 aSharedLocationPath + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/regdeinstall/userdeinst.exe" ) ); 521 522 osl::Module aCleanModule( aDeregCompletePath ); 523 CleanCurUserRegProc pNativeProc = ( CleanCurUserRegProc )( 524 aCleanModule.getFunctionSymbol( 525 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CleanCurUserOldSystemRegistry" ) ) ) ); 526 527 if( pNativeProc!=NULL ) 528 { 529 ::rtl::OUString aExecCompleteSysPath; 530 if ( osl::File::getSystemPathFromFileURL( aExecCompletePath, aExecCompleteSysPath ) == FileBase::E_None 531 && aExecCompleteSysPath.getLength() ) 532 { 533 ( *pNativeProc )( (wchar_t*)( aExecCompleteSysPath.getStr() ) ); 534 } 535 } 536 } 537 #endif 538 } 539 540 void FirstStartWizard::disableWizard() 541 { 542 543 try { 544 Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); 545 // get configuration provider 546 Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( 547 xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); 548 Sequence< Any > theArgs(1); 549 NamedValue v(OUString::createFromAscii("NodePath"), 550 makeAny(OUString::createFromAscii("org.openoffice.Setup/Office"))); 551 theArgs[0] <<= v; 552 Reference< XPropertySet > pset = Reference< XPropertySet >( 553 theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); 554 pset->setPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted"), makeAny(sal_True)); 555 Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges(); 556 } catch (const Exception&) 557 { 558 } 559 560 } 561 562 563 void FirstStartWizard::enableQuickstart() 564 { 565 sal_Bool bQuickstart( sal_True ); 566 sal_Bool bAutostart( sal_True ); 567 Sequence< Any > aSeq( 2 ); 568 aSeq[0] <<= bQuickstart; 569 aSeq[1] <<= bAutostart; 570 571 Reference < XInitialization > xQuickstart( ::comphelper::getProcessServiceFactory()->createInstance( 572 OUString::createFromAscii( "com.sun.star.office.Quickstart" )),UNO_QUERY ); 573 if ( xQuickstart.is() ) 574 xQuickstart->initialize( aSeq ); 575 576 } 577 578 sal_Bool FirstStartWizard::showOnlineUpdatePage() 579 { 580 try { 581 Reference < XNameReplace > xUpdateAccess; 582 Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); 583 584 xUpdateAccess = Reference < XNameReplace >( 585 xFactory->createInstance( UNISTRING( "com.sun.star.setup.UpdateCheckConfig" ) ), UNO_QUERY_THROW ); 586 587 if ( xUpdateAccess.is() ) 588 { 589 sal_Bool bAutoUpdChk = sal_False; 590 Any result = xUpdateAccess->getByName( UNISTRING( "AutoCheckEnabled" ) ); 591 result >>= bAutoUpdChk; 592 if ( bAutoUpdChk == sal_False ) 593 return sal_True; 594 else 595 return sal_False; 596 } 597 } catch (const Exception&) 598 { 599 } 600 return sal_False; 601 } 602 603 } 604