diff options
Diffstat (limited to 'desktop/source')
67 files changed, 1932 insertions, 836 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index bba615e0ebbc..d80aa37fdece 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -28,6 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_desktop.hxx" +#include <cstdlib> +#include <vector> + #include <memory> #include <unistd.h> #include "app.hxx" @@ -119,6 +122,7 @@ #include <osl/file.hxx> #include <osl/signal.h> #include <rtl/uuid.h> +#include <rtl/uri.hxx> #include <unotools/pathoptions.hxx> #include <svl/languageoptions.hxx> #include <unotools/internaloptions.hxx> @@ -155,6 +159,11 @@ #include "langselect.hxx" +#if defined MACOSX +#include <errno.h> +#include <sys/wait.h> +#endif + #define DEFINE_CONST_UNICODE(CONSTASCII) UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII)) #define U2S(STRING) ::rtl::OUStringToOString(STRING, RTL_TEXTENCODING_UTF8) @@ -460,6 +469,194 @@ void ReplaceStringHookProc( UniString& rStr ) } } +static const char pLastSyncFileName[] = "lastsynchronized"; +static const sal_Int32 nStrLenLastSync = 16; + +static bool needsSynchronization( + ::rtl::OUString const & baseSynchronizedURL, ::rtl::OUString const & userSynchronizedURL ) +{ + bool bNeedsSync( false ); + + ::osl::DirectoryItem itemUserFile; + ::osl::File::RC err1 = + ::osl::DirectoryItem::get(userSynchronizedURL, itemUserFile); + + //If it does not exist, then there is nothing to be done + if (err1 == ::osl::File::E_NOENT) + { + return true; + } + else if (err1 != ::osl::File::E_None) + { + OSL_ENSURE(0, "Cannot access lastsynchronized in user layer"); + return true; //sync just in case + } + + //If last synchronized does not exist in base layer, then do nothing + ::osl::DirectoryItem itemBaseFile; + ::osl::File::RC err2 = ::osl::DirectoryItem::get(baseSynchronizedURL, itemBaseFile); + if (err2 == ::osl::File::E_NOENT) + { + return true; + + } + else if (err2 != ::osl::File::E_None) + { + OSL_ENSURE(0, "Cannot access file lastsynchronized in base layer"); + return true; //sync just in case + } + + //compare the modification time of the extension folder and the last + //modified file + ::osl::FileStatus statUser(FileStatusMask_ModifyTime); + ::osl::FileStatus statBase(FileStatusMask_ModifyTime); + if (itemUserFile.getFileStatus(statUser) == ::osl::File::E_None) + { + if (itemBaseFile.getFileStatus(statBase) == ::osl::File::E_None) + { + TimeValue timeUser = statUser.getModifyTime(); + TimeValue timeBase = statBase.getModifyTime(); + + if (timeUser.Seconds < timeBase.Seconds) + bNeedsSync = true; + } + else + { + OSL_ASSERT(0); + bNeedsSync = true; + } + } + else + { + OSL_ASSERT(0); + bNeedsSync = true; + } + + return bNeedsSync; +} + +static ::rtl::OUString getBrandSharePreregBundledPathURL() +{ + ::rtl::OUString url( + RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/share/prereg/bundled")); + + ::rtl::Bootstrap::expandMacros(url); + return url; +} + +static ::rtl::OUString getUserBundledExtPathURL() +{ + ::rtl::OUString folder( RTL_CONSTASCII_USTRINGPARAM( "$BUNDLED_EXTENSIONS_USER" )); + ::rtl::Bootstrap::expandMacros(folder); + + return folder; +} + +static ::rtl::OUString getLastSyncFileURLFromBrandInstallation() +{ + ::rtl::OUString aURL = getBrandSharePreregBundledPathURL(); + ::sal_Int32 nLastIndex = aURL.lastIndexOf('/'); + + ::rtl::OUStringBuffer aTmp( aURL ); + + if ( nLastIndex != aURL.getLength()-1 ) + aTmp.appendAscii( "/" ); + aTmp.appendAscii( pLastSyncFileName ); + + return aTmp.makeStringAndClear(); +} + +static ::rtl::OUString getLastSyncFileURLFromUserInstallation() +{ + ::rtl::OUString aUserBundledPathURL = getUserBundledExtPathURL(); + ::sal_Int32 nLastIndex = aUserBundledPathURL.lastIndexOf('/'); + + ::rtl::OUStringBuffer aTmp( aUserBundledPathURL ); + + if ( nLastIndex != aUserBundledPathURL.getLength()-1 ) + aTmp.appendAscii( "/" ); + aTmp.appendAscii( pLastSyncFileName ); + + return aTmp.makeStringAndClear(); +} + +static osl::FileBase::RC copy_bundled_recursive( + const rtl::OUString& srcUnqPath, + const rtl::OUString& dstUnqPath, + sal_Int32 TypeToCopy ) +throw() +{ + osl::FileBase::RC err = osl::FileBase::E_None; + + if( TypeToCopy == -1 ) // Document + { + err = osl::File::copy( srcUnqPath,dstUnqPath ); + } + else if( TypeToCopy == +1 ) // Folder + { + osl::Directory aDir( srcUnqPath ); + aDir.open(); + + err = osl::Directory::create( dstUnqPath ); + osl::FileBase::RC next = err; + if( err == osl::FileBase::E_None || + err == osl::FileBase::E_EXIST ) + { + err = osl::FileBase::E_None; + sal_Int32 n_Mask = FileStatusMask_FileURL | FileStatusMask_FileName | FileStatusMask_Type; + + osl::DirectoryItem aDirItem; + + while( err == osl::FileBase::E_None && ( next = aDir.getNextItem( aDirItem ) ) == osl::FileBase::E_None ) + { + sal_Bool IsDoc = false; + sal_Bool bFilter = false; + osl::FileStatus aFileStatus( n_Mask ); + aDirItem.getFileStatus( aFileStatus ); + if( aFileStatus.isValid( FileStatusMask_Type ) ) + IsDoc = aFileStatus.getFileType() == osl::FileStatus::Regular; + + // Getting the information for the next recursive copy + sal_Int32 newTypeToCopy = IsDoc ? -1 : +1; + + rtl::OUString newSrcUnqPath; + if( aFileStatus.isValid( FileStatusMask_FileURL ) ) + newSrcUnqPath = aFileStatus.getFileURL(); + + rtl::OUString newDstUnqPath = dstUnqPath; + rtl::OUString tit; + if( aFileStatus.isValid( FileStatusMask_FileName ) ) + { + ::rtl::OUString aFileName = aFileStatus.getFileName(); + tit = rtl::Uri::encode( aFileName, + rtl_UriCharClassPchar, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ); + + // Special treatment for "lastsychronized" file. Must not be + // copied from the bundled folder! + if ( IsDoc && aFileName.equalsAscii( pLastSyncFileName )) + bFilter = true; + } + + if( newDstUnqPath.lastIndexOf( sal_Unicode('/') ) != newDstUnqPath.getLength()-1 ) + newDstUnqPath += rtl::OUString::createFromAscii( "/" ); + + newDstUnqPath += tit; + + if (( newSrcUnqPath != dstUnqPath ) && !bFilter ) + err = copy_bundled_recursive( newSrcUnqPath,newDstUnqPath, newTypeToCopy ); + } + + if( err == osl::FileBase::E_None && next != osl::FileBase::E_NOENT ) + err = next; + } + aDir.close(); + } + + return err; +} + Desktop::Desktop() : m_bServicesRegistered( false ) , m_aBootstrapError( BE_OK ) @@ -477,6 +674,24 @@ void Desktop::Init() RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::Desktop::Init" ); SetBootstrapStatus(BS_OK); + // Check for lastsynchronized file for bundled extensions in the user directory + // and test if synchronzation is necessary! + { + ::rtl::OUString aUserLastSyncFilePathURL = getLastSyncFileURLFromUserInstallation(); + ::rtl::OUString aPreregSyncFilePathURL = getLastSyncFileURLFromBrandInstallation(); + + if ( needsSynchronization( aPreregSyncFilePathURL, aUserLastSyncFilePathURL )) + { + rtl::OUString aUserPath = getUserBundledExtPathURL(); + rtl::OUString aPreregBundledPath = getBrandSharePreregBundledPathURL(); + + // copy bundled folder to the user directory + osl::FileBase::RC rc = osl::Directory::createPath(aUserPath); + (void) rc; + copy_bundled_recursive( aPreregBundledPath, aUserPath, +1 ); + } + } + // create service factory... Reference < XMultiServiceFactory > rSMgr = CreateApplicationServiceManager(); if( rSMgr.is() ) @@ -492,7 +707,12 @@ void Desktop::Init() { // prepare language if ( !LanguageSelection::prepareLanguage() ) - SetBootstrapError( BE_LANGUAGE_MISSING ); + { + if ( LanguageSelection::getStatus() == LanguageSelection::LS_STATUS_CANNOT_DETERMINE_LANGUAGE ) + SetBootstrapError( BE_LANGUAGE_MISSING ); + else + SetBootstrapError( BE_OFFICECONFIG_BROKEN ); + } } if ( GetBootstrapError() == BE_OK ) @@ -534,6 +754,7 @@ void Desktop::DeInit() // instead of removing of the configManager just let it commit all the changes RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" ); utl::ConfigManager::GetConfigManager()->StoreConfigItems(); + FlushConfiguration(); RTL_LOGFILE_CONTEXT_TRACE( aLog, "<- store config items" ); // close splashscreen if it's still open @@ -595,6 +816,7 @@ BOOL Desktop::QueryExit() } else { + FlushConfiguration(); try { // it is no problem to call DisableOfficeIPCThread() more than once @@ -873,6 +1095,17 @@ void Desktop::HandleBootstrapErrors( BootstrapError aBootstrapError ) FatalError( aMessage); } + else if ( aBootstrapError == BE_OFFICECONFIG_BROKEN ) + { + OUString aMessage; + OUStringBuffer aDiagnosticMessage( 100 ); + OUString aErrorMsg; + aErrorMsg = GetMsgString( STR_CONFIG_ERR_ACCESS_GENERAL, + OUString( RTL_CONSTASCII_USTRINGPARAM( "A general error occurred while accessing your central configuration." )) ); + aDiagnosticMessage.append( aErrorMsg ); + aMessage = MakeStartupErrorMessage( aDiagnosticMessage.makeStringAndClear() ); + FatalError(aMessage); + } else if ( aBootstrapError == BE_USERINSTALL_FAILED ) { OUString aMessage; @@ -1101,28 +1334,79 @@ sal_Bool Desktop::SaveTasks() sal_False); } -#ifdef MACOSX -static void DoRestart() -{ - oslProcess process; - oslProcessError error; - OUString sExecutableFile; - - osl_getExecutableFile( &sExecutableFile.pData ); - - error = osl_executeProcess( - sExecutableFile.pData, - NULL, - 0, - 0, - NULL, - NULL, - NULL, - 0, - &process - ); -} +namespace { + +void restartOnMac(bool passArguments) { +#if defined MACOSX + OfficeIPCThread::DisableOfficeIPCThread(); + rtl::OUString execUrl; + OSL_VERIFY(osl_getExecutableFile(&execUrl.pData) == osl_Process_E_None); + rtl::OUString execPath; + rtl::OString execPath8; + if ((osl::FileBase::getSystemPathFromFileURL(execUrl, execPath) + != osl::FileBase::E_None) || + !execPath.convertToString( + &execPath8, osl_getThreadTextEncoding(), + (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | + RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) + { + std::abort(); + } + std::vector< rtl::OString > args; + args.push_back(execPath8); + bool wait = false; + if (passArguments) { + sal_uInt32 n = osl_getCommandArgCount(); + for (sal_uInt32 i = 0; i < n; ++i) { + rtl::OUString arg; + OSL_VERIFY(osl_getCommandArg(i, &arg.pData) == osl_Process_E_None); + if (arg.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("-accept="))) { + wait = true; + } + rtl::OString arg8; + if (!arg.convertToString( + &arg8, osl_getThreadTextEncoding(), + (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | + RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) + { + std::abort(); + } + args.push_back(arg8); + } + } + std::vector< char const * > argPtrs; + for (std::vector< rtl::OString >::iterator i(args.begin()); i != args.end(); + ++i) + { + argPtrs.push_back(i->getStr()); + } + argPtrs.push_back(0); + execv(execPath8.getStr(), const_cast< char ** >(&argPtrs[0])); + if (errno == ENOTSUP) { // happens when multithreaded on OS X < 10.6 + pid_t pid = fork(); + if (pid == 0) { + execv(execPath8.getStr(), const_cast< char ** >(&argPtrs[0])); + } else if (pid > 0) { + // Two simultaneously running soffice processes lead to two dock + // icons, so avoid waiting here unless it must be assumed that the + // process invoking soffice itself wants to wait for soffice to + // finish: + if (!wait) { + return; + } + int stat; + if (waitpid(pid, &stat, 0) == pid && WIFEXITED(stat)) { + _exit(WEXITSTATUS(stat)); + } + } + } + std::abort(); +#else + (void) passArguments; // avoid warnings #endif +} + +} USHORT Desktop::Exception(USHORT nError) { @@ -1154,18 +1438,7 @@ USHORT Desktop::Exception(USHORT nError) if ( bAllowRecoveryAndSessionManagement ) bRestart = SaveTasks(); - // because there is no method to flush the condiguration data, we must dispose the ConfigManager - Reference < XFlushable > xCFGFlush( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY ); - if (xCFGFlush.is()) - { - xCFGFlush->flush(); - } - else - { - Reference < XComponent > xCFGDispose( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY ); - if (xCFGDispose.is()) - xCFGDispose->dispose(); - } + FlushConfiguration(); switch( nError & EXC_MAJORTYPE ) { @@ -1193,9 +1466,7 @@ USHORT Desktop::Exception(USHORT nError) OfficeIPCThread::DisableOfficeIPCThread(); if( pSignalHandler ) DELETEZ( pSignalHandler ); -#ifdef MACOSX - DoRestart(); -#endif + restartOnMac(false); _exit( ExitHelper::E_CRASH_WITH_RESTART ); } else @@ -1278,6 +1549,10 @@ void Desktop::Main() std::auto_ptr<SvtLanguageOptions> pLanguageOptions; std::auto_ptr<SvtPathOptions> pPathOptions; + Reference< ::com::sun::star::task::XRestartManager > xRestartManager; + sal_Bool bRestartRequested( sal_False ); + sal_Bool bUseSystemFileDialog(sal_True); + int nAcquireCount( 0 ); Reference < css::document::XEventListener > xGlobalBroadcaster; try { @@ -1407,6 +1682,13 @@ void Desktop::Main() ( xSMgr->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.frame.GlobalEventBroadcaster" ) ), UNO_QUERY ); + /* ensure existance of a default window that messages can be dispatched to + This is for the benefit of testtool which uses PostUserEvent extensively + and else can deadlock while creating this window from another tread while + the main thread is not yet in the event loop. + */ + Application::GetDefaultDevice(); + // initialize test-tool library (if available) RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ tools::InitTestToolLib" ); tools::InitTestToolLib(); @@ -1471,58 +1753,79 @@ void Desktop::Main() impl_checkRecoveryState(bCrashed, bExistsRecoveryData, bExistsSessionData); RTL_LOGFILE_CONTEXT_TRACE( aLog, "} impl_checkRecoveryState" ); - if ( - (pCmdLineArgs->IsEmptyOrAcceptOnly() ) && - (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) && - (!bExistsRecoveryData ) && - (!bExistsSessionData ) && - (!Application::AnyInput( INPUT_APPEVENT ) ) - ) { - RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" ); - Reference< XFrame > xDesktopFrame( xSMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); - if (xDesktopFrame.is()) + ::comphelper::ComponentContext aContext( xSMgr ); + xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY ); + } + + // check whether the shutdown is caused by restart + bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) ); + + if ( pCmdLineArgs->IsHeadless() ) + { + // Ensure that we use not the system file dialogs as + // headless mode relies on Application::EnableHeadlessMode() + // which does only work for VCL dialogs!! + SvtMiscOptions aMiscOptions; + bUseSystemFileDialog = aMiscOptions.UseSystemFileDialog(); + aMiscOptions.SetUseSystemFileDialog( sal_False ); + } + + if ( !bRestartRequested ) + { + if ( + (pCmdLineArgs->IsEmptyOrAcceptOnly() ) && + (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) && + (!bExistsRecoveryData ) && + (!bExistsSessionData ) && + (!Application::AnyInput( INPUT_APPEVENT ) ) + ) { -// SetSplashScreenProgress(60); - Reference< XFrame > xBackingFrame; - Reference< ::com::sun::star::awt::XWindow > xContainerWindow; - - xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0); - if (xBackingFrame.is()) - xContainerWindow = xBackingFrame->getContainerWindow(); - if (xContainerWindow.is()) + RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" ); + Reference< XFrame > xDesktopFrame( xSMgr->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); + if (xDesktopFrame.is()) { - // set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank" - // frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior, - // otherwise documents loaded into this frame will later on miss functionality depending on the style. - Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); - OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" ); - pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT ); - - SetSplashScreenProgress(75); - Sequence< Any > lArgs(1); - lArgs[0] <<= xContainerWindow; - - Reference< XController > xBackingComp( - xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs), - UNO_QUERY); -// SetSplashScreenProgress(80); - if (xBackingComp.is()) + // SetSplashScreenProgress(60); + Reference< XFrame > xBackingFrame; + Reference< ::com::sun::star::awt::XWindow > xContainerWindow; + + xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0); + if (xBackingFrame.is()) + xContainerWindow = xBackingFrame->getContainerWindow(); + if (xContainerWindow.is()) { - Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY); - // Attention: You MUST(!) call setComponent() before you call attachFrame(). - // Because the backing component set the property "IsBackingMode" of the frame - // to true inside attachFrame(). But setComponent() reset this state everytimes ... - xBackingFrame->setComponent(xBackingWin, xBackingComp); - SetSplashScreenProgress(100); - xBackingComp->attachFrame(xBackingFrame); - CloseSplashScreen(); - xContainerWindow->setVisible(sal_True); + // set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank" + // frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior, + // otherwise documents loaded into this frame will later on miss functionality depending on the style. + Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" ); + pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT ); + + SetSplashScreenProgress(75); + Sequence< Any > lArgs(1); + lArgs[0] <<= xContainerWindow; + + Reference< XController > xBackingComp( + xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs), + UNO_QUERY); + // SetSplashScreenProgress(80); + if (xBackingComp.is()) + { + Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY); + // Attention: You MUST(!) call setComponent() before you call attachFrame(). + // Because the backing component set the property "IsBackingMode" of the frame + // to true inside attachFrame(). But setComponent() reset this state everytimes ... + xBackingFrame->setComponent(xBackingWin, xBackingComp); + SetSplashScreenProgress(100); + xBackingComp->attachFrame(xBackingFrame); + CloseSplashScreen(); + xContainerWindow->setVisible(sal_True); + } } } + RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create BackingComponent" ); } - RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create BackingComponent" ); } } catch ( com::sun::star::lang::WrappedTargetException& wte ) @@ -1557,107 +1860,98 @@ void Desktop::Main() aOptions.SetVCLSettings(); // SetSplashScreenProgress(60); - Application::SetFilterHdl( LINK( this, Desktop, ImplInitFilterHdl ) ); + if ( !bRestartRequested ) + { + Application::SetFilterHdl( LINK( this, Desktop, ImplInitFilterHdl ) ); - sal_Bool bTerminateRequested = sal_False; + sal_Bool bTerminateRequested = sal_False; - // Preload function depends on an initialized sfx application! - SetSplashScreenProgress(75); + // Preload function depends on an initialized sfx application! + SetSplashScreenProgress(75); - sal_Bool bUseSystemFileDialog(sal_True); - if ( pCmdLineArgs->IsHeadless() ) - { - // Ensure that we use not the system file dialogs as - // headless mode relies on Application::EnableHeadlessMode() - // which does only work for VCL dialogs!! - SvtMiscOptions aMiscOptions; - bUseSystemFileDialog = aMiscOptions.UseSystemFileDialog(); - aMiscOptions.SetUseSystemFileDialog( sal_False ); - } + // use system window dialogs + Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG ); - // use system window dialogs - Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG ); + // SetSplashScreenProgress(80); -// SetSplashScreenProgress(80); + if ( !bTerminateRequested && !pCmdLineArgs->IsInvisible() && + !pCmdLineArgs->IsNoQuickstart() ) + InitializeQuickstartMode( xSMgr ); - if ( !bTerminateRequested && !pCmdLineArgs->IsInvisible() && - !pCmdLineArgs->IsNoQuickstart() ) - InitializeQuickstartMode( xSMgr ); + RTL_LOGFILE_CONTEXT( aLog2, "desktop (cd100003) createInstance com.sun.star.frame.Desktop" ); + try + { + Reference< XDesktop > xDesktop( xSMgr->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); + if ( xDesktop.is() ) + xDesktop->addTerminateListener( new OfficeIPCThreadController ); + SetSplashScreenProgress(100); + } + catch ( com::sun::star::uno::Exception& e ) + { + FatalError( MakeStartupErrorMessage(e.Message) ); + return; + } + /* + catch ( ... ) + { + FatalError( MakeStartupErrorMessage( + OUString::createFromAscii( + "Unknown error during startup (TD/Desktop service).\nInstallation could be damaged."))); + return; + } + */ - RTL_LOGFILE_CONTEXT( aLog2, "desktop (cd100003) createInstance com.sun.star.frame.Desktop" ); - try - { - Reference< XDesktop > xDesktop( xSMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); - if ( xDesktop.is() ) - xDesktop->addTerminateListener( new OfficeIPCThreadController ); - SetSplashScreenProgress(100); - } - catch ( com::sun::star::uno::Exception& e ) - { - FatalError( MakeStartupErrorMessage(e.Message) ); - return; - } - /* - catch ( ... ) - { - FatalError( MakeStartupErrorMessage( - OUString::createFromAscii( - "Unknown error during startup (TD/Desktop service).\nInstallation could be damaged."))); - return; - } - */ + // Post user event to startup first application component window + // We have to send this OpenClients message short before execute() to + // minimize the risk that this message overtakes type detection contruction!! + Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) ); - // Release solar mutex just before we wait for our client to connect - int nAcquireCount = 0; - ::vos::IMutex& rMutex = Application::GetSolarMutex(); - if ( rMutex.tryToAcquire() ) - nAcquireCount = Application::ReleaseSolarMutex() - 1; + // Post event to enable acceptors + Application::PostUserEvent( LINK( this, Desktop, EnableAcceptors_Impl) ); - // Post user event to startup first application component window - // We have to send this OpenClients message short before execute() to - // minimize the risk that this message overtakes type detection contruction!! - Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) ); + // The configuration error handler currently is only for startup + aConfigErrHandler.deactivate(); - // Post event to enable acceptors - Application::PostUserEvent( LINK( this, Desktop, EnableAcceptors_Impl) ); + // Acquire solar mutex just before we enter our message loop + if ( nAcquireCount ) + Application::AcquireSolarMutex( nAcquireCount ); - // The configuration error handler currently is only for startup - aConfigErrHandler.deactivate(); + // call Application::Execute to process messages in vcl message loop + RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" ); - // Acquire solar mutex just before we enter our message loop - if ( nAcquireCount ) - Application::AcquireSolarMutex( nAcquireCount ); + try + { + // The JavaContext contains an interaction handler which is used when + // the creation of a Java Virtual Machine fails + com::sun::star::uno::ContextLayer layer2( + new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) ); - // call Application::Execute to process messages in vcl message loop - RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" ); + // check whether the shutdown is caused by restart just before entering the Execute + bRestartRequested = bRestartRequested || ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) ); - Reference< ::com::sun::star::task::XRestartManager > xRestartManager; - try - { - // The JavaContext contains an interaction handler which is used when - // the creation of a Java Virtual Machine fails - com::sun::star::uno::ContextLayer layer2( - new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) ); + if ( !bRestartRequested ) + { + // if this run of the office is triggered by restart, some additional actions should be done + DoRestartActionsIfNecessary( !pCmdLineArgs->IsInvisible() && !pCmdLineArgs->IsNoQuickstart() ); - ::comphelper::ComponentContext aContext( xSMgr ); - xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY ); - if ( !xRestartManager.is() || !xRestartManager->isRestartRequested( sal_True ) ) - Execute(); - } - catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg) - { - OfficeIPCThread::SetDowning(); - FatalError( MakeStartupErrorMessage(exFilterCfg.Message) ); - } - catch(const com::sun::star::configuration::CorruptedConfigurationException& exAnyCfg) - { - OfficeIPCThread::SetDowning(); - FatalError( MakeStartupErrorMessage(exAnyCfg.Message) ); + Execute(); + } + } + catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg) + { + OfficeIPCThread::SetDowning(); + FatalError( MakeStartupErrorMessage(exFilterCfg.Message) ); + } + catch(const com::sun::star::configuration::CorruptedConfigurationException& exAnyCfg) + { + OfficeIPCThread::SetDowning(); + FatalError( MakeStartupErrorMessage(exAnyCfg.Message) ); + } } - // check whether the shutdown is caused by restart - sal_Bool bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) ); + if ( bRestartRequested ) + SetRestartState(); if (xGlobalBroadcaster.is()) { @@ -1673,6 +1967,7 @@ void Desktop::Main() // remove temp directory RemoveTemporaryDirectory(); + FlushConfiguration(); // The acceptors in the AcceptorMap must be released (in DeregisterServices) // with the solar mutex unlocked, to avoid deadlock: nAcquireCount = Application::ReleaseSolarMutex(); @@ -1693,9 +1988,7 @@ void Desktop::Main() RTL_LOGFILE_CONTEXT_TRACE( aLog, "FINISHED WITH Destop::Main" ); if ( bRestartRequested ) { -#ifdef MACOSX - DoRestart(); -#endif + restartOnMac(true); // wouldn't the solution be more clean if SalMain returns the exit code to the system? _exit( ExitHelper::E_NORMAL_RESTART ); } @@ -1772,6 +2065,22 @@ sal_Bool Desktop::InitializeConfiguration() return bOk; } +void Desktop::FlushConfiguration() +{ + Reference < XFlushable > xCFGFlush( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY ); + if (xCFGFlush.is()) + { + xCFGFlush->flush(); + } + else + { + // because there is no method to flush the condiguration data, we must dispose the ConfigManager + Reference < XComponent > xCFGDispose( ::utl::ConfigManager::GetConfigManager()->GetConfigurationProvider(), UNO_QUERY ); + if (xCFGDispose.is()) + xCFGDispose->dispose(); + } +} + sal_Bool Desktop::InitializeQuickstartMode( Reference< XMultiServiceFactory >& rSMgr ) { try @@ -2352,8 +2661,6 @@ void Desktop::OpenClients() aHelpURLBuffer.appendAscii("&System=UNX"); #elif defined WNT aHelpURLBuffer.appendAscii("&System=WIN"); -#elif defined MAC - aHelpURLBuffer.appendAscii("&System=MAC"); #elif defined OS2 aHelpURLBuffer.appendAscii("&System=OS2"); #endif diff --git a/desktop/source/app/appfirststart.cxx b/desktop/source/app/appfirststart.cxx index 2f0d4ab9e538..c06d94fd0812 100644 --- a/desktop/source/app/appfirststart.cxx +++ b/desktop/source/app/appfirststart.cxx @@ -36,12 +36,14 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/util/XChangesBatch.hpp> #include "app.hxx" -using rtl::OUString; -using namespace desktop; -using namespace com::sun::star::beans; +using ::rtl::OUString; +using namespace ::desktop; +using namespace ::com::sun::star; +using namespace ::com::sun::star::beans; static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ); static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ); @@ -128,24 +130,29 @@ sal_Bool Desktop::LicenseNeedsAcceptance() */ } -/* Local function - was the wizard completed already? */ -static sal_Bool impl_isFirstStart() +/* Local function - get access to the configuration */ +static Reference< XPropertySet > impl_getConfigurationAccess( const OUString& rPath ) { - try { - Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - // get configuration provider - Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( - xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); + // get configuration provider + Reference< XMultiServiceFactory > xConfigProvider = 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; + Sequence< Any > aArgs( 1 ); + NamedValue aValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NodePath" ) ), makeAny( rPath ) ); + aArgs[0] <<= aValue; + return Reference< XPropertySet >( + xConfigProvider->createInstanceWithArguments( sAccessSrvc, aArgs ), UNO_QUERY_THROW ); +} - Reference< XPropertySet > pset = Reference< XPropertySet >( - theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); +/* Local function - was the wizard completed already? */ +static sal_Bool impl_isFirstStart() +{ + try { + Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) ); - Any result = pset->getPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted")); + Any result = xPSet->getPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted")); sal_Bool bCompleted = sal_False; if ((result >>= bCompleted) && bCompleted) return sal_False; // wizard was already completed @@ -219,20 +226,9 @@ static sal_Bool impl_isLicenseAccepted() try { - Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - - // get configuration provider - Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >( - xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW); + Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) ); - 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")); + Any result = xPSet->getPropertyValue(OUString::createFromAscii("LicenseAcceptDate")); OUString aAcceptDate; if (result >>= aAcceptDate) @@ -272,3 +268,51 @@ sal_Bool Desktop::IsFirstStartWizardNeeded() return impl_isFirstStart() || !impl_isLicenseAccepted(); } +void Desktop::DoRestartActionsIfNecessary( sal_Bool bQuickStart ) +{ + if ( bQuickStart ) + { + try + { + Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) ); + + OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "OfficeRestartInProgress" ) ); + Any aRestart = xPSet->getPropertyValue( sPropName ); + sal_Bool bRestart = sal_False; + if ( ( aRestart >>= bRestart ) && bRestart ) + { + xPSet->setPropertyValue( sPropName, makeAny( sal_False ) ); + Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges(); + + Sequence< Any > aSeq( 2 ); + aSeq[0] <<= sal_True; + aSeq[1] <<= sal_True; + + Reference < XInitialization > xQuickstart( ::comphelper::getProcessServiceFactory()->createInstance( + OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.Quickstart" ) ) ),UNO_QUERY_THROW ); + xQuickstart->initialize( aSeq ); + } + } + catch( uno::Exception& ) + { + // this is no critical operation so it should not prevent office from starting + } + } +} + +void Desktop::SetRestartState() +{ + try + { + Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) ); + OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "OfficeRestartInProgress" ) ); + xPSet->setPropertyValue( sPropName, makeAny( sal_True ) ); + Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges(); + } + catch( uno::Exception& ) + { + // this is no critical operation, ignore the exception + } + +} + diff --git a/desktop/source/app/desktop.src b/desktop/source/app/desktop.src index 2f6897adf80e..98ee68685917 100644 --- a/desktop/source/app/desktop.src +++ b/desktop/source/app/desktop.src @@ -159,6 +159,7 @@ InfoBox INFOBOX_CMDLINEHELP ModalDialog DLG_CMDLINEHELP { + HelpID = "desktop:ModalDialog:DLG_CMDLINEHELP"; Text = "Help Message..."; Size = MAP_APPFONT(250, 365); Border = True; diff --git a/desktop/source/app/exports.dxp b/desktop/source/app/exports.dxp index 9630d7e06768..f0e1c69934bc 100644 --- a/desktop/source/app/exports.dxp +++ b/desktop/source/app/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx index 5e2145b03729..9df8d82a37ff 100644 --- a/desktop/source/app/langselect.cxx +++ b/desktop/source/app/langselect.cxx @@ -64,10 +64,12 @@ namespace desktop { static char const SOFFICE_BOOTSTRAP[] = "Bootstrap"; static char const SOFFICE_STARTLANG[] = "STARTLANG"; + sal_Bool LanguageSelection::bFoundLanguage = sal_False; OUString LanguageSelection::aFoundLanguage; -const OUString LanguageSelection::usFallbackLanguage = OUString::createFromAscii("en-US"); +LanguageSelection::LanguageSelectionStatus LanguageSelection::m_eStatus = LS_STATUS_OK; +const OUString LanguageSelection::usFallbackLanguage = OUString::createFromAscii("en-US"); static sal_Bool existsURL( OUString const& sURL ) { @@ -122,6 +124,7 @@ Locale LanguageSelection::IsoStringToLocale(const OUString& str) bool LanguageSelection::prepareLanguage() { + m_eStatus = LS_STATUS_OK; OUString sConfigSrvc = OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider"); Reference< XMultiServiceFactory > theMSF = comphelper::getProcessServiceFactory(); Reference< XLocalizable > theConfigProvider; @@ -131,7 +134,9 @@ bool LanguageSelection::prepareLanguage() } catch(const Exception&) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; } + if(!theConfigProvider.is()) return false; @@ -149,6 +154,7 @@ bool LanguageSelection::prepareLanguage() } catch(const Exception&) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; } // #i32939# use system locale to set document default locale @@ -162,6 +168,7 @@ bool LanguageSelection::prepareLanguage() } catch (Exception&) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; } // get the selected UI language as string @@ -350,8 +357,10 @@ OUString LanguageSelection::getLanguageString() aFoundLanguage = usFallbackLanguage; return aFoundLanguage; } + // fallback didn't work use first installed language aUserLanguage = getFirstInstalledLanguage(); + bFoundLanguage = sal_True; aFoundLanguage = aUserLanguage; return aFoundLanguage; @@ -455,7 +464,7 @@ sal_Bool LanguageSelection::isInstalledLanguage(OUString& usLocale, sal_Bool bEx // requested locale starts with the installed locale // (i.e. installed locale has index 0 in requested locale) bInstalled = sal_True; - usLocale = seqLanguages[i]; + usLocale = seqLanguages[i]; break; } } @@ -484,10 +493,12 @@ OUString LanguageSelection::getUserLanguage() } catch ( NoSuchElementException const & ) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; return OUString(); } catch ( WrappedTargetException const & ) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; return OUString(); } } @@ -506,10 +517,12 @@ OUString LanguageSelection::getSystemLanguage() } catch ( NoSuchElementException const & ) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; return OUString(); } catch ( WrappedTargetException const & ) { + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; return OUString(); } } @@ -533,9 +546,13 @@ void LanguageSelection::resetUserLanguage() { OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US); OSL_ENSURE(sal_False, aMsg.getStr()); + m_eStatus = LS_STATUS_CONFIGURATIONACCESS_BROKEN; } - } +LanguageSelection::LanguageSelectionStatus LanguageSelection::getStatus() +{ + return m_eStatus; +} } // namespace desktop diff --git a/desktop/source/app/langselect.hxx b/desktop/source/app/langselect.hxx index 60308164690f..bdf3cd6364de 100644 --- a/desktop/source/app/langselect.hxx +++ b/desktop/source/app/langselect.hxx @@ -40,10 +40,24 @@ namespace desktop class LanguageSelection { +public: + enum LanguageSelectionStatus + { + LS_STATUS_OK, + LS_STATUS_CANNOT_DETERMINE_LANGUAGE, + LS_STATUS_CONFIGURATIONACCESS_BROKEN + }; + + static com::sun::star::lang::Locale IsoStringToLocale(const rtl::OUString& str); + static rtl::OUString getLanguageString(); + static bool prepareLanguage(); + static LanguageSelectionStatus getStatus(); + private: static const rtl::OUString usFallbackLanguage; static rtl::OUString aFoundLanguage; static sal_Bool bFoundLanguage; + static LanguageSelectionStatus m_eStatus; static com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > getConfigAccess(const sal_Char* pPath, sal_Bool bUpdate=sal_False); @@ -55,11 +69,6 @@ private: static rtl::OUString getSystemLanguage(); static void resetUserLanguage(); static void setDefaultLanguage(const rtl::OUString&); - -public: - static com::sun::star::lang::Locale IsoStringToLocale(const rtl::OUString& str); - static rtl::OUString getLanguageString(); - static bool prepareLanguage(); }; } //namespace desktop diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index fc74c3fb4504..5527b8ea2aea 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -847,8 +847,6 @@ void SAL_CALL OfficeIPCThread::run() aHelpURLBuffer.appendAscii("&System=UNX"); #elif defined WNT aHelpURLBuffer.appendAscii("&System=WIN"); -#elif defined MAC - aHelpURLBuffer.appendAscii("&System=MAC"); #elif defined OS2 aHelpURLBuffer.appendAscii("&System=OS2"); #endif diff --git a/desktop/source/deployment/deployment.component b/desktop/source/deployment/deployment.component new file mode 100644 index 000000000000..11385c7aa8d9 --- /dev/null +++ b/desktop/source/deployment/deployment.component @@ -0,0 +1,64 @@ +<?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.deployment.ExtensionManager"> + <service name="com.sun.star.comp.deployment.ExtensionManager"/> + <singleton name="com.sun.star.deployment.ExtensionManager"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.PackageInformationProvider"> + <service name="com.sun.star.comp.deployment.PackageInformationProvider"/> + <singleton name="com.sun.star.deployment.PackageInformationProvider"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.PackageManagerFactory"> + <service name="com.sun.star.comp.deployment.PackageManagerFactory"/> + <singleton name="com.sun.star.deployment.thePackageManagerFactory"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.ProgressLog"> + <service name="com.sun.star.comp.deployment.ProgressLog"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.component.PackageRegistryBackend"> + <service name="com.sun.star.deployment.PackageRegistryBackend"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.configuration.PackageRegistryBackend"> + <service name="com.sun.star.deployment.PackageRegistryBackend"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.executable.PackageRegistryBackend"> + <service name="com.sun.star.deployment.PackageRegistryBackend"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.help.PackageRegistryBackend"> + <service name="com.sun.star.deployment.PackageRegistryBackend"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.script.PackageRegistryBackend"> + <service name="com.sun.star.deployment.PackageRegistryBackend"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.sfwk.PackageRegistryBackend"> + <service name="com.sun.star.deployment.PackageRegistryBackend"/> + </implementation> +</component> diff --git a/desktop/source/deployment/dp_services.cxx b/desktop/source/deployment/dp_services.cxx index f7ebf66355ba..f3dc75ae39c5 100644 --- a/desktop/source/deployment/dp_services.cxx +++ b/desktop/source/deployment/dp_services.cxx @@ -92,27 +92,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( - lang::XMultiServiceFactory * pServiceManager, - registry::XRegistryKey * pRegistryKey ) -{ - return component_writeInfoHelper( - pServiceManager, pRegistryKey, - dp_registry::backend::configuration::serviceDecl, - dp_registry::backend::component::serviceDecl, - dp_registry::backend::help::serviceDecl, - dp_registry::backend::script::serviceDecl, - dp_registry::backend::sfwk::serviceDecl, - dp_registry::backend::executable::serviceDecl, - dp_manager::factory::serviceDecl, - dp_log::serviceDecl, - dp_info::serviceDecl, - dp_manager::serviceDecl) && - dp_manager::factory::singleton_entries( pRegistryKey ) && - dp_info::singleton_entries( pRegistryKey ) && - dp_manager::singleton_entries( pRegistryKey); -} - void * SAL_CALL component_getFactory( sal_Char const * pImplName, lang::XMultiServiceFactory * pServiceManager, diff --git a/desktop/source/deployment/gui/deploymentgui.component b/desktop/source/deployment/gui/deploymentgui.component new file mode 100644 index 000000000000..d613f482e791 --- /dev/null +++ b/desktop/source/deployment/gui/deploymentgui.component @@ -0,0 +1,40 @@ +<?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.deployment.ui.LicenseDialog"> + <service name="com.sun.star.deployment.ui.LicenseDialog"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.ui.PackageManagerDialog"> + <service name="com.sun.star.deployment.ui.PackageManagerDialog"/> + </implementation> + <implementation name="com.sun.star.comp.deployment.ui.UpdateRequiredDialog"> + <service name="com.sun.star.deployment.ui.UpdateRequiredDialog"/> + </implementation> +</component> diff --git a/desktop/source/deployment/gui/dp_gui_dependencydialog.src b/desktop/source/deployment/gui/dp_gui_dependencydialog.src index fa7465678326..e7adbce9992b 100644 --- a/desktop/source/deployment/gui/dp_gui_dependencydialog.src +++ b/desktop/source/deployment/gui/dp_gui_dependencydialog.src @@ -34,6 +34,7 @@ #define LOCAL_LIST_HEIGHT (6 * RSC_BS_CHARHEIGHT) ModalDialog RID_DLG_DEPENDENCIES { + HelpID = "desktop:ModalDialog:RID_DLG_DEPENDENCIES"; Size = MAP_APPFONT( (RSC_SP_DLG_INNERBORDER_LEFT + LOCAL_WIDTH + RSC_SP_DLG_INNERBORDER_RIGHT), @@ -52,6 +53,7 @@ ModalDialog RID_DLG_DEPENDENCIES { NoLabel = TRUE; }; ListBox RID_DLG_DEPENDENCIES_LIST { + HelpID = "desktop:ListBox:RID_DLG_DEPENDENCIES:RID_DLG_DEPENDENCIES_LIST"; Pos = MAP_APPFONT( RSC_SP_DLG_INNERBORDER_LEFT, (RSC_SP_DLG_INNERBORDER_TOP + LOCAL_TEXT_HEIGHT + diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src index 15823288ee20..665dbe5934d7 100755..100644 --- a/desktop/source/deployment/gui/dp_gui_dialog.src +++ b/desktop/source/deployment/gui/dp_gui_dialog.src @@ -169,6 +169,7 @@ String RID_STR_ERROR_MISSING_LICENSE ModalDialog RID_DLG_LICENSE { + HelpID = "desktop:ModalDialog:RID_DLG_LICENSE"; Text [ en-US ] = "Extension Software License Agreement"; Size = MAP_APPFONT(LIC_DLG_WIDTH, LIC_DLG_HEIGHT); @@ -181,6 +182,7 @@ ModalDialog RID_DLG_LICENSE MultiLineEdit ML_LICENSE { + HelpID = "desktop:MultiLineEdit:RID_DLG_LICENSE:ML_LICENSE"; Pos = MAP_APPFONT(COL1_X, ROW1_Y); Size = MAP_APPFONT(BODYWIDTH, ROW1_HEIGHT); Border = TRUE; @@ -230,6 +232,7 @@ ModalDialog RID_DLG_LICENSE }; PushButton PB_LICENSE_DOWN { + HelpID = "desktop:PushButton:RID_DLG_LICENSE:PB_LICENSE_DOWN"; TabStop = TRUE ; Pos = MAP_APPFONT(COL5_X , ROW3_Y) ; Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT) ; diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index 1a66ff38e4a4..44d1e30f74b6 100755..100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -363,24 +363,28 @@ bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse ) // ----------------------------------------------------------------------- MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos ) { - if ( nPos >= (long) getItemCount() ) - return CMD_NONE; + if ( ( nPos >= 0 ) && ( nPos < (long) getItemCount() ) ) + { + if ( ! GetEntryData( nPos )->m_bLocked ) + { + PopupMenu aPopup; - PopupMenu aPopup; + aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); - aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); + if ( GetEntryData( nPos )->m_bUser ) + { + if ( GetEntryData( nPos )->m_eState == REGISTERED ) + aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); + else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE ) + aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) ); + } - if ( ! GetEntryData( nPos )->m_bLocked ) - { - if ( GetEntryData( nPos )->m_eState == REGISTERED ) - aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) ); - else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE ) - aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) ); + aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); - aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) ); + return (MENU_COMMAND) aPopup.Execute( this, rPos ); + } } - - return (MENU_COMMAND) aPopup.Execute( this, rPos ); + return CMD_NONE; } //------------------------------------------------------------------------------ @@ -1147,13 +1151,13 @@ void ExtMgrDialog::Resize() { ImplControlValue aValue; bool bNativeOK; - Region aControlRegion( Rectangle( (const Point&)Point(), m_aProgressBar.GetSizePixel() ) ); - Region aNativeControlRegion, aNativeContentRegion; + Rectangle aControlRegion( Point( 0, 0 ), m_aProgressBar.GetSizePixel() ); + Rectangle aNativeControlRegion, aNativeContentRegion; if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion, CTRL_STATE_ENABLED, aValue, rtl::OUString(), aNativeControlRegion, aNativeContentRegion ) ) != FALSE ) { - nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight(); + nProgressHeight = aNativeControlRegion.GetHeight(); } } @@ -1590,13 +1594,13 @@ void UpdateRequiredDialog::Resize() { ImplControlValue aValue; bool bNativeOK; - Region aControlRegion( Rectangle( (const Point&)Point(), m_aProgressBar.GetSizePixel() ) ); - Region aNativeControlRegion, aNativeContentRegion; + Rectangle aControlRegion( Point( 0, 0 ), m_aProgressBar.GetSizePixel() ); + Rectangle aNativeControlRegion, aNativeContentRegion; if( (bNativeOK = GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion, CTRL_STATE_ENABLED, aValue, rtl::OUString(), aNativeControlRegion, aNativeContentRegion ) ) != FALSE ) { - nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight(); + nProgressHeight = aNativeControlRegion.GetHeight(); } } diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.src b/desktop/source/deployment/gui/dp_gui_dialog2.src index 7c47365999a0..996c96b1d083 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.src +++ b/desktop/source/deployment/gui/dp_gui_dialog2.src @@ -43,6 +43,7 @@ ModelessDialog RID_DLG_EXTENSION_MANAGER PushButton RID_EM_BTN_ADD { + HelpID = "desktop:PushButton:RID_DLG_EXTENSION_MANAGER:RID_EM_BTN_ADD"; TabStop = TRUE; Text [ en-US ] = "~Add..."; Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); @@ -50,6 +51,7 @@ ModelessDialog RID_DLG_EXTENSION_MANAGER PushButton RID_EM_BTN_CHECK_UPDATES { + HelpID = "desktop:PushButton:RID_DLG_EXTENSION_MANAGER:RID_EM_BTN_CHECK_UPDATES"; TabStop = TRUE; Text [ en-US ] = "Check for ~Updates..."; Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); @@ -131,6 +133,7 @@ ModalDialog RID_DLG_UPDATE_REQUIRED PushButton RID_EM_BTN_CHECK_UPDATES { + HelpID = "desktop:PushButton:RID_DLG_UPDATE_REQUIRED:RID_EM_BTN_CHECK_UPDATES"; TabStop = TRUE; Text [ en-US ] = "Check for ~Updates..."; Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT ); @@ -138,6 +141,7 @@ ModalDialog RID_DLG_UPDATE_REQUIRED PushButton RID_EM_BTN_CLOSE { + HelpID = "desktop:PushButton:RID_DLG_UPDATE_REQUIRED:RID_EM_BTN_CLOSE"; TabStop = TRUE; DefButton = TRUE; Text [ en-US ] = "Disable all"; diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 24b47aa223e3..24b47aa223e3 100755..100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index 29bedf1b229f..567eb9756386 100755..100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -356,14 +356,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( - lang::XMultiServiceFactory * pServiceManager, - registry::XRegistryKey * pRegistryKey ) -{ - return component_writeInfoHelper( - pServiceManager, pRegistryKey, dp_gui::serviceDecl, dp_gui::licenseDecl, dp_gui::updateDecl ); -} - void * SAL_CALL component_getFactory( sal_Char const * pImplName, lang::XMultiServiceFactory * pServiceManager, diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.src b/desktop/source/deployment/gui/dp_gui_updatedialog.src index 325d98c88d48..20b7d30988fd 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.src +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.src @@ -86,6 +86,7 @@ ModalDialog RID_DLG_UPDATE { TabStop = TRUE; }; CheckBox RID_DLG_UPDATE_ALL { + HelpID = "desktop:CheckBox:RID_DLG_UPDATE:RID_DLG_UPDATE_ALL"; Disable = TRUE; Pos = MAP_APPFONT( RSC_SP_DLG_INNERBORDER_LEFT, @@ -150,6 +151,7 @@ ModalDialog RID_DLG_UPDATE { Text[en-US] = "Release Notes"; }; MultiLineEdit RID_DLG_UPDATE_DESCRIPTIONS { + HelpID = "desktop:MultiLineEdit:RID_DLG_UPDATE:RID_DLG_UPDATE_DESCRIPTIONS"; Disable = TRUE; Border = TRUE; Pos = MAP_APPFONT( @@ -183,6 +185,7 @@ ModalDialog RID_DLG_UPDATE { Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT); }; PushButton RID_DLG_UPDATE_OK { + HelpID = "desktop:PushButton:RID_DLG_UPDATE:RID_DLG_UPDATE_OK"; Disable = TRUE; Pos = MAP_APPFONT( (RSC_SP_DLG_INNERBORDER_LEFT + LOCAL_WIDTH - RSC_CD_PUSHBUTTON_WIDTH - diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.src b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.src index d77dd256582c..f7cc93493b5d 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.src +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.src @@ -90,6 +90,7 @@ ModalDialog RID_DLG_UPDATEINSTALL { }; MultiLineEdit RID_DLG_UPDATE_INSTALL_INFO { + HelpID = "desktop:MultiLineEdit:RID_DLG_UPDATEINSTALL:RID_DLG_UPDATE_INSTALL_INFO"; Pos = MAP_APPFONT( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP + RSC_CD_FIXEDTEXT_HEIGHT + diff --git a/desktop/source/deployment/gui/makefile.mk b/desktop/source/deployment/gui/makefile.mk index 52092a077a4b..fe3921bf506b 100644 --- a/desktop/source/deployment/gui/makefile.mk +++ b/desktop/source/deployment/gui/makefile.mk @@ -107,3 +107,11 @@ RESLIB1IMAGES= $(PRJ)$/res .INCLUDE : target.mk + +ALLTAR : $(MISC)/deploymentgui.component + +$(MISC)/deploymentgui.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt deploymentgui.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt deploymentgui.component diff --git a/desktop/source/deployment/makefile.mk b/desktop/source/deployment/makefile.mk index 6d83a5c1004b..991ba7026d72 100644 --- a/desktop/source/deployment/makefile.mk +++ b/desktop/source/deployment/makefile.mk @@ -110,3 +110,11 @@ RESLIB1SRSFILES += $(SRS)$/deployment_misc.srs .INCLUDE : target.mk + +ALLTAR : $(MISC)/deployment.component + +$(MISC)/deployment.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + deployment.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt deployment.component diff --git a/desktop/source/deployment/manager/dp_commandenvironments.cxx b/desktop/source/deployment/manager/dp_commandenvironments.cxx index c2801ba1d965..0de1f9e96e91 100644 --- a/desktop/source/deployment/manager/dp_commandenvironments.cxx +++ b/desktop/source/deployment/manager/dp_commandenvironments.cxx @@ -31,6 +31,8 @@ #include "com/sun/star/deployment/VersionException.hpp" #include "com/sun/star/deployment/LicenseException.hpp" #include "com/sun/star/deployment/InstallException.hpp" +#include "com/sun/star/deployment/DependencyException.hpp" +#include "com/sun/star/deployment/PlatformException.hpp" #include "com/sun/star/task/XInteractionApprove.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionHandler.hpp" @@ -250,7 +252,43 @@ void NoLicenseCommandEnv::handle( handle_(approve, abort, xRequest); } +// SilentCheckPrerequisitesCommandEnv::SilentCheckPrerequisitesCommandEnv( +// css::uno::Reference< css::task::XInteractionHandler> const & handler): +// BaseCommandEnv(handler) +// { +// } +SilentCheckPrerequisitesCommandEnv::SilentCheckPrerequisitesCommandEnv() +{ +} + +void SilentCheckPrerequisitesCommandEnv::handle( + Reference< task::XInteractionRequest> const & xRequest ) + throw (uno::RuntimeException) +{ + uno::Any request( xRequest->getRequest() ); + OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION ); + deployment::LicenseException licExc; + deployment::PlatformException platformExc; + deployment::DependencyException depExc; + bool approve = false; + bool abort = false; + + if (request >>= licExc) + { + approve = true; + handle_(approve, abort, xRequest); + } + else if ((request >>= platformExc) + || (request >>= depExc)) + { + m_Exception = request; + } + else + { + m_UnknownException = request; + } +} // NoExceptionCommandEnv::NoExceptionCommandEnv( // css::uno::Reference< css::task::XInteractionHandler> const & handler, // css::uno::Type const & type): diff --git a/desktop/source/deployment/manager/dp_commandenvironments.hxx b/desktop/source/deployment/manager/dp_commandenvironments.hxx index aa21f8281c72..bea11586d462 100644 --- a/desktop/source/deployment/manager/dp_commandenvironments.hxx +++ b/desktop/source/deployment/manager/dp_commandenvironments.hxx @@ -135,6 +135,29 @@ public: }; +/* For use in XExtensionManager::addExtension in the call to + XPackage::checkPrerequisites + It prevents all user interactions. The license is always accepted. + It remembers if there was a platform or a dependency exception in + the member m_bException. if there was any other exception then m_bUnknownException + is set. + + */ +class SilentCheckPrerequisitesCommandEnv : public BaseCommandEnv +{ +public: + SilentCheckPrerequisitesCommandEnv(); + // XInteractionHandler + virtual void SAL_CALL handle( + css::uno::Reference<css::task::XInteractionRequest > const & xRequest ) + throw (css::uno::RuntimeException); + + // Set to true if a PlatformException or a DependencyException were handled. + css::uno::Any m_Exception; + // Set to true if an unknown exception was handled. + css::uno::Any m_UnknownException; +}; + // class NoExceptionCommandEnv : public BaseCommandEnv // { // css::uno::Type m_type; diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index de9d97db2b48..709cca86c631 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -139,6 +139,37 @@ void writeLastModified(OUString & url, Reference<ucb::XCommandEnvironment> const OUSTR("Failed to update") + url, 0, exc); } } + +class ExtensionRemoveGuard +{ + css::uno::Reference<css::deployment::XPackage> m_extension; + css::uno::Reference<css::deployment::XPackageManager> m_xPackageManager; + +public: + ExtensionRemoveGuard( + css::uno::Reference<css::deployment::XPackage> const & extension, + css::uno::Reference<css::deployment::XPackageManager> const & xPackageManager): + m_extension(extension), m_xPackageManager(xPackageManager) {} + ~ExtensionRemoveGuard(); + + void reset(css::uno::Reference<css::deployment::XPackage> const & extension) { + m_extension = extension; + } +}; + +ExtensionRemoveGuard::~ExtensionRemoveGuard() +{ + try { + if (m_xPackageManager.is() && m_extension.is()) + m_xPackageManager->removePackage( + dp_misc::getIdentifier(m_extension), ::rtl::OUString(), + css::uno::Reference<css::task::XAbortChannel>(), + css::uno::Reference<css::ucb::XCommandEnvironment>()); + } catch (...) { + OSL_ASSERT(0); + } +} + } //end namespace namespace dp_manager { @@ -500,6 +531,107 @@ ExtensionManager::getSupportedPackageTypes() { return m_userRepository->getSupportedPackageTypes(); } +//Do some necessary checks and user interaction. This function does not +//aquire the extension manager mutex and that mutex must not be aquired +//when this function is called. doChecksForAddExtension does synchronous +//user interactions which may require aquiring the solar mutex. +//Returns true if the extension can be installed. +bool ExtensionManager::doChecksForAddExtension( + Reference<deploy::XPackageManager> const & xPackageMgr, + uno::Sequence<beans::NamedValue> const & properties, + css::uno::Reference<css::deployment::XPackage> const & xTmpExtension, + Reference<task::XAbortChannel> const & xAbortChannel, + Reference<ucb::XCommandEnvironment> const & xCmdEnv, + Reference<deploy::XPackage> & out_existingExtension ) + throw (deploy::DeploymentException, + ucb::CommandFailedException, + ucb::CommandAbortedException, + lang::IllegalArgumentException, + uno::RuntimeException) +{ + try + { + Reference<deploy::XPackage> xOldExtension; + const OUString sIdentifier = dp_misc::getIdentifier(xTmpExtension); + const OUString sFileName = xTmpExtension->getName(); + const OUString sDisplayName = xTmpExtension->getDisplayName(); + const OUString sVersion = xTmpExtension->getVersion(); + + try + { + xOldExtension = xPackageMgr->getDeployedPackage( + sIdentifier, sFileName, xCmdEnv); + out_existingExtension = xOldExtension; + } + catch (lang::IllegalArgumentException &) + { + } + bool bCanInstall = false; + + //This part is not guarded against other threads removing, adding, disabling ... + //etc. the same extension. + //checkInstall is safe because it notifies the user if the extension is not yet + //installed in the same repository. Because addExtension has its own guard + //(m_addMutex), another thread cannot add the extension in the meantime. + //checkUpdate is called if the same extension exists in the same + //repository. The user is asked if they want to replace it. Another + //thread + //could already remove the extension. So asking the user was not + //necessary. No harm is done. The other thread may also ask the user + //if he wants to remove the extension. This depends on the + //XCommandEnvironment which it passes to removeExtension. + if (xOldExtension.is()) + { + //throws a CommandFailedException if the user cancels + //the action. + checkUpdate(sVersion, sDisplayName,xOldExtension, xCmdEnv); + } + else + { + //throws a CommandFailedException if the user cancels + //the action. + checkInstall(sDisplayName, xCmdEnv); + } + //Prevent showing the license if requested. + Reference<ucb::XCommandEnvironment> _xCmdEnv(xCmdEnv); + ExtensionProperties props(OUString(), properties, Reference<ucb::XCommandEnvironment>()); + + dp_misc::DescriptionInfoset info(dp_misc::getDescriptionInfoset(xTmpExtension->getURL())); + const ::boost::optional<dp_misc::SimpleLicenseAttributes> licenseAttributes = + info.getSimpleLicenseAttributes(); + + if (licenseAttributes && licenseAttributes->suppressIfRequired + && props.isSuppressedLicense()) + _xCmdEnv = Reference<ucb::XCommandEnvironment>( + new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler())); + + bCanInstall = xTmpExtension->checkPrerequisites( + xAbortChannel, _xCmdEnv, xOldExtension.is() || props.isExtensionUpdate()) == 0 ? true : false; + + return bCanInstall; + } + catch (deploy::DeploymentException& ) { + throw; + } catch (ucb::CommandFailedException & ) { + throw; + } catch (ucb::CommandAbortedException & ) { + throw; + } catch (lang::IllegalArgumentException &) { + throw; + } catch (uno::RuntimeException &) { + throw; + } catch (uno::Exception &) { + uno::Any excOccurred = ::cppu::getCaughtException(); + deploy::DeploymentException exc( + OUSTR("Extension Manager: exception in doChecksForAddExtension"), + static_cast<OWeakObject*>(this), excOccurred); + throw exc; + } catch (...) { + throw uno::RuntimeException( + OUSTR("Extension Manager: unexpected exception in doChecksForAddExtension"), + static_cast<OWeakObject*>(this)); + } +} // Only add to shared and user repository Reference<deploy::XPackage> ExtensionManager::addExtension( @@ -524,165 +656,183 @@ Reference<deploy::XPackage> ExtensionManager::addExtension( throw lang::IllegalArgumentException( OUSTR("No valid repository name provided."), static_cast<cppu::OWeakObject*>(this), 0); - ::osl::MutexGuard guard(getMutex()); + //We must make sure that the xTmpExtension is not create twice, because this + //would remove the first one. + ::osl::MutexGuard addGuard(m_addMutex); + Reference<deploy::XPackage> xTmpExtension = getTempExtension(url, xAbortChannel, xCmdEnv); + //Make sure the extension is removed from the tmp repository in case + //of an exception + ExtensionRemoveGuard tmpExtensionRemoveGuard(xTmpExtension, m_tmpRepository); const OUString sIdentifier = dp_misc::getIdentifier(xTmpExtension); const OUString sFileName = xTmpExtension->getName(); - const OUString sDisplayName = xTmpExtension->getDisplayName(); - const OUString sVersion = xTmpExtension->getVersion(); - dp_misc::DescriptionInfoset info(dp_misc::getDescriptionInfoset(xTmpExtension->getURL())); - const ::boost::optional<dp_misc::SimpleLicenseAttributes> licenseAttributes = - info.getSimpleLicenseAttributes(); Reference<deploy::XPackage> xOldExtension; Reference<deploy::XPackage> xExtensionBackup; - uno::Any excOccurred1; uno::Any excOccurred2; bool bUserDisabled = false; - try + bool bCanInstall = doChecksForAddExtension( + xPackageManager, + properties, + xTmpExtension, + xAbortChannel, + xCmdEnv, + xOldExtension ); + { - bUserDisabled = isUserDisabled(sIdentifier, sFileName); - try - { - xOldExtension = xPackageManager->getDeployedPackage( - sIdentifier, sFileName, xCmdEnv); - } - catch (lang::IllegalArgumentException &) - { - } - bool bCanInstall = false; - try + // In this garded section (getMutex) we must not use the argument xCmdEnv + // because it may bring up dialogs (XInteractionHandler::handle) this + //may potententially deadlock. See issue + //http://qa.openoffice.org/issues/show_bug.cgi?id=114933 + //By not providing xCmdEnv the underlying APIs will throw an exception if + //the XInteractionRequest cannot be handled + ::osl::MutexGuard guard(getMutex()); + + if (bCanInstall) { - if (xOldExtension.is()) + try { - //throws a CommandFailedException if the user cancels - //the action. - checkUpdate(sVersion, sDisplayName,xOldExtension, xCmdEnv); + bUserDisabled = isUserDisabled(sIdentifier, sFileName); + if (xOldExtension.is()) + { + try + { + xOldExtension->revokePackage( + xAbortChannel, Reference<ucb::XCommandEnvironment>()); + //save the old user extension in case the user aborts + //store the extension in the tmp repository, this will overwrite + //xTmpPackage (same identifier). Do not let the user abort or + //interact + //importing the old extension in the tmp repository will remove + //the xTmpExtension + //no command environment supplied, only this class shall interact + //with the user! + xExtensionBackup = m_tmpRepository->importExtension( + xOldExtension, Reference<task::XAbortChannel>(), + Reference<ucb::XCommandEnvironment>()); + tmpExtensionRemoveGuard.reset(xExtensionBackup); + //xTmpExtension will later be used to check the dependencies + //again. However, only xExtensionBackup will be later removed + //from the tmp repository + xTmpExtension = xExtensionBackup; + OSL_ASSERT(xTmpExtension.is()); + } + catch (lang::DisposedException &) + { + //Another thread might have removed the extension meanwhile + } + } + //check again dependencies but prevent user interaction, + //We can disregard the license, because the user must have already + //accepted it, whe we called checkPrerequisites the first time + SilentCheckPrerequisitesCommandEnv * pSilentCommandEnv = + new SilentCheckPrerequisitesCommandEnv(); + Reference<ucb::XCommandEnvironment> silentCommandEnv(pSilentCommandEnv); + + sal_Int32 failedPrereq = xTmpExtension->checkPrerequisites( + xAbortChannel, silentCommandEnv, true); + if (failedPrereq == 0) + { + xNewExtension = xPackageManager->addPackage( + url, properties, OUString(), xAbortChannel, + Reference<ucb::XCommandEnvironment>()); + //If we add a user extension and there is already one which was + //disabled by a user, then the newly installed one is enabled. If we + //add to another repository then the user extension remains + //disabled. + bool bUserDisabled2 = bUserDisabled; + if (repository.equals(OUSTR("user"))) + bUserDisabled2 = false; + + activateExtension( + dp_misc::getIdentifier(xNewExtension), + xNewExtension->getName(), bUserDisabled2, false, xAbortChannel, + Reference<ucb::XCommandEnvironment>()); + } + else + { + if (pSilentCommandEnv->m_Exception.hasValue()) + ::cppu::throwException(pSilentCommandEnv->m_Exception); + else if ( pSilentCommandEnv->m_UnknownException.hasValue()) + ::cppu::throwException(pSilentCommandEnv->m_UnknownException); + else + throw deploy::DeploymentException ( + OUSTR("Extension Manager: exception during addExtension, ckeckPrerequisites failed"), + static_cast<OWeakObject*>(this), uno::Any()); + } } - else - { - //throws a CommandFailedException if the user cancels - //the action. - checkInstall(sDisplayName, xCmdEnv); + catch (deploy::DeploymentException& ) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (ucb::CommandFailedException & ) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (ucb::CommandAbortedException & ) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (lang::IllegalArgumentException &) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (uno::RuntimeException &) { + excOccurred2 = ::cppu::getCaughtException(); + } catch (...) { + excOccurred2 = ::cppu::getCaughtException(); + deploy::DeploymentException exc( + OUSTR("Extension Manager: exception during addExtension, url: ") + + url, static_cast<OWeakObject*>(this), excOccurred2); + excOccurred2 <<= exc; } - //Prevent showing the license if requested. - Reference<ucb::XCommandEnvironment> _xCmdEnv(xCmdEnv); - ExtensionProperties props(OUString(), properties, Reference<ucb::XCommandEnvironment>()); - if (licenseAttributes && licenseAttributes->suppressIfRequired - && props.isSuppressedLicense()) - _xCmdEnv = Reference<ucb::XCommandEnvironment>( - new NoLicenseCommandEnv(xCmdEnv->getInteractionHandler())); - - bCanInstall = xTmpExtension->checkPrerequisites( - xAbortChannel, _xCmdEnv, xOldExtension.is() || props.isExtensionUpdate()) == 0 ? true : false; - } - catch (deploy::DeploymentException& ) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (ucb::CommandFailedException & ) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (ucb::CommandAbortedException & ) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (lang::IllegalArgumentException &) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (uno::RuntimeException &) { - excOccurred1 = ::cppu::getCaughtException(); - } catch (...) { - excOccurred1 = ::cppu::getCaughtException(); - deploy::DeploymentException exc( - OUSTR("Extension Manager: exception during addExtension, url: ") - + url, static_cast<OWeakObject*>(this), excOccurred1); - excOccurred1 <<= exc; } - if (bCanInstall) + if (excOccurred2.hasValue()) { - if (xOldExtension.is()) + //It does not matter what exception is thrown. We try to + //recover the original status. + //If the user aborted installation then a ucb::CommandAbortedException + //is thrown. + //Use a private AbortChannel so the user cannot interrupt. + try + { + if (xExtensionBackup.is()) + { + Reference<deploy::XPackage> xRestored = + xPackageManager->importExtension( + xExtensionBackup, Reference<task::XAbortChannel>(), + Reference<ucb::XCommandEnvironment>()); + } + activateExtension( + sIdentifier, sFileName, bUserDisabled, false, + Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>()); + } + catch (...) { - xOldExtension->revokePackage(xAbortChannel, xCmdEnv); - //save the old user extension in case the user aborts - //store the extension in the tmp repository, this will overwrite - //xTmpPackage (same identifier). Do not let the user abort or - //interact - Reference<ucb::XCommandEnvironment> tmpCmdEnv( - new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler())); - //importing the old extension in the tmp repository will remove - //the xTmpExtension - xTmpExtension = 0; - xExtensionBackup = m_tmpRepository->importExtension( - xOldExtension, Reference<task::XAbortChannel>(), - tmpCmdEnv); } - xNewExtension = xPackageManager->addPackage( - url, properties, OUString(), xAbortChannel, xCmdEnv); - //If we add a user extension and there is already one which was - //disabled by a user, then the newly installed one is enabled. If we - //add to another repository then the user extension remains - //disabled. - bool bUserDisabled2 = bUserDisabled; - if (repository.equals(OUSTR("user"))) - bUserDisabled2 = false; - activateExtension( - dp_misc::getIdentifier(xNewExtension), - xNewExtension->getName(), bUserDisabled2, false, xAbortChannel, xCmdEnv); - fireModified(); + ::cppu::throwException(excOccurred2); } - } - catch (deploy::DeploymentException& ) { - excOccurred2 = ::cppu::getCaughtException(); + } // leaving the garded section (getMutex()) + + try + { + fireModified(); + + }catch (deploy::DeploymentException& ) { + throw; } catch (ucb::CommandFailedException & ) { - excOccurred2 = ::cppu::getCaughtException(); + throw; } catch (ucb::CommandAbortedException & ) { - excOccurred2 = ::cppu::getCaughtException(); + throw; } catch (lang::IllegalArgumentException &) { - excOccurred2 = ::cppu::getCaughtException(); + throw; } catch (uno::RuntimeException &) { - excOccurred2 = ::cppu::getCaughtException(); - } catch (...) { - excOccurred2 = ::cppu::getCaughtException(); + throw; + } catch (uno::Exception &) { + uno::Any excOccurred = ::cppu::getCaughtException(); deploy::DeploymentException exc( - OUSTR("Extension Manager: exception during addExtension, url: ") - + url, static_cast<OWeakObject*>(this), excOccurred2); - excOccurred2 <<= exc; - } - - if (excOccurred2.hasValue()) - { - //It does not matter what exception is thrown. We try to - //recover the original status. - //If the user aborted installation then a ucb::CommandAbortedException - //is thrown. - //Use a private AbortChannel so the user cannot interrupt. - try - { - Reference<ucb::XCommandEnvironment> tmpCmdEnv( - new TmpRepositoryCommandEnv(xCmdEnv->getInteractionHandler())); - if (xExtensionBackup.is()) - { - Reference<deploy::XPackage> xRestored = - xPackageManager->importExtension( - xExtensionBackup, Reference<task::XAbortChannel>(), - tmpCmdEnv); - } - activateExtension( - sIdentifier, sFileName, bUserDisabled, false, - Reference<task::XAbortChannel>(), tmpCmdEnv); - if (xTmpExtension.is() || xExtensionBackup.is()) - m_tmpRepository->removePackage( - sIdentifier, OUString(), xAbortChannel, xCmdEnv); - fireModified(); - } - catch (...) - { - } - ::cppu::throwException(excOccurred2); + OUSTR("Extension Manager: exception in doChecksForAddExtension"), + static_cast<OWeakObject*>(this), excOccurred); + throw exc; + } catch (...) { + throw uno::RuntimeException( + OUSTR("Extension Manager: unexpected exception in doChecksForAddExtension"), + static_cast<OWeakObject*>(this)); } - if (xTmpExtension.is() || xExtensionBackup.is()) - m_tmpRepository->removePackage( - sIdentifier,OUString(), xAbortChannel, xCmdEnv); - - if (excOccurred1.hasValue()) - ::cppu::throwException(excOccurred1); return xNewExtension; } @@ -1136,6 +1286,14 @@ sal_Bool ExtensionManager::synchronize( bModified |= m_bundledRepository->synchronize(xAbortChannel, xCmdEnv); progressBundled.update(OUSTR("\n\n")); + //Always determine the active extension. This is necessary for the + //first-start optimization. The setup creates the registration data for the + //bundled extensions (brand_layer/share/prereg/bundled), which is copied to the user + //installation (user_installation/extension/bundled) when a user starts OOo + //for the first time after running setup. All bundled extensions are registered + //at that moment. However, extensions with the same identifier can be in the + //shared or user repository, in which case the respective bundled extensions must + //be revoked. try { const uno::Sequence<uno::Sequence<Reference<deploy::XPackage> > > diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index 64cada7da3ac..683f45a1bd6e 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -235,6 +235,8 @@ private: css::uno::Reference<css::deployment::XPackageManager> m_bundledRepository; css::uno::Reference<css::deployment::XPackageManager> m_tmpRepository; + //only to be used within addExtension + ::osl::Mutex m_addMutex; /* contains the names of all repositories (except tmp) in order of there priority. That is, the first element is "user" follod by "shared" and then "bundled" @@ -296,6 +298,21 @@ private: css::uno::Reference<css::deployment::XPackageManager> getPackageManager(::rtl::OUString const & repository) throw (css::lang::IllegalArgumentException); + + bool doChecksForAddExtension( + css::uno::Reference<css::deployment::XPackageManager> const & xPackageMgr, + css::uno::Sequence<css::beans::NamedValue> const & properties, + css::uno::Reference<css::deployment::XPackage> const & xTmpExtension, + css::uno::Reference<css::task::XAbortChannel> const & xAbortChannel, + css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv, + css::uno::Reference<css::deployment::XPackage> & out_existingExtension ) + throw (css::deployment::DeploymentException, + css::ucb::CommandFailedException, + css::ucb::CommandAbortedException, + css::lang::IllegalArgumentException, + css::uno::RuntimeException); + + }; } diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx index df579944c6e4..9a181d1573e5 100644 --- a/desktop/source/deployment/manager/dp_properties.cxx +++ b/desktop/source/deployment/manager/dp_properties.cxx @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * diff --git a/desktop/source/deployment/manager/dp_properties.hxx b/desktop/source/deployment/manager/dp_properties.hxx index 97fc8b8c5394..a1b953ce8376 100644 --- a/desktop/source/deployment/manager/dp_properties.hxx +++ b/desktop/source/deployment/manager/dp_properties.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dp_manager.h,v $ - * $Revision: 1.17 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index fe3490903043..cfdac4068130 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -589,6 +589,11 @@ void TRACE(::rtl::OString const & sText) void syncRepositories(Reference<ucb::XCommandEnvironment> const & xCmdEnv) { + OUString sDisable; + ::rtl::Bootstrap::get( OUSTR( "DISABLE_EXTENSION_SYNCHRONIZATION" ), sDisable, OUString() ); + if (sDisable.getLength() > 0) + return; + Reference<deployment::XExtensionManager> xExtensionManager; //synchronize shared before bundled otherewise there are //more revoke and registration calls. diff --git a/desktop/source/deployment/misc/dp_update.cxx b/desktop/source/deployment/misc/dp_update.cxx index 52011f1f0ca0..fb6efe0b79aa 100755..100644 --- a/desktop/source/deployment/misc/dp_update.cxx +++ b/desktop/source/deployment/misc/dp_update.cxx @@ -90,8 +90,6 @@ getUpdateInformation( Reference<deployment::XUpdateInformationProvider > const & Sequence<Reference< xml::dom::XElement > >(); } -//Put in anonymous namespace - void getOwnUpdateInfos( Reference<uno::XComponentContext> const & xContext, Reference<deployment::XUpdateInformationProvider > const & updateInformation, @@ -185,6 +183,56 @@ void getDefaultUpdateInfos( } } +bool containsBundledOnly(Sequence<Reference<deployment::XPackage> > const & sameIdExtensions) +{ + OSL_ASSERT(sameIdExtensions.getLength() == 3); + if (!sameIdExtensions[0].is() && !sameIdExtensions[1].is() && sameIdExtensions[2].is()) + return true; + else + return false; +} +/** Returns true if the list of extensions are bundled extensions and there are no + other extensions with the same identifier in the shared or user repository. + If extensionList is NULL, then it is checked if there are only bundled extensions. +*/ +bool onlyBundledExtensions( + Reference<deployment::XExtensionManager> const & xExtMgr, + std::vector< Reference<deployment::XPackage > > const * extensionList) +{ + OSL_ASSERT(xExtMgr.is()); + bool onlyBundled = true; + if (extensionList) + { + typedef std::vector<Reference<deployment::XPackage > >::const_iterator CIT; + for (CIT i = extensionList->begin(); i != extensionList->end(); i++) + { + Sequence<Reference<deployment::XPackage> > seqExt = xExtMgr->getExtensionsWithSameIdentifier( + dp_misc::getIdentifier(*i), (*i)->getName(), Reference<ucb::XCommandEnvironment>()); + + if (!containsBundledOnly(seqExt)) + { + onlyBundled = false; + break; + } + + } + } + else + { + const uno::Sequence< uno::Sequence< Reference<deployment::XPackage > > > seqAllExt = + xExtMgr->getAllExtensions(Reference<task::XAbortChannel>(), Reference<ucb::XCommandEnvironment>()); + + for (int pos = seqAllExt.getLength(); pos --; ) + { + if (!containsBundledOnly(seqAllExt[pos])) + { + onlyBundled = false; + break; + } + } + } + return onlyBundled; +} } // anon namespace @@ -233,13 +281,14 @@ UPDATE_SOURCE isUpdateUserExtension( retVal = UPDATE_SOURCE_ONLINE; } - else if (bundledVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), OUString(), bundledVersion, onlineVersion); - if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } + //No update for bundled extensions, they are updated only by the setup + //else if (bundledVersion.getLength()) + //{ + // int index = determineHighestVersion( + // OUString(), OUString(), bundledVersion, onlineVersion); + // if (index == 3) + // retVal = UPDATE_SOURCE_ONLINE; + //} } else { @@ -278,13 +327,14 @@ UPDATE_SOURCE isUpdateSharedExtension( else if (index == 3) retVal = UPDATE_SOURCE_ONLINE; } - else if (bundledVersion.getLength()) - { - int index = determineHighestVersion( - OUString(), OUString(), bundledVersion, onlineVersion); - if (index == 3) - retVal = UPDATE_SOURCE_ONLINE; - } + //No update for bundled extensions, they are updated only by the setup + //else if (bundledVersion.getLength()) + //{ + // int index = determineHighestVersion( + // OUString(), OUString(), bundledVersion, onlineVersion); + // if (index == 3) + // retVal = UPDATE_SOURCE_ONLINE; + //} return retVal; } @@ -332,7 +382,7 @@ UpdateInfoMap getOnlineUpdateInfos( { OSL_ASSERT(xExtMgr.is()); UpdateInfoMap infoMap; - if (!xExtMgr.is()) + if (!xExtMgr.is() || onlyBundledExtensions(xExtMgr, extensionList)) return infoMap; if (!extensionList) diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index 9ea6e8227340..1e7ee5bfac8a 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -139,7 +139,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend void addDataToDb(OUString const & url, ConfigurationBackendDb::Data const & data); ::boost::optional<ConfigurationBackendDb::Data> readDataFromDb(OUString const & url); - void deleteDataFromDb(OUString const & url); + OUString deleteDataFromDb(OUString const & url); ::std::list<OUString> getAllIniEntries(); public: @@ -240,10 +240,18 @@ void BackendImpl::addDataToDb( return data; } -void BackendImpl::deleteDataFromDb(OUString const & url) +OUString BackendImpl::deleteDataFromDb(OUString const & url) { - if (m_backendDb.get()) + OUString url2(url); + if (m_backendDb.get()) { + boost::optional< ConfigurationBackendDb::Data > data( + m_backendDb->getEntry(url)); + if (data) { + url2 = expandUnoRcTerm(data->iniEntry); + } m_backendDb->removeEntry(url); + } + return url2; } ::std::list<OUString> BackendImpl::getAllIniEntries() @@ -359,16 +367,11 @@ void BackendImpl::configmgrini_verify_init( do { OUString token( line.getToken( 0, ' ', index ).trim() ); if (token.getLength() > 0) { - // cleanup, check if existing: - if (create_ucb_content( - 0, expandUnoRcTerm(token), xCmdEnv, - false /* no throw */ )) { - //The file may not exist anymore if a shared or bundled - //extension was removed, but it can still be in the configmgrini. - //After running XExtensionManager::synchronize, the configmgrini is - //cleaned up - m_xcs_files.push_back( token ); - } + //The file may not exist anymore if a shared or bundled + //extension was removed, but it can still be in the configmgrini. + //After running XExtensionManager::synchronize, the configmgrini is + //cleaned up + m_xcs_files.push_back( token ); } } while (index >= 0); @@ -378,31 +381,15 @@ void BackendImpl::configmgrini_verify_init( sal_Int32 index = sizeof ("DATA=") - 1; do { OUString token( line.getToken( 0, ' ', index ).trim() ); - if (token.getLength() > 0) { + if (token.getLength() > 0) + { if (token[ 0 ] == '?') token = token.copy( 1 ); - // cleanup, check if existing: - if (create_ucb_content( - 0, expandUnoRcTerm(token), - xCmdEnv, false /* no throw */ )) { - //The file may not exist anymore if a shared or bundled - //extension was removed, but it can still be in the configmgrini. - //After running XExtensionManager::synchronize, the configmgrini is - //cleaned up - m_xcu_files.push_back( token ); - } - else - { - //Check if it was removed. Only when the file contained %origin, so that - //a new file was writen in the user installation (e.g. $BUNDLED_EXTENSIONS_USER) - //See also ConfigurationBackendDb.iniEntry - ::std::list<OUString> iniEntries = getAllIniEntries(); - if (::std::find(iniEntries.begin(), iniEntries.end(), token) - != iniEntries.end()) - m_xcu_files.push_back( token ); - else - OSL_ENSURE(0, "Extension manager: Invalid configmgr.ini entry."); - } + //The file may not exist anymore if a shared or bundled + //extension was removed, but it can still be in the configmgrini. + //After running XExtensionManager::synchronize, the configmgrini is + //cleaned up + m_xcu_files.push_back( token ); } } while (index >= 0); @@ -502,6 +489,8 @@ bool BackendImpl::removeFromConfigmgrIni( { //in case the xcu contained %origin% then the configmr.ini contains the //url to the file in the user installation (e.g. $BUNDLED_EXTENSIONS_USER) + //However, m_url (getURL()) contains the URL for the file in the actual + //extension installatation. ::boost::optional<ConfigurationBackendDb::Data> data = readDataFromDb(url_); if (data) i = std::find(rSet.begin(), rSet.end(), data->iniEntry); @@ -736,11 +725,11 @@ void BackendImpl::PackageImpl::processPackage_( //rebuilding the directory structure. rtl::OUString url2( rtl::OStringToOUString(i->first, RTL_TEXTENCODING_UTF8)); - ConfigurationBackendDb::Data data; if (url2 != url) { bool schema = i->second.equalsIgnoreAsciiCase( "vnd.sun.star.configuration-schema"); OUString url_replaced(url2); + ConfigurationBackendDb::Data data; if (!schema) { const OUString sModFolder = that->createFolder(OUString(), xCmdEnv); @@ -753,18 +742,29 @@ void BackendImpl::PackageImpl::processPackage_( deleteTempFolder(sModFolder); } that->addToConfigmgrIni(schema, url_replaced, xCmdEnv); + data.iniEntry = dp_misc::makeRcTerm(url_replaced); that->addDataToDb(url2, data); } that->m_registeredPackages->erase(i->first); } - ::ucbhelper::Content( - makeURL( that->getCachePath(), OUSTR("registry") ), - xCmdEnv ).executeCommand( - OUSTR("delete"), Any( true /* delete physically */ ) ); + try + { + ::ucbhelper::Content( + makeURL( that->getCachePath(), OUSTR("registry") ), + xCmdEnv ).executeCommand( + OUSTR("delete"), Any( true /* delete physically */ ) ); + } + catch(Exception&) + { + OSL_ASSERT(0); + } + } + url = that->deleteDataFromDb(url); + if (!m_isSchema) { + com::sun::star::configuration::Update::get( + that->m_xComponentContext)->removeExtensionXcuFile( + expandUnoRcUrl(url)); } - that->deleteDataFromDb(getURL()); - - //TODO: revoking at runtime, possible, sensible? } } diff --git a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx index 845ba88cb813..2a02c6d8efa0 100644 --- a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dp_package.cxx,v $ - * $Revision: 1.34.16.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx index 1b6c4f8973a4..7023897bd8de 100644 --- a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx +++ b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dp_backend.h,v $ - * $Revision: 1.18 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index c5e440a2a825..0f309a5b729f 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -129,7 +129,9 @@ public: virtual Reference<deployment::XPackage> SAL_CALL bindPackage( OUString const & url, OUString const & mediaType, sal_Bool bRemoved, OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv ) - throw (deployment::DeploymentException, CommandFailedException, + throw (deployment::DeploymentException, + deployment::InvalidRemovedParameterException, + CommandFailedException, lang::IllegalArgumentException, RuntimeException); virtual Sequence< Reference<deployment::XPackageTypeInfo> > SAL_CALL getSupportedPackageTypes() throw (RuntimeException); @@ -461,7 +463,8 @@ void PackageRegistryImpl::update() throw (RuntimeException) Reference<deployment::XPackage> PackageRegistryImpl::bindPackage( OUString const & url, OUString const & mediaType_, sal_Bool bRemoved, OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv ) - throw (deployment::DeploymentException, CommandFailedException, + throw (deployment::DeploymentException, deployment::InvalidRemovedParameterException, + CommandFailedException, lang::IllegalArgumentException, RuntimeException) { check(); diff --git a/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx b/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx index 976a6281a2bd..ff1044910985 100644 --- a/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx +++ b/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dp_package.cxx,v $ - * $Revision: 1.34.16.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx b/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx index 4f17eeda24a6..80cd33771a34 100644 --- a/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx +++ b/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dp_backend.h,v $ - * $Revision: 1.18 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index bc17a1f7163d..5a5efe825cfb 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -80,6 +80,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend ::rtl::Reference<AbortChannel> const & abortChannel, Reference<XCommandEnvironment> const & xCmdEnv ); + bool extensionContainsCompiledHelp(); public: PackageImpl( ::rtl::Reference<PackageRegistryBackend> const & myBackend, @@ -100,7 +101,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference<XCommandEnvironment> const & xCmdEnv ); void implProcessHelp( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, - Reference<ucb::XCommandEnvironment> const & xCmdEnv); + bool compiledHelp, Reference<ucb::XCommandEnvironment> const & xCmdEnv); void implCollectXhpFiles( const rtl::OUString& aDir, std::vector< rtl::OUString >& o_rXhpFileVector ); @@ -259,6 +260,57 @@ BackendImpl * BackendImpl::PackageImpl::getMyBackend() const return pBackend; } + +bool BackendImpl::PackageImpl::extensionContainsCompiledHelp() +{ + bool bCompiled = true; + rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl(getURL()); + + ::osl::Directory helpFolder(aExpandedHelpURL); + if ( helpFolder.open() == ::osl::File::E_None) + { + //iterate over the contents of the help folder + //We assume that all folders withing the help folder contain language specific + //help files. If just one of them does not contain compiled help then this + //function returns false. + ::osl::DirectoryItem item; + ::osl::File::RC errorNext = ::osl::File::E_None; + while ((errorNext = helpFolder.getNextItem(item)) == ::osl::File::E_None) + { + //No find the language folders + ::osl::FileStatus stat(FileStatusMask_Type | FileStatusMask_FileName |FileStatusMask_FileURL); + if (item.getFileStatus(stat) == ::osl::File::E_None) + { + if (stat.getFileType() != ::osl::FileStatus::Directory) + continue; + + //look if there is the folder help.idxl in the language folder + OUString compUrl(stat.getFileURL() + OUSTR("/help.idxl")); + ::osl::Directory compiledFolder(compUrl); + if (compiledFolder.open() != ::osl::File::E_None) + { + bCompiled = false; + break; + } + } + else + { + //Error + OSL_ASSERT(0); + bCompiled = false; + break; + } + } + if (errorNext != ::osl::File::E_NOENT + && errorNext != ::osl::File::E_None) + { + //Error + OSL_ASSERT(0); + bCompiled = false; + } + } + return bCompiled; +} //______________________________________________________________________________ beans::Optional< beans::Ambiguous<sal_Bool> > BackendImpl::PackageImpl::isRegistered_( @@ -289,7 +341,8 @@ void BackendImpl::PackageImpl::processPackage_( BackendImpl* that = getMyBackend(); Reference< deployment::XPackage > xThisPackage( this ); - that->implProcessHelp( xThisPackage, doRegisterPackage, xCmdEnv); + that->implProcessHelp( xThisPackage, doRegisterPackage, + extensionContainsCompiledHelp(), xCmdEnv); } beans::Optional< OUString > BackendImpl::PackageImpl::getRegistrationDataURL() @@ -316,213 +369,220 @@ static rtl::OUString aHelpStr( rtl::OUString::createFromAscii( "help" ) ); void BackendImpl::implProcessHelp -( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, +( Reference< deployment::XPackage > xPackage, bool doRegisterPackage, bool compiledHelp, Reference<ucb::XCommandEnvironment> const & xCmdEnv) { OSL_ASSERT(xPackage.is()); if (doRegisterPackage) { HelpBackendDb::Data data; - const OUString sHelpFolder = createFolder(OUString(), xCmdEnv); - data.dataUrl = sHelpFolder; - - Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess(); - rtl::OUString aHelpURL = xPackage->getURL(); - rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL ); - rtl::OUString aName = xPackage->getName(); - if( !xSFA->isFolder( aExpandedHelpURL ) ) + + if (compiledHelp) { - rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR ); - aErrStr += rtl::OUString::createFromAscii( "No help folder" ); - OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); - throw deployment::DeploymentException( rtl::OUString(), oWeakThis, - makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + data.dataUrl = xPackage->getURL(); } - - Reference<XComponentContext> const & xContext = getComponentContext(); - Reference< script::XInvocation > xInvocation; - if( xContext.is() ) + else { - try + const OUString sHelpFolder = createFolder(OUString(), xCmdEnv); + data.dataUrl = sHelpFolder; + + Reference< ucb::XSimpleFileAccess > xSFA = getFileAccess(); + rtl::OUString aHelpURL = xPackage->getURL(); + rtl::OUString aExpandedHelpURL = dp_misc::expandUnoRcUrl( aHelpURL ); + rtl::OUString aName = xPackage->getName(); + if( !xSFA->isFolder( aExpandedHelpURL ) ) { - xInvocation = Reference< script::XInvocation >( - xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( - "com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY ); + rtl::OUString aErrStr = getResourceString( RID_STR_HELPPROCESSING_GENERAL_ERROR ); + aErrStr += rtl::OUString::createFromAscii( "No help folder" ); + OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); + throw deployment::DeploymentException( rtl::OUString(), oWeakThis, + makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); } - catch (Exception &) + + Reference<XComponentContext> const & xContext = getComponentContext(); + Reference< script::XInvocation > xInvocation; + if( xContext.is() ) { - // i98680: Survive missing lucene + try + { + xInvocation = Reference< script::XInvocation >( + xContext->getServiceManager()->createInstanceWithContext( rtl::OUString::createFromAscii( + "com.sun.star.help.HelpIndexer" ), xContext ) , UNO_QUERY ); + } + catch (Exception &) + { + // i98680: Survive missing lucene + } } - } - // Scan languages - Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true ); - sal_Int32 nLangCount = aLanguageFolderSeq.getLength(); - const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray(); - for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang ) - { - rtl::OUString aLangURL = pSeq[iLang]; - if( xSFA->isFolder( aLangURL ) ) + // Scan languages + Sequence< rtl::OUString > aLanguageFolderSeq = xSFA->getFolderContents( aExpandedHelpURL, true ); + sal_Int32 nLangCount = aLanguageFolderSeq.getLength(); + const rtl::OUString* pSeq = aLanguageFolderSeq.getConstArray(); + for( sal_Int32 iLang = 0 ; iLang < nLangCount ; ++iLang ) { - std::vector< rtl::OUString > aXhpFileVector; - - // calculate jar file URL - sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/'); - // for example "/en" - OUString langFolderURLSegment( - aLangURL.copy( - indexStartSegment + 1, aLangURL.getLength() - indexStartSegment - 1)); - - //create the folder in the "temporary folder" - ::ucbhelper::Content langFolderContent; - const OUString langFolderDest = makeURL(sHelpFolder, langFolderURLSegment); - const OUString langFolderDestExpanded = ::dp_misc::expandUnoRcUrl(langFolderDest); - ::dp_misc::create_folder( - &langFolderContent, - langFolderDest, xCmdEnv); - - rtl::OUString aJarFile( - makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr + - OUSTR(".jar"))); - aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile); - - rtl::OUString aEncodedJarFilePath = rtl::Uri::encode( - aJarFile, rtl_UriCharClassPchar, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ); - rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); - aDestBasePath += aEncodedJarFilePath; - aDestBasePath += rtl::OUString::createFromAscii( "/" ); - - sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1; - - Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true ); - sal_Int32 nSubLangCount = aSubLangSeq.getLength(); - const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray(); - for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang ) + rtl::OUString aLangURL = pSeq[iLang]; + if( xSFA->isFolder( aLangURL ) ) { - rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang]; - if( !xSFA->isFolder( aSubFolderURL ) ) - continue; + std::vector< rtl::OUString > aXhpFileVector; + + // calculate jar file URL + sal_Int32 indexStartSegment = aLangURL.lastIndexOf('/'); + // for example "/en" + OUString langFolderURLSegment( + aLangURL.copy( + indexStartSegment + 1, aLangURL.getLength() - indexStartSegment - 1)); + + //create the folder in the "temporary folder" + ::ucbhelper::Content langFolderContent; + const OUString langFolderDest = makeURL(sHelpFolder, langFolderURLSegment); + const OUString langFolderDestExpanded = ::dp_misc::expandUnoRcUrl(langFolderDest); + ::dp_misc::create_folder( + &langFolderContent, + langFolderDest, xCmdEnv); + + rtl::OUString aJarFile( + makeURL(sHelpFolder, langFolderURLSegment + aSlash + aHelpStr + + OUSTR(".jar"))); + aJarFile = ::dp_misc::expandUnoRcUrl(aJarFile); + + rtl::OUString aEncodedJarFilePath = rtl::Uri::encode( + aJarFile, rtl_UriCharClassPchar, + rtl_UriEncodeIgnoreEscapes, + RTL_TEXTENCODING_UTF8 ); + rtl::OUString aDestBasePath = rtl::OUString::createFromAscii( "vnd.sun.star.pkg://" ); + aDestBasePath += aEncodedJarFilePath; + aDestBasePath += rtl::OUString::createFromAscii( "/" ); + + sal_Int32 nLenLangFolderURL = aLangURL.getLength() + 1; + + Sequence< rtl::OUString > aSubLangSeq = xSFA->getFolderContents( aLangURL, true ); + sal_Int32 nSubLangCount = aSubLangSeq.getLength(); + const rtl::OUString* pSubLangSeq = aSubLangSeq.getConstArray(); + for( sal_Int32 iSubLang = 0 ; iSubLang < nSubLangCount ; ++iSubLang ) + { + rtl::OUString aSubFolderURL = pSubLangSeq[iSubLang]; + if( !xSFA->isFolder( aSubFolderURL ) ) + continue; - implCollectXhpFiles( aSubFolderURL, aXhpFileVector ); + implCollectXhpFiles( aSubFolderURL, aXhpFileVector ); - // Copy to package (later: move?) - rtl::OUString aDestPath = aDestBasePath; - rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); - aDestPath += aPureFolderName; - xSFA->copy( aSubFolderURL, aDestPath ); - } + // Copy to package (later: move?) + rtl::OUString aDestPath = aDestBasePath; + rtl::OUString aPureFolderName = aSubFolderURL.copy( nLenLangFolderURL ); + aDestPath += aPureFolderName; + xSFA->copy( aSubFolderURL, aDestPath ); + } - // Call compiler - sal_Int32 nXhpFileCount = aXhpFileVector.size(); - rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount]; - for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) - { - rtl::OUString aXhpFile = aXhpFileVector[iXhp]; - rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL ); - pXhpFiles[iXhp] = aXhpRelFile; - } + // Call compiler + sal_Int32 nXhpFileCount = aXhpFileVector.size(); + rtl::OUString* pXhpFiles = new rtl::OUString[nXhpFileCount]; + for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) + { + rtl::OUString aXhpFile = aXhpFileVector[iXhp]; + rtl::OUString aXhpRelFile = aXhpFile.copy( nLenLangFolderURL ); + pXhpFiles[iXhp] = aXhpRelFile; + } - rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); - rtl::OUString aOfficeHelpPathFileURL; - ::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL ); + rtl::OUString aOfficeHelpPath( SvtPathOptions().GetHelpPath() ); + rtl::OUString aOfficeHelpPathFileURL; + ::osl::File::getFileURLFromSystemPath( aOfficeHelpPath, aOfficeHelpPathFileURL ); - HelpProcessingErrorInfo aErrorInfo; - bool bSuccess = compileExtensionHelp( - aOfficeHelpPathFileURL, aHelpStr, aLangURL, - nXhpFileCount, pXhpFiles, - langFolderDestExpanded, aErrorInfo ); + HelpProcessingErrorInfo aErrorInfo; + bool bSuccess = compileExtensionHelp( + aOfficeHelpPathFileURL, aHelpStr, aLangURL, + nXhpFileCount, pXhpFiles, + langFolderDestExpanded, aErrorInfo ); - if( bSuccess && xInvocation.is() ) - { - Sequence<uno::Any> aParamsSeq( 6 ); - - aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) ); - - rtl::OUString aLang; - sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' ); - if( nLastSlash != -1 ) - aLang = aLangURL.copy( nLastSlash + 1 ); - else - aLang = rtl::OUString::createFromAscii( "en" ); - aParamsSeq[1] = uno::makeAny( aLang ); - - aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) ); - aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) ); - - aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) ); - rtl::OUString aSystemPath; - osl::FileBase::getSystemPathFromFileURL( - langFolderDestExpanded, aSystemPath ); - aParamsSeq[5] = uno::makeAny( aSystemPath ); - - Sequence< sal_Int16 > aOutParamIndex; - Sequence< uno::Any > aOutParam; - uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ), - aParamsSeq, aOutParamIndex, aOutParam ); - } - - if( !bSuccess ) - { - USHORT nErrStrId = 0; - switch( aErrorInfo.m_eErrorClass ) + if( bSuccess && xInvocation.is() ) { - case HELPPROCESSING_GENERAL_ERROR: - case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; - case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break; - default: ; - }; - - rtl::OUString aErrStr; - if( nErrStrId != 0 ) + Sequence<uno::Any> aParamsSeq( 6 ); + + aParamsSeq[0] = uno::makeAny( rtl::OUString::createFromAscii( "-lang" ) ); + + rtl::OUString aLang; + sal_Int32 nLastSlash = aLangURL.lastIndexOf( '/' ); + if( nLastSlash != -1 ) + aLang = aLangURL.copy( nLastSlash + 1 ); + else + aLang = rtl::OUString::createFromAscii( "en" ); + aParamsSeq[1] = uno::makeAny( aLang ); + + aParamsSeq[2] = uno::makeAny( rtl::OUString::createFromAscii( "-mod" ) ); + aParamsSeq[3] = uno::makeAny( rtl::OUString::createFromAscii( "help" ) ); + + aParamsSeq[4] = uno::makeAny( rtl::OUString::createFromAscii( "-zipdir" ) ); + rtl::OUString aSystemPath; + osl::FileBase::getSystemPathFromFileURL( + langFolderDestExpanded, aSystemPath ); + aParamsSeq[5] = uno::makeAny( aSystemPath ); + + Sequence< sal_Int16 > aOutParamIndex; + Sequence< uno::Any > aOutParam; + uno::Any aRet = xInvocation->invoke( rtl::OUString::createFromAscii( "createIndex" ), + aParamsSeq, aOutParamIndex, aOutParam ); + } + + if( !bSuccess ) { - aErrStr = getResourceString( nErrStrId ); - - // Remoce CR/LF - rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg ); - sal_Unicode nCR = 13, nLF = 10; - sal_Int32 nSearchCR = aErrMsg.indexOf( nCR ); - sal_Int32 nSearchLF = aErrMsg.indexOf( nLF ); - sal_Int32 nCopy; - if( nSearchCR != -1 || nSearchLF != -1 ) + USHORT nErrStrId = 0; + switch( aErrorInfo.m_eErrorClass ) { - if( nSearchCR == -1 ) - nCopy = nSearchLF; - else if( nSearchLF == -1 ) - nCopy = nSearchCR; - else - nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF; - - aErrMsg = aErrMsg.copy( 0, nCopy ); - } - aErrStr += aErrMsg; - if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() ) + case HELPPROCESSING_GENERAL_ERROR: + case HELPPROCESSING_INTERNAL_ERROR: nErrStrId = RID_STR_HELPPROCESSING_GENERAL_ERROR; break; + case HELPPROCESSING_XMLPARSING_ERROR: nErrStrId = RID_STR_HELPPROCESSING_XMLPARSING_ERROR; break; + default: ; + }; + + rtl::OUString aErrStr; + if( nErrStrId != 0 ) { - aErrStr += rtl::OUString::createFromAscii( " in " ); - - rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile, - rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); - aErrStr += aDecodedFile; - if( aErrorInfo.m_nXMLParsingLine != -1 ) + aErrStr = getResourceString( nErrStrId ); + + // Remoce CR/LF + rtl::OUString aErrMsg( aErrorInfo.m_aErrorMsg ); + sal_Unicode nCR = 13, nLF = 10; + sal_Int32 nSearchCR = aErrMsg.indexOf( nCR ); + sal_Int32 nSearchLF = aErrMsg.indexOf( nLF ); + sal_Int32 nCopy; + if( nSearchCR != -1 || nSearchLF != -1 ) { - aErrStr += rtl::OUString::createFromAscii( ", line " ); - aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine ); + if( nSearchCR == -1 ) + nCopy = nSearchLF; + else if( nSearchLF == -1 ) + nCopy = nSearchCR; + else + nCopy = ( nSearchCR < nSearchLF ) ? nSearchCR : nSearchLF; + + aErrMsg = aErrMsg.copy( 0, nCopy ); + } + aErrStr += aErrMsg; + if( nErrStrId == RID_STR_HELPPROCESSING_XMLPARSING_ERROR && aErrorInfo.m_aXMLParsingFile.getLength() ) + { + aErrStr += rtl::OUString::createFromAscii( " in " ); + + rtl::OUString aDecodedFile = rtl::Uri::decode( aErrorInfo.m_aXMLParsingFile, + rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + aErrStr += aDecodedFile; + if( aErrorInfo.m_nXMLParsingLine != -1 ) + { + aErrStr += rtl::OUString::createFromAscii( ", line " ); + aErrStr += ::rtl::OUString::valueOf( aErrorInfo.m_nXMLParsingLine ); + } } } - } - OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); - throw deployment::DeploymentException( rtl::OUString(), oWeakThis, - makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); + throw deployment::DeploymentException( rtl::OUString(), oWeakThis, + makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); + } } } } - //Writing the data entry replaces writing the flag file. If we got to this //point the registration was successful. addDataToDb(xPackage->getURL(), data); - } + } //if (doRegisterPackage) else { deleteDataFromDb(xPackage->getURL()); diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx index 3bf67e0c050b..8ec9a39d5050 100644 --- a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dp_package.cxx,v $ - * $Revision: 1.34.16.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx index edf7dfdfc284..c7b730fd1b99 100644 --- a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx +++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dp_backend.h,v $ - * $Revision: 1.18 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 2ad6478b665c..feb55d0af3bf 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -866,14 +866,10 @@ void BackendImpl::PackageImpl::processPackage_( try { xPackage->registerPackage( startup, xSubAbortChannel, xCmdEnv ); } - catch (RuntimeException &) { - throw; - } - catch (ucb::CommandAbortedException &) { - throw; - } - catch (Exception &) { - // CommandFailedException, DeploymentException: + catch (Exception &) + { + //We even try a rollback if the user cancelled the action (CommandAbortedException) + //in order to prevent invalid database entries. Any exc( ::cppu::getCaughtException() ); // try to handle exception, notify: bool approve = false, abort = false; @@ -904,14 +900,8 @@ void BackendImpl::PackageImpl::processPackage_( bundle[ pos ]->revokePackage( xSubAbortChannel, xCmdEnv ); } - catch (RuntimeException &) { - throw; - } - catch (ucb::CommandAbortedException &) { - throw; - } - catch (Exception &) { - // bundle rollback error: + catch (Exception &) + { OSL_ENSURE( 0, ::rtl::OUStringToOString( ::comphelper::anyToString( ::cppu::getCaughtException() ), diff --git a/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx b/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx index ce0d3029084d..9a84a7286027 100644 --- a/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx +++ b/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dp_package.cxx,v $ - * $Revision: 1.34.16.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx b/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx index 9d227f8b64b8..7feaeba5568b 100644 --- a/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx +++ b/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dp_backend.h,v $ - * $Revision: 1.18 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/inc/helpid.hrc b/desktop/source/inc/helpid.hrc index 2619c4398881..d96b12196342 100644 --- a/desktop/source/inc/helpid.hrc +++ b/desktop/source/inc/helpid.hrc @@ -28,51 +28,40 @@ #if ! defined INCLUDED_DESKTOP_HELPID_HRC #define INCLUDED_DESKTOP_HELPID_HRC -#include "svl/solar.hrc" +#define HID_PACKAGE_MANAGER "DESKTOP_HID_PACKAGE_MANAGER" +#define HID_PACKAGE_MANAGER_TREELISTBOX "DESKTOP_HID_PACKAGE_MANAGER_TREELISTBOX" +#define HID_PACKAGE_MANAGER_PROGRESS "DESKTOP_HID_PACKAGE_MANAGER_PROGRESS" +#define HID_PACKAGE_MANAGER_PROGRESS_CANCEL "DESKTOP_HID_PACKAGE_MANAGER_PROGRESS_CANCEL" +#define HID_PACKAGE_MANAGER_MENU_ITEM "DESKTOP_HID_PACKAGE_MANAGER_MENU_ITEM" -#define HID_GLOBAL_FALLBACK 0xFFFFFFFF +#define HID_FIRSTSTART_DIALOG "DESKTOP_HID_FIRSTSTART_DIALOG" +#define HID_FIRSTSTART_WELCOME "DESKTOP_HID_FIRSTSTART_WELCOME" +#define HID_FIRSTSTART_LICENSE "DESKTOP_HID_FIRSTSTART_LICENSE" +#define HID_FIRSTSTART_MIGRATION "DESKTOP_HID_FIRSTSTART_MIGRATION" +#define HID_FIRSTSTART_REGISTRATION "DESKTOP_HID_FIRSTSTART_REGISTRATION" +#define HID_FIRSTSTART_USER "DESKTOP_HID_FIRSTSTART_USER" +#define HID_FIRSTSTART_PREV "DESKTOP_HID_FIRSTSTART_PREV" +#define HID_FIRSTSTART_NEXT "DESKTOP_HID_FIRSTSTART_NEXT" +#define HID_FIRSTSTART_CANCEL "DESKTOP_HID_FIRSTSTART_CANCEL" +#define HID_FIRSTSTART_FINISH "DESKTOP_HID_FIRSTSTART_FINISH" +#define UID_FIRSTSTART_HELP "DESKTOP_UID_FIRSTSTART_HELP" +#define UID_BTN_LICENSE_ACCEPT "DESKTOP_UID_BTN_LICENSE_ACCEPT" +#define HID_FIRSTSTART_UPDATE_CHECK "DESKTOP_HID_FIRSTSTART_UPDATE_CHECK" +#define HID_DEPLOYMENT_GUI_UPDATE "DESKTOP_HID_DEPLOYMENT_GUI_UPDATE" +#define HID_DEPLOYMENT_GUI_UPDATEINSTALL "DESKTOP_HID_DEPLOYMENT_GUI_UPDATEINSTALL" +#define HID_DEPLOYMENT_GUI_UPDATE_PUBLISHER "DESKTOP_HID_DEPLOYMENT_GUI_UPDATE_PUBLISHER" +#define HID_DEPLOYMENT_GUI_UPDATE_RELEASENOTES "DESKTOP_HID_DEPLOYMENT_GUI_UPDATE_RELEASENOTES" +#define HID_DEPLOYMENT_GUI_UPDATE_AVAILABLE_UPDATES "DESKTOP_HID_DEPLOYMENT_GUI_UPDATE_AVAILABLE_UPDATES" -#define HID_PACKAGE_MANAGER (HID_DESKTOP_START + 0) -#define HID_PACKAGE_MANAGER_TREELISTBOX (HID_DESKTOP_START + 1) -#define HID_PACKAGE_MANAGER_PROGRESS (HID_DESKTOP_START + 2) -#define HID_PACKAGE_MANAGER_PROGRESS_CANCEL (HID_DESKTOP_START + 3) -#define HID_PACKAGE_MANAGER_MENU_ITEM (HID_DESKTOP_START + 4) +#define HID_EXTENSION_MANAGER_LISTBOX "DESKTOP_HID_EXTENSION_MANAGER_LISTBOX" +#define HID_EXTENSION_MANAGER_LISTBOX_OPTIONS "DESKTOP_HID_EXTENSION_MANAGER_LISTBOX_OPTIONS" +#define HID_EXTENSION_MANAGER_LISTBOX_ENABLE "DESKTOP_HID_EXTENSION_MANAGER_LISTBOX_ENABLE" +#define HID_EXTENSION_MANAGER_LISTBOX_DISABLE "DESKTOP_HID_EXTENSION_MANAGER_LISTBOX_DISABLE" +#define HID_EXTENSION_MANAGER_LISTBOX_REMOVE "DESKTOP_HID_EXTENSION_MANAGER_LISTBOX_REMOVE" -#define HID_FIRSTSTART_DIALOG (HID_DESKTOP_START + 5) -#define HID_FIRSTSTART_WELCOME (HID_DESKTOP_START + 6) -#define HID_FIRSTSTART_LICENSE (HID_DESKTOP_START + 7) -#define HID_FIRSTSTART_MIGRATION (HID_DESKTOP_START + 8) -#define HID_FIRSTSTART_REGISTRATION (HID_DESKTOP_START + 9) -#define HID_FIRSTSTART_USER (HID_DESKTOP_START + 10) -#define HID_FIRSTSTART_PREV (HID_DESKTOP_START + 11) -#define HID_FIRSTSTART_NEXT (HID_DESKTOP_START + 12) -#define HID_FIRSTSTART_CANCEL (HID_DESKTOP_START + 13) -#define HID_FIRSTSTART_FINISH (HID_DESKTOP_START + 14) -#define UID_FIRSTSTART_HELP (HID_DESKTOP_START + 15) -#define UID_BTN_LICENSE_ACCEPT (HID_DESKTOP_START + 16) -#define HID_FIRSTSTART_UPDATE_CHECK (HID_DESKTOP_START + 17) -#define HID_DEPLOYMENT_GUI_UPDATE (HID_DESKTOP_START + 18) -#define HID_DEPLOYMENT_GUI_UPDATEINSTALL (HID_DESKTOP_START + 19) -#define HID_DEPLOYMENT_GUI_UPDATE_PUBLISHER (HID_DESKTOP_START + 20) -#define HID_DEPLOYMENT_GUI_UPDATE_RELEASENOTES (HID_DESKTOP_START + 21) -#define HID_DEPLOYMENT_GUI_UPDATE_AVAILABLE_UPDATES (HID_DESKTOP_START + 22) +#define HID_EXTENSION_DEPENDENCIES "DESKTOP_HID_EXTENSION_DEPENDENCIES" -#define HID_EXTENSION_MANAGER_LISTBOX (HID_DESKTOP_START + 23) -#define HID_EXTENSION_MANAGER_LISTBOX_OPTIONS (HID_DESKTOP_START + 24) -#define HID_EXTENSION_MANAGER_LISTBOX_ENABLE (HID_DESKTOP_START + 25) -#define HID_EXTENSION_MANAGER_LISTBOX_DISABLE (HID_DESKTOP_START + 26) -#define HID_EXTENSION_MANAGER_LISTBOX_REMOVE (HID_DESKTOP_START + 27) - -#define HID_EXTENSION_DEPENDENCIES (HID_DESKTOP_START + 28) - -#define HID_PACKAGE_MANAGER_UPD_REQ (HID_DESKTOP_START + 29) - -#define ACT_DESKTOP_HID_END HID_PACKAGE_MANAGER_UPD_REQ - -// check bounds: -#if ACT_DESKTOP_HID_END > HID_DESKTOP_END -#error Resource overflow in #line, #file -#endif +#define HID_PACKAGE_MANAGER_UPD_REQ "DESKTOP_HID_PACKAGE_MANAGER_UPD_REQ" #endif diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 314537836921..314537836921 100755..100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx diff --git a/desktop/source/migration/services/cexports.cxx b/desktop/source/migration/services/cexports.cxx index cf9a9ab30b0c..d869993f39c3 100644 --- a/desktop/source/migration/services/cexports.cxx +++ b/desktop/source/migration/services/cexports.cxx @@ -63,13 +63,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 20b8232044e9..589701d534d5 100755..100644 --- a/desktop/source/migration/services/cexportsoo3.cxx +++ b/desktop/source/migration/services/cexportsoo3.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: cexports.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -54,13 +51,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/makefile.mk b/desktop/source/migration/services/makefile.mk index 2f3eb9308ebd..38f97084b36e 100644 --- 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 \ @@ -117,3 +117,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 100644 index 000000000000..2b21ab123b9e --- /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/migrationoo3.component b/desktop/source/migration/services/migrationoo3.component new file mode 100644 index 000000000000..380c389ab7b9 --- /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 100755 index ac2c3750bfe0..000000000000 --- 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/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index 2e3a8d1d518c..3e9836fa2e84 100644 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: extensionmigration.cxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx index 03995652888c..fb58692c81ee 100644 --- a/desktop/source/migration/services/oo3extensionmigration.hxx +++ b/desktop/source/migration/services/oo3extensionmigration.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: extensionmigration.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/wizard.src b/desktop/source/migration/wizard.src index 9c1ab5496d39..e690e130c74f 100644 --- a/desktop/source/migration/wizard.src +++ b/desktop/source/migration/wizard.src @@ -188,6 +188,7 @@ TabPage TP_LICENSE }; 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; @@ -195,6 +196,7 @@ TabPage TP_LICENSE }; 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 ) ; @@ -240,6 +242,7 @@ TabPage TP_MIGRATION 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; @@ -275,6 +278,7 @@ TabPage TP_UPDATE_CHECK 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; @@ -321,6 +325,7 @@ TabPage TP_USER }; 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); @@ -333,6 +338,7 @@ TabPage TP_USER }; 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); @@ -345,6 +351,7 @@ TabPage TP_USER }; 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); @@ -359,6 +366,7 @@ TabPage TP_USER }; 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); @@ -391,6 +399,7 @@ TabPage TP_REGISTRATION }; 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); @@ -398,12 +407,14 @@ TabPage TP_REGISTRATION }; 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); diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx index 4e100fd99665..430737106a59 100644 --- a/desktop/source/offacc/acceptor.cxx +++ b/desktop/source/offacc/acceptor.cxx @@ -317,23 +317,6 @@ component_getImplementationEnvironment(const sal_Char **ppEnvironmentTypeName, u *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; } -sal_Bool SAL_CALL -component_writeInfo(void *pServiceManager, void *pRegistryKey) -{ - Reference< XMultiServiceFactory > xMan(reinterpret_cast< XMultiServiceFactory* >(pServiceManager)); - Reference< XRegistryKey > xKey(reinterpret_cast< XRegistryKey* >(pRegistryKey)); - - // register service - ::rtl::OUString aTempStr; - ::rtl::OUString aImpl(RTL_CONSTASCII_USTRINGPARAM("/")); - aImpl += Acceptor::impl_getImplementationName(); - aImpl += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES")); - Reference< XRegistryKey > xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(Acceptor::impl_getSupportedServiceNames()[0]); - - return sal_True; -} - void * SAL_CALL component_getFactory(const sal_Char *pImplementationName, void *pServiceManager, void *) { diff --git a/desktop/source/offacc/makefile.mk b/desktop/source/offacc/makefile.mk index c2d53930b580..809c28414bef 100644 --- a/desktop/source/offacc/makefile.mk +++ b/desktop/source/offacc/makefile.mk @@ -60,3 +60,11 @@ SHL1STDLIBS= \ .INCLUDE : target.mk + +ALLTAR : $(MISC)/offacc.component + +$(MISC)/offacc.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + offacc.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt offacc.component diff --git a/desktop/source/offacc/offacc.component b/desktop/source/offacc/offacc.component new file mode 100644 index 000000000000..6f0d4a97a2d2 --- /dev/null +++ b/desktop/source/offacc/offacc.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.office.comp.Acceptor"> + <service name="com.sun.star.office.Acceptor"/> + </implementation> +</component> diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index a9a0c8271373..4545ed862271 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -39,6 +39,7 @@ #include "osl/thread.h" #include "osl/process.h" #include "osl/conditn.hxx" +#include "osl/file.hxx" #include "cppuhelper/implbase1.hxx" #include "cppuhelper/exc_hlp.hxx" #include "comphelper/anytostring.hxx" @@ -377,6 +378,29 @@ extern "C" int unopkg_main() if (e != osl_File_E_None && e != osl_File_E_NOENT) throw Exception(OUSTR("Could not delete ") + extensionUnorc, 0); } + else if (subCommand.equals(OUSTR("sync"))) + { + //sync is private!!!! Only for bundled extensions!!! + //For performance reasons unopkg sync is called during the setup and + //creates the registration data for the repository of the bundled + //extensions. It is then copied to the user installation during + //startup of OOo (userdata/extensions/bundled). The registration + //data is in the brand installation and must be removed when + //uninstalling OOo. We do this here, before UNO is + //bootstrapped. Otherwies files could be locked by this process. + + //If there is no folder left in + //$BRAND_BASE_DIR/share/extensions + //then we can delete the registration data at + //$BUNDLED_EXTENSIONS_USER + if (hasNoFolder(OUSTR("$BRAND_BASE_DIR/share/extensions"))) + { + removeFolder(OUSTR("$BUNDLED_EXTENSIONS_USER")); + //return otherwise we create the registration data again + return 0; + } + + } xComponentContext = getUNO( disposeGuard, option_verbose, option_shared, subcmd_gui, @@ -587,6 +611,15 @@ extern "C" int unopkg_main() xDialog->startExecuteModal(xListener); dialogEnded.wait(); } + else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("sync"))) + { + //This sub command may be removed later and is only there to have a + //possibility to start extension synching without any output. + //This is just here so we do not get an error, because of an unknown + //sub-command. We do synching before + //the sub-commands are processed. + + } else { dp_misc::writeConsoleError( diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index 3272810afee2..d7b6e1ca2336 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -528,5 +528,110 @@ Reference<XComponentContext> getUNO( return xComponentContext; } +//Determines if a folder does not contains a folder. +//Return false may also mean that the status could not be determined +//because some error occurred. +bool hasNoFolder(OUString const & folderUrl) +{ + bool ret = false; + OUString url = folderUrl; + ::rtl::Bootstrap::expandMacros(url); + ::osl::Directory dir(url); + osl::File::RC rc = dir.open(); + if (rc == osl::File::E_None) + { + bool bFolderExist = false; + osl::DirectoryItem i; + osl::File::RC rcNext = osl::File::E_None; + while ( (rcNext = dir.getNextItem(i)) == osl::File::E_None) + { + osl::FileStatus stat(FileStatusMask_Type); + if (i.getFileStatus(stat) == osl::File::E_None) + { + if (stat.getFileType() == osl::FileStatus::Directory) + { + bFolderExist = true; + break; + } + } + else + { + dp_misc::writeConsole( + OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n")); + break; + } + i = osl::DirectoryItem(); + } + + if (rcNext == osl::File::E_NOENT || + rcNext == osl::File::E_None) + { + if (!bFolderExist) + ret = true; + } + else + { + dp_misc::writeConsole( + OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n")); + } + + dir.close(); + } + else + { + dp_misc::writeConsole( + OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n")); + } + return ret; } +void removeFolder(OUString const & folderUrl) +{ + OUString url = folderUrl; + ::rtl::Bootstrap::expandMacros(url); + ::osl::Directory dir(url); + ::osl::File::RC rc = dir.open(); + if (rc == osl::File::E_None) + { + ::osl::DirectoryItem i; + ::osl::File::RC rcNext = ::osl::File::E_None; + while ( (rcNext = dir.getNextItem(i)) == ::osl::File::E_None) + { + ::osl::FileStatus stat(FileStatusMask_Type | FileStatusMask_FileURL); + if (i.getFileStatus(stat) == ::osl::File::E_None) + { + ::osl::FileStatus::Type t = stat.getFileType(); + if (t == ::osl::FileStatus::Directory) + { + //remove folder + removeFolder(stat.getFileURL()); + } + else if (t == ::osl::FileStatus::Regular) + { + //remove file + ::osl::File::remove(stat.getFileURL()); + } + else + { + OSL_ASSERT(0); + } + } + else + { + dp_misc::writeConsole( + OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n")); + break; + } + i = ::osl::DirectoryItem(); + } + dir.close(); + ::osl::Directory::remove(url); + } + else + { + dp_misc::writeConsole( + OUSTR("unopkg: Error while removing ") + url + OUSTR("\n")); + } +} + +} diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h index 43f77513b10c..4975cc4c087b 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_shared.h +++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h @@ -178,5 +178,11 @@ css::uno::Reference<css::uno::XComponentContext> getUNO( DisposeGuard & disposeGuard, bool verbose, bool shared, bool bGui, css::uno::Reference<css::uno::XComponentContext> & out_LocalComponentContext); +bool hasNoFolder(::rtl::OUString const & folderUrl); + +void removeFolder(::rtl::OUString const & folderUrl); + } + + diff --git a/desktop/source/registration/com/sun/star/registration/Registration.java b/desktop/source/registration/com/sun/star/registration/Registration.java index 7fc24b80398f..e5c98dd51ab8 100644 --- a/desktop/source/registration/com/sun/star/registration/Registration.java +++ b/desktop/source/registration/com/sun/star/registration/Registration.java @@ -63,10 +63,6 @@ public class Registration { return xSingleServiceFactory; } - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(Registration.class.getName(), _serviceName, regKey); - } - static final String _serviceName = "com.sun.star.comp.framework.DoRegistrationJob"; static public class _Registration implements XJob { diff --git a/desktop/source/registration/com/sun/star/registration/makefile.mk b/desktop/source/registration/com/sun/star/registration/makefile.mk index 9784166eb91b..859802256256 100644 --- a/desktop/source/registration/com/sun/star/registration/makefile.mk +++ b/desktop/source/registration/com/sun/star/registration/makefile.mk @@ -53,3 +53,10 @@ CUSTOMMANIFESTFILE = manifest .INCLUDE : target.mk +ALLTAR : $(MISC)/productregistration.jar.component + +$(MISC)/productregistration.jar.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt productregistration.jar.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_JAVA)productregistration.jar' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt productregistration.jar.component diff --git a/desktop/source/registration/com/sun/star/registration/productregistration.jar.component b/desktop/source/registration/com/sun/star/registration/productregistration.jar.component new file mode 100644 index 000000000000..c022a98ae010 --- /dev/null +++ b/desktop/source/registration/com/sun/star/registration/productregistration.jar.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.Java2" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.registration.Registration"> + <service name="com.sun.star.comp.framework.DoRegistrationJob"/> + </implementation> +</component> diff --git a/desktop/source/so_comp/makefile.mk b/desktop/source/so_comp/makefile.mk index 590f99518c68..7f9ceb4b646a 100644 --- a/desktop/source/so_comp/makefile.mk +++ b/desktop/source/so_comp/makefile.mk @@ -75,3 +75,10 @@ SHL1STDLIBS= \ .INCLUDE : target.mk +ALLTAR : $(MISC)/socomp.component + +$(MISC)/socomp.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + socomp.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt socomp.component diff --git a/desktop/source/so_comp/services.cxx b/desktop/source/so_comp/services.cxx index d1a2b3139e91..e28d762fc69b 100644 --- a/desktop/source/so_comp/services.cxx +++ b/desktop/source/so_comp/services.cxx @@ -100,32 +100,6 @@ component_getImplementationEnvironment( *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; } -sal_Bool SAL_CALL -component_writeInfo( - void* pServiceManager, - void* pRegistryKey) -{ - Reference<XMultiServiceFactory> xMan( - reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - Reference<XRegistryKey> xKey( - reinterpret_cast< XRegistryKey* >( pRegistryKey ) ) ; - - // iterate over service names and register them... - OUString aImpl; - const char* pServiceName = NULL; - const char* pImplName = NULL; - for (int i = 0; (pServices[i]!=NULL)&&(pImplementations[i]!=NULL); i++) { - pServiceName= pServices[i]; - pImplName = pImplementations[i]; - aImpl = OUString::createFromAscii("/") - + OUString::createFromAscii(pImplName) - + OUString::createFromAscii("/UNO/SERVICES"); - Reference<XRegistryKey> xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(OUString::createFromAscii(pServiceName)); - } - return sal_True; -} - void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, diff --git a/desktop/source/so_comp/socomp.component b/desktop/source/so_comp/socomp.component new file mode 100644 index 000000000000..a53035223c39 --- /dev/null +++ b/desktop/source/so_comp/socomp.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.Evaluation"> + <service name="com.sun.star.office.Evaluation"/> + </implementation> + <implementation name="com.sun.star.comp.desktop.OEMPreloadJob"> + <service name="com.sun.star.office.OEMPreloadJob"/> + </implementation> +</component> diff --git a/desktop/source/splash/makefile.mk b/desktop/source/splash/makefile.mk index 89609687438c..02483aae83dd 100644 --- a/desktop/source/splash/makefile.mk +++ b/desktop/source/splash/makefile.mk @@ -87,3 +87,11 @@ DO_PHONY=.PHONY $(INCCOM)$/introbmpnames.hxx $(DO_PHONY): echo const char INTRO_BITMAP_STRINGLIST[]=$(EMQ)"$(INTRO_BITMAPS:f:t",")$(EMQ)"$(EMQ); > $@ echo LASTTIME_INTRO_BITMAPS=$(INTRO_BITMAPS:f) > $(MISC)$/intro_bmp_names.mk + +ALLTAR : $(MISC)/spl.component + +$(MISC)/spl.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + spl.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt spl.component diff --git a/desktop/source/splash/services_spl.cxx b/desktop/source/splash/services_spl.cxx index 349ec2ec0a78..4b1130c71cdf 100755 --- a/desktop/source/splash/services_spl.cxx +++ b/desktop/source/splash/services_spl.cxx @@ -97,32 +97,6 @@ component_getImplementationEnvironment( *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; } -sal_Bool SAL_CALL -component_writeInfo( - void* pServiceManager, - void* pRegistryKey) -{ - Reference<XMultiServiceFactory> xMan( - reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - Reference<XRegistryKey> xKey( - reinterpret_cast< XRegistryKey* >( pRegistryKey ) ) ; - - // iterate over service names and register them... - OUString aImpl; - const char* pServiceName = NULL; - const char* pImplName = NULL; - for (int i = 0; (pServices[i]!=NULL)&&(pImplementations[i]!=NULL); i++) { - pServiceName= pServices[i]; - pImplName = pImplementations[i]; - aImpl = OUString::createFromAscii("/") - + OUString::createFromAscii(pImplName) - + OUString::createFromAscii("/UNO/SERVICES"); - Reference<XRegistryKey> xNewKey = xKey->createKey(aImpl); - xNewKey->createKey(OUString::createFromAscii(pServiceName)); - } - return sal_True; -} - void* SAL_CALL component_getFactory( const sal_Char* pImplementationName, diff --git a/desktop/source/splash/spl.component b/desktop/source/splash/spl.component new file mode 100644 index 000000000000..2caecf5c0e4b --- /dev/null +++ b/desktop/source/splash/spl.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.FirstStart"> + <service name="com.sun.star.task.Job"/> + </implementation> + <implementation name="com.sun.star.office.comp.SplashScreen"> + <service name="com.sun.star.office.SplashScreen"/> + </implementation> +</component> diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 381a98ce008f..c6a185b8e54d 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -640,20 +640,18 @@ void SplashScreen::Paint( const Rectangle&) ImplControlValue aValue( _iProgress * _barwidth / _iMax); Rectangle aDrawRect( Point(_tlx, _tly), Size( _barwidth, _barheight ) ); - Region aControlRegion( aDrawRect ); - Region aNativeControlRegion, aNativeContentRegion; + Rectangle aNativeControlRegion, aNativeContentRegion; - if( GetNativeControlRegion( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aControlRegion, + if( GetNativeControlRegion( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aDrawRect, CTRL_STATE_ENABLED, aValue, rtl::OUString(), aNativeControlRegion, aNativeContentRegion ) ) { - long nProgressHeight = aNativeControlRegion.GetBoundRect().GetHeight(); + long nProgressHeight = aNativeControlRegion.GetHeight(); aDrawRect.Top() -= (nProgressHeight - _barheight)/2; aDrawRect.Bottom() += (nProgressHeight - _barheight)/2; - aControlRegion = Region( aDrawRect ); } - if( (bNativeOK = DrawNativeControl( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aControlRegion, + if( (bNativeOK = DrawNativeControl( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL, aDrawRect, CTRL_STATE_ENABLED, aValue, _sProgressText )) != FALSE ) { return; |