From c2d9d80b487dd0d7353b22eee44bee3b84fc7838 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Wed, 21 Apr 2010 16:04:34 +0200 Subject: jl152 import 263449 from native0jl:#i77196# no registration of components in uno.exe at startup, fixed extension activation, basic, etc. --- basic/source/inc/namecont.hxx | 11 ++ basic/source/uno/namecont.cxx | 90 ++++++++- .../deployment/gui/dp_gui_extensioncmdqueue.cxx | 2 +- .../deployment/manager/dp_extensionmanager.cxx | 207 +++++++++------------ .../deployment/manager/dp_extensionmanager.hxx | 21 ++- desktop/source/deployment/manager/dp_manager.hrc | 2 +- desktop/source/deployment/manager/dp_manager.src | 4 + .../deployment/registry/component/dp_component.cxx | 39 ++-- .../registry/configuration/dp_configuration.cxx | 2 + desktop/source/deployment/registry/dp_backend.cxx | 7 +- .../registry/executable/dp_executable.cxx | 2 + .../source/deployment/registry/help/dp_help.cxx | 2 + .../source/deployment/registry/inc/dp_backend.h | 3 + .../deployment/registry/package/dp_package.cxx | 4 +- .../deployment/registry/script/dp_script.cxx | 2 + .../source/deployment/registry/sfwk/dp_sfwk.cxx | 2 + .../migration/services/extensionmigration.cxx | 6 +- .../migration/services/oo3extensionmigration.cxx | 2 +- desktop/source/pkgchk/unopkg/unopkg_app.cxx | 7 +- svx/source/smarttags/SmartTagMgr.cxx | 11 +- 20 files changed, 253 insertions(+), 173 deletions(-) diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index 1f7e77170d44..2d24759d9b83 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -689,6 +689,7 @@ enum IteratorState { USER_EXTENSIONS, SHARED_EXTENSIONS, + BUNDLED_EXTENSIONS, END_REACHED }; @@ -708,6 +709,8 @@ protected: implGetNextUserScriptPackage( bool& rbPureDialogLib ); com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implGetNextSharedScriptPackage( bool& rbPureDialogLib ); + com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > + implGetNextBundledScriptPackage( bool& rbPureDialogLib ); com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; @@ -721,8 +724,16 @@ protected: < com::sun::star::deployment::XPackage > > m_aSharedPackagesSeq; bool m_bSharedPackagesLoaded; + com::sun::star::uno::Sequence< com::sun::star::uno::Reference + < com::sun::star::deployment::XPackage > > m_aBundledPackagesSeq; + bool m_bBundledPackagesLoaded; + + int m_iUserPackage; int m_iSharedPackage; + int m_iBundledPackage; + + ScriptSubPackageIterator* m_pScriptSubPackageIterator; diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 14c84420dad6..7a6a771f85cc 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -65,7 +65,7 @@ #include #include #include -#include "com/sun/star/deployment/thePackageManagerFactory.hpp" +#include "com/sun/star/deployment/ExtensionManager.hpp" #include #ifndef _RTL_USTRING_HXX_ #include @@ -1080,6 +1080,7 @@ sal_Bool SfxLibraryContainer::init_Impl( OUString aUserSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" ); OUString aSharedSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" ); + OUString aBundledSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" ); OUString aInstSearchStr = OUString::createFromAscii( "$(INST)" ); Sequence< OUString > aNames = pPrevCont->getElementNames(); @@ -1111,6 +1112,7 @@ sal_Bool SfxLibraryContainer::init_Impl( bool bCreateLink = true; if( aStorageURL.indexOf( aUserSearchStr ) != -1 || aStorageURL.indexOf( aSharedSearchStr ) != -1 || + aStorageURL.indexOf( aBundledSearchStr ) != -1 || aStorageURL.indexOf( aInstSearchStr ) != -1 ) { bCreateLink = false; @@ -2182,11 +2184,12 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink OUString aUserSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" ); OUString aSharedSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" ); + OUString aBundledSearchStr = OUString::createFromAscii( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" ); if( StorageURL.indexOf( aUserSearchStr ) != -1 ) { pNewLib->mbExtension = sal_True; } - else if( StorageURL.indexOf( aSharedSearchStr ) != -1 ) + else if( StorageURL.indexOf( aSharedSearchStr ) != -1 || StorageURL.indexOf( aBundledSearchStr ) != -1 ) { pNewLib->mbExtension = sal_True; pNewLib->mbReadOnly = sal_True; @@ -3075,8 +3078,10 @@ ScriptExtensionIterator::ScriptExtensionIterator( void ) : m_eState( USER_EXTENSIONS ) , m_bUserPackagesLoaded( false ) , m_bSharedPackagesLoaded( false ) + , m_bBundledPackagesLoaded( false ) , m_iUserPackage( 0 ) , m_iSharedPackage( 0 ) + , m_iBundledPackage( 0 ) , m_pScriptSubPackageIterator( NULL ) { Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); @@ -3125,6 +3130,16 @@ rtl::OUString ScriptExtensionIterator::nextBasicOrDialogLibrary( bool& rbPureDia aRetLib = xScriptPackage->getURL(); break; } + case BUNDLED_EXTENSIONS: + { + Reference< deployment::XPackage > xScriptPackage = + implGetNextBundledScriptPackage( rbPureDialogLib ); + if( !xScriptPackage.is() ) + break; + + aRetLib = xScriptPackage->getURL(); + break; + } case END_REACHED: VOS_ENSURE( false, "ScriptExtensionIterator::nextBasicOrDialogLibrary(): Invalid case END_REACHED" ); break; @@ -3295,10 +3310,11 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextUserScript { try { - Reference< XPackageManager > xUserManager = - thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("user") ); - m_aUserPackagesSeq = xUserManager->getDeployedPackages - ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + Reference< XExtensionManager > xManager = + ExtensionManager::get( m_xContext ); + m_aUserPackagesSeq = xManager->getDeployedExtensions + (rtl::OUString::createFromAscii("user"), + Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); } catch( com::sun::star::uno::DeploymentException& ) { @@ -3348,10 +3364,11 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri { try { - Reference< XPackageManager > xSharedManager = - thePackageManagerFactory::get( m_xContext )->getPackageManager( rtl::OUString::createFromAscii("shared") ); - m_aSharedPackagesSeq = xSharedManager->getDeployedPackages - ( Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + Reference< XExtensionManager > xSharedManager = + ExtensionManager::get( m_xContext ); + m_aSharedPackagesSeq = xSharedManager->getDeployedExtensions + (rtl::OUString::createFromAscii("shared"), + Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); } catch( com::sun::star::uno::DeploymentException& ) { @@ -3391,4 +3408,57 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri return xScriptPackage; } +Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextBundledScriptPackage + ( bool& rbPureDialogLib ) +{ + Reference< deployment::XPackage > xScriptPackage; + + if( !m_bBundledPackagesLoaded ) + { + try + { + Reference< XExtensionManager > xManager = + ExtensionManager::get( m_xContext ); + m_aBundledPackagesSeq = xManager->getDeployedExtensions + (rtl::OUString::createFromAscii("bundled"), + Reference< task::XAbortChannel >(), Reference< ucb::XCommandEnvironment >() ); + } + catch( com::sun::star::uno::DeploymentException& ) + { + // Special Office installations may not contain deployment code + return xScriptPackage; + } + + m_bBundledPackagesLoaded = true; + } + + if( m_iBundledPackage == m_aBundledPackagesSeq.getLength() ) + { + m_eState = END_REACHED; + } + else + { + if( m_pScriptSubPackageIterator == NULL ) + { + const Reference< deployment::XPackage >* pBundledPackages = m_aBundledPackagesSeq.getConstArray(); + Reference< deployment::XPackage > xPackage = pBundledPackages[ m_iBundledPackage ]; + VOS_ENSURE( xPackage.is(), "ScriptExtensionIterator::implGetNextBundledScriptPackage(): Invalid package" ); + m_pScriptSubPackageIterator = new ScriptSubPackageIterator( xPackage ); + } + + if( m_pScriptSubPackageIterator != NULL ) + { + xScriptPackage = m_pScriptSubPackageIterator->getNextScriptSubPackage( rbPureDialogLib ); + if( !xScriptPackage.is() ) + { + delete m_pScriptSubPackageIterator; + m_pScriptSubPackageIterator = NULL; + m_iBundledPackage++; + } + } + } + + return xScriptPackage; +} + } // namespace basic diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 4b55a93d3f84..647c46b754c8 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -1048,7 +1048,7 @@ void ExtensionCmdQueue::Thread::_enableExtension( ::rtl::Reference< ProgressCmdE try { - xPackage->registerPackage( xAbortChannel, rCmdEnv.get() ); + xPackage->registerPackage(false, xAbortChannel, rCmdEnv.get() ); if ( m_pDialogHelper ) m_pDialogHelper->updatePackageInfo( xPackage ); } diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx index c4581556749f..bbe476e57fba 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.cxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx @@ -260,48 +260,38 @@ void ExtensionManager::addExtensionsToMap( } -/* -*/ -Reference ExtensionManager::getExtensionAndStatus( - ::rtl::OUString const & identifier, - ::rtl::OUString const & fileName, - ::rtl::OUString const & repository, - Reference const & xAbortChannel, - Reference const & xCmdEnv, - bool & out_bWasRegistered) +bool ExtensionManager::isUserDisabled( + OUString const & identifier, OUString const & fileName) { - Reference theExtension; ::std::list > listExtensions = - getExtensionsWithSameId(identifier, fileName); - OSL_ASSERT(listExtensions.size() == m_repositoryNames.size()); - Reference xActiveExtension; - ::std::list::const_iterator - inames = m_repositoryNames.begin(); - ::std::list >::const_iterator - iext = listExtensions.begin(); - for (; inames != m_repositoryNames.end(); inames++, iext++) + getExtensionsWithSameId(identifier, fileName); + OSL_ASSERT(listExtensions.size() == 3); + + return isUserDisabled( ::comphelper::containerToSequence< + Reference, + ::std::list > + > (listExtensions)); +} + +bool ExtensionManager::isUserDisabled( + uno::Sequence > const & seqExtSameId) +{ + OSL_ASSERT(seqExtSameId.getLength() == 3); + Reference const & userExtension = seqExtSameId[0]; + if (userExtension.is()) { - if (repository.equals(*inames)) - { - theExtension = *iext; - if (iext->is()) - { - beans::Optional > optRegistered = - (*iext)->isRegistered(xAbortChannel, xCmdEnv); - OSL_ENSURE(! optRegistered.Value.IsAmbiguous, - "Extension is not properly registered"); - //IsAmbiguous = true: only partly registered, but we assume - //that this is the active extension, and something went wrong when registering it - //previously. - if (optRegistered.IsPresent - && (optRegistered.Value.Value || optRegistered.Value.IsAmbiguous)) - out_bWasRegistered = true; - } - break; - } + beans::Optional > reg = + userExtension->isRegistered(Reference(), + Reference()); + //If the value is ambiguous is than we assume that the extension + //is enabled, but something went wrong during enabling. We do not + //automatically disable user extensions. + if (reg.IsPresent && + ! reg.Value.IsAmbiguous && ! reg.Value.Value) + return true; } - return theExtension; + return false; } /* @@ -321,6 +311,8 @@ Reference ExtensionManager::getExtensionAndStatus( */ void ExtensionManager::activateExtension( OUString const & identifier, OUString const & fileName, + bool bUserDisabled, + bool bStartup, Reference const & xAbortChannel, Reference const & xCmdEnv ) { @@ -333,11 +325,13 @@ void ExtensionManager::activateExtension( Reference, ::std::list > > (listExtensions), - xAbortChannel, xCmdEnv); + bUserDisabled, bStartup, xAbortChannel, xCmdEnv); } void ExtensionManager::activateExtension( uno::Sequence > const & seqExt, + bool bUserDisabled, + bool bStartup, Reference const & xAbortChannel, Reference const & xCmdEnv ) { @@ -355,9 +349,12 @@ void ExtensionManager::activateExtension( if (!optReg.IsPresent) break; - //Check if this is a disabled user extension, if so then skip - if (!optReg.Value.Value && i == 0) //e.g. not registered - continue; + //Check if this is a disabled user extension, + if (i == 0 && bUserDisabled) + { + aExt->revokePackage(xAbortChannel, xCmdEnv); + continue; + } //If we have already determined an active extension then we must //make sure to unregister all extensions with the same id in @@ -374,7 +371,7 @@ void ExtensionManager::activateExtension( //Register if not already done. //reregister if the value is ambiguous, which indicates that //something went wrong during last registration. - aExt->registerPackage(xAbortChannel, xCmdEnv); + aExt->registerPackage(bStartup, xAbortChannel, xCmdEnv); } } } @@ -455,17 +452,18 @@ Reference ExtensionManager::addExtension( uno::Any excOccurred1; uno::Any excOccurred2; - + bool bUserDisabled = false; try { - //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 bWasRegistered = false; - xOldExtension = getExtensionAndStatus( - sIdentifier, sFileName, repository, xAbortChannel, - xCmdEnv, bWasRegistered); + bUserDisabled = isUserDisabled(sIdentifier, sFileName); + try + { + xOldExtension = xPackageManager->getDeployedPackage( + sIdentifier, sFileName, xCmdEnv); + } + catch (lang::IllegalArgumentException &) + { + } bool bCanInstall = false; try { @@ -514,8 +512,7 @@ Reference ExtensionManager::addExtension( { if (xOldExtension.is()) { - if (bWasRegistered) - xOldExtension->revokePackage(xAbortChannel, xCmdEnv); + 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 @@ -532,9 +529,17 @@ Reference ExtensionManager::addExtension( 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(), xAbortChannel, xCmdEnv); + xNewExtension->getName(), bUserDisabled2, false, xAbortChannel, xCmdEnv); fireModified(); } } @@ -575,7 +580,7 @@ Reference ExtensionManager::addExtension( tmpCmdEnv); } activateExtension( - sIdentifier, sFileName, + sIdentifier, sFileName, bUserDisabled, false, Reference(), tmpCmdEnv); if (xTmpExtension.is() || xExtensionBackup.is()) m_tmpRepository->removePackage( @@ -611,7 +616,8 @@ void ExtensionManager::removeExtension( uno::Any excOccurred1; Reference xExtensionBackup; Reference xPackageManager; - + bool bUserDisabled = false; + ::osl::MutexGuard guard(getMutex()); try { //Determine the repository to use @@ -624,7 +630,7 @@ void ExtensionManager::removeExtension( OUSTR("No valid repository name provided."), static_cast(this), 0); - ::osl::MutexGuard guard(getMutex()); + bUserDisabled = isUserDisabled(identifier, fileName); //Backup the extension, in case the user cancels the action xExtensionBackup = backupExtension( identifier, fileName, xPackageManager, xCmdEnv); @@ -637,7 +643,8 @@ void ExtensionManager::removeExtension( xPackageManager->removePackage( identifier, fileName, xAbortChannel, xCmdEnv); - activateExtension(identifier, fileName, xAbortChannel, xCmdEnv); + activateExtension(identifier, fileName, bUserDisabled, false, + xAbortChannel, xCmdEnv); fireModified(); } catch (deploy::DeploymentException& ) { @@ -673,7 +680,8 @@ void ExtensionManager::removeExtension( xExtensionBackup, Reference(), tmpCmdEnv); activateExtension( - identifier, fileName, Reference(), + identifier, fileName, bUserDisabled, false, + Reference(), tmpCmdEnv); m_tmpRepository->removePackage( @@ -705,49 +713,24 @@ void ExtensionManager::enableExtension( lang::IllegalArgumentException, uno::RuntimeException) { + ::osl::MutexGuard guard(getMutex()); + bool bUserDisabled = false; + uno::Any excOccurred; try { if (!extension.is()) return; - OUString repository = extension->getRepositoryName(); if (!repository.equals(OUSTR("user"))) throw lang::IllegalArgumentException( OUSTR("No valid repository name provided."), static_cast(this), 0); - ::osl::MutexGuard guard(getMutex()); - //if it is already registered or if it cannot be registered - //because it does not contain any files which need to be processed - //then there is nothing to do here - beans::Optional > reg = - extension->isRegistered(xAbortChannel, xCmdEnv); - if (!reg.IsPresent - || (!reg.Value.IsAmbiguous && reg.Value.Value)) - return; - } - catch (deploy::DeploymentException& ) { - throw; - } catch (ucb::CommandFailedException & ) { - throw; - } catch (ucb::CommandAbortedException & ) { - throw; - } catch (lang::IllegalArgumentException &) { - throw; - } catch (uno::RuntimeException &) { - throw; - } catch (...) { - uno::Any exc = ::cppu::getCaughtException(); - throw deploy::DeploymentException( - OUSTR("Extension Manager: exception during enableExtension"), - static_cast(this), exc); - } + bUserDisabled = isUserDisabled(dp_misc::getIdentifier(extension), + extension->getName()); - uno::Any excOccurred; - try - { activateExtension(dp_misc::getIdentifier(extension), - extension->getName(), + extension->getName(), false, false, xAbortChannel, xCmdEnv); } catch (deploy::DeploymentException& ) { @@ -772,9 +755,8 @@ void ExtensionManager::enableExtension( { try { - extension->revokePackage(Reference(), xCmdEnv); activateExtension(dp_misc::getIdentifier(extension), - extension->getName(), + extension->getName(), bUserDisabled, false, xAbortChannel, xCmdEnv); } catch (...) @@ -810,8 +792,10 @@ long ExtensionManager::checkPrerequisitesAndEnable( //There are some unfulfilled prerequisites, try to revoke extension->revokePackage(xAbortChannel, xCmdEnv); } - activateExtension(dp_misc::getIdentifier(extension), - extension->getName(), xAbortChannel, xCmdEnv); + const OUString id(dp_misc::getIdentifier(extension)); + activateExtension(id, extension->getName(), + isUserDisabled(id, extension->getName()), false, + xAbortChannel, xCmdEnv); return ret; } catch (deploy::DeploymentException& ) { @@ -844,31 +828,23 @@ void ExtensionManager::disableExtension( lang::IllegalArgumentException, uno::RuntimeException) { + ::osl::MutexGuard guard(getMutex()); uno::Any excOccurred; + bool bUserDisabled = false; try { if (!extension.is()) return; - - ::osl::MutexGuard guard(getMutex()); - OUString repository = extension->getRepositoryName(); + const OUString repository( extension->getRepositoryName()); if (!repository.equals(OUSTR("user"))) throw lang::IllegalArgumentException( OUSTR("No valid repository name provided."), static_cast(this), 0); - //if it is already registered or if it cannot be registered - //because it does not contain any files which need to be processed - //then there is nothing to do here - beans::Optional > reg = - extension->isRegistered(xAbortChannel, xCmdEnv); - if (!reg.IsPresent - || (!reg.Value.IsAmbiguous && !reg.Value.Value)) - return; + const OUString id(dp_misc::getIdentifier(extension)); + bUserDisabled = isUserDisabled(id, extension->getName()); - extension->revokePackage(xAbortChannel, xCmdEnv); - activateExtension(dp_misc::getIdentifier(extension), - extension->getName(), + activateExtension(id, extension->getName(), true, false, xAbortChannel, xCmdEnv); } catch (deploy::DeploymentException& ) { @@ -894,7 +870,7 @@ void ExtensionManager::disableExtension( try { activateExtension(dp_misc::getIdentifier(extension), - extension->getName(), + extension->getName(), bUserDisabled, false, xAbortChannel, xCmdEnv); } catch (...) @@ -1021,7 +997,7 @@ void ExtensionManager::reinstallDeployedExtensions( const OUString id = dp_misc::getIdentifier(extensions[ pos ]); const OUString fileName = extensions[ pos ]->getName(); OSL_ASSERT(id.getLength()); - activateExtension(id, fileName, xAbortChannel, xCmdEnv ); + activateExtension(id, fileName, false, false, xAbortChannel, xCmdEnv ); } catch (lang::DisposedException &) { @@ -1083,12 +1059,11 @@ void ExtensionManager::synchronize( static_cast(this), 0); ::osl::MutexGuard guard(getMutex()); + String sSynchronizing(StrSyncRepository::get()); + sSynchronizing.SearchAndReplaceAllAscii( "%NAME", repository ); + dp_misc::ProgressLevel progress(xCmdEnv, sSynchronizing); - dp_misc::ProgressLevel progress( - xCmdEnv, OUSTR("Synchronizing ") + repository + OUSTR(" repository\n")); xPackageManager->synchronize(xAbortChannel, xCmdEnv); - - try { const uno::Sequence > > @@ -1097,8 +1072,8 @@ void ExtensionManager::synchronize( { uno::Sequence > const & seqExt = seqSeqExt[i]; - - activateExtension(seqExt, xAbortChannel, xCmdEnv); + activateExtension(seqExt, isUserDisabled(seqExt), true, + xAbortChannel, xCmdEnv); } } catch (...) diff --git a/desktop/source/deployment/manager/dp_extensionmanager.hxx b/desktop/source/deployment/manager/dp_extensionmanager.hxx index b11a2c64f546..10bf3713c410 100644 --- a/desktop/source/deployment/manager/dp_extensionmanager.hxx +++ b/desktop/source/deployment/manager/dp_extensionmanager.hxx @@ -204,6 +204,9 @@ public: private: + struct StrSyncRepository : public ::dp_misc::StaticResourceString< + StrSyncRepository, RID_STR_SYNCHRONIZING_REPOSITORY> {}; + struct ExtensionInfos { ::rtl::OUString identifier; @@ -225,24 +228,24 @@ private: */ ::std::list< ::rtl::OUString > m_repositoryNames; - css::uno::Reference getExtensionAndStatus( - ::rtl::OUString const & identifier, - ::rtl::OUString const & fileName, - ::rtl::OUString const & repository, - css::uno::Reference const & xAbortChannel, - css::uno::Reference const & xCmdEnv, - bool & out_bWasRegistered); + bool isUserDisabled(::rtl::OUString const & identifier, + ::rtl::OUString const & filename); + + bool ExtensionManager::isUserDisabled( + css::uno::Sequence > const & seqExtSameId); void activateExtension( ::rtl::OUString const & identifier, ::rtl::OUString const & fileName, + bool bUserDisabled, bool bStartup, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv); void activateExtension( css::uno::Sequence > const & seqExt, - css::uno::Reference const & xAbortChannel, - css::uno::Reference const & xCmdEnv ); + bool bUserDisabled, bool bStartup, + css::uno::Reference const & xAbortChannel, + css::uno::Reference const & xCmdEnv ); ::std::list > diff --git a/desktop/source/deployment/manager/dp_manager.hrc b/desktop/source/deployment/manager/dp_manager.hrc index bdbfc079cda6..6131cc381abf 100644 --- a/desktop/source/deployment/manager/dp_manager.hrc +++ b/desktop/source/deployment/manager/dp_manager.hrc @@ -35,5 +35,5 @@ #define RID_STR_PACKAGE_ALREADY_ADDED (RID_DEPLOYMENT_MANAGER_START+2) #define RID_STR_COPYING_PACKAGE (RID_DEPLOYMENT_MANAGER_START+3) #define RID_STR_NO_SUCH_PACKAGE (RID_DEPLOYMENT_MANAGER_START+4) - +#define RID_STR_SYNCHRONIZING_REPOSITORY (RID_DEPLOYMENT_MANAGER_START+5) #endif diff --git a/desktop/source/deployment/manager/dp_manager.src b/desktop/source/deployment/manager/dp_manager.src index 95ede4aa6227..7d38b880c37a 100644 --- a/desktop/source/deployment/manager/dp_manager.src +++ b/desktop/source/deployment/manager/dp_manager.src @@ -53,3 +53,7 @@ String RID_STR_NO_SUCH_PACKAGE Text [ en-US ] = "There is no such extension deployed: "; }; +String RID_STR_SYNCHRONIZING_REPOSITORY +{ + Text [ en-US ] = "Synchronizing repository for %NAME extensions"; +}; diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 17444eb0828e..b3b8a8249994 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -122,7 +122,6 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend BackendImpl * getMyBackend() const; const OUString m_loader; - Reference m_xRemoteContext; ComponentBackendDb::Data m_registeredComponentsDb; enum reg { @@ -143,6 +142,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -179,6 +179,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -356,7 +357,7 @@ BackendImpl * BackendImpl::ComponentPackageImpl::getMyBackend() const //______________________________________________________________________________ void BackendImpl::ComponentPackageImpl::disposing() { - m_xRemoteContext.clear(); +// m_xRemoteContext.clear(); Package::disposing(); } @@ -1224,6 +1225,7 @@ BackendImpl::ComponentPackageImpl::isRegistered_( void BackendImpl::ComponentPackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ) { @@ -1244,11 +1246,14 @@ void BackendImpl::ComponentPackageImpl::processPackage_( data.javaTypeLibrary = isJavaTypelib; if (doRegisterPackage) { - if (! m_xRemoteContext.is()) { - m_xRemoteContext.set( + Reference context(that->getComponentContext()); + if (! startup) + { + context.set( that->getObject( url ), UNO_QUERY ); - if (! m_xRemoteContext.is()) { - m_xRemoteContext.set( + + if (! context.is()) { + context.set( that->insertObject( url, raise_uno_process( that->getComponentContext(), abortChannel ) ), @@ -1258,9 +1263,9 @@ void BackendImpl::ComponentPackageImpl::processPackage_( const Reference xServicesRDB( getRDB() ); const Reference xImplReg( - m_xRemoteContext->getServiceManager()->createInstanceWithContext( + context->getServiceManager()->createInstanceWithContext( OUSTR("com.sun.star.registry.ImplementationRegistration"), - m_xRemoteContext ), UNO_QUERY_THROW ); + context ), UNO_QUERY_THROW ); xImplReg->registerImplementation( m_loader, url, xServicesRDB ); //only write to unorc if registration was successful. @@ -1274,7 +1279,7 @@ void BackendImpl::ComponentPackageImpl::processPackage_( t_stringlist implNames; t_stringpairvec singletons; const Reference xLoader( - getComponentInfo( &implNames, &singletons, m_xRemoteContext ) ); + getComponentInfo( &implNames, &singletons, context ) ); data.implementationNames = implNames; data.singletons = singletons; @@ -1348,11 +1353,14 @@ void BackendImpl::ComponentPackageImpl::processPackage_( // set to VOID during revocation process: m_registered = REG_VOID; - Reference xContext; - if (m_xRemoteContext.is()) // has been activated in this process - xContext = m_xRemoteContext; - else // has been deployed in former times + //get the remote context. If it does not exist then use the local one + Reference xContext( + that->getObject( url ), UNO_QUERY ); + bool bRemoteContext = false; + if (!xContext.is()) xContext = that->getComponentContext(); + else + bRemoteContext = true; t_stringlist implNames; t_stringpairvec singletons; @@ -1427,10 +1435,8 @@ void BackendImpl::ComponentPackageImpl::processPackage_( if (isJavaTypelib) that->removeFromUnoRc( java, url, xCmdEnv ); - if (m_xRemoteContext.is()) { + if (bRemoteContext) that->releaseObject( url ); - m_xRemoteContext.clear(); - } m_registered = REG_NOT_REGISTERED; getMyBackend()->deleteDataFromDb(url); @@ -1483,6 +1489,7 @@ BackendImpl::TypelibraryPackageImpl::isRegistered_( void BackendImpl::TypelibraryPackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool startup, ::rtl::Reference const &, Reference const & xCmdEnv ) { diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index fefa6794342a..941b9a35d7f5 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -86,6 +86,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -644,6 +645,7 @@ OUString replaceOrigin( void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool /*startup*/, ::rtl::Reference const &, Reference const & xCmdEnv ) { diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index 1cebd20c297a..e822a66aa85f 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -619,6 +619,7 @@ beans::Optional< beans::Ambiguous > Package::isRegistered( //______________________________________________________________________________ void Package::processPackage_impl( bool doRegisterPackage, + bool startup, Reference const & xAbortChannel, Reference const & xCmdEnv ) { @@ -646,6 +647,7 @@ void Package::processPackage_impl( + displayName ); processPackage_( guard, doRegisterPackage, + startup, AbortChannel::get(xAbortChannel), xCmdEnv ); } @@ -683,6 +685,7 @@ void Package::processPackage_impl( //______________________________________________________________________________ void Package::registerPackage( + sal_Bool startup, Reference const & xAbortChannel, Reference const & xCmdEnv ) throw (deployment::DeploymentException, @@ -692,7 +695,7 @@ void Package::registerPackage( { if (m_bRemoved) throw deployment::ExtensionRemovedException(); - processPackage_impl( true /* register */, xAbortChannel, xCmdEnv ); + processPackage_impl( true /* register */, startup, xAbortChannel, xCmdEnv ); } //______________________________________________________________________________ @@ -703,7 +706,7 @@ void Package::revokePackage( CommandFailedException, CommandAbortedException, lang::IllegalArgumentException, RuntimeException) { - processPackage_impl( false /* revoke */, xAbortChannel, xCmdEnv ); + processPackage_impl( false /* revoke */, false, xAbortChannel, xCmdEnv ); } diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx index 1dc4cdde64ea..ac83302f9fb4 100644 --- a/desktop/source/deployment/registry/executable/dp_executable.cxx +++ b/desktop/source/deployment/registry/executable/dp_executable.cxx @@ -62,6 +62,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -202,6 +203,7 @@ BackendImpl::ExecutablePackageImpl::isRegistered_( void BackendImpl::ExecutablePackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool /*startup*/, ::rtl::Reference const & abortChannel, Reference const & /*xCmdEnv*/ ) { diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index a523a1aa20a5..7e8f128bbf12 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -76,6 +76,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -278,6 +279,7 @@ BackendImpl::PackageImpl::isRegistered_( void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool /* startup */, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ) { diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 7ad55d29ba2f..7b11ae456d5d 100644 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -67,6 +67,7 @@ class Package : protected ::dp_misc::MutexHolder, public t_PackageBase PackageRegistryBackend * getMyBackend() const; void processPackage_impl( bool registerPackage, + bool startup, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv ); @@ -97,6 +98,7 @@ protected: virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference< ::dp_misc::AbortChannel > const & abortChannel, css::uno::Reference const & xCmdEnv ) = 0; @@ -193,6 +195,7 @@ public: css::uno::RuntimeException); virtual void SAL_CALL registerPackage( + sal_Bool startup, css::uno::Reference const & xAbortChannel, css::uno::Reference const & xCmdEnv ) throw (css::deployment::DeploymentException, diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 822e744b8fc2..a5426bf26b54 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -159,6 +159,7 @@ class BackendImpl : public ImplBaseT virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -847,6 +848,7 @@ uno::Reference< graphic::XGraphic > BackendImpl::PackageImpl::getIcon( sal_Bool void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ) { @@ -865,7 +867,7 @@ void BackendImpl::PackageImpl::processPackage_( xPackage->createAbortChannel() ); AbortChannel::Chain chain( abortChannel, xSubAbortChannel ); try { - xPackage->registerPackage( xSubAbortChannel, xCmdEnv ); + xPackage->registerPackage( startup, xSubAbortChannel, xCmdEnv ); } catch (RuntimeException &) { throw; diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index 5023a501c67e..b2eddfaf74e0 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -80,6 +80,7 @@ class BackendImpl : public t_helper virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -379,6 +380,7 @@ BackendImpl::PackageImpl::isRegistered_( void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool /* startup */, ::rtl::Reference const &, Reference const & xCmdEnv ) { diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx index 704f4f810928..8a4ee1b45fbc 100644 --- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx +++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx @@ -77,6 +77,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend virtual void processPackage_( ::osl::ResettableMutexGuard & guard, bool registerPackage, + bool startup, ::rtl::Reference const & abortChannel, Reference const & xCmdEnv ); @@ -371,6 +372,7 @@ BackendImpl::PackageImpl::isRegistered_( void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, + bool /* startup */, ::rtl::Reference const &, Reference const & ) { diff --git a/desktop/source/migration/services/extensionmigration.cxx b/desktop/source/migration/services/extensionmigration.cxx index a926f17c0c19..66f32744a782 100755 --- a/desktop/source/migration/services/extensionmigration.cxx +++ b/desktop/source/migration/services/extensionmigration.cxx @@ -236,7 +236,7 @@ namespace migration if ( (sMediaType.equals(sBasicType) || sMediaType.equals(sDialogType)) && isBasicPackageEnabled(xPkg)) { - xPkg->registerPackage(uno::Reference< task::XAbortChannel >(), + xPkg->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); } } @@ -288,7 +288,7 @@ namespace migration if ( bRegistered && !sMediaType.equals(sBasicType) && !sMediaType.equals(sDialogType) ) { seqPkg[l]->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - seqPkg[l]->registerPackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); + seqPkg[l]->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); } } } @@ -297,7 +297,7 @@ namespace migration registerBasicPackage(aPackage); { aPackage->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - aPackage->registerPackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); + aPackage->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); } } } diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx index a077eaddb911..2d17a654b29b 100755 --- a/desktop/source/migration/services/oo3extensionmigration.cxx +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -146,7 +146,7 @@ void OO3ExtensionMigration::registerConfigurationPackage( const uno::Reference< if ( (sMediaType.equals(sConfigurationDataType) || sMediaType.equals(sConfigurationSchemaType) ) ) { xPkg->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - xPkg->registerPackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); + xPkg->registerPackage(false, uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); } } diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index ba8cd56085f8..2f4a7f1d7146 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -400,12 +400,7 @@ extern "C" int unopkg_main() Reference p( findPackage(repository, xExtensionManager, xCmdEnv, cmdPackage ) ); - //Todo. temporary preventing exception in bundled case. - //In case of a bundled extension, remove would be called as a result of - //uninstalling a rpm. Then we do not want to show an error when the - //extension does not exist, because the package will be uninstalled anyway - //and the error would only confuse people. - if ( !p.is() && !option_bundled) + if ( !p.is()) throw; else if (p.is()) xExtensionManager->removeExtension( diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx index b3a19ecc65bd..0070646b3330 100644 --- a/svx/source/smarttags/SmartTagMgr.cxx +++ b/svx/source/smarttags/SmartTagMgr.cxx @@ -35,8 +35,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -472,11 +471,9 @@ void SmartTagMgr::RegisterListener() // register as listener at package manager try { - Reference xPackageManagerFactory( - deployment::thePackageManagerFactory::get( mxContext ) ); - Reference xPackageManager( - xPackageManagerFactory->getPackageManager( C2U("user" ) ) ); - Reference< util::XModifyBroadcaster > xMB ( xPackageManager, UNO_QUERY_THROW ); + Reference xExtensionManager( + deployment::ExtensionManager::get( mxContext ) ); + Reference< util::XModifyBroadcaster > xMB ( xExtensionManager, UNO_QUERY_THROW ); Reference< util::XModifyListener > xListener( this ); xMB->addModifyListener( xListener ); -- cgit v1.2.3