Update ooo320-m1
[ooovba.git] / desktop / source / migration / pages.cxx
blobb430e235c033f3b3d0918d7f4de7eeb83910a334
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 <vos/security.hxx>
41 #include <app.hxx>
42 #include <rtl/ustring.hxx>
43 #include <osl/file.hxx>
44 #include <unotools/bootstrap.hxx>
45 #include <unotools/configmgr.hxx>
46 #include <svtools/regoptions.hxx>
47 #include <svtools/useroptions.hxx>
48 #include <sfx2/basedlgs.hxx>
49 #include <comphelper/processfactory.hxx>
50 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
51 #include <com/sun/star/lang/XInitialization.hpp>
52 #include <com/sun/star/frame/XDesktop.hpp>
53 #include <com/sun/star/beans/XMaterialHolder.hpp>
54 #include <com/sun/star/beans/NamedValue.hpp>
55 #include <com/sun/star/container/XNameReplace.hpp>
56 #include <com/sun/star/task/XJobExecutor.hpp>
57 #include <comphelper/configurationhelper.hxx>
58 #include <rtl/bootstrap.hxx>
59 #include <rtl/ustrbuf.hxx>
60 #include <osl/file.hxx>
61 #include <unotools/bootstrap.hxx>
62 #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 // No OEM is built, remove the check
104 // switch (checkOEM())
105 // {
106 // case OEM_NONE:
107 // check for migration
108 if (Migration::checkMigration())
110 String aText(WizardResId(STR_WELCOME_MIGRATION));
111 // replace %OLDPRODUCT with found version name
112 aText.SearchAndReplaceAll( UniString::CreateFromAscii("%OLD_VERSION"), Migration::getOldVersionName());
113 m_ftBody.SetText( aText );
115 else
116 if ( ! m_bLicenseNeedsAcceptance )
118 String aText(WizardResId(STR_WELCOME_WITHOUT_LICENSE));
119 m_ftBody.SetText( aText );
124 void WelcomePage::checkEval()
126 Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
127 Reference< XMaterialHolder > xHolder(xFactory->createInstance(
128 OUString::createFromAscii("com.sun.star.tab.tabreg")), UNO_QUERY);
129 if (xHolder.is()) {
130 Any aData = xHolder->getMaterial();
131 Sequence < NamedValue > aSeq;
132 if (aData >>= aSeq) {
133 bIsEvalVersion = true;
134 for (int i=0; i< aSeq.getLength(); i++) {
135 if (aSeq[i].Name.equalsAscii("NoEvalText")) {
136 aSeq[i].Value >>= bNoEvalText;
144 void WelcomePage::ActivatePage()
146 OWizardPage::ActivatePage();
147 // this page has no controls, so forwarding to default
148 // button (next) won't work if we grap focus
149 // GrabFocus();
152 LicensePage::LicensePage( svt::OWizardMachine* parent, const ResId& resid, const rtl::OUString &rLicensePath )
153 : OWizardPage(parent, resid)
154 , m_pParent(parent)
155 , m_ftHead(this, WizardResId(FT_LICENSE_HEADER))
156 , m_ftBody1(this, WizardResId(FT_LICENSE_BODY_1))
157 , m_ftBody1Txt(this, WizardResId(FT_LICENSE_BODY_1_TXT))
158 , m_ftBody2(this, WizardResId(FT_LICENSE_BODY_2))
159 , m_ftBody2Txt(this, WizardResId(FT_LICENSE_BODY_2_TXT))
160 , m_mlLicense(this, WizardResId(ML_LICENSE))
161 , m_pbDown(this, WizardResId(PB_LICENSE_DOWN))
162 , m_bLicenseRead(sal_False)
164 FreeResource();
166 _setBold(m_ftHead);
168 m_mlLicense.SetEndReachedHdl( LINK(this, LicensePage, EndReachedHdl) );
169 m_mlLicense.SetScrolledHdl( LINK(this, LicensePage, ScrolledHdl) );
170 m_pbDown.SetClickHdl( LINK(this, LicensePage, PageDownHdl) );
172 // We want a automatic repeating page down button
173 WinBits aStyle = m_pbDown.GetStyle();
174 aStyle |= WB_REPEAT;
175 m_pbDown.SetStyle( aStyle );
177 // replace %PAGEDOWN in text2 with button text
178 String aText = m_ftBody1Txt.GetText();
179 aText.SearchAndReplaceAll( UniString::CreateFromAscii("%PAGEDOWN"),
180 MnemonicGenerator::EraseAllMnemonicChars(m_pbDown.GetText()));
182 m_ftBody1Txt.SetText( aText );
184 // load license text
185 File aLicenseFile(rLicensePath);
186 if ( aLicenseFile.open(OpenFlag_Read) == FileBase::E_None)
188 DirectoryItem d;
189 DirectoryItem::get(rLicensePath, d);
190 FileStatus fs(FileStatusMask_FileSize);
191 d.getFileStatus(fs);
192 sal_uInt64 nBytesRead = 0;
193 sal_uInt64 nPosition = 0;
194 sal_uInt32 nBytes = (sal_uInt32)fs.getFileSize();
195 sal_Char *pBuffer = new sal_Char[nBytes];
196 // FileBase RC r = FileBase::E_None;
197 while (aLicenseFile.read(pBuffer+nPosition, nBytes-nPosition, nBytesRead) == FileBase::E_None
198 && nPosition + nBytesRead < nBytes)
200 nPosition += nBytesRead;
202 OUString aLicenseString(pBuffer, nBytes, RTL_TEXTENCODING_UTF8,
203 OSTRING_TO_OUSTRING_CVTFLAGS | RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE);
204 delete[] pBuffer;
205 m_mlLicense.SetText(aLicenseString);
210 void LicensePage::ActivatePage()
212 OWizardPage::ActivatePage();
213 m_bLicenseRead = m_mlLicense.IsEndReached();
214 m_pbDown.GrabFocus();
215 updateDialogTravelUI();
218 bool LicensePage::canAdvance() const
220 if (m_mlLicense.IsEndReached())
221 const_cast< LicensePage* >( this )->m_pbDown.Disable();
222 else
223 const_cast< LicensePage* >( this )->m_pbDown.Enable();
225 return m_bLicenseRead;
228 IMPL_LINK( LicensePage, PageDownHdl, PushButton *, EMPTYARG )
230 m_mlLicense.ScrollDown( SCROLL_PAGEDOWN );
231 return 0;
234 IMPL_LINK( LicensePage, EndReachedHdl, LicenseView *, EMPTYARG )
236 m_bLicenseRead = TRUE;
237 updateDialogTravelUI();
238 return 0;
241 IMPL_LINK( LicensePage, ScrolledHdl, LicenseView *, EMPTYARG )
243 updateDialogTravelUI();
244 return 0;
248 LicenseView::LicenseView( Window* pParent, const ResId& rResId )
249 : MultiLineEdit( pParent, rResId )
251 SetLeftMargin( 5 );
252 mbEndReached = IsEndReached();
253 StartListening( *GetTextEngine() );
256 LicenseView::~LicenseView()
258 maEndReachedHdl = Link();
259 maScrolledHdl = Link();
260 EndListeningAll();
263 void LicenseView::ScrollDown( ScrollType eScroll )
265 ScrollBar* pScroll = GetVScrollBar();
266 if ( pScroll )
267 pScroll->DoScrollAction( eScroll );
270 BOOL LicenseView::IsEndReached() const
272 BOOL bEndReached;
274 ExtTextView* pView = GetTextView();
275 ExtTextEngine* pEdit = GetTextEngine();
276 ULONG nHeight = pEdit->GetTextHeight();
277 Size aOutSize = pView->GetWindow()->GetOutputSizePixel();
278 Point aBottom( 0, aOutSize.Height() );
280 if ( (ULONG) pView->GetDocPos( aBottom ).Y() >= nHeight - 1 )
281 bEndReached = TRUE;
282 else
283 bEndReached = FALSE;
285 return bEndReached;
288 void LicenseView::Notify( SfxBroadcaster&, const SfxHint& rHint )
290 if ( rHint.IsA( TYPE(TextHint) ) )
292 BOOL bLastVal = EndReached();
293 ULONG nId = ((const TextHint&)rHint).GetId();
295 if ( nId == TEXT_HINT_PARAINSERTED )
297 if ( bLastVal )
298 mbEndReached = IsEndReached();
300 else if ( nId == TEXT_HINT_VIEWSCROLLED )
302 if ( ! mbEndReached )
303 mbEndReached = IsEndReached();
304 maScrolledHdl.Call( this );
307 if ( EndReached() && !bLastVal )
309 maEndReachedHdl.Call( this );
316 // -------------------------------------------------------------------
318 MigrationPage::MigrationPage( svt::OWizardMachine* parent, const ResId& resid)
319 : OWizardPage(parent, resid)
320 , m_ftHead(this, WizardResId(FT_MIGRATION_HEADER))
321 , m_ftBody(this, WizardResId(FT_MIGRATION_BODY))
322 , m_cbMigration(this, WizardResId(CB_MIGRATION))
323 , m_bMigrationDone(sal_False)
325 FreeResource();
326 _setBold(m_ftHead);
328 // replace %OLDPRODUCT with found version name
329 String aText = m_ftBody.GetText();
330 aText.SearchAndReplaceAll( UniString::CreateFromAscii("%OLDPRODUCT"), Migration::getOldVersionName());
331 m_ftBody.SetText( aText );
334 sal_Bool MigrationPage::commitPage( CommitPageReason _eReason )
336 if (_eReason == eTravelForward && m_cbMigration.IsChecked() && !m_bMigrationDone)
338 EnterWait();
339 Migration::doMigration();
340 LeaveWait();
341 m_bMigrationDone = sal_True;
343 else
344 Migration::cancelMigration();
345 return sal_True;
348 void MigrationPage::ActivatePage()
350 OWizardPage::ActivatePage();
351 GrabFocus();
354 UserPage::UserPage( svt::OWizardMachine* parent, const ResId& resid)
355 : OWizardPage(parent, resid)
356 , m_ftHead(this, WizardResId(FT_USER_HEADER))
357 , m_ftBody(this, WizardResId(FT_USER_BODY))
358 , m_ftFirst(this, WizardResId(FT_USER_FIRST))
359 , m_edFirst(this, WizardResId(ED_USER_FIRST))
360 , m_ftLast(this, WizardResId(FT_USER_LAST))
361 , m_edLast(this, WizardResId(ED_USER_LAST))
362 , m_ftInitials(this, WizardResId(FT_USER_INITIALS))
363 , m_edInitials(this, WizardResId(ED_USER_INITIALS))
364 , m_ftFather(this, WizardResId(FT_USER_FATHER))
365 , m_edFather(this, WizardResId(ED_USER_FATHER))
366 , m_lang(Application::GetSettings().GetUILanguage())
368 FreeResource();
369 _setBold(m_ftHead);
371 // check whether this is a russian version. otherwise
372 // we'll hide the 'Fathers name' field
373 SvtUserOptions aUserOpt;
374 m_edFirst.SetText(aUserOpt.GetFirstName());
375 m_edLast.SetText(aUserOpt.GetLastName());
376 rtl::OUString aUserName;
377 vos::OSecurity().getUserName( aUserName );
378 aUserOpt.SetID( aUserName );
380 m_edInitials.SetText(aUserOpt.GetID());
381 if (m_lang == LANGUAGE_RUSSIAN)
383 m_ftFather.Show();
384 m_edFather.Show();
385 m_edFather.SetText(aUserOpt.GetFathersName());
389 sal_Bool UserPage::commitPage( CommitPageReason )
391 SvtUserOptions aUserOpt;
392 aUserOpt.SetFirstName(m_edFirst.GetText());
393 aUserOpt.SetLastName(m_edLast.GetText());
394 aUserOpt.SetID( m_edInitials.GetText());
396 if (m_lang == LANGUAGE_RUSSIAN)
397 aUserOpt.SetFathersName(m_edFather.GetText());
399 return sal_True;
402 void UserPage::ActivatePage()
404 OWizardPage::ActivatePage();
405 GrabFocus();
408 // -------------------------------------------------------------------
409 UpdateCheckPage::UpdateCheckPage( svt::OWizardMachine* parent, const ResId& resid)
410 : OWizardPage(parent, resid)
411 , m_ftHead(this, WizardResId(FT_UPDATE_CHECK_HEADER))
412 , m_ftBody(this, WizardResId(FT_UPDATE_CHECK_BODY))
413 , m_cbUpdateCheck(this, WizardResId(CB_UPDATE_CHECK))
415 FreeResource();
416 _setBold(m_ftHead);
419 sal_Bool UpdateCheckPage::commitPage( CommitPageReason _eReason )
421 if ( _eReason == eTravelForward )
423 try {
424 Reference < XNameReplace > xUpdateAccess;
425 Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
427 xUpdateAccess = Reference < XNameReplace >(
428 xFactory->createInstance( UNISTRING( "com.sun.star.setup.UpdateCheckConfig" ) ), UNO_QUERY_THROW );
430 if ( !xUpdateAccess.is() )
431 return sal_False;
433 sal_Bool bAutoUpdChk = m_cbUpdateCheck.IsChecked();
434 xUpdateAccess->replaceByName( UNISTRING("AutoCheckEnabled"), makeAny( bAutoUpdChk ) );
436 Reference< XChangesBatch > xChangesBatch( xUpdateAccess, UNO_QUERY);
437 if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() )
438 xChangesBatch->commitChanges();
439 } catch (RuntimeException)
444 return sal_True;
447 void UpdateCheckPage::ActivatePage()
449 OWizardPage::ActivatePage();
450 GrabFocus();
453 // -------------------------------------------------------------------
454 RegistrationPage::RegistrationPage( Window* pParent, const ResId& rResid )
455 : OWizardPage( pParent, rResid )
456 , m_ftHeader(this, WizardResId(FT_REGISTRATION_HEADER))
457 , m_ftBody(this, WizardResId(FT_REGISTRATION_BODY))
458 , m_rbNow(this, WizardResId(RB_REGISTRATION_NOW))
459 , m_rbLater(this, WizardResId(RB_REGISTRATION_LATER))
460 , m_rbNever(this, WizardResId(RB_REGISTRATION_NEVER))
461 , m_flSeparator(this, WizardResId(FL_REGISTRATION))
462 , m_ftEnd(this, WizardResId(FT_REGISTRATION_END))
463 , m_bNeverVisible( sal_True )
465 FreeResource();
467 // another text for OOo
468 sal_Int32 nOpenSourceContext = 0;
471 ::utl::ConfigManager::GetDirectConfigProperty(
472 ::utl::ConfigManager::OPENSOURCECONTEXT ) >>= nOpenSourceContext;
474 catch( Exception& )
476 DBG_ERRORFILE( "RegistrationPage::RegistrationPage(): error while getting open source context" );
479 if ( nOpenSourceContext > 0 )
481 String sBodyText( WizardResId( STR_REGISTRATION_OOO ) );
482 m_ftBody.SetText( sBodyText );
485 // calculate height of body text and rearrange the buttons
486 Size aSize = m_ftBody.GetSizePixel();
487 Size aMinSize = m_ftBody.CalcMinimumSize( aSize.Width() );
488 long nTxtH = aMinSize.Height();
489 long nCtrlH = aSize.Height();
490 long nDelta = ( nCtrlH - nTxtH );
491 aSize.Height() -= nDelta;
492 m_ftBody.SetSizePixel( aSize );
493 Window* pWins[] = { &m_rbNow, &m_rbLater, &m_rbNever };
494 Window** pCurrent = pWins;
495 for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent )
497 Point aNewPos = (*pCurrent)->GetPosPixel();
498 aNewPos.Y() -= nDelta;
499 (*pCurrent)->SetPosPixel( aNewPos );
502 _setBold(m_ftHeader);
503 impl_retrieveConfigurationData();
504 updateButtonStates();
507 bool RegistrationPage::canAdvance() const
509 return false;
512 void RegistrationPage::ActivatePage()
514 OWizardPage::ActivatePage();
515 GrabFocus();
518 void RegistrationPage::impl_retrieveConfigurationData()
520 static ::rtl::OUString PACKAGE = ::rtl::OUString::createFromAscii("org.openoffice.FirstStartWizard");
521 static ::rtl::OUString PATH = ::rtl::OUString::createFromAscii("TabPages/Registration/RegistrationOptions/NeverButton");
522 static ::rtl::OUString KEY = ::rtl::OUString::createFromAscii("Visible");
524 ::com::sun::star::uno::Any aValue;
527 aValue = ::comphelper::ConfigurationHelper::readDirectKey(
528 ::comphelper::getProcessServiceFactory(),
529 PACKAGE,
530 PATH,
531 KEY,
532 ::comphelper::ConfigurationHelper::E_READONLY);
534 catch(const ::com::sun::star::uno::Exception&)
535 { aValue.clear(); }
537 aValue >>= m_bNeverVisible;
540 void RegistrationPage::updateButtonStates()
542 m_rbNever.Show( m_bNeverVisible );
545 sal_Bool RegistrationPage::commitPage( CommitPageReason _eReason )
547 if ( _eReason == eFinish )
549 ::svt::RegOptions aOptions;
550 rtl::OUString aEvent;
552 if ( m_rbNow.IsChecked())
554 aEvent = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RegistrationRequired" ) );
556 else if (m_rbLater.IsChecked())
558 aOptions.activateReminder(7);
559 // avtivate a reminder job...
561 // aOptions.markSessionDone();
565 // create the Desktop component which can load components
566 Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
567 if( xFactory.is() )
569 Reference< com::sun::star::task::XJobExecutor > xProductRegistration(
570 xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.setup.ProductRegistration" ) ) ),
571 UNO_QUERY_THROW );
573 // tell it that the user wants to register
574 xProductRegistration->trigger( aEvent );
577 catch( const Exception& )
581 return sal_True;
584 RegistrationPage::RegistrationMode RegistrationPage::getRegistrationMode() const
586 RegistrationPage::RegistrationMode eMode = rmNow;
587 if ( m_rbLater.IsChecked() )
588 eMode = rmLater;
589 else if ( m_rbNever.IsChecked() )
590 eMode = rmNever;
591 return eMode;
594 void RegistrationPage::prepareSingleMode()
596 // remove wizard text (hide and cut)
597 m_flSeparator.Hide();
598 m_ftEnd.Hide();
599 Size aNewSize = GetSizePixel();
600 aNewSize.Height() -= ( aNewSize.Height() - m_flSeparator.GetPosPixel().Y() );
601 SetSizePixel( aNewSize );
604 bool RegistrationPage::hasReminderDateCome()
606 return ::svt::RegOptions().hasReminderDateCome();
609 void RegistrationPage::executeSingleMode()
611 // opens the page in a single tabdialog
612 SfxSingleTabDialog aSingleDlg( NULL, TP_REGISTRATION );
613 RegistrationPage* pPage = new RegistrationPage( &aSingleDlg, WizardResId( TP_REGISTRATION ) );
614 pPage->prepareSingleMode();
615 aSingleDlg.SetPage( pPage );
616 aSingleDlg.SetText( pPage->getSingleModeTitle() );
617 aSingleDlg.Execute();
618 // the registration modes "Now" and "Later" are handled by the page
619 RegistrationPage::RegistrationMode eMode = pPage->getRegistrationMode();
620 if ( eMode == RegistrationPage::rmNow || eMode == RegistrationPage::rmLater )
621 pPage->commitPage( IWizardPage::eFinish );
622 if ( eMode != RegistrationPage::rmLater )
623 ::svt::RegOptions().removeReminder();
626 // -----------------------------------------------------------------------
628 static char const OEM_PRELOAD_SECTION[] = "Bootstrap";
629 static char const OEM_PRELOAD[] = "Preload";
630 static char const STR_TRUE[] = "1";
631 static char const STR_FALSE[] = "0";
633 static sal_Bool existsURL( OUString const& _sURL )
635 using namespace osl;
636 DirectoryItem aDirItem;
638 if (_sURL.getLength() != 0)
639 return ( DirectoryItem::get( _sURL, aDirItem ) == DirectoryItem::E_None );
641 return sal_False;
645 // locate soffice.ini/.rc file
646 static OUString locateIniFile()
648 OUString aUserDataPath;
649 OUString aSofficeIniFileURL;
651 // Retrieve the default file URL for the soffice.ini/rc
652 rtl::Bootstrap().getIniName( aSofficeIniFileURL );
654 if ( utl::Bootstrap::locateUserData( aUserDataPath ) == utl::Bootstrap::PATH_EXISTS )
656 const char CONFIG_DIR[] = "/config";
658 sal_Int32 nIndex = aSofficeIniFileURL.lastIndexOf( '/');
659 if ( nIndex > 0 )
661 OUString aUserSofficeIniFileURL;
662 OUStringBuffer aBuffer( aUserDataPath );
663 aBuffer.appendAscii( CONFIG_DIR );
664 aBuffer.append( aSofficeIniFileURL.copy( nIndex ));
665 aUserSofficeIniFileURL = aBuffer.makeStringAndClear();
667 if ( existsURL( aUserSofficeIniFileURL ))
668 return aUserSofficeIniFileURL;
671 // Fallback try to use the soffice.ini/rc from program folder
672 return aSofficeIniFileURL;
675 // check whether the OEMPreload flag was set in soffice.ini/.rc
676 static sal_Int32 checkOEMPreloadFlag()
678 OUString aSofficeIniFileURL;
679 aSofficeIniFileURL = locateIniFile();
680 Config aConfig(aSofficeIniFileURL);
681 aConfig.SetGroup( OEM_PRELOAD_SECTION );
682 ByteString sResult = aConfig.ReadKey( OEM_PRELOAD );
683 return sResult.ToInt32();
685 if ( sResult == STR_TRUE )
686 return sal_True;
687 else
688 return sal_False;
692 WelcomePage::OEMType WelcomePage::checkOEM()
694 sal_Int32 oemResult = checkOEMPreloadFlag();
695 switch (oemResult) {
696 case 1:
697 return OEM_NORMAL;
698 case 2:
699 return OEM_EXTENDED;
700 default:
701 return OEM_NONE;
705 } // namespace desktop