diff options
Diffstat (limited to 'desktop/source/migration')
28 files changed, 2223 insertions, 26 deletions
diff --git a/desktop/source/migration/makefile.mk b/desktop/source/migration/makefile.mk index b20b4c5797..b20b4c5797 100644..100755 --- a/desktop/source/migration/makefile.mk +++ b/desktop/source/migration/makefile.mk diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index e755dda19b..e755dda19b 100644..100755 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx diff --git a/desktop/source/migration/migration_impl.hxx b/desktop/source/migration/migration_impl.hxx index a4619b4c8d..a4619b4c8d 100644..100755 --- a/desktop/source/migration/migration_impl.hxx +++ b/desktop/source/migration/migration_impl.hxx diff --git a/desktop/source/migration/pages.cxx b/desktop/source/migration/pages.cxx new file mode 100755 index 0000000000..291ec4d8b8 --- /dev/null +++ b/desktop/source/migration/pages.cxx @@ -0,0 +1,671 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "pages.hxx" +#include "wizard.hrc" +#include "wizard.hxx" +#include "migration.hxx" +#include <vcl/msgbox.hxx> +#include <vcl/mnemonic.hxx> +#include <vos/security.hxx> +#include <app.hxx> +#include <rtl/ustring.hxx> +#include <osl/file.hxx> +#include <unotools/bootstrap.hxx> +#include <unotools/configmgr.hxx> +#include <unotools/regoptions.hxx> +#include <unotools/useroptions.hxx> +#include <sfx2/basedlgs.hxx> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/beans/XMaterialHolder.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/task/XJobExecutor.hpp> +#include <comphelper/configurationhelper.hxx> +#include <rtl/bootstrap.hxx> +#include <rtl/ustrbuf.hxx> +#include <osl/file.hxx> +#include <osl/thread.hxx> +#include <unotools/bootstrap.hxx> +#include <tools/config.hxx> + +using namespace rtl; +using namespace osl; +using namespace utl; +using namespace svt; +using namespace com::sun::star; +using namespace com::sun::star::frame; +using namespace com::sun::star::lang; +using namespace com::sun::star::util; +using namespace com::sun::star::beans; +using namespace com::sun::star::uno; +using namespace com::sun::star::container; + +#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) + +namespace desktop { + +static void _setBold(FixedText& ft) +{ + Font f = ft.GetControlFont(); + f.SetWeight(WEIGHT_BOLD); + ft.SetControlFont(f); +} + +WelcomePage::WelcomePage( svt::OWizardMachine* parent, const ResId& resid, sal_Bool bLicenseNeedsAcceptance ) + : OWizardPage(parent, resid) + , m_ftHead(this, WizardResId(FT_WELCOME_HEADER)) + , m_ftBody(this, WizardResId(FT_WELCOME_BODY)) + , m_pParent(parent) + , m_bLicenseNeedsAcceptance( bLicenseNeedsAcceptance ) + , bIsEvalVersion(false) + , bNoEvalText(false) +{ + FreeResource(); + + _setBold(m_ftHead); + + checkEval(); + + // check for migration + if (Migration::checkMigration()) + { + String aText(WizardResId(STR_WELCOME_MIGRATION)); + // replace %OLDPRODUCT with found version name + aText.SearchAndReplaceAll( UniString::CreateFromAscii("%OLD_VERSION"), Migration::getOldVersionName()); + m_ftBody.SetText( aText ); + } + else if ( ! m_bLicenseNeedsAcceptance ) + { + String aText(WizardResId(STR_WELCOME_WITHOUT_LICENSE)); + m_ftBody.SetText( aText ); + } +} + + +void WelcomePage::checkEval() +{ + Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + Reference< XMaterialHolder > xHolder(xFactory->createInstance( + OUString::createFromAscii("com.sun.star.tab.tabreg")), UNO_QUERY); + if (xHolder.is()) { + Any aData = xHolder->getMaterial(); + Sequence < NamedValue > aSeq; + if (aData >>= aSeq) { + bIsEvalVersion = true; + for (int i=0; i< aSeq.getLength(); i++) { + if (aSeq[i].Name.equalsAscii("NoEvalText")) { + aSeq[i].Value >>= bNoEvalText; + } + } + } + } +} + + +void WelcomePage::ActivatePage() +{ + OWizardPage::ActivatePage(); + // this page has no controls, so forwarding to default + // button (next) won't work if we grap focus + // GrabFocus(); +} + +LicensePage::LicensePage( svt::OWizardMachine* parent, const ResId& resid, const rtl::OUString &rLicensePath ) + : OWizardPage(parent, resid) + , m_pParent(parent) + , m_ftHead(this, WizardResId(FT_LICENSE_HEADER)) + , m_ftBody1(this, WizardResId(FT_LICENSE_BODY_1)) + , m_ftBody1Txt(this, WizardResId(FT_LICENSE_BODY_1_TXT)) + , m_ftBody2(this, WizardResId(FT_LICENSE_BODY_2)) + , m_ftBody2Txt(this, WizardResId(FT_LICENSE_BODY_2_TXT)) + , m_mlLicense(this, WizardResId(ML_LICENSE)) + , m_pbDown(this, WizardResId(PB_LICENSE_DOWN)) + , m_bLicenseRead(sal_False) +{ + FreeResource(); + + _setBold(m_ftHead); + + m_mlLicense.SetEndReachedHdl( LINK(this, LicensePage, EndReachedHdl) ); + m_mlLicense.SetScrolledHdl( LINK(this, LicensePage, ScrolledHdl) ); + m_pbDown.SetClickHdl( LINK(this, LicensePage, PageDownHdl) ); + + // We want a automatic repeating page down button + WinBits aStyle = m_pbDown.GetStyle(); + aStyle |= WB_REPEAT; + m_pbDown.SetStyle( aStyle ); + + // replace %PAGEDOWN in text2 with button text + String aText = m_ftBody1Txt.GetText(); + aText.SearchAndReplaceAll( UniString::CreateFromAscii("%PAGEDOWN"), + MnemonicGenerator::EraseAllMnemonicChars(m_pbDown.GetText())); + + m_ftBody1Txt.SetText( aText ); + + // load license text + File aLicenseFile(rLicensePath); + if ( aLicenseFile.open(OpenFlag_Read) == FileBase::E_None) + { + DirectoryItem d; + DirectoryItem::get(rLicensePath, d); + FileStatus fs(FileStatusMask_FileSize); + d.getFileStatus(fs); + sal_uInt64 nBytesRead = 0; + sal_uInt64 nPosition = 0; + sal_uInt32 nBytes = (sal_uInt32)fs.getFileSize(); + sal_Char *pBuffer = new sal_Char[nBytes]; + // FileBase RC r = FileBase::E_None; + while (aLicenseFile.read(pBuffer+nPosition, nBytes-nPosition, nBytesRead) == FileBase::E_None + && nPosition + nBytesRead < nBytes) + { + nPosition += nBytesRead; + } + OUString aLicenseString(pBuffer, nBytes, RTL_TEXTENCODING_UTF8, + OSTRING_TO_OUSTRING_CVTFLAGS | RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE); + delete[] pBuffer; + m_mlLicense.SetText(aLicenseString); + + } +} + +void LicensePage::ActivatePage() +{ + OWizardPage::ActivatePage(); + m_bLicenseRead = m_mlLicense.IsEndReached(); + m_pbDown.GrabFocus(); + updateDialogTravelUI(); +} + +bool LicensePage::canAdvance() const +{ + if (m_mlLicense.IsEndReached()) + const_cast< LicensePage* >( this )->m_pbDown.Disable(); + else + const_cast< LicensePage* >( this )->m_pbDown.Enable(); + + return m_bLicenseRead; +} + +IMPL_LINK( LicensePage, PageDownHdl, PushButton *, EMPTYARG ) +{ + m_mlLicense.ScrollDown( SCROLL_PAGEDOWN ); + return 0; +} + +IMPL_LINK( LicensePage, EndReachedHdl, LicenseView *, EMPTYARG ) +{ + m_bLicenseRead = sal_True; + updateDialogTravelUI(); + return 0; +} + +IMPL_LINK( LicensePage, ScrolledHdl, LicenseView *, EMPTYARG ) +{ + updateDialogTravelUI(); + return 0; +} + + +LicenseView::LicenseView( Window* pParent, const ResId& rResId ) + : MultiLineEdit( pParent, rResId ) +{ + SetLeftMargin( 5 ); + mbEndReached = IsEndReached(); + StartListening( *GetTextEngine() ); +} + +LicenseView::~LicenseView() +{ + maEndReachedHdl = Link(); + maScrolledHdl = Link(); + EndListeningAll(); +} + +void LicenseView::ScrollDown( ScrollType eScroll ) +{ + ScrollBar* pScroll = GetVScrollBar(); + if ( pScroll ) + pScroll->DoScrollAction( eScroll ); +} + +sal_Bool LicenseView::IsEndReached() const +{ + sal_Bool bEndReached; + + ExtTextView* pView = GetTextView(); + ExtTextEngine* pEdit = GetTextEngine(); + sal_uLong nHeight = pEdit->GetTextHeight(); + Size aOutSize = pView->GetWindow()->GetOutputSizePixel(); + Point aBottom( 0, aOutSize.Height() ); + + if ( (sal_uLong) pView->GetDocPos( aBottom ).Y() >= nHeight - 1 ) + bEndReached = sal_True; + else + bEndReached = sal_False; + + return bEndReached; +} + +void LicenseView::Notify( SfxBroadcaster&, const SfxHint& rHint ) +{ + if ( rHint.IsA( TYPE(TextHint) ) ) + { + sal_Bool bLastVal = EndReached(); + sal_uLong nId = ((const TextHint&)rHint).GetId(); + + if ( nId == TEXT_HINT_PARAINSERTED ) + { + if ( bLastVal ) + mbEndReached = IsEndReached(); + } + else if ( nId == TEXT_HINT_VIEWSCROLLED ) + { + if ( ! mbEndReached ) + mbEndReached = IsEndReached(); + maScrolledHdl.Call( this ); + } + + if ( EndReached() && !bLastVal ) + { + maEndReachedHdl.Call( this ); + } + } +} + + + +// ------------------------------------------------------------------- + +class MigrationThread : public ::osl::Thread +{ + public: + MigrationThread(); + + virtual void SAL_CALL run(); + virtual void SAL_CALL onTerminated(); +}; + +MigrationThread::MigrationThread() +{ +} + +void MigrationThread::run() +{ + try + { + Migration::doMigration(); + } + catch ( uno::Exception& ) + { + } +} + +void MigrationThread::onTerminated() +{ +} + +// ------------------------------------------------------------------- + +MigrationPage::MigrationPage( + svt::OWizardMachine* parent, + const ResId& resid, Throbber& i_throbber ) + : OWizardPage(parent, resid) + , m_ftHead(this, WizardResId(FT_MIGRATION_HEADER)) + , m_ftBody(this, WizardResId(FT_MIGRATION_BODY)) + , m_cbMigration(this, WizardResId(CB_MIGRATION)) + , m_rThrobber(i_throbber) + , m_bMigrationDone(sal_False) +{ + FreeResource(); + _setBold(m_ftHead); + + // replace %OLDPRODUCT with found version name + String aText = m_ftBody.GetText(); + aText.SearchAndReplaceAll( UniString::CreateFromAscii("%OLDPRODUCT"), Migration::getOldVersionName()); + m_ftBody.SetText( aText ); +} + +sal_Bool MigrationPage::commitPage( svt::WizardTypes::CommitPageReason _eReason ) +{ + if (_eReason == svt::WizardTypes::eTravelForward && m_cbMigration.IsChecked() && !m_bMigrationDone) + { + GetParent()->EnterWait(); + FirstStartWizard* pWizard = dynamic_cast< FirstStartWizard* >( GetParent() ); + if ( pWizard ) + pWizard->DisableButtonsWhileMigration(); + + m_rThrobber.Show(); + m_rThrobber.start(); + MigrationThread* pMigThread = new MigrationThread(); + pMigThread->create(); + + while ( pMigThread->isRunning() ) + { + Application::Reschedule(); + } + + m_rThrobber.stop(); + GetParent()->LeaveWait(); + // Next state will enable buttons - so no EnableButtons necessary! + m_rThrobber.Hide(); + pMigThread->join(); + delete pMigThread; + m_bMigrationDone = sal_True; + } + else + Migration::cancelMigration(); + return sal_True; +} + +void MigrationPage::ActivatePage() +{ + OWizardPage::ActivatePage(); + GrabFocus(); +} + +UserPage::UserPage( svt::OWizardMachine* parent, const ResId& resid) + : OWizardPage(parent, resid) + , m_ftHead(this, WizardResId(FT_USER_HEADER)) + , m_ftBody(this, WizardResId(FT_USER_BODY)) + , m_ftFirst(this, WizardResId(FT_USER_FIRST)) + , m_edFirst(this, WizardResId(ED_USER_FIRST)) + , m_ftLast(this, WizardResId(FT_USER_LAST)) + , m_edLast(this, WizardResId(ED_USER_LAST)) + , m_ftInitials(this, WizardResId(FT_USER_INITIALS)) + , m_edInitials(this, WizardResId(ED_USER_INITIALS)) + , m_ftFather(this, WizardResId(FT_USER_FATHER)) + , m_edFather(this, WizardResId(ED_USER_FATHER)) + , m_lang(Application::GetSettings().GetUILanguage()) +{ + FreeResource(); + _setBold(m_ftHead); + + // check whether this is a russian version. otherwise + // we'll hide the 'Fathers name' field + SvtUserOptions aUserOpt; + m_edFirst.SetText(aUserOpt.GetFirstName()); + m_edLast.SetText(aUserOpt.GetLastName()); +#if 0 + rtl::OUString aUserName; + vos::OSecurity().getUserName( aUserName ); + aUserOpt.SetID( aUserName ); +#endif + + m_edInitials.SetText(aUserOpt.GetID()); + if (m_lang == LANGUAGE_RUSSIAN) + { + m_ftFather.Show(); + m_edFather.Show(); + m_edFather.SetText(aUserOpt.GetFathersName()); + } +} + +sal_Bool UserPage::commitPage( svt::WizardTypes::CommitPageReason ) +{ + SvtUserOptions aUserOpt; + aUserOpt.SetFirstName(m_edFirst.GetText()); + aUserOpt.SetLastName(m_edLast.GetText()); + aUserOpt.SetID( m_edInitials.GetText()); + + if (m_lang == LANGUAGE_RUSSIAN) + aUserOpt.SetFathersName(m_edFather.GetText()); + + return sal_True; +} + +void UserPage::ActivatePage() +{ + OWizardPage::ActivatePage(); + GrabFocus(); +} + +// ------------------------------------------------------------------- +UpdateCheckPage::UpdateCheckPage( svt::OWizardMachine* parent, const ResId& resid) + : OWizardPage(parent, resid) + , m_ftHead(this, WizardResId(FT_UPDATE_CHECK_HEADER)) + , m_ftBody(this, WizardResId(FT_UPDATE_CHECK_BODY)) + , m_cbUpdateCheck(this, WizardResId(CB_UPDATE_CHECK)) +{ + FreeResource(); + _setBold(m_ftHead); +} + +sal_Bool UpdateCheckPage::commitPage( svt::WizardTypes::CommitPageReason _eReason ) +{ + if ( _eReason == svt::WizardTypes::eTravelForward ) + { + try { + Reference < XNameReplace > xUpdateAccess; + Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + + xUpdateAccess = Reference < XNameReplace >( + xFactory->createInstance( UNISTRING( "com.sun.star.setup.UpdateCheckConfig" ) ), UNO_QUERY_THROW ); + + if ( !xUpdateAccess.is() ) + return sal_False; + + sal_Bool bAutoUpdChk = m_cbUpdateCheck.IsChecked(); + xUpdateAccess->replaceByName( UNISTRING("AutoCheckEnabled"), makeAny( bAutoUpdChk ) ); + + Reference< XChangesBatch > xChangesBatch( xUpdateAccess, UNO_QUERY); + if( xChangesBatch.is() && xChangesBatch->hasPendingChanges() ) + xChangesBatch->commitChanges(); + } catch (RuntimeException) + { + } + } + + return sal_True; +} + +void UpdateCheckPage::ActivatePage() +{ + OWizardPage::ActivatePage(); + GrabFocus(); +} + +// ------------------------------------------------------------------- +RegistrationPage::RegistrationPage( Window* pParent, const ResId& rResid ) + : OWizardPage( pParent, rResid ) + , m_ftHeader(this, WizardResId(FT_REGISTRATION_HEADER)) + , m_ftBody(this, WizardResId(FT_REGISTRATION_BODY)) + , m_rbNow(this, WizardResId(RB_REGISTRATION_NOW)) + , m_rbLater(this, WizardResId(RB_REGISTRATION_LATER)) + , m_rbNever(this, WizardResId(RB_REGISTRATION_NEVER)) + , m_flSeparator(this, WizardResId(FL_REGISTRATION)) + , m_ftEnd(this, WizardResId(FT_REGISTRATION_END)) + , m_bNeverVisible( sal_True ) +{ + FreeResource(); + + // another text for OOo + sal_Int32 nOpenSourceContext = 0; + try + { + ::utl::ConfigManager::GetDirectConfigProperty( + ::utl::ConfigManager::OPENSOURCECONTEXT ) >>= nOpenSourceContext; + } + catch( Exception& ) + { + DBG_ERRORFILE( "RegistrationPage::RegistrationPage(): error while getting open source context" ); + } + + if ( nOpenSourceContext > 0 ) + { + String sBodyText( WizardResId( STR_REGISTRATION_OOO ) ); + m_ftBody.SetText( sBodyText ); + } + + // calculate height of body text and rearrange the buttons + Size aSize = m_ftBody.GetSizePixel(); + Size aMinSize = m_ftBody.CalcMinimumSize( aSize.Width() ); + long nTxtH = aMinSize.Height(); + long nCtrlH = aSize.Height(); + long nDelta = ( nCtrlH - nTxtH ); + aSize.Height() -= nDelta; + m_ftBody.SetSizePixel( aSize ); + Window* pWins[] = { &m_rbNow, &m_rbLater, &m_rbNever }; + Window** pCurrent = pWins; + for ( sal_uInt32 i = 0; i < sizeof( pWins ) / sizeof( pWins[ 0 ] ); ++i, ++pCurrent ) + { + Point aNewPos = (*pCurrent)->GetPosPixel(); + aNewPos.Y() -= nDelta; + (*pCurrent)->SetPosPixel( aNewPos ); + } + + _setBold(m_ftHeader); + impl_retrieveConfigurationData(); + updateButtonStates(); +} + +bool RegistrationPage::canAdvance() const +{ + return false; +} + +void RegistrationPage::ActivatePage() +{ + OWizardPage::ActivatePage(); + GrabFocus(); +} + +void RegistrationPage::impl_retrieveConfigurationData() +{ + static ::rtl::OUString PACKAGE = ::rtl::OUString::createFromAscii("org.openoffice.FirstStartWizard"); + static ::rtl::OUString PATH = ::rtl::OUString::createFromAscii("TabPages/Registration/RegistrationOptions/NeverButton"); + static ::rtl::OUString KEY = ::rtl::OUString::createFromAscii("Visible"); + + ::com::sun::star::uno::Any aValue; + try + { + aValue = ::comphelper::ConfigurationHelper::readDirectKey( + ::comphelper::getProcessServiceFactory(), + PACKAGE, + PATH, + KEY, + ::comphelper::ConfigurationHelper::E_READONLY); + } + catch(const ::com::sun::star::uno::Exception&) + { aValue.clear(); } + + aValue >>= m_bNeverVisible; +} + +void RegistrationPage::updateButtonStates() +{ + m_rbNever.Show( m_bNeverVisible ); +} + +sal_Bool RegistrationPage::commitPage( svt::WizardTypes::CommitPageReason _eReason ) +{ + if ( _eReason == svt::WizardTypes::eFinish ) + { + ::utl::RegOptions aOptions; + rtl::OUString aEvent; + + if ( m_rbNow.IsChecked()) + { + aEvent = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RegistrationRequired" ) ); + } + else if (m_rbLater.IsChecked()) + { + aOptions.activateReminder(7); + // avtivate a reminder job... + } + // aOptions.markSessionDone(); + + try + { + // create the Desktop component which can load components + Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + if( xFactory.is() ) + { + Reference< com::sun::star::task::XJobExecutor > xProductRegistration( + xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.setup.ProductRegistration" ) ) ), + UNO_QUERY_THROW ); + + // tell it that the user wants to register + xProductRegistration->trigger( aEvent ); + } + } + catch( const Exception& ) + { + } + } + return sal_True; +} + +RegistrationPage::RegistrationMode RegistrationPage::getRegistrationMode() const +{ + RegistrationPage::RegistrationMode eMode = rmNow; + if ( m_rbLater.IsChecked() ) + eMode = rmLater; + else if ( m_rbNever.IsChecked() ) + eMode = rmNever; + return eMode; +} + +void RegistrationPage::prepareSingleMode() +{ + // remove wizard text (hide and cut) + m_flSeparator.Hide(); + m_ftEnd.Hide(); + Size aNewSize = GetSizePixel(); + aNewSize.Height() -= ( aNewSize.Height() - m_flSeparator.GetPosPixel().Y() ); + SetSizePixel( aNewSize ); +} + +bool RegistrationPage::hasReminderDateCome() +{ + return ::utl::RegOptions().hasReminderDateCome(); +} + +void RegistrationPage::executeSingleMode() +{ + // opens the page in a single tabdialog + SfxSingleTabDialog aSingleDlg( NULL, TP_REGISTRATION ); + RegistrationPage* pPage = new RegistrationPage( &aSingleDlg, WizardResId( TP_REGISTRATION ) ); + pPage->prepareSingleMode(); + aSingleDlg.SetPage( pPage ); + aSingleDlg.SetText( pPage->getSingleModeTitle() ); + aSingleDlg.Execute(); + // the registration modes "Now" and "Later" are handled by the page + RegistrationPage::RegistrationMode eMode = pPage->getRegistrationMode(); + if ( eMode == RegistrationPage::rmNow || eMode == RegistrationPage::rmLater ) + pPage->commitPage( WizardTypes::eFinish ); + if ( eMode != RegistrationPage::rmLater ) + ::utl::RegOptions().removeReminder(); +} + +} // namespace desktop diff --git a/desktop/source/migration/pages.hxx b/desktop/source/migration/pages.hxx new file mode 100755 index 0000000000..2f6c2d31a5 --- /dev/null +++ b/desktop/source/migration/pages.hxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _PAGES_HXX_ +#define _PAGES_HXX_ + +#include <vcl/tabpage.hxx> +#include <vcl/button.hxx> +#include <vcl/dialog.hxx> +#include <vcl/scrbar.hxx> +#include <vcl/throbber.hxx> +#include <svtools/wizardmachine.hxx> +#include <svtools/svmedit.hxx> +#include <svl/lstner.hxx> +#include <svtools/xtextedt.hxx> + +namespace desktop +{ +class WelcomePage : public svt::OWizardPage +{ +private: + FixedText m_ftHead; + FixedText m_ftBody; + svt::OWizardMachine *m_pParent; + sal_Bool m_bLicenseNeedsAcceptance; + enum OEMType + { + OEM_NONE, OEM_NORMAL, OEM_EXTENDED + }; + bool bIsEvalVersion; + bool bNoEvalText; + void checkEval(); + + +public: + WelcomePage( svt::OWizardMachine* parent, const ResId& resid, sal_Bool bLicenseNeedsAcceptance ); +protected: + virtual void ActivatePage(); +}; + +class LicenseView : public MultiLineEdit, public SfxListener +{ + sal_Bool mbEndReached; + Link maEndReachedHdl; + Link maScrolledHdl; + +public: + LicenseView( Window* pParent, const ResId& rResId ); + ~LicenseView(); + + void ScrollDown( ScrollType eScroll ); + + sal_Bool IsEndReached() const; + sal_Bool EndReached() const { return mbEndReached; } + void SetEndReached( sal_Bool bEnd ) { mbEndReached = bEnd; } + + void SetEndReachedHdl( const Link& rHdl ) { maEndReachedHdl = rHdl; } + const Link& GetAutocompleteHdl() const { return maEndReachedHdl; } + + void SetScrolledHdl( const Link& rHdl ) { maScrolledHdl = rHdl; } + const Link& GetScrolledHdl() const { return maScrolledHdl; } + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + +protected: + using MultiLineEdit::Notify; +}; + +class LicensePage : public svt::OWizardPage +{ +private: + svt::OWizardMachine *m_pParent; + FixedText m_ftHead; + FixedText m_ftBody1; + FixedText m_ftBody1Txt; + FixedText m_ftBody2; + FixedText m_ftBody2Txt; + LicenseView m_mlLicense; + PushButton m_pbDown; + sal_Bool m_bLicenseRead; +public: + LicensePage( svt::OWizardMachine* parent, const ResId& resid, const rtl::OUString &rLicensePath ); +private: + DECL_LINK(PageDownHdl, PushButton*); + DECL_LINK(EndReachedHdl, LicenseView*); + DECL_LINK(ScrolledHdl, LicenseView*); +protected: + virtual bool canAdvance() const; + virtual void ActivatePage(); +}; + +class MigrationPage : public svt::OWizardPage +{ +private: + FixedText m_ftHead; + FixedText m_ftBody; + CheckBox m_cbMigration; + Throbber& m_rThrobber; + sal_Bool m_bMigrationDone; +public: + MigrationPage( svt::OWizardMachine* parent, const ResId& resid, Throbber& i_throbber ); + virtual sal_Bool commitPage( svt::WizardTypes::CommitPageReason _eReason ); + +protected: + virtual void ActivatePage(); +}; + +class UserPage : public svt::OWizardPage +{ +private: + FixedText m_ftHead; + FixedText m_ftBody; + FixedText m_ftFirst; + Edit m_edFirst; + FixedText m_ftLast; + Edit m_edLast; + FixedText m_ftInitials; + Edit m_edInitials; + FixedText m_ftFather; + Edit m_edFather; + LanguageType m_lang; + +public: + UserPage( svt::OWizardMachine* parent, const ResId& resid); + virtual sal_Bool commitPage( svt::WizardTypes::CommitPageReason _eReason ); +protected: + virtual void ActivatePage(); +}; + +class UpdateCheckPage : public svt::OWizardPage +{ +private: + FixedText m_ftHead; + FixedText m_ftBody; + CheckBox m_cbUpdateCheck; +public: + UpdateCheckPage( svt::OWizardMachine* parent, const ResId& resid); + virtual sal_Bool commitPage( svt::WizardTypes::CommitPageReason _eReason ); + +protected: + virtual void ActivatePage(); +}; + + +class RegistrationPage : public svt::OWizardPage +{ +private: + FixedText m_ftHeader; + FixedText m_ftBody; + RadioButton m_rbNow; + RadioButton m_rbLater; + RadioButton m_rbNever; + FixedLine m_flSeparator; + FixedText m_ftEnd; + + sal_Bool m_bNeverVisible; + + void updateButtonStates(); + void impl_retrieveConfigurationData(); + +protected: + virtual bool canAdvance() const; + virtual void ActivatePage(); + + virtual sal_Bool commitPage( svt::WizardTypes::CommitPageReason _eReason ); + +public: + RegistrationPage( Window* parent, const ResId& resid); + + enum RegistrationMode + { + rmNow, // register now + rmLater, // register later + rmNever // register never + }; + + RegistrationMode getRegistrationMode() const; + void prepareSingleMode(); + inline String getSingleModeTitle() const { return m_ftHeader.GetText(); } + + static bool hasReminderDateCome(); + static void executeSingleMode(); +}; + +} // namespace desktop + +#endif // #ifndef _PAGES_HXX_ + diff --git a/desktop/source/migration/services/autocorrmigration.cxx b/desktop/source/migration/services/autocorrmigration.cxx index 4b12969dbe..4b12969dbe 100644..100755 --- a/desktop/source/migration/services/autocorrmigration.cxx +++ b/desktop/source/migration/services/autocorrmigration.cxx diff --git a/desktop/source/migration/services/autocorrmigration.hxx b/desktop/source/migration/services/autocorrmigration.hxx index 9a8aef32cd..9a8aef32cd 100644..100755 --- a/desktop/source/migration/services/autocorrmigration.hxx +++ b/desktop/source/migration/services/autocorrmigration.hxx diff --git a/desktop/source/migration/services/basicmigration.cxx b/desktop/source/migration/services/basicmigration.cxx index fa3fa81fa4..fa3fa81fa4 100644..100755 --- a/desktop/source/migration/services/basicmigration.cxx +++ b/desktop/source/migration/services/basicmigration.cxx diff --git a/desktop/source/migration/services/basicmigration.hxx b/desktop/source/migration/services/basicmigration.hxx index 131092748a..131092748a 100644..100755 --- a/desktop/source/migration/services/basicmigration.hxx +++ b/desktop/source/migration/services/basicmigration.hxx diff --git a/desktop/source/migration/services/cexports.cxx b/desktop/source/migration/services/cexports.cxx index 261cf26665..02ff514a0b 100644..100755 --- a/desktop/source/migration/services/cexports.cxx +++ b/desktop/source/migration/services/cexports.cxx @@ -67,13 +67,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_writeInfoHelper( - pServiceManager, pRegistryKey, entries ); -} - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/desktop/source/migration/services/cexportsoo3.cxx b/desktop/source/migration/services/cexportsoo3.cxx index 771c161879..9ffc255de5 100644..100755 --- a/desktop/source/migration/services/cexportsoo3.cxx +++ b/desktop/source/migration/services/cexportsoo3.cxx @@ -52,13 +52,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_writeInfoHelper( - pServiceManager, pRegistryKey, entries ); -} - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/desktop/source/migration/services/cppumaker.mk b/desktop/source/migration/services/cppumaker.mk index 5ab16ed1e3..5ab16ed1e3 100644..100755 --- a/desktop/source/migration/services/cppumaker.mk +++ b/desktop/source/migration/services/cppumaker.mk diff --git a/desktop/source/migration/services/jvmfwk.cxx b/desktop/source/migration/services/jvmfwk.cxx index 3e756bf451..3e756bf451 100644..100755 --- a/desktop/source/migration/services/jvmfwk.cxx +++ b/desktop/source/migration/services/jvmfwk.cxx diff --git a/desktop/source/migration/services/jvmfwk.hxx b/desktop/source/migration/services/jvmfwk.hxx index 96e459521d..96e459521d 100644..100755 --- a/desktop/source/migration/services/jvmfwk.hxx +++ b/desktop/source/migration/services/jvmfwk.hxx diff --git a/desktop/source/migration/services/makefile.mk b/desktop/source/migration/services/makefile.mk index 35f21ba99d..718ac0387c 100644..100755 --- a/desktop/source/migration/services/makefile.mk +++ b/desktop/source/migration/services/makefile.mk @@ -87,7 +87,7 @@ DEF1NAME=$(SHL1TARGET) COMP2TYPELIST = migrationoo3 SHL2TARGET=migrationoo3.uno -SHL2VERSIONMAP = migrationoo3.map +SHL2VERSIONMAP = $(SOLARENV)/src/component.map SHL2OBJS= \ $(SLO)$/cexportsoo3.obj \ @@ -116,3 +116,18 @@ DEF2NAME=$(SHL2TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/migrationoo3.component + +$(MISC)/migrationoo3.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt migrationoo3.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL2TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt migrationoo3.component + +ALLTAR : $(MISC)/migrationoo2.component + +$(MISC)/migrationoo2.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt migrationoo2.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt migrationoo2.component diff --git a/desktop/source/migration/services/migrationoo2.component b/desktop/source/migration/services/migrationoo2.component new file mode 100755 index 0000000000..2b21ab123b --- /dev/null +++ b/desktop/source/migration/services/migrationoo2.component @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.desktop.migration.Basic"> + <service name="com.sun.star.migration.Basic"/> + </implementation> + <implementation name="com.sun.star.comp.desktop.migration.Wordbooks"> + <service name="com.sun.star.migration.Wordbooks"/> + </implementation> +</component> diff --git a/desktop/source/migration/services/migrationoo2.xml b/desktop/source/migration/services/migrationoo2.xml index 0c77badebc..0c77badebc 100644..100755 --- a/desktop/source/migration/services/migrationoo2.xml +++ b/desktop/source/migration/services/migrationoo2.xml diff --git a/desktop/source/migration/services/migrationoo3.component b/desktop/source/migration/services/migrationoo3.component new file mode 100755 index 0000000000..380c389ab7 --- /dev/null +++ b/desktop/source/migration/services/migrationoo3.component @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<component loader="com.sun.star.loader.SharedLibrary" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.desktop.migration.OOo3Extensions"> + <service name="com.sun.star.migration.Extensions"/> + </implementation> +</component> diff --git a/desktop/source/migration/services/migrationoo3.map b/desktop/source/migration/services/migrationoo3.map deleted file mode 100644 index ac2c3750bf..0000000000 --- a/desktop/source/migration/services/migrationoo3.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/desktop/source/migration/services/misc.hxx b/desktop/source/migration/services/misc.hxx index a8f7babef9..a8f7babef9 100644..100755 --- a/desktop/source/migration/services/misc.hxx +++ b/desktop/source/migration/services/misc.hxx diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index bf61dbb1b1..bd8c27e0c3 100644..100755 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -293,7 +293,7 @@ bool OO3ExtensionMigration::scanDescriptionXml( const ::rtl::OUString& sDescript utl::TextSearch ts(param, LANGUAGE_DONTKNOW); xub_StrLen start = 0; - xub_StrLen end = static_cast<USHORT>(aExtIdentifier.getLength()); + xub_StrLen end = static_cast<sal_uInt16>(aExtIdentifier.getLength()); if (ts.SearchFrwrd(aExtIdentifier, &start, &end)) return false; } @@ -318,7 +318,7 @@ bool OO3ExtensionMigration::scanDescriptionXml( const ::rtl::OUString& sDescript utl::TextSearch ts(param, LANGUAGE_DONTKNOW); xub_StrLen start = 0; - xub_StrLen end = static_cast<USHORT>(sDescriptionXmlURL.getLength()); + xub_StrLen end = static_cast<sal_uInt16>(sDescriptionXmlURL.getLength()); if (ts.SearchFrwrd(sDescriptionXmlURL, &start, &end)) return false; } diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx index 0843707fb6..0843707fb6 100644..100755 --- a/desktop/source/migration/services/oo3extensionmigration.hxx +++ b/desktop/source/migration/services/oo3extensionmigration.hxx diff --git a/desktop/source/migration/services/wordbookmigration.cxx b/desktop/source/migration/services/wordbookmigration.cxx index 4900c02755..3f1a79d1c6 100644..100755 --- a/desktop/source/migration/services/wordbookmigration.cxx +++ b/desktop/source/migration/services/wordbookmigration.cxx @@ -177,7 +177,7 @@ bool IsUserWordbook( const ::rtl::OUString& rFile ) bRet = true; else { - USHORT nLen; + sal_uInt16 nLen; pStream->Seek (nSniffPos); *pStream >> nLen; if ( nLen < MAX_HEADER_LENGTH ) diff --git a/desktop/source/migration/services/wordbookmigration.hxx b/desktop/source/migration/services/wordbookmigration.hxx index 8b04417dba..8b04417dba 100644..100755 --- a/desktop/source/migration/services/wordbookmigration.hxx +++ b/desktop/source/migration/services/wordbookmigration.hxx diff --git a/desktop/source/migration/wizard.cxx b/desktop/source/migration/wizard.cxx new file mode 100755 index 0000000000..47f3fcda50 --- /dev/null +++ b/desktop/source/migration/wizard.cxx @@ -0,0 +1,603 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include <migration.hxx> +#include "wizard.hxx" +#include "wizard.hrc" +#include "pages.hxx" +#include "app.hxx" + +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> +#include <rtl/string.hxx> +#include <rtl/strbuf.hxx> +#include <rtl/bootstrap.hxx> + +#include <comphelper/processfactory.hxx> +#include <tools/date.hxx> +#include <tools/time.hxx> +#include <tools/datetime.hxx> +#include <osl/file.hxx> +#include <osl/time.h> +#include <osl/module.hxx> +#include <unotools/bootstrap.hxx> +#include <vcl/msgbox.hxx> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/util/XChangesBatch.hpp> +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/awt/WindowDescriptor.hpp> +#include <com/sun/star/awt/WindowAttribute.hpp> + +using namespace svt; +using namespace rtl; +using namespace osl; +using namespace utl; +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::lang; +using namespace com::sun::star::beans; +using namespace com::sun::star::util; +using namespace com::sun::star::container; + +#define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) + +namespace desktop +{ + +const FirstStartWizard::WizardState FirstStartWizard::STATE_WELCOME = 0; +const FirstStartWizard::WizardState FirstStartWizard::STATE_LICENSE = 1; +const FirstStartWizard::WizardState FirstStartWizard::STATE_MIGRATION = 2; +const FirstStartWizard::WizardState FirstStartWizard::STATE_USER = 3; +const FirstStartWizard::WizardState FirstStartWizard::STATE_UPDATE_CHECK = 4; +const FirstStartWizard::WizardState FirstStartWizard::STATE_REGISTRATION = 5; + +static sal_Int32 getBuildId() +{ + ::rtl::OUString aDefault; + ::rtl::OUString aBuildIdData = utl::Bootstrap::getBuildIdData( aDefault ); + sal_Int32 nBuildId( 0 ); + sal_Int32 nIndex1 = aBuildIdData.indexOf(':'); + sal_Int32 nIndex2 = aBuildIdData.indexOf(')'); + if (( nIndex1 > 0 ) && ( nIndex2 > 0 ) && ( nIndex2-1 > nIndex1+1 )) + { + ::rtl::OUString aBuildId = aBuildIdData.copy( nIndex1+1, nIndex2-nIndex1-1 ); + nBuildId = aBuildId.toInt32(); + } + return nBuildId; +} + +WizardResId::WizardResId( sal_uInt16 nId ) : + ResId( nId, *FirstStartWizard::GetResManager() ) +{ +} + +ResMgr *FirstStartWizard::pResMgr = 0; + +ResMgr *FirstStartWizard::GetResManager() +{ + if ( !FirstStartWizard::pResMgr ) + { + String aMgrName = String::CreateFromAscii( "dkt" ); + FirstStartWizard::pResMgr = ResMgr::CreateResMgr( OUStringToOString( aMgrName, RTL_TEXTENCODING_UTF8 )); + } + return FirstStartWizard::pResMgr; +} + +FirstStartWizard::FirstStartWizard( Window* pParent, sal_Bool bLicenseNeedsAcceptance, const rtl::OUString &rLicensePath ) + :RoadmapWizard( pParent, WizardResId(DLG_FIRSTSTART_WIZARD), + WZB_NEXT|WZB_PREVIOUS|WZB_FINISH|WZB_CANCEL|WZB_HELP) + ,m_bOverride(sal_False) + ,m_aDefaultPath(0) + ,m_aMigrationPath(0) + ,m_bDone(sal_False) + ,m_bLicenseNeedsAcceptance( bLicenseNeedsAcceptance ) + ,m_bLicenseWasAccepted(sal_False) + ,m_bAutomaticUpdChk(sal_True) + ,m_aThrobber(this, WizardResId(CTRL_THROBBER)) + ,m_aLicensePath( rLicensePath ) +{ + FreeResource(); + // --- +// enableState(STATE_USER, sal_False); +// enableState(STATE_REGISTRATION, sal_False); + + Size aTPSize(TP_WIDTH, TP_HEIGHT); + SetPageSizePixel(LogicToPixel(aTPSize, MAP_APPFONT)); + + //set help id + m_pPrevPage->SetHelpId(HID_FIRSTSTART_PREV); + m_pNextPage->SetHelpId(HID_FIRSTSTART_NEXT); + m_pCancel->SetHelpId(HID_FIRSTSTART_CANCEL); + m_pFinish->SetHelpId(HID_FIRSTSTART_FINISH); + // m_pHelp->SetUniqueId(UID_FIRSTSTART_HELP); + m_pHelp->Hide(); + m_pHelp->Disable(); + + // save button lables + m_sNext = m_pNextPage->GetText(); + m_sCancel = m_pCancel->GetText(); + + // save cancel click handler + m_lnkCancel = m_pCancel->GetClickHdl(); + + m_aDefaultPath = defineWizardPagesDependingFromContext(); + activatePath(m_aDefaultPath, sal_True); + + ActivatePage(); + + // set text of finish putton: + m_pFinish->SetText(String(WizardResId(STR_FINISH))); + // disable "finish button" + enableButtons(WZB_FINISH, sal_False); + defaultButton(WZB_NEXT); +} + +void FirstStartWizard::DisableButtonsWhileMigration() +{ + enableButtons(0xff, sal_False); +} + +::svt::RoadmapWizardTypes::PathId FirstStartWizard::defineWizardPagesDependingFromContext() +{ + ::svt::RoadmapWizardTypes::PathId aDefaultPath = 0; + + sal_Bool bPage_Welcome = sal_True; + sal_Bool bPage_License = sal_True; + sal_Bool bPage_Migration = sal_True; + sal_Bool bPage_User = sal_True; + sal_Bool bPage_UpdateCheck = sal_True; + sal_Bool bPage_Registration = sal_True; + + bPage_License = m_bLicenseNeedsAcceptance; + bPage_Migration = Migration::checkMigration(); + bPage_UpdateCheck = showOnlineUpdatePage(); + + WizardPath aPath; + if (bPage_Welcome) + aPath.push_back(STATE_WELCOME); + if (bPage_License) + aPath.push_back(STATE_LICENSE); + if (bPage_Migration) + aPath.push_back(STATE_MIGRATION); + if (bPage_User) + aPath.push_back(STATE_USER); + if (bPage_UpdateCheck) + aPath.push_back(STATE_UPDATE_CHECK); + if (bPage_Registration) + aPath.push_back(STATE_REGISTRATION); + + declarePath(aDefaultPath, aPath); + + // a) If license must be accepted by the user, all direct links + // to wizard tab pages must be disabled. Because such pages + // should be accessible only in case license was accepted ! + // b) But if no license should be shown at all ... + // such direct links can be enabled by default. + sal_Bool bAllowDirectLink = ( ! bPage_License); + + if (bPage_User) + enableState(STATE_USER, bAllowDirectLink); + if (bPage_UpdateCheck) + enableState(STATE_UPDATE_CHECK, bAllowDirectLink); + if (bPage_Migration) + enableState(STATE_MIGRATION, bAllowDirectLink); + if (bPage_Registration) + enableState(STATE_REGISTRATION, bAllowDirectLink); + + return aDefaultPath; +} + +// catch F1 and disable help +long FirstStartWizard::PreNotify( NotifyEvent& rNEvt ) +{ + if( rNEvt.GetType() == EVENT_KEYINPUT ) + { + const KeyCode& rKey = rNEvt.GetKeyEvent()->GetKeyCode(); + if( rKey.GetCode() == KEY_F1 && ! rKey.GetModifier() ) + return sal_True; + } + return RoadmapWizard::PreNotify(rNEvt); +} + + +void FirstStartWizard::enterState(WizardState _nState) +{ + RoadmapWizard::enterState(_nState); + // default state + // all on + enableButtons(0xff, sal_True); + // finish off + enableButtons(WZB_FINISH, sal_False); + // default text + m_pCancel->SetText(m_sCancel); + m_pCancel->SetClickHdl(m_lnkCancel); + m_pNextPage->SetText(m_sNext); + + // default + defaultButton(WZB_NEXT); + + // specialized state + switch (_nState) + { + case STATE_WELCOME: + enableButtons(WZB_PREVIOUS, sal_False); + break; + case STATE_LICENSE: + m_pCancel->SetText(String(WizardResId(STR_LICENSE_DECLINE))); + m_pNextPage->SetText(String(WizardResId(STR_LICENSE_ACCEPT))); + enableButtons(WZB_NEXT, sal_False); + // attach warning dialog to cancel/decline button + m_pCancel->SetClickHdl( LINK(this, FirstStartWizard, DeclineHdl) ); + break; + case STATE_REGISTRATION: + enableButtons(WZB_NEXT, sal_False); + enableButtons(WZB_FINISH, sal_True); + defaultButton(WZB_FINISH); + break; + } + + // focus + +} + +IMPL_LINK( FirstStartWizard, DeclineHdl, PushButton *, EMPTYARG ) +{ + QueryBox aBox(this, WizardResId(QB_ASK_DECLINE)); + sal_Int32 ret = aBox.Execute(); + if ( ret == BUTTON_OK || ret == BUTTON_YES) + { + Close(); + return sal_False; + } + else + return sal_True; +} + + +TabPage* FirstStartWizard::createPage(WizardState _nState) +{ + TabPage *pTabPage = 0; + switch (_nState) + { + case STATE_WELCOME: + pTabPage = new WelcomePage(this, WizardResId(TP_WELCOME), m_bLicenseNeedsAcceptance); + break; + case STATE_LICENSE: + pTabPage = new LicensePage(this, WizardResId(TP_LICENSE), m_aLicensePath); + break; + case STATE_MIGRATION: + pTabPage = new MigrationPage(this, WizardResId(TP_MIGRATION), m_aThrobber); + break; + case STATE_USER: + pTabPage = new UserPage(this, WizardResId(TP_USER)); + break; + case STATE_UPDATE_CHECK: + pTabPage = new UpdateCheckPage(this, WizardResId(TP_UPDATE_CHECK)); + break; + case STATE_REGISTRATION: + pTabPage = new RegistrationPage(this, WizardResId(TP_REGISTRATION)); + break; + } + pTabPage->Show(); + + return pTabPage; +} + +String FirstStartWizard::getStateDisplayName( WizardState _nState ) const +{ + String sName; + switch(_nState) + { + case STATE_WELCOME: + sName = String(WizardResId(STR_STATE_WELCOME)); + break; + case STATE_LICENSE: + sName = String(WizardResId(STR_STATE_LICENSE)); + break; + case STATE_MIGRATION: + sName = String(WizardResId(STR_STATE_MIGRATION)); + break; + case STATE_USER: + sName = String(WizardResId(STR_STATE_USER)); + break; + case STATE_UPDATE_CHECK: + sName = String(WizardResId(STR_STATE_UPDATE_CHECK)); + break; + case STATE_REGISTRATION: + sName = String(WizardResId(STR_STATE_REGISTRATION)); + break; + } + return sName; +} + +sal_Bool FirstStartWizard::prepareLeaveCurrentState( CommitPageReason _eReason ) +{ + // the license acceptance is handled here, because it needs to change the state + // of the roadmap wizard which the page implementation does not know. + if ( + (_eReason == eTravelForward) && + (getCurrentState() == STATE_LICENSE ) && + (m_bLicenseWasAccepted == sal_False ) + ) + { + if (Migration::checkMigration()) + enableState(FirstStartWizard::STATE_MIGRATION, sal_True); + if ( showOnlineUpdatePage() ) + enableState(FirstStartWizard::STATE_UPDATE_CHECK, sal_True); + enableState(FirstStartWizard::STATE_USER, sal_True); + enableState(FirstStartWizard::STATE_REGISTRATION, sal_True); + + storeAcceptDate(); + m_bLicenseWasAccepted = sal_True; + } + + return svt::RoadmapWizard::prepareLeaveCurrentState(_eReason); +} + +sal_Bool FirstStartWizard::leaveState(WizardState) +{ + if (( getCurrentState() == STATE_MIGRATION ) && m_bLicenseWasAccepted ) + { + // Store accept date and patch level now as it has been + // overwritten by the migration process! + storeAcceptDate(); + setPatchLevel(); + } + + return sal_True; +} + +sal_Bool FirstStartWizard::onFinish() +{ + // return sal_True; + if ( svt::RoadmapWizard::onFinish() ) + { +#ifndef OS2 // cannot enable quickstart on first startup, see shutdownicon.cxx comments. + enableQuickstart(); +#endif + disableWizard(); + return sal_True; + } + else + return sal_False; +} + +short FirstStartWizard::Execute() +{ + return svt::RoadmapWizard::Execute(); +} + +static OUString _makeDateTimeString (const DateTime& aDateTime, sal_Bool bUTC = sal_False) +{ + OStringBuffer aDateTimeString; + aDateTimeString.append((sal_Int32)aDateTime.GetYear()); + aDateTimeString.append("-"); + if (aDateTime.GetMonth()<10) aDateTimeString.append("0"); + aDateTimeString.append((sal_Int32)aDateTime.GetMonth()); + aDateTimeString.append("-"); + if (aDateTime.GetDay()<10) aDateTimeString.append("0"); + aDateTimeString.append((sal_Int32)aDateTime.GetDay()); + aDateTimeString.append("T"); + if (aDateTime.GetHour()<10) aDateTimeString.append("0"); + aDateTimeString.append((sal_Int32)aDateTime.GetHour()); + aDateTimeString.append(":"); + if (aDateTime.GetMin()<10) aDateTimeString.append("0"); + aDateTimeString.append((sal_Int32)aDateTime.GetMin()); + aDateTimeString.append(":"); + if (aDateTime.GetSec()<10) aDateTimeString.append("0"); + aDateTimeString.append((sal_Int32)aDateTime.GetSec()); + if (bUTC) aDateTimeString.append("Z"); + + return OStringToOUString(aDateTimeString.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); +} + +static OUString _getCurrentDateString() +{ + OUString aString; + return _makeDateTimeString(DateTime()); +} + + +static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); +static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ); +static const OUString sReadSrvc ( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" ) ); + +void FirstStartWizard::storeAcceptDate() +{ + + try { + Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + // get configuration provider + Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( + xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); + Sequence< Any > theArgs(1); + NamedValue v(OUString::createFromAscii("NodePath"), + makeAny(OUString::createFromAscii("org.openoffice.Setup/Office"))); + theArgs[0] <<= v; + Reference< XPropertySet > pset = Reference< XPropertySet >( + theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); + Any result = pset->getPropertyValue(OUString::createFromAscii("LicenseAcceptDate")); + + OUString aAcceptDate = _getCurrentDateString(); + pset->setPropertyValue(OUString::createFromAscii("LicenseAcceptDate"), makeAny(aAcceptDate)); + Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges(); + + // since the license is accepted the local user registry can be cleaned if required + cleanOldOfficeRegKeys(); + } catch (const Exception&) + { + } + +} + +void FirstStartWizard::setPatchLevel() +{ + try { + Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + // get configuration provider + Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( + xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); + Sequence< Any > theArgs(1); + NamedValue v(OUString::createFromAscii("NodePath"), + makeAny(OUString::createFromAscii("org.openoffice.Office.Common/Help/Registration"))); + theArgs[0] <<= v; + Reference< XPropertySet > pset = Reference< XPropertySet >( + theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); + Any result = pset->getPropertyValue(OUString::createFromAscii("ReminderDate")); + + OUString aPatchLevel( RTL_CONSTASCII_USTRINGPARAM( "Patch" )); + aPatchLevel += OUString::valueOf( getBuildId(), 10 ); + pset->setPropertyValue(OUString::createFromAscii("ReminderDate"), makeAny(aPatchLevel)); + Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges(); + } catch (const Exception&) + { + } +} + +#ifdef WNT +typedef int ( __stdcall * CleanCurUserRegProc ) ( wchar_t* ); +#endif + +void FirstStartWizard::cleanOldOfficeRegKeys() +{ +#ifdef WNT + // after the wizard is completed clean OOo1.1.x entries in the current user registry if required + // issue i47658 + + OUString aBaseLocationPath; + OUString aSharedLocationPath; + OUString aInstallMode; + + ::utl::Bootstrap::PathStatus aBaseLocateResult = + ::utl::Bootstrap::locateBaseInstallation( aBaseLocationPath ); + ::utl::Bootstrap::PathStatus aSharedLocateResult = + ::utl::Bootstrap::locateSharedData( aSharedLocationPath ); + aInstallMode = ::utl::Bootstrap::getAllUsersValue( ::rtl::OUString() ); + + // TODO: replace the checking for install mode + if ( aBaseLocateResult == ::utl::Bootstrap::PATH_EXISTS && aSharedLocateResult == ::utl::Bootstrap::PATH_EXISTS + && aInstallMode.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "1" ) ) ) ) + { + ::rtl::OUString aDeregCompletePath = + aBaseLocationPath + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/program/regcleanold.dll" ) ); + ::rtl::OUString aExecCompletePath = + aSharedLocationPath + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/regdeinstall/userdeinst.exe" ) ); + + osl::Module aCleanModule( aDeregCompletePath ); + CleanCurUserRegProc pNativeProc = ( CleanCurUserRegProc )( + aCleanModule.getFunctionSymbol( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CleanCurUserOldSystemRegistry" ) ) ) ); + + if( pNativeProc!=NULL ) + { + ::rtl::OUString aExecCompleteSysPath; + if ( osl::File::getSystemPathFromFileURL( aExecCompletePath, aExecCompleteSysPath ) == FileBase::E_None + && aExecCompleteSysPath.getLength() ) + { + ( *pNativeProc )( (wchar_t*)( aExecCompleteSysPath.getStr() ) ); + } + } + } +#endif +} + +void FirstStartWizard::disableWizard() +{ + + try { + Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + // get configuration provider + Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( + xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); + Sequence< Any > theArgs(1); + NamedValue v(OUString::createFromAscii("NodePath"), + makeAny(OUString::createFromAscii("org.openoffice.Setup/Office"))); + theArgs[0] <<= v; + Reference< XPropertySet > pset = Reference< XPropertySet >( + theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); + pset->setPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted"), makeAny(sal_True)); + Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges(); + } catch (const Exception&) + { + } + +} + + +void FirstStartWizard::enableQuickstart() +{ + sal_Bool bQuickstart( sal_True ); + sal_Bool bAutostart( sal_True ); + Sequence< Any > aSeq( 2 ); + aSeq[0] <<= bQuickstart; + aSeq[1] <<= bAutostart; + + Reference < XInitialization > xQuickstart( ::comphelper::getProcessServiceFactory()->createInstance( + OUString::createFromAscii( "com.sun.star.office.Quickstart" )),UNO_QUERY ); + if ( xQuickstart.is() ) + xQuickstart->initialize( aSeq ); + +} + +sal_Bool FirstStartWizard::showOnlineUpdatePage() +{ + try { + Reference < XNameReplace > xUpdateAccess; + Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + + xUpdateAccess = Reference < XNameReplace >( + xFactory->createInstance( UNISTRING( "com.sun.star.setup.UpdateCheckConfig" ) ), UNO_QUERY_THROW ); + + if ( xUpdateAccess.is() ) + { + sal_Bool bAutoUpdChk = sal_False; + Any result = xUpdateAccess->getByName( UNISTRING( "AutoCheckEnabled" ) ); + result >>= bAutoUpdChk; + if ( bAutoUpdChk == sal_False ) + return sal_True; + else + return sal_False; + } + } catch (const Exception&) + { + } + return sal_False; +} + +} diff --git a/desktop/source/migration/wizard.hrc b/desktop/source/migration/wizard.hrc new file mode 100755 index 0000000000..8ba9c89d7e --- /dev/null +++ b/desktop/source/migration/wizard.hrc @@ -0,0 +1,100 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "desktop.hrc" +#include "helpid.hrc" + +#define TP_WIDTH 220 +#define TP_HEIGHT 205 + +#define DLG_FIRSTSTART_WIZARD RID_FIRSTSTSTART_START+1 + // FREE +#define TP_WELCOME RID_FIRSTSTSTART_START+3 +#define TP_REGISTRATION RID_FIRSTSTSTART_START+4 +#define TP_MIGRATION RID_FIRSTSTSTART_START+5 +#define TP_USER RID_FIRSTSTSTART_START+6 +#define TP_LICENSE RID_FIRSTSTSTART_START+7 +#define TP_UPDATE_CHECK RID_FIRSTSTSTART_START+8 +#define ERRBOX_REG_NOSYSBROWSER RID_FIRSTSTSTART_START+29 +#define QB_ASK_DECLINE RID_FIRSTSTSTART_START+30 + +// local resIDs + +#define FT_WELCOME_HEADER 1 +#define FT_WELCOME_BODY 2 +#define FT_LICENSE_HEADER 1 +#define FT_LICENSE_BODY_1 2 +#define FT_LICENSE_BODY_1_TXT 3 +#define FT_LICENSE_BODY_2 4 +#define FT_LICENSE_BODY_2_TXT 5 +#define ML_LICENSE 6 +#define PB_LICENSE_DOWN 7 +#define FT_MIGRATION_HEADER 1 +#define FT_MIGRATION_BODY 2 +#define CB_MIGRATION 3 +#define FT_UPDATE_CHECK_HEADER 1 +#define FT_UPDATE_CHECK_BODY 2 +#define CB_UPDATE_CHECK 3 +#define FT_REGISTRATION_HEADER 1 +#define FT_REGISTRATION_BODY 2 +#define FL_REGISTRATION 3 +#define FT_REGISTRATION_END 4 +#define RB_REGISTRATION_NOW 5 +#define RB_REGISTRATION_LATER 6 +#define RB_REGISTRATION_NEVER 7 +#define RB_REGISTRATION_REG 8 +#define IMG_REGISTRATION 9 +#define FT_USER_HEADER 10 +#define FT_USER_BODY 11 +#define FT_USER_FIRST 12 +#define FT_USER_LAST 13 +#define FT_USER_FATHER 14 +#define FT_USER_INITIALS 15 +#define ED_USER_FIRST 16 +#define ED_USER_LAST 17 +#define ED_USER_FATHER 18 +#define ED_USER_INITIALS 19 +#define TR_WAITING 20 +#define CTRL_THROBBER 21 + +// global strings +#define STR_STATE_WELCOME RID_FIRSTSTSTART_START+100 +#define STR_STATE_LICENSE RID_FIRSTSTSTART_START+101 +#define STR_STATE_MIGRATION RID_FIRSTSTSTART_START+102 +#define STR_STATE_REGISTRATION RID_FIRSTSTSTART_START+103 +#define STR_WELCOME_MIGRATION RID_FIRSTSTSTART_START+104 +// FREE RID_FIRSTSTSTART_START+105 +// FREE RID_FIRSTSTSTART_START+106 +#define STR_LICENSE_ACCEPT RID_FIRSTSTSTART_START+107 +#define STR_LICENSE_DECLINE RID_FIRSTSTSTART_START+108 +#define STR_FINISH RID_FIRSTSTSTART_START+109 +#define STR_STATE_USER RID_FIRSTSTSTART_START+110 +// FREE RID_FIRSTSTSTART_START+111 +#define STR_STATE_UPDATE_CHECK RID_FIRSTSTSTART_START+112 +#define STR_WELCOME_WITHOUT_LICENSE RID_FIRSTSTSTART_START+113 +#define STR_REGISTRATION_OOO RID_FIRSTSTSTART_START+114 + diff --git a/desktop/source/migration/wizard.hxx b/desktop/source/migration/wizard.hxx new file mode 100755 index 0000000000..7a9681a30f --- /dev/null +++ b/desktop/source/migration/wizard.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _WIZARD_HXX_ +#define _WIZARD_HXX_ + +#include <rtl/ustring.hxx> +#include <svtools/roadmapwizard.hxx> +#include <vcl/throbber.hxx> +#include <tools/resid.hxx> + +namespace desktop +{ + +class WizardResId : public ResId +{ +public: + WizardResId( sal_uInt16 nId ); +}; + +class FirstStartWizard : public svt::RoadmapWizard +{ + +public: + static const WizardState STATE_WELCOME; + static const WizardState STATE_LICENSE; + static const WizardState STATE_MIGRATION; + static const WizardState STATE_USER; + static const WizardState STATE_UPDATE_CHECK; + static const WizardState STATE_REGISTRATION; + + static ResMgr* pResMgr; + static ResMgr* GetResManager(); + + FirstStartWizard( Window* pParent, sal_Bool bLicenseNeedsAcceptance, const rtl::OUString &rLicensePath ); + + virtual short Execute(); + virtual long PreNotify( NotifyEvent& rNEvt ); + + void DisableButtonsWhileMigration(); + +private: + sal_Bool m_bOverride; + WizardState _currentState; + ::svt::RoadmapWizardTypes::PathId m_aDefaultPath; + ::svt::RoadmapWizardTypes::PathId m_aMigrationPath; + String m_sNext; + String m_sCancel; + sal_Bool m_bDone; + sal_Bool m_bLicenseNeedsAcceptance; + sal_Bool m_bLicenseWasAccepted; + sal_Bool m_bAutomaticUpdChk; + Link m_lnkCancel; + Throbber m_aThrobber; + + rtl::OUString m_aLicensePath; + + void storeAcceptDate(); + void setPatchLevel(); + void disableWizard(); + void enableQuickstart(); + + DECL_LINK(DeclineHdl, PushButton*); + + void cleanOldOfficeRegKeys(); + sal_Bool showOnlineUpdatePage(); + ::svt::RoadmapWizardTypes::PathId defineWizardPagesDependingFromContext(); + +protected: + // from svt::WizardMachine + virtual TabPage* createPage(WizardState _nState); + virtual sal_Bool prepareLeaveCurrentState( CommitPageReason _eReason ); + virtual sal_Bool leaveState(WizardState _nState ); + virtual sal_Bool onFinish(); + virtual void enterState(WizardState _nState); + + // from svt::RoadmapWizard + virtual String getStateDisplayName( WizardState _nState ) const; +}; +} +#endif diff --git a/desktop/source/migration/wizard.src b/desktop/source/migration/wizard.src new file mode 100755 index 0000000000..4f98ce91bb --- /dev/null +++ b/desktop/source/migration/wizard.src @@ -0,0 +1,442 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + /* + * encoding for resources: windows-1252 + */ + +#include "wizard.hrc" +#include <svtools/controldims.hrc> + +ModalDialog DLG_FIRSTSTART_WIZARD +{ + Text [ en-US ] = "Welcome to %PRODUCTNAME %PRODUCTVERSION"; + + OutputSize = TRUE ; + SVLook = TRUE ; + Moveable = TRUE ; + Closeable = TRUE ; + Hide = TRUE; + HelpID = HID_FIRSTSTART_DIALOG; + + FixedImage CTRL_THROBBER + { + Pos = MAP_APPFONT( 5, 210 ); + Size = MAP_APPFONT( 11, 11 ); + Hide = TRUE; + }; +}; + +String STR_STATE_WELCOME +{ + Text [ en-US ] = "Welcome"; +}; +String STR_STATE_LICENSE +{ + Text [ en-US ] = "License Agreement"; +}; +String STR_STATE_MIGRATION +{ + Text [ en-US ] = "Personal Data"; +}; +String STR_STATE_USER +{ + Text [ en-US ] = "User name"; +}; + +String STR_STATE_UPDATE_CHECK +{ + Text [ en-US ] = "Online Update"; +}; + +String STR_STATE_REGISTRATION +{ + Text [ en-US ] = "Registration"; +}; + +String STR_WELCOME_MIGRATION +{ + Text [ en-US ] = "This wizard will guide you through the license agreement, the transfer of user data from %OLD_VERSION and the registration of %PRODUCTNAME.\n\nClick 'Next' to continue."; + +}; + +String STR_WELCOME_WITHOUT_LICENSE +{ + Text [ en-US ] = "This wizard will guide you through the registration of %PRODUCTNAME.\n\nClick 'Next' to continue."; +}; + +String STR_FINISH +{ + Text [ en-US ] = "~Finish"; +}; + +String STR_REGISTRATION_OOO +{ + Text [ en-US ] = "You now have the opportunity to support and contribute to the fastest growing open source community in the world.\n\nHelp us prove that %PRODUCTNAME has already gained significant market share by registering.\n\nRegistering is voluntary and without obligation."; +}; + +ErrorBox ERRBOX_REG_NOSYSBROWSER +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + + Message [ en-US ] = "An error occurred in starting the web browser.\nPlease check the %PRODUCTNAME and web browser settings."; +}; + +QueryBox QB_ASK_DECLINE +{ + Buttons = WB_YES_NO; + DefButton = WB_DEF_NO; + + Message [ en-US ] = "Do you really want to decline?"; +}; + + +#define ROWHEIGHT 8 +#define MARGINLEFT 10 +#define MARGINRIGHT 10 +#define BODYWIDTH TP_WIDTH-MARGINLEFT-MARGINRIGHT +#define MARGINTOP 10 +#define MARGINBOTTOM 2 +#define BODYHEIGHT TP_HEIGHT-MARGINTOP-MARGINBOTTOM +#define INDENT 10 +#define INDENT2 12 + +TabPage TP_WELCOME +{ + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT(TP_WIDTH, TP_HEIGHT); + HelpID = HID_FIRSTSTART_WELCOME; + // bold fixedtext for header + FixedText FT_WELCOME_HEADER + { + NoLabel = TRUE; + Pos = MAP_APPFONT(MARGINRIGHT, MARGINTOP); + Size = MAP_APPFONT( BODYWIDTH, ROWHEIGHT ); + Text [ en-US ] = "Welcome to %PRODUCTNAME %PRODUCTVERSION"; + }; + FixedText FT_WELCOME_BODY + { + NoLabel = TRUE; + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP + 2*ROWHEIGHT); + Size = MAP_APPFONT( BODYWIDTH, BODYHEIGHT-MARGINTOP - 2*ROWHEIGHT ); + WordBreak = TRUE; + Text [ en-US ] = "This wizard will guide you through the license agreement and the registration of %PRODUCTNAME.\n\nClick 'Next' to continue."; + }; +}; + +TabPage TP_LICENSE +{ + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT(TP_WIDTH, TP_HEIGHT); + HelpID = HID_FIRSTSTART_LICENSE; + FixedText FT_LICENSE_HEADER + { + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP); + Size = MAP_APPFONT( BODYWIDTH, ROWHEIGHT ); + NoLabel = TRUE; + Text [ en-US ] = "Please follow these steps to accept the license"; + }; + FixedText FT_LICENSE_BODY_1 + { + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP + 2*ROWHEIGHT); + Size = MAP_APPFONT( INDENT, ROWHEIGHT ); + NoLabel = TRUE; + Text [ en-US ] = "1."; + }; + FixedText FT_LICENSE_BODY_1_TXT + { + Pos = MAP_APPFONT(MARGINLEFT+INDENT, MARGINTOP +2*ROWHEIGHT); + Size = MAP_APPFONT( BODYWIDTH-INDENT, 3*ROWHEIGHT); + WordBreak = TRUE; + NoLabel = TRUE; + Text [ en-US ] = "View the complete License Agreement. Please use the scrollbar or the '%PAGEDOWN' button in this dialog to view the entire license text."; + }; + FixedText FT_LICENSE_BODY_2 + { + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP + 5*ROWHEIGHT); + Size = MAP_APPFONT(INDENT, ROWHEIGHT ); + NoLabel = TRUE; + Text [ en-US ] = "2."; + }; + FixedText FT_LICENSE_BODY_2_TXT + { + Pos = MAP_APPFONT(MARGINLEFT+INDENT, MARGINTOP + 5*ROWHEIGHT); + Size = MAP_APPFONT( BODYWIDTH-INDENT, 2*ROWHEIGHT); + WordBreak = TRUE; + NoLabel = TRUE; + Text [ en-US ] = "Click 'Accept' to accept the terms of the Agreement."; + }; + MultiLineEdit ML_LICENSE + { + HelpID = "desktop:MultiLineEdit:TP_LICENSE:ML_LICENSE"; + PosSize = MAP_APPFONT (MARGINLEFT+INDENT, MARGINTOP + 8*ROWHEIGHT, BODYWIDTH-INDENT , BODYHEIGHT - 8*ROWHEIGHT - 20-2*MARGINBOTTOM) ; + Border = TRUE; + VScroll = TRUE; + ReadOnly = TRUE; + }; + PushButton PB_LICENSE_DOWN + { + HelpID = "desktop:PushButton:TP_LICENSE:PB_LICENSE_DOWN"; + TabStop = TRUE ; + Pos = MAP_APPFONT ( TP_WIDTH-MARGINRIGHT-50 , TP_HEIGHT-MARGINBOTTOM-18 ) ; + Size = MAP_APPFONT ( 50, 15 ) ; + Text [ en-US ] = "Scroll Do~wn"; + }; +}; + +String STR_LICENSE_ACCEPT +{ + Text [ en-US ] = "~Accept"; +}; +String STR_LICENSE_DECLINE +{ + Text [ en-US ] = "~Decline"; +}; + + +TabPage TP_MIGRATION +{ + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT(TP_WIDTH, TP_HEIGHT); + HelpID = HID_FIRSTSTART_MIGRATION; + + FixedText FT_MIGRATION_HEADER + { + NoLabel = TRUE; + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP); + Size = MAP_APPFONT( BODYWIDTH, ROWHEIGHT ); + Text [ en-US ] = "Transfer personal data"; + + }; + + FixedText FT_MIGRATION_BODY + { + NoLabel = TRUE; + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP+ROWHEIGHT*2); + Size = MAP_APPFONT(BODYWIDTH, ROWHEIGHT*8); + WordBreak = TRUE; + Text [ en-US ] = "Most personal data from %OLDPRODUCT installation can be reused in %PRODUCTNAME %PRODUCTVERSION.\n\nIf you do not want to reuse any settings in %PRODUCTNAME %PRODUCTVERSION, unmark the check box."; + + }; + + CheckBox CB_MIGRATION + { + HelpID = "desktop:CheckBox:TP_MIGRATION:CB_MIGRATION"; + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP+ROWHEIGHT*10); + Size = MAP_APPFONT(BODYWIDTH, ROWHEIGHT*2); + Check = TRUE; + Text [ en-US ] = "Transfer personal data"; + }; +}; + +TabPage TP_UPDATE_CHECK +{ + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT(TP_WIDTH, TP_HEIGHT); + HelpID = HID_FIRSTSTART_UPDATE_CHECK; + + FixedText FT_UPDATE_CHECK_HEADER + { + NoLabel = TRUE; + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP); + Size = MAP_APPFONT( BODYWIDTH, ROWHEIGHT ); + Text [ en-US ] = "Online Update"; + + }; + + FixedText FT_UPDATE_CHECK_BODY + { + NoLabel = TRUE; + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP+ROWHEIGHT*2); + Size = MAP_APPFONT(BODYWIDTH, ROWHEIGHT*8); + WordBreak = TRUE; + Text [ en-US ] = "%PRODUCTNAME searches automatically at regular intervals for new versions.\nIn doing so online update does not transfer personal data.\nAs soon as a new version is available, you will be notified.\n\nYou can configure this feature at Tools / Options... / %PRODUCTNAME / Online Update."; + + }; + + CheckBox CB_UPDATE_CHECK + { + HelpID = "desktop:CheckBox:TP_UPDATE_CHECK:CB_UPDATE_CHECK"; + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP+ROWHEIGHT*10); + Size = MAP_APPFONT(BODYWIDTH, ROWHEIGHT*2); + Check = TRUE; + Text [ en-US ] = "~Check for updates automatically"; + }; +}; + +#define USERINDENT 40 +#define EDHEIGHT 12 +#define INITIALSWIDTH 50 +#define FTADD 2 + +TabPage TP_USER +{ + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT(TP_WIDTH, TP_HEIGHT); + HelpID = HID_FIRSTSTART_USER; + + FixedText FT_USER_HEADER + { + NoLabel = TRUE; + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP); + Size = MAP_APPFONT( BODYWIDTH, ROWHEIGHT ); + Text [ en-US ] = "Provide your full name and initials below"; + + }; + + FixedText FT_USER_BODY + { + NoLabel = TRUE; + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP+ROWHEIGHT*2); + Size = MAP_APPFONT(BODYWIDTH, ROWHEIGHT*3); + WordBreak = TRUE; + Text [ en-US ] = "The user name will be used in the document properties, templates and when you record changes made to documents."; + }; + + + FixedText FT_USER_FIRST + { + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP+ROWHEIGHT*7+FTADD); + Size = MAP_APPFONT(USERINDENT, ROWHEIGHT); + Text [ en-US ] = "~First name"; + }; + Edit ED_USER_FIRST + { + HelpID = "desktop:Edit:TP_USER:ED_USER_FIRST"; + Border = TRUE; + Pos = MAP_APPFONT(MARGINLEFT+USERINDENT, MARGINTOP+ROWHEIGHT*7); + Size = MAP_APPFONT(BODYWIDTH-USERINDENT, EDHEIGHT); + }; + FixedText FT_USER_LAST + { + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP+ROWHEIGHT*9+FTADD); + Size = MAP_APPFONT(USERINDENT, ROWHEIGHT); + Text [ en-US ] = "~Last name"; + }; + Edit ED_USER_LAST + { + HelpID = "desktop:Edit:TP_USER:ED_USER_LAST"; + Border = TRUE; + Pos = MAP_APPFONT(MARGINLEFT+USERINDENT, MARGINTOP+ROWHEIGHT*9); + Size = MAP_APPFONT(BODYWIDTH-USERINDENT, EDHEIGHT); + }; + FixedText FT_USER_INITIALS + { + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP+ROWHEIGHT*11+FTADD); + Size = MAP_APPFONT(USERINDENT, ROWHEIGHT); + Text [ en-US ] = "~Initials"; + }; + Edit ED_USER_INITIALS + { + HelpID = "desktop:Edit:TP_USER:ED_USER_INITIALS"; + Border = TRUE; + Pos = MAP_APPFONT(MARGINLEFT+USERINDENT, MARGINTOP+ROWHEIGHT*11); + Size = MAP_APPFONT(INITIALSWIDTH, EDHEIGHT); + }; + + FixedText FT_USER_FATHER + { + Hide = TRUE; + Pos = MAP_APPFONT(MARGINLEFT+USERINDENT+INITIALSWIDTH+10, MARGINTOP+ROWHEIGHT*11+FTADD); + Size = MAP_APPFONT(USERINDENT, ROWHEIGHT); + Text [ en-US ] = "~Father's name"; + }; + Edit ED_USER_FATHER + { + HelpID = "desktop:Edit:TP_USER:ED_USER_FATHER"; + Border = TRUE; + Hide = TRUE; + Pos = MAP_APPFONT(MARGINLEFT+USERINDENT*2+INITIALSWIDTH+10, MARGINTOP+ROWHEIGHT*11); + Size = MAP_APPFONT(BODYWIDTH-10-USERINDENT*2-INITIALSWIDTH, EDHEIGHT); + }; +}; + +#define RB_HEIGHT (RSC_CD_CHECKBOX_HEIGHT+RSC_SP_GRP_SPACE_Y) + +TabPage TP_REGISTRATION +{ + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT(TP_WIDTH, TP_HEIGHT); + HelpID = HID_FIRSTSTART_REGISTRATION; + FixedText FT_REGISTRATION_HEADER + { + NoLabel = TRUE; + Text [ en-US ] = "%PRODUCTNAME Registration"; + Pos = MAP_APPFONT(MARGINLEFT, MARGINRIGHT); + Size = MAP_APPFONT(BODYWIDTH, MARGINRIGHT); + }; + FixedText FT_REGISTRATION_BODY + { + NoLabel = TRUE; + Text [ en-US ] = "You now have the opportunity to register as a %PRODUCTNAME user. Registration is voluntary and is without obligation.\n\nIf you register, we can inform you about new developments concerning this product."; + WordBreak = TRUE; + Pos = MAP_APPFONT(MARGINLEFT, MARGINTOP+ROWHEIGHT*2); + Size = MAP_APPFONT(BODYWIDTH, ROWHEIGHT*8); + }; + RadioButton RB_REGISTRATION_NOW + { + HelpID = "desktop:RadioButton:TP_REGISTRATION:RB_REGISTRATION_NOW"; + Text [ en-US ] = "I want to register ~now"; + Pos = MAP_APPFONT(MARGINLEFT+INDENT2, ROWHEIGHT*12+2); + Size = MAP_APPFONT(BODYWIDTH-INDENT2, RSC_CD_CHECKBOX_HEIGHT); + Check = TRUE; + }; + RadioButton RB_REGISTRATION_LATER + { + HelpID = "desktop:RadioButton:TP_REGISTRATION:RB_REGISTRATION_LATER"; + Text [ en-US ] = "I want to register ~later"; + Pos = MAP_APPFONT(MARGINLEFT+INDENT2, ROWHEIGHT*12+2+RB_HEIGHT); + Size = MAP_APPFONT(BODYWIDTH-INDENT2, RSC_CD_CHECKBOX_HEIGHT); + }; + RadioButton RB_REGISTRATION_NEVER + { + HelpID = "desktop:RadioButton:TP_REGISTRATION:RB_REGISTRATION_NEVER"; + Text [ en-US ] = "I do not want to ~register"; + Pos = MAP_APPFONT(MARGINLEFT+INDENT2, ROWHEIGHT*12+2+RB_HEIGHT*2); + Size = MAP_APPFONT(BODYWIDTH-INDENT2, RSC_CD_CHECKBOX_HEIGHT); + }; + FixedLine FL_REGISTRATION + { + Pos = MAP_APPFONT(MARGINLEFT, TP_HEIGHT-MARGINBOTTOM-ROWHEIGHT*6); + Size = MAP_APPFONT(BODYWIDTH, ROWHEIGHT); + }; + FixedText FT_REGISTRATION_END + { + NoLabel = TRUE; + Text [ en-US ] = "We hope you enjoy working with %PRODUCTNAME.\n\nTo exit the wizard, click 'Finish'."; + Pos = MAP_APPFONT(MARGINLEFT, TP_HEIGHT-MARGINBOTTOM-ROWHEIGHT*4); + Size = MAP_APPFONT(BODYWIDTH, ROWHEIGHT*4); + }; +}; + |