diff options
author | Daniel Rentz <dr@openoffice.org> | 2010-07-27 17:12:01 +0200 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2010-07-27 17:12:01 +0200 |
commit | 0ae44da7752001293131a96e30d5466b3b7919f2 (patch) | |
tree | 02091e4ff930589fb948a0745fc65dba4ea5a423 /basic | |
parent | e1461c4204ffc1c099fb8b877c3b7a58c35437dd (diff) | |
parent | a2e7c2e0d002d75a6b77a629a4e904ab54bf8375 (diff) |
mib17: rebase to DEV300_m84
Diffstat (limited to 'basic')
-rw-r--r-- | basic/inc/basic/sbmod.hxx | 3 | ||||
-rw-r--r-- | basic/source/inc/namecont.hxx | 26 | ||||
-rw-r--r-- | basic/source/runtime/step0.cxx | 3 | ||||
-rwxr-xr-x | basic/source/runtime/step2.cxx | 2 | ||||
-rw-r--r-- | basic/source/uno/namecont.cxx | 108 | ||||
-rw-r--r-- | basic/source/uno/scriptcont.cxx | 6 |
6 files changed, 128 insertions, 20 deletions
diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx index 932a828ac753..bccf8212f10e 100644 --- a/basic/inc/basic/sbmod.hxx +++ b/basic/inc/basic/sbmod.hxx @@ -136,7 +136,8 @@ public: void SetModuleType( INT32 nType ) { mnType = nType; } bool GetIsProxyModule() { return bIsProxyModule; } void AddVarName( const String& aName ); - void RemoveVars(); ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule(); + void RemoveVars(); + ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule(); bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject ); }; diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index 10150daf96b8..7fd6eb06f607 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -35,6 +35,7 @@ #include <com/sun/star/script/XStorageBasedLibraryContainer.hpp> #include <com/sun/star/script/XLibraryContainerPassword.hpp> #include <com/sun/star/script/XLibraryContainerExport.hpp> +#include <com/sun/star/script/XLibraryContainer3.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> #include <com/sun/star/ucb/XSimpleFileAccess.hpp> @@ -57,8 +58,7 @@ #include <com/sun/star/deployment/XPackage.hpp> #include <cppuhelper/implbase2.hxx> -#include <cppuhelper/compbase6.hxx> -#include <cppuhelper/compbase7.hxx> +#include <cppuhelper/compbase8.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <com/sun/star/script/vba/XVBACompatibility.hpp> @@ -67,11 +67,12 @@ class BasicManager; namespace basic { -typedef ::cppu::WeakComponentImplHelper7< +typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::lang::XInitialization, ::com::sun::star::script::XStorageBasedLibraryContainer, ::com::sun::star::script::XLibraryContainerPassword, ::com::sun::star::script::XLibraryContainerExport, + ::com::sun::star::script::XLibraryContainer3, ::com::sun::star::container::XContainer, ::com::sun::star::script::vba::XVBACompatibility, ::com::sun::star::lang::XServiceInfo > LibraryContainerHelper; @@ -412,6 +413,12 @@ public: virtual ::rtl::OUString SAL_CALL getContainerLocationName() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL storeLibraries( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + //Methods XLibraryContainer3 + virtual ::rtl::OUString SAL_CALL getOriginalLibraryLinkURL( const ::rtl::OUString& Name ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + // Methods XLibraryContainer2 (base of XPersistentLibraryContainer) virtual sal_Bool SAL_CALL isLibraryLink( const ::rtl::OUString& Name ) throw (::com::sun::star::container::NoSuchElementException, @@ -551,6 +558,8 @@ private: ::rtl::OUString maLibInfoFileURL; ::rtl::OUString maStorageURL; ::rtl::OUString maUnexpandedStorageURL; + ::rtl::OUString maOrignialStorageURL; + sal_Bool mbLink; sal_Bool mbReadOnly; sal_Bool mbReadOnlyLink; @@ -699,6 +708,7 @@ enum IteratorState { USER_EXTENSIONS, SHARED_EXTENSIONS, + BUNDLED_EXTENSIONS, END_REACHED }; @@ -718,6 +728,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; @@ -731,8 +743,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/runtime/step0.cxx b/basic/source/runtime/step0.cxx index 29965c7e9da5..1051a0b514f5 100644 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -558,6 +558,9 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b *refVar = *refVal; } + if( bWithEvents ) + refVar->SetComListener( xComListener ); // Hold reference + // lhs is a property who's value is currently (Empty e.g. no broadcast yet) // in this case if there is a default prop involved the value of the // default property may infact be void so the type will also be SbxEMPTY diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx index 0e95bf66631d..587b0ae7a590 100755 --- a/basic/source/runtime/step2.cxx +++ b/basic/source/runtime/step2.cxx @@ -1170,7 +1170,7 @@ void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 ) StepPUBLIC_Impl( nOp1, nOp2, true ); String aName( pImg->GetString( static_cast<short>( nOp1 ) ) ); - SbxDataType t = (SbxDataType)(nOp2 & 0xffff);; + SbxDataType t = (SbxDataType)(nOp2 & 0xffff); // Store module scope variables at module scope // in non vba mode these are stored at the library level :/ diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index b4cd118533fd..c31aed1f8ef7 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -65,7 +65,7 @@ #include <com/sun/star/uno/DeploymentException.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/script/LibraryNotLoadedException.hpp> -#include "com/sun/star/deployment/thePackageManagerFactory.hpp" +#include "com/sun/star/deployment/ExtensionManager.hpp" #include <comphelper/storagehelper.hxx> #ifndef _RTL_USTRING_HXX_ #include <comphelper/anytostring.hxx> @@ -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; @@ -2169,6 +2171,7 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink SfxLibrary* pNewLib = implCreateLibraryLink( Name, aLibInfoFileURL, aLibDirURL, ReadOnly ); pNewLib->maLibElementFileExtension = maLibElementFileExtension; pNewLib->maUnexpandedStorageURL = aUnexpandedStorageURL; + pNewLib->maOrignialStorageURL = StorageURL; OUString aInitFileName; uno::Reference< embed::XStorage > xDummyStor; @@ -2184,11 +2187,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; @@ -2789,6 +2793,21 @@ OUString SfxLibraryContainer::expand_url( const OUString& url ) } } +//XLibraryContainer3 +OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString& Name ) + throw (IllegalArgumentException, NoSuchElementException, RuntimeException) +{ + LibraryContainerMethodGuard aGuard( *this ); + SfxLibrary* pImplLib = getImplLib( Name ); + sal_Bool bLink = pImplLib->mbLink; + if( !bLink ) + throw IllegalArgumentException(); + OUString aRetStr = pImplLib->maOrignialStorageURL; + return aRetStr; +} + + +// XVBACompatibility ::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatibilityMode() throw (RuntimeException) { return mbVBACompat; @@ -3101,8 +3120,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(); @@ -3151,6 +3172,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; @@ -3321,10 +3352,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& ) { @@ -3374,10 +3406,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& ) { @@ -3390,7 +3423,7 @@ Reference< deployment::XPackage > ScriptExtensionIterator::implGetNextSharedScri if( m_iSharedPackage == m_aSharedPackagesSeq.getLength() ) { - m_eState = END_REACHED; + m_eState = BUNDLED_EXTENSIONS; } else { @@ -3417,4 +3450,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/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index ef8e1f459472..f7091d1c1a0b 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -216,8 +216,7 @@ void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement Any aElement = xLib->getByName( aElementName ); aElement >>= aMod.aCode; - Reference < script::vba::XVBAModuleInfo > xModInfo( xLib, UNO_QUERY ); - + Reference< script::vba::XVBAModuleInfo > xModInfo( xLib, UNO_QUERY ); if( xModInfo.is() && xModInfo->hasModuleInfo( aElementName ) ) { script::ModuleInfo aModInfo = xModInfo->getModuleInfo( aElementName ); @@ -381,8 +380,7 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement } } - Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, - UNO_QUERY ); + Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY ); if( xVBAModuleInfo.is() ) { if( xVBAModuleInfo->hasModuleInfo( aElementName ) ) |