Kaydet (Commit) 287bc0aa authored tarafından Jan Holesovsky's avatar Jan Holesovsky

Kill the migration wizard for good.

Extends default-no-startup-wizard.diff and desktop-disable-startup-registration.diff.
üst 4843a465
......@@ -47,7 +47,7 @@
#include "userinstall.hxx"
#include "desktopcontext.hxx"
#include "exithelper.hxx"
#include "../migration/pages.hxx"
#include "../migration/migration.hxx"
#include <svtools/javacontext.hxx>
#include <com/sun/star/frame/XSessionManagerListener.hpp>
......@@ -1710,37 +1710,9 @@ void Desktop::Main()
bool bAbort = CheckExtensionDependencies();
if ( bAbort )
return;
// First Start Wizard allowed ?
if ( ! pCmdLineArgs->IsNoFirstStartWizard())
{
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ FirstStartWizard" );
if (IsFirstStartWizardNeeded())
{
::utl::RegOptions().removeReminder(); // remove patch registration reminder
Reference< XJob > xFirstStartJob( xSMgr->createInstance(
DEFINE_CONST_UNICODE( "com.sun.star.comp.desktop.FirstStart" ) ), UNO_QUERY );
if (xFirstStartJob.is())
{
sal_Bool bDone = sal_False;
Sequence< NamedValue > lArgs(2);
lArgs[0].Name = ::rtl::OUString::createFromAscii("LicenseNeedsAcceptance");
lArgs[0].Value <<= LicenseNeedsAcceptance();
lArgs[1].Name = ::rtl::OUString::createFromAscii("LicensePath");
lArgs[1].Value <<= GetLicensePath();
xFirstStartJob->execute(lArgs) >>= bDone;
if ( !bDone )
{
return;
}
}
}
else if ( RegistrationPage::hasReminderDateCome() )
RegistrationPage::executeSingleMode();
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} FirstStartWizard" );
}
if ( Migration::checkMigration() )
Migration::doMigration();
// keep a language options instance...
pLanguageOptions.reset( new SvtLanguageOptions(sal_True));
......
......@@ -45,14 +45,8 @@ CDEFS+=-I..$/app
SLOFILES = \
$(SLO)$/migration.obj \
$(SLO)$/wizard.obj \
$(SLO)$/pages.obj \
$(SLO)$/cfgfilter.obj
SRS1NAME= wizard
SRC1FILES= wizard.src
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
......
File mode changed from 100755 to 100644
/*************************************************************************
*
* 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 = 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 );
}
BOOL LicenseView::IsEndReached() const
{
BOOL bEndReached;
ExtTextView* pView = GetTextView();
ExtTextEngine* pEdit = GetTextEngine();
ULONG nHeight = pEdit->GetTextHeight();
Size aOutSize = pView->GetWindow()->GetOutputSizePixel();
Point aBottom( 0, aOutSize.Height() );
if ( (ULONG) pView->GetDocPos( aBottom ).Y() >= nHeight - 1 )
bEndReached = TRUE;
else
bEndReached = FALSE;
return bEndReached;
}
void LicenseView::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
if ( rHint.IsA( TYPE(TextHint) ) )
{
BOOL bLastVal = EndReached();
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,
::com::sun::star::uno::Reference< ::com::sun::star::awt::XThrobber > xThrobber)
: OWizardPage(parent, resid)
, m_ftHead(this, WizardResId(FT_MIGRATION_HEADER))
, m_ftBody(this, WizardResId(FT_MIGRATION_BODY))
, m_cbMigration(this, WizardResId(CB_MIGRATION))
, m_bMigrationDone(sal_False)
, m_xThrobber(xThrobber)
{
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();
uno::Reference< awt::XWindow > xWin( m_xThrobber, uno::UNO_QUERY );
xWin->setVisible( true );
m_xThrobber->start();
MigrationThread* pMigThread = new MigrationThread();
pMigThread->create();
while ( pMigThread->isRunning() )
{
Application::Reschedule();
}
m_xThrobber->stop();
GetParent()->LeaveWait();
// Next state will enable buttons - so no EnableButtons necessary!
xWin->setVisible( false );
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
/*************************************************************************
*
* 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/fixed.hxx>
#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
#include <vcl/scrbar.hxx>
#include <svtools/wizardmachine.hxx>
#include <svtools/svmedit.hxx>
#include <svl/lstner.hxx>
#include <svtools/xtextedt.hxx>
#include <com/sun/star/awt/XThrobber.hpp>
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
{
BOOL mbEndReached;
Link maEndReachedHdl;
Link maScrolledHdl;
public:
LicenseView( Window* pParent, const ResId& rResId );
~LicenseView();
void ScrollDown( ScrollType eScroll );
BOOL IsEndReached() const;
BOOL EndReached() const { return mbEndReached; }
void SetEndReached( 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;
sal_Bool m_bMigrationDone;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XThrobber > m_xThrobber;
public:
MigrationPage( svt::OWizardMachine* parent, const ResId& resid, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XThrobber > xThrobber );
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_
File mode changed from 100755 to 100644
/*************************************************************************
*
* 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 uno::Reference< uno::XComponentContext > getComponentContext( const uno::Reference< lang::XMultiServiceFactory >& rFactory )
{
uno::Reference< uno::XComponentContext > rContext;
uno::Reference< beans::XPropertySet > rPropSet( rFactory, uno::UNO_QUERY );
uno::Any a = rPropSet->getPropertyValue(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) );
a >>= rContext;
return rContext;
}
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( USHORT 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_aLicensePath( rLicensePath )
{
// ---
// FreeResource();
// enableState(STATE_USER, sal_False);
// enableState(STATE_REGISTRATION, sal_False);
try
{
Point pos(5, 210 );
Size size(11, 11 );
pos = LogicToPixel( pos, MAP_APPFONT );
size = LogicToPixel( size, MAP_APPFONT );
uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
uno::Reference< awt::XToolkit > xToolkit(
uno::Reference< lang::XMultiComponentFactory >(
xFactory, uno::UNO_QUERY_THROW)->
createInstanceWithContext(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")),
getComponentContext(xFactory)),
uno::UNO_QUERY_THROW);
m_xThrobber = uno::Reference< awt::XThrobber >(
xToolkit->createWindow(
awt::WindowDescriptor(
awt::WindowClass_SIMPLE,
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Throbber")),
GetComponentInterface(), 0,
awt::Rectangle(
pos.X(), pos.Y(), size.Width(), size.Height()),
awt::WindowAttribute::SHOW)),
uno::UNO_QUERY_THROW);
}
catch (uno::RuntimeException &)
{
throw;
}
catch (Exception& )
{
}
uno::Reference< awt::XWindow > xThrobberWin( m_xThrobber, uno::UNO_QUERY );
if ( xThrobberWin.is() )
xThrobberWin->setVisible( 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);
enterState(STATE_WELCOME);
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 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_xThrobber );
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;
}
}
/*************************************************************************
*
* 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
// 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
/*************************************************************************
*
* 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/window.hxx>
#include <tools/resid.hxx>
#include <com/sun/star/awt/XThrobber.hpp>
namespace desktop
{
class WizardResId : public ResId
{
public:
WizardResId( USHORT 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;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XThrobber > m_xThrobber;
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
/*************************************************************************
*
* 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;
};
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
{
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
{
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
{
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
{
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
{
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
{
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
{
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
{
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
{
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
{
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
{
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);
};
};
/*************************************************************************
*
* 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 "firststart.hxx"
#include "../migration/wizard.hxx"
#include <comphelper/sequenceashashmap.hxx>
using namespace rtl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
namespace desktop{
const char* FirstStart::interfaces[] =
{
"com.sun.star.task.XJob",
NULL,
};
const char* FirstStart::implementationName = "com.sun.star.comp.desktop.FirstStart";
const char* FirstStart::serviceName = "com.sun.star.task.Job";
OUString FirstStart::GetImplementationName()
{
return OUString( RTL_CONSTASCII_USTRINGPARAM( implementationName));
}
Sequence< OUString > FirstStart::GetSupportedServiceNames()
{
sal_Int32 nSize = (sizeof( interfaces ) / sizeof( const char *)) - 1;
Sequence< OUString > aResult( nSize );
for( sal_Int32 i = 0; i < nSize; i++ )
aResult[i] = OUString::createFromAscii( interfaces[i] );
return aResult;
}
Reference< XInterface > SAL_CALL FirstStart::CreateInstance(
const Reference< XMultiServiceFactory >& rSMgr )
{
static osl::Mutex aMutex;
osl::MutexGuard guard( aMutex );
return (XComponent*) ( new FirstStart( rSMgr ) );
}
FirstStart::FirstStart( const Reference< XMultiServiceFactory >& xFactory ) :
m_aListeners( m_aMutex ),
m_xServiceManager( xFactory )
{
}
FirstStart::~FirstStart()
{
}
// XComponent
void SAL_CALL FirstStart::dispose() throw ( RuntimeException )
{
EventObject aObject;
aObject.Source = (XComponent*)this;
m_aListeners.disposeAndClear( aObject );
}
void SAL_CALL FirstStart::addEventListener( const Reference< XEventListener > & aListener) throw ( RuntimeException )
{
m_aListeners.addInterface( aListener );
}
void SAL_CALL FirstStart::removeEventListener( const Reference< XEventListener > & aListener ) throw ( RuntimeException )
{
m_aListeners.removeInterface( aListener );
}
// XServiceInfo
::rtl::OUString SAL_CALL FirstStart::getImplementationName()
throw ( RuntimeException )
{
return FirstStart::GetImplementationName();
}
sal_Bool SAL_CALL FirstStart::supportsService( const ::rtl::OUString& rServiceName )
throw ( RuntimeException )
{
sal_Int32 nSize = sizeof( interfaces ) / sizeof( const char *);
for( sal_Int32 i = 0; i < nSize; i++ )
if ( rServiceName.equalsAscii( interfaces[i] ))
return sal_True;
return sal_False;
}
Sequence< ::rtl::OUString > SAL_CALL FirstStart::getSupportedServiceNames()
throw ( RuntimeException )
{
return FirstStart::GetSupportedServiceNames();
}
// XJob
Any SAL_CALL FirstStart::execute(const Sequence<NamedValue>& args)
throw ( RuntimeException )
{
static const ::rtl::OUString ARG_LICENSENEEDED( RTL_CONSTASCII_USTRINGPARAM( "LicenseNeedsAcceptance" ) );
static const ::rtl::OUString ARG_LICENSEPATH( RTL_CONSTASCII_USTRINGPARAM( "LicensePath" ) );
::comphelper::SequenceAsHashMap lArgs(args);
sal_Bool bLicenseNeeded = lArgs.getUnpackedValueOrDefault( ARG_LICENSENEEDED, (sal_Bool)sal_True );
rtl::OUString aLicensePath = lArgs.getUnpackedValueOrDefault( ARG_LICENSEPATH, rtl::OUString() );
FirstStartWizard fsw( NULL, bLicenseNeeded && ( aLicensePath.getLength() > 0 ), aLicensePath );
return makeAny( (sal_Bool)fsw.Execute() );
}
// XJobExecutor
void SAL_CALL FirstStart::trigger(const OUString&)
throw ( RuntimeException )
{
// trigger wizard with override, so it gets started regardless of
// configuration
Sequence<NamedValue> seq(1);
seq[0] = NamedValue(
OUString::createFromAscii("Override"),
makeAny(sal_True));
execute(seq);
}
} // namespace desktop
/*************************************************************************
*
* 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 _SOCOMP_FIRSTSTART_HXX_
#define _SOCOMP_FIRSTSTART_HXX_
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/task/XJob.hpp>
#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <com/sun/star/task/XJobExecutor.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <osl/mutex.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::task;
namespace desktop{
class FirstStart : public ::cppu::WeakImplHelper4< XJob, XJobExecutor, XComponent, XServiceInfo >
{
private:
::osl::Mutex m_aMutex;
::cppu::OInterfaceContainerHelper m_aListeners;
Reference< XMultiServiceFactory > m_xServiceManager;
public:
FirstStart( const Reference < XMultiServiceFactory >& xFactory );
virtual ~FirstStart();
static ::rtl::OUString GetImplementationName();
static Sequence< rtl::OUString > GetSupportedServiceNames();
// XComponent
virtual void SAL_CALL dispose() throw ( RuntimeException );
virtual void SAL_CALL addEventListener( const Reference< XEventListener > & aListener) throw ( RuntimeException );
virtual void SAL_CALL removeEventListener(const Reference< XEventListener > & aListener) throw ( RuntimeException );
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( RuntimeException );
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw ( RuntimeException );
virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw ( RuntimeException );
//XJob
virtual Any SAL_CALL execute(const Sequence<NamedValue>& args)throw ( RuntimeException );
//XJobExecutor
virtual void SAL_CALL trigger(const rtl::OUString& arg)throw ( RuntimeException );
static const char* interfaces[];
static const char* implementationName;
static const char* serviceName;
static Reference<XInterface> SAL_CALL CreateInstance(
const Reference< XMultiServiceFactory >&);
};
}
#endif // _SOCOMP_FIRSTSTART_HXX_
......@@ -40,13 +40,10 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
SLOFILES = $(SLO)$/splash.obj \
$(SLO)$/firststart.obj \
$(SLO)$/services_spl.obj
SHL1DEPN= makefile.mk
SHL1OBJS= $(SLOFILES) \
$(SLO)$/pages.obj \
$(SLO)$/wizard.obj \
$(SLO)$/migration.obj \
$(SLO)$/cfgfilter.obj
......
......@@ -35,7 +35,6 @@
#include <unotools/configmgr.hxx>
#include "splash.hxx"
#include "firststart.hxx"
using namespace rtl;
......@@ -48,14 +47,12 @@ using namespace ::desktop;
static const char* pServices[] =
{
SplashScreen::serviceName,
FirstStart::serviceName,
NULL
};
static const char* pImplementations[] =
{
SplashScreen::implementationName,
FirstStart::implementationName,
NULL
};
......@@ -64,7 +61,6 @@ typedef Reference<XInterface>(* fProvider)(const Reference<XMultiServiceFactory>
static const fProvider pInstanceProviders[] =
{
SplashScreen::getInstance,
FirstStart::CreateInstance,
NULL
};
......@@ -72,7 +68,6 @@ static const fProvider pInstanceProviders[] =
static const char** pSupportedServices[] =
{
SplashScreen::interfaces,
FirstStart::interfaces,
NULL
};
......
......@@ -71,8 +71,7 @@ LINKFLAGSAPPGUI!:= $(LINKFLAGSAPPGUI:s/-bind_at_load//)
RESLIB1NAME= dkt
RESLIB1IMAGES= $(PRJ)$/res
RESLIB1SRSFILES= $(SRS)$/desktop.srs \
$(SRS)$/wizard.srs
RESLIB1SRSFILES= $(SRS)$/desktop.srs
.IF "$(L10N_framework)"==""
.IF "$(LINK_SO)"=="TRUE"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment