update dev300-m57
[ooovba.git] / desktop / source / migration / pages.cxx
blob9063da001b014050d3f9f50c96349d886587e4b5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pages.cxx,v $
10 * $Revision: 1.23 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_desktop.hxx"
34 #include "pages.hxx"
35 #include "wizard.hrc"
36 #include "wizard.hxx"
37 #include "migration.hxx"
38 #include <vcl/msgbox.hxx>
39 #include <vcl/mnemonic.hxx>
40 #include <app.hxx>
41 #include <rtl/ustring.hxx>
42 #include <osl/file.hxx>
43 #include <unotools/bootstrap.hxx>
44 #include <unotools/configmgr.hxx>
45 #include <svtools/regoptions.hxx>
46 #include <svtools/useroptions.hxx>
47 #include <sfx2/basedlgs.hxx>
48 #include <comphelper/processfactory.hxx>
49 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
50 #include <com/sun/star/lang/XInitialization.hpp>
51 #include <com/sun/star/frame/XDesktop.hpp>
52 #include <com/sun/star/beans/XMaterialHolder.hpp>
53 #include <com/sun/star/beans/NamedValue.hpp>
54 #include <com/sun/star/container/XNameReplace.hpp>
55 #include <com/sun/star/task/XJobExecutor.hpp>
56 #include <comphelper/configurationhelper.hxx>
57 #include <rtl/bootstrap.hxx>
58 #include <rtl/ustrbuf.hxx>
59 #include <osl/file.hxx>
60 #include <unotools/bootstrap.hxx>
61 #include <tools/config.hxx>
64 using namespace rtl;
65 using namespace osl;
66 using namespace utl;
67 using namespace svt;
68 using namespace com::sun::star::frame;
69 using namespace com::sun::star::lang;
70 using namespace com::sun::star::util;
71 using namespace com::sun::star::beans;
72 using namespace com::sun::star::uno;
73 using namespace com::sun::star::container;
75 #define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s))
77 namespace desktop {
79 static void _setBold(FixedText& ft)
81 Font f = ft.GetControlFont();
82 f.SetWeight(WEIGHT_BOLD);
83 ft.SetControlFont(f);
86 WelcomePage::WelcomePage( svt::OWizardMachine* parent, const ResId& resid, sal_Bool bLicenseNeedsAcceptance )
87 : OWizardPage(parent, resid)
88 , m_ftHead(this, WizardResId(FT_WELCOME_HEADER))
89 , m_ftBody(this, WizardResId(FT_WELCOME_BODY))
90 , m_pParent(parent)
91 , m_bLicenseNeedsAcceptance( bLicenseNeedsAcceptance )
92 , bIsEvalVersion(false)
93 , bNoEvalText(false)
95 FreeResource();
97 _setBold(m_ftHead);
99 checkEval();
100 // we need to choose the welcome text that is diplayed
101 // choices are the default text, default text+migradtion,
102 // OEM and extended OEM
103 switch (checkOEM())
105 case OEM_NONE:
106 // check for migration
107 if (Migration::checkMigration())
109 String aText(WizardResId(STR_WELCOME_MIGRATION));
110 // replace %OLDPRODUCT with found version name
111 aText.SearchAndReplaceAll( UniString::CreateFromAscii("%OLD_VERSION"), Migration::getOldVersionName());
112 m_ftBody.SetText( aText );
114 else
115 if (bIsEvalVersion && (! bNoEvalText))
117 String aText(WizardResId(STR_WELCOME_EVAL));
118 aText.SearchAndReplaceAll( UniString::CreateFromAscii("%EVALDAYS"), UniString::CreateFromAscii("90"));
119 m_ftBody.SetText( aText );
121 else
122 if ( ! m_bLicenseNeedsAcceptance )
124 String aText(WizardResId(STR_WELCOME_WITHOUT_LICENSE));
125 m_ftBody.SetText( aText );
127 break;
128 case OEM_NORMAL:
129 m_ftBody.SetText(String(WizardResId(STR_WELCOME_OEM)));
130 break;
131 case OEM_EXTENDED:
132 m_ftBody.SetText(String(WizardResId(STR_WELCOME_OEM_EXT)));
133 break;
139 void WelcomePage::checkEval()
141 Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
142 Reference< XMaterialHolder > xHolder(xFactory->createInstance(
143 OUString::createFromAscii("com.sun.star.tab.tabreg")), UNO_QUERY);
144 if (xHolder.is()) {
145 Any aData = xHolder->getMaterial();
146 Sequence < NamedValue > aSeq;
147 if (aData >>= aSeq) {
148 bIsEvalVersion = true;
149 for (int i=0; i< aSeq.getLength(); i++) {
150 if (aSeq[i].Name.equalsAscii("NoEvalText")) {
151 aSeq[i].Value >>= bNoEvalText;
159 void WelcomePage::ActivatePage()
161 OWizardPage::ActivatePage();
162 // this page has no controls, so forwarding to default
163 // button (next) won't work if we grap focus
164 // GrabFocus();
167 LicensePage::LicensePage( svt::OWizardMachine* parent, const ResId& resid, const rtl::OUString &rLicensePath )
168 : OWizardPage(parent, resid)
169 , m_pParent(parent)
170 , m_ftHead(this, WizardResId(FT_LICENSE_HEADER))
171 , m_ftBody1(this, WizardResId(FT_LICENSE_BODY_1))
172 , m_ftBody1Txt(this, WizardResId(FT_LICENSE_BODY_1_TXT))
173 , m_ftBody2(this, WizardResId(FT_LICENSE_BODY_2))
174 , m_ftBody2Txt(this, WizardResId(FT_LICENSE_BODY_2_TXT))
175 , m_mlLicense(this, WizardResId(ML_LICENSE))
176 , m_pbDown(this, WizardResId(PB_LICENSE_DOWN))
177 , m_bLicenseRead(sal_False)
179 FreeResource();
181 _setBold(m_ftHead);
183 m_mlLicense.SetEndReachedHdl( LINK(this, LicensePage, EndReachedHdl) );
184 m_mlLicense.SetScrolledHdl( LINK(this, LicensePage, ScrolledHdl) );
185 m_pbDown.SetClickHdl( LINK(this, LicensePage, PageDownHdl) );
187 // We want a automatic repeating page down button
188 WinBits aStyle = m_pbDown.GetStyle();
189 aStyle |= WB_REPEAT;
190 m_pbDown.SetStyle( aStyle );
192 // replace %PAGEDOWN in text2 with button text
193 String aText = m_ftBody1Txt.GetText();
194 aText.SearchAndReplaceAll( UniString::CreateFromAscii("%PAGEDOWN"),
195 MnemonicGenerator::EraseAllMnemonicChars(m_pbDown.GetText()));
197 m_ftBody1Txt.SetText( aText );
199 // load license text
200 File aLicenseFile(rLicensePath);
201 if ( aLicenseFile.open(OpenFlag_Read) == FileBase::E_None)
203 DirectoryItem d;
204 DirectoryItem::get(rLicensePath, d);
205 FileStatus fs(FileStatusMask_FileSize);
206 d.getFileStatus(fs);
207 sal_uInt64 nBytesRead = 0;
208 sal_uInt64 nPosition = 0;
209 sal_uInt32 nBytes = (sal_uInt32)fs.getFileSize();
210 sal_Char *pBuffer = new sal_Char[nBytes];
211 // FileBase RC r = FileBase::E_None;
212 while (aLicenseFile.read(pBuffer+nPosition, nBytes-nPosition, nBytesRead) == FileBase::E_None
213 && nPosition + nBytesRead < nBytes)
215 nPosition += nBytesRead;
217 OUString aLicenseString(pBuffer, nBytes, RTL_TEXTENCODING_UTF8,
218 OSTRING_TO_OUSTRING_CVTFLAGS | RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE);
219 delete[] pBuffer;
220 m_mlLicense.SetText(aLicenseString);
225 void LicensePage::ActivatePage()
227 OWizardPage::ActivatePage();
228 m_bLicenseRead = m_mlLicense.IsEndReached();
229 m_pbDown.GrabFocus();
230 updateDialogTravelUI();
233 bool LicensePage::canAdvance() const
235 if (m_mlLicense.IsEndReached())
236 const_cast< LicensePage* >( this )->m_pbDown.Disable();
237 else
238 const_cast< LicensePage* >( this )->m_pbDown.Enable();
240 return m_bLicenseRead;
243 IMPL_LINK( LicensePage, PageDownHdl, PushButton *, EMPTYARG )
245 m_mlLicense.ScrollDown( SCROLL_PAGEDOWN );
246 return 0;
249 IMPL_LINK( LicensePage, EndReachedHdl, LicenseView *, EMPTYARG )
251 m_bLicenseRead = TRUE;
252 updateDialogTravelUI();
253 return 0;
256 IMPL_LINK( LicensePage, ScrolledHdl, LicenseView *, EMPTYARG )
258 updateDialogTravelUI();
259 return 0;
263 LicenseView::LicenseView( Window* pParent, const ResId& rResId )
264 : MultiLineEdit( pParent, rResId )
266 SetLeftMargin( 5 );
267 mbEndReached = IsEndReached();
268 StartListening( *GetTextEngine() );
271 LicenseView::~LicenseView()
273 maEndReachedHdl = Link();
274 maScrolledHdl = Link();
275 EndListeningAll();
278 void LicenseView::ScrollDown( ScrollType eScroll )
280 ScrollBar* pScroll = GetVScrollBar();
281 if ( pScroll )
282 pScroll->DoScrollAction( eScroll );
285 BOOL LicenseView::IsEndReached() const
287 BOOL bEndReached;
289 ExtTextView* pView = GetTextView();
290 ExtTextEngine* pEdit = GetTextEngine();
291 ULONG nHeight = pEdit->GetTextHeight();
292 Size aOutSize = pView->GetWindow()->GetOutputSizePixel();
293 Point aBottom( 0, aOutSize.Height() );
295 if ( (ULONG) pView->GetDocPos( aBottom ).Y() >= nHeight - 1 )
296 bEndReached = TRUE;
297 else
298 bEndReached = FALSE;
300 return bEndReached;
303 void LicenseView::Notify( SfxBroadcaster&, const SfxHint& rHint )
305 if ( rHint.IsA( TYPE(TextHint) ) )
307 BOOL bLastVal = EndReached();
308 ULONG nId = ((const TextHint&)rHint).GetId();
310 if ( nId == TEXT_HINT_PARAINSERTED )
312 if ( bLastVal )
313 mbEndReached = IsEndReached();
315 else if ( nId == TEXT_HINT_VIEWSCROLLED )
317 if ( ! mbEndReached )
318 mbEndReached = IsEndReached();
319 maScrolledHdl.Call( this );
322 if ( EndReached() && !bLastVal )
324 maEndReachedHdl.Call( this );
331 // -------------------------------------------------------------------
333 MigrationPage::MigrationPage( svt::OWizardMachine* parent, const ResId& resid)
334 : OWizardPage(parent, resid)
335 , m_ftHead(this, WizardResId(FT_MIGRATION_HEADER))
336 , m_ftBody(this, WizardResId(FT_MIGRATION_BODY))
337 , m_cbMigration(this, WizardResId(CB_MIGRATION))
338 , m_bMigrationDone(sal_False)
340 FreeResource();
341 _setBold(m_ftHead);
343 // replace %OLDPRODUCT with found version name
344 String aText = m_ftBody.GetText();
345 aText.SearchAndReplaceAll( UniString::CreateFromAscii("%OLDPRODUCT"), Migration::getOldVersionName());
346 m_ftBody.SetText( aText );
349 sal_Bool MigrationPage::commitPage( CommitPageReason _eReason )
351 if (_eReason == eTravelForward && m_cbMigration.IsChecked() && !m_bMigrationDone)
353 EnterWait();
354 Migration::doMigration();
355 LeaveWait();
356 m_bMigrationDone = sal_True;
358 else
359 Migration::cancelMigration();
360 return sal_True;
363 void MigrationPage::ActivatePage()
365 OWizardPage::ActivatePage();
366 GrabFocus();
369 UserPage::UserPage( svt::OWizardMachine* parent, const ResId& resid)
370 : OWizardPage(parent, resid)
371 , m_ftHead(this, WizardResId(FT_USER_HEADER))
372 , m_ftBody(this, WizardResId(FT_USER_BODY))
373 , m_ftFirst(this, WizardResId(FT_USER_FIRST))
374 , m_edFirst(this, WizardResId(ED_USER_FIRST))
375 , m_ftLast(this, WizardResId(FT_USER_LAST))
376 , m_edLast(this, WizardResId(ED_USER_LAST))
377 , m_ftInitials(this, WizardResId(FT_USER_INITIALS))
378 , m_edInitials(this, WizardResId(ED_USER_INITIALS))
379 , m_ftFather(this, WizardResId(FT_USER_FATHER))
380 , m_edFather(this, WizardResId(ED_USER_FATHER))
381 , m_lang(Application::GetSettings().GetUILanguage())
383 FreeResource();
384 _setBold(m_ftHead);
386 // check whether this is a russian version. otherwise
387 // we'll hide the 'Fathers name' field
388 SvtUserOptions aUserOpt;
389 m_edFirst.SetText(aUserOpt.GetFirstName());
390 m_edLast.SetText(aUserOpt.GetLastName());
391 m_edInitials.SetText(aUserOpt.GetID());
392 if (m_lang == LANGUAGE_RUSSIAN)
394 m_ftFather.Show();
395 m_edFather.Show();
396 m_edFather.SetText(aUserOpt.GetFathersName());
400 sal_Bool UserPage::commitPage( CommitPageReason )
402 SvtUserOptions aUserOpt;
403 aUserOpt.SetFirstName(m_edFirst.GetText());
404 aUserOpt.SetLastName(m_edLast.GetText());
405 aUserOpt.SetID( m_edInitials.GetText());
406 if (m_lang == LANGUAGE_RUSSIAN)
407 aUserOpt.SetFathersName(m_edFather.GetText());
409 return sal_True;
412 void UserPage::ActivatePage()
414 OWizardPage::ActivatePage();
415 GrabFocus();
418 // -------------------------------------------------------------------
419 UpdateCheckPage::UpdateCheckPage( svt::OWizardMachine* parent, const ResId& resid)
420 : OWizardPage(parent, resid)
421 , m_ftHead(this, WizardResId(FT_UPDATE_CHECK_HEADER))
422 , m_ftBody(this, WizardResId(FT_UPDATE_CHECK_BODY))
423 , m_cbUpdateCheck(this, WizardResId(CB_UPDATE_CHECK))
425 FreeResource();
426 _setBold(m_ftHead);
429 sal_Bool UpdateCheckPage::commitPage( CommitPageReason _eReason )
431 if ( _eReason == eTravelForward )
433 try {
434 Reference < XNameReplace > xUpdateAccess;
435 Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
437 xUpdateAccess = Reference < XNameReplace >(
438 xFactory->createInstance( UNISTRING( "com.sun.star.setup.UpdateCheckConfig" ) ), UNO_QUERY_THROW );
440 if ( !xUpdateAccess.is() )
441 return sal_False;
443 sal_Bool bAutoUpdChk = m_cbUpdateCheck.IsChecked();
444 xUpdateAccess->replaceByName( UNISTRING("AutoCheckEnabled"), makeAny( bAutoUpdChk ) );
446 Reference< XChangesBatch > xChangesBatch( xUpdateAccess, UNO_QUERY);
447 if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() )
448 xChangesBatch->commitChanges();
449 } catch (RuntimeException)
454 return sal_True;
457 void UpdateCheckPage::ActivatePage()
459 OWizardPage::ActivatePage();
460 GrabFocus();
463 // -------------------------------------------------------------------
464 RegistrationPage::RegistrationPage( Window* pParent, const ResId& rResid )
465 : OWizardPage( pParent, rResid )
466 , m_ftHeader(this, WizardResId(FT_REGISTRATION_HEADER))
467 , m_ftBody(this, WizardResId(FT_REGISTRATION_BODY))
468 , m_rbNow(this, WizardResId(RB_REGISTRATION_NOW))
469 , m_rbLater(this, WizardResId(RB_REGISTRATION_LATER))
470 , m_rbNever(this, WizardResId(RB_REGISTRATION_NEVER))
471 , m_flSeparator(this, WizardResId(FL_REGISTRATION))
472 , m_ftEnd(this, WizardResId(FT_REGISTRATION_END))
473 , m_bNeverVisible( sal_True )
475 FreeResource();
477 // another text for OOo
478 sal_Int32 nOpenSourceContext = 0;
481 ::utl::ConfigManager::GetDirectConfigProperty(
482 ::utl::ConfigManager::OPENSOURCECONTEXT ) >>= nOpenSourceContext;
484 catch( Exception& )
486 DBG_ERRORFILE( "RegistrationPage::RegistrationPage(): error while getting open source context" );
489 if ( nOpenSourceContext > 0 )
491 String sBodyText( WizardResId( STR_REGISTRATION_OOO ) );
492 m_ftBody.SetText( sBodyText );
495 // calculate height of body text and rearrange the buttons
496 Size aSize = m_ftBody.GetSizePixel();
497 Size aMinSize = m_ftBody.CalcMinimumSize( aSize.Width() );
498 long nTxtH = aMinSize.Height();
499 long nCtrlH = aSize.Height();
500 long nDelta = ( nCtrlH - nTxtH );
501 aSize.Height() -= nDelta;
502 m_ftBody.SetSizePixel( aSize );
503 Window* pWins[] = { &m_rbNow, &m_rbLater, &m_rbNever };
504 Window** pCurrent = pWins;
505 for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
507 Point aNewPos = (*pCurrent)->GetPosPixel();
508 aNewPos.Y() -= nDelta;
509 (*pCurrent)->SetPosPixel( aNewPos );
512 _setBold(m_ftHeader);
513 impl_retrieveConfigurationData();
514 updateButtonStates();
517 bool RegistrationPage::canAdvance() const
519 return false;
522 void RegistrationPage::ActivatePage()
524 OWizardPage::ActivatePage();
525 GrabFocus();
528 void RegistrationPage::impl_retrieveConfigurationData()
530 static ::rtl::OUString PACKAGE = ::rtl::OUString::createFromAscii("org.openoffice.FirstStartWizard");
531 static ::rtl::OUString PATH = ::rtl::OUString::createFromAscii("TabPages/Registration/RegistrationOptions/NeverButton");
532 static ::rtl::OUString KEY = ::rtl::OUString::createFromAscii("Visible");
534 ::com::sun::star::uno::Any aValue;
537 aValue = ::comphelper::ConfigurationHelper::readDirectKey(
538 ::comphelper::getProcessServiceFactory(),
539 PACKAGE,
540 PATH,
541 KEY,
542 ::comphelper::ConfigurationHelper::E_READONLY);
544 catch(const ::com::sun::star::uno::Exception&)
545 { aValue.clear(); }
547 aValue >>= m_bNeverVisible;
550 void RegistrationPage::updateButtonStates()
552 m_rbNever.Show( m_bNeverVisible );
555 sal_Bool RegistrationPage::commitPage( CommitPageReason _eReason )
557 if ( _eReason == eFinish )
559 ::svt::RegOptions aOptions;
560 rtl::OUString aEvent;
562 if ( m_rbNow.IsChecked())
564 aEvent = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RegistrationRequired" ) );
566 else if (m_rbLater.IsChecked())
568 aOptions.activateReminder(7);
569 // avtivate a reminder job...
571 // aOptions.markSessionDone();
575 // create the Desktop component which can load components
576 Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
577 if( xFactory.is() )
579 Reference< com::sun::star::task::XJobExecutor > xProductRegistration(
580 xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.setup.ProductRegistration" ) ) ),
581 UNO_QUERY_THROW );
583 // tell it that the user wants to register
584 xProductRegistration->trigger( aEvent );
587 catch( const Exception& )
591 return sal_True;
594 RegistrationPage::RegistrationMode RegistrationPage::getRegistrationMode() const
596 RegistrationPage::RegistrationMode eMode = rmNow;
597 if ( m_rbLater.IsChecked() )
598 eMode = rmLater;
599 else if ( m_rbNever.IsChecked() )
600 eMode = rmNever;
601 return eMode;
604 void RegistrationPage::prepareSingleMode()
606 // remove wizard text (hide and cut)
607 m_flSeparator.Hide();
608 m_ftEnd.Hide();
609 Size aNewSize = GetSizePixel();
610 aNewSize.Height() -= ( aNewSize.Height() - m_flSeparator.GetPosPixel().Y() );
611 SetSizePixel( aNewSize );
614 bool RegistrationPage::hasReminderDateCome()
616 return ::svt::RegOptions().hasReminderDateCome();
619 void RegistrationPage::executeSingleMode()
621 // opens the page in a single tabdialog
622 SfxSingleTabDialog aSingleDlg( NULL, TP_REGISTRATION );
623 RegistrationPage* pPage = new RegistrationPage( &aSingleDlg, WizardResId( TP_REGISTRATION ) );
624 pPage->prepareSingleMode();
625 aSingleDlg.SetPage( pPage );
626 aSingleDlg.SetText( pPage->getSingleModeTitle() );
627 aSingleDlg.Execute();
628 // the registration modes "Now" and "Later" are handled by the page
629 RegistrationPage::RegistrationMode eMode = pPage->getRegistrationMode();
630 if ( eMode == RegistrationPage::rmNow || eMode == RegistrationPage::rmLater )
631 pPage->commitPage( IWizardPage::eFinish );
632 if ( eMode != RegistrationPage::rmLater )
633 ::svt::RegOptions().removeReminder();
636 // -----------------------------------------------------------------------
638 static char const OEM_PRELOAD_SECTION[] = "Bootstrap";
639 static char const OEM_PRELOAD[] = "Preload";
640 static char const STR_TRUE[] = "1";
641 static char const STR_FALSE[] = "0";
643 static sal_Bool existsURL( OUString const& _sURL )
645 using namespace osl;
646 DirectoryItem aDirItem;
648 if (_sURL.getLength() != 0)
649 return ( DirectoryItem::get( _sURL, aDirItem ) == DirectoryItem::E_None );
651 return sal_False;
655 // locate soffice.ini/.rc file
656 static OUString locateIniFile()
658 OUString aUserDataPath;
659 OUString aSofficeIniFileURL;
661 // Retrieve the default file URL for the soffice.ini/rc
662 rtl::Bootstrap().getIniName( aSofficeIniFileURL );
664 if ( utl::Bootstrap::locateUserData( aUserDataPath ) == utl::Bootstrap::PATH_EXISTS )
666 const char CONFIG_DIR[] = "/config";
668 sal_Int32 nIndex = aSofficeIniFileURL.lastIndexOf( '/');
669 if ( nIndex > 0 )
671 OUString aUserSofficeIniFileURL;
672 OUStringBuffer aBuffer( aUserDataPath );
673 aBuffer.appendAscii( CONFIG_DIR );
674 aBuffer.append( aSofficeIniFileURL.copy( nIndex ));
675 aUserSofficeIniFileURL = aBuffer.makeStringAndClear();
677 if ( existsURL( aUserSofficeIniFileURL ))
678 return aUserSofficeIniFileURL;
681 // Fallback try to use the soffice.ini/rc from program folder
682 return aSofficeIniFileURL;
685 // check whether the OEMPreload flag was set in soffice.ini/.rc
686 static sal_Int32 checkOEMPreloadFlag()
688 OUString aSofficeIniFileURL;
689 aSofficeIniFileURL = locateIniFile();
690 Config aConfig(aSofficeIniFileURL);
691 aConfig.SetGroup( OEM_PRELOAD_SECTION );
692 ByteString sResult = aConfig.ReadKey( OEM_PRELOAD );
693 return sResult.ToInt32();
695 if ( sResult == STR_TRUE )
696 return sal_True;
697 else
698 return sal_False;
702 WelcomePage::OEMType WelcomePage::checkOEM()
704 sal_Int32 oemResult = checkOEMPreloadFlag();
705 switch (oemResult) {
706 case 1:
707 return OEM_NORMAL;
708 case 2:
709 return OEM_EXTENDED;
710 default:
711 return OEM_NONE;
715 } // namespace desktop