diff options
author | Michael E. Bohn <mbn@openoffice.org> | 2010-09-17 02:15:05 +0200 |
---|---|---|
committer | Michael E. Bohn <mbn@openoffice.org> | 2010-09-17 02:15:05 +0200 |
commit | d64222d8ffa2c2ea565cd2c28978b59fe2a6bed6 (patch) | |
tree | 6553cb1ed0a993a148c6b134e4eba01f53a9585a | |
parent | 6f8d8311daae52da8e92f9d735efe1eac6c5aa8b (diff) | |
parent | d6c63e5fccd3e39f79526eaf990de361aff1e9a3 (diff) |
merged heads
-rwxr-xr-x | basic/source/classes/sbunoobj.cxx | 16 | ||||
-rwxr-xr-x | basic/source/classes/sbxmod.cxx | 36 | ||||
-rwxr-xr-x | basic/source/comp/sbcomp.cxx | 4 | ||||
-rwxr-xr-x | basic/source/runtime/methods1.cxx | 1 | ||||
-rw-r--r-- | basic/source/uno/scriptcont.cxx | 26 | ||||
-rw-r--r-- | oovbaapi/ooo/vba/excel/XWorkbooks.idl | 2 | ||||
-rw-r--r-- | vbahelper/inc/vbahelper/vbadocumentsbase.hxx | 8 | ||||
-rwxr-xr-x | vbahelper/inc/vbahelper/vbaeventshelperbase.hxx | 22 | ||||
-rw-r--r-- | vbahelper/source/vbahelper/vbadocumentsbase.cxx | 9 |
9 files changed, 68 insertions, 56 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index e952fff3e64b..45bcc5469ae6 100755 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -4432,6 +4432,19 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction, ::rtl::OUString aFunctionName = m_aPrefix; aFunctionName += rFunction; + sal_Bool bSetRescheduleBack = sal_False; + sal_Bool bOldReschedule = sal_True; + SbiInstance* pInst = pINST; + if( pInst && pInst->IsCompatibility() ) + { + bOldReschedule = pInst->IsReschedule(); + if ( bOldReschedule ) + { + pInst->EnableReschedule( sal_False ); + bSetRescheduleBack = sal_True; + } + } + SbxVariable* p = xScopeObj->Find( aFunctionName, SbxCLASS_METHOD ); SbMethod* pMeth = p != NULL ? PTR_CAST(SbMethod,p) : NULL; if( pMeth == NULL ) @@ -4464,6 +4477,9 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction, aRet = sbxToUnoValue( xValue ); pMeth->SetParameters( NULL ); + if( bSetRescheduleBack ) + pInst->EnableReschedule( bOldReschedule ); + // TODO: OutParameter? return aRet; diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index daeb1707b974..3204e7681088 100755 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -500,33 +500,26 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ ) return 0L; } -#if 0 -bool UnlockControllerHack( StarBASIC* pBasic ) +bool VBAUnlockControllers( StarBASIC* pBasic ) { bool bRes = false; if ( pBasic && pBasic->IsDocBasic() ) { - uno::Any aUnoVar; - ::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( "ThisComponent" ) ); - SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( pBasic->Find( sVarName, SbxCLASS_DONTCARE ) ); - if ( pGlobs ) - aUnoVar = pGlobs->getUnoAny(); - uno::Reference< frame::XModel > xModel( aUnoVar, uno::UNO_QUERY); - if ( xModel.is() ) + SbUnoObject* pGlobs = dynamic_cast< SbUnoObject* >( pBasic->Find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ), SbxCLASS_DONTCARE ) ); + if ( pGlobs ) try { - try - { + uno::Reference< frame::XModel > xModel( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW ); + if ( xModel->hasControllersLocked() ) xModel->unlockControllers(); - bRes = true; - } - catch( uno::Exception& ) - { - } + bRes = true; + } + catch( uno::Exception& ) + { } } return bRes; } -#endif + ///////////////////////////////////////////////////////////////////////////// // Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen @@ -1191,6 +1184,10 @@ USHORT SbModule::Run( SbMethod* pMeth ) GlobalRunDeInit(); + // VBA always ensures screenupdating is enabled after completing + if ( mbVBACompat ) + VBAUnlockControllers( PTR_CAST( StarBASIC, GetParent() ) ); + #ifdef DBG_TRACE_BASIC dbg_DeInitTrace(); #endif @@ -1205,12 +1202,7 @@ USHORT SbModule::Run( SbMethod* pMeth ) StarBASIC::FatalError( SbERR_STACK_OVERFLOW ); } - // VBA always ensure screenupdating is enabled after completing StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent()); -#if 0 - if ( pBasic && pBasic->IsDocBasic() && !pINST ) - UnlockControllerHack( pBasic ); -#endif if( bDelInst ) { // #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden, diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx index 089a48a4d889..c8fe782487e3 100755 --- a/basic/source/comp/sbcomp.cxx +++ b/basic/source/comp/sbcomp.cxx @@ -32,6 +32,7 @@ #include "sbcomp.hxx" #include "image.hxx" #include "sbtrace.hxx" +#include <basic/sbobjmod.hxx> //========================================================================== @@ -648,7 +649,8 @@ BOOL SbModule::Compile() BOOL bRet = IsCompiled(); if( bRet ) { - pBasic->ClearAllModuleVars(); + if( !this->ISA(SbObjModule) ) + pBasic->ClearAllModuleVars(); RemoveVars(); // remove 'this' Modules variables // clear all method statics for( USHORT i = 0; i < pMethods->Count(); i++ ) diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 68f4dbe76c5f..9d8da0b7026f 100755 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -655,6 +655,7 @@ RTLFUNC(DoEvents) //aTimer.Start(); //while ( aTimer.IsActive() ) // Application::Reschedule(); + Application::Reschedule( true ); } RTLFUNC(GetGUIVersion) diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index f7091d1c1a0b..fa20add4f1fd 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -315,20 +315,22 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement { setVBACompatibilityMode( sal_True ); - Any aGlobs; - Sequence< Any > aArgs(1); - Reference<frame::XModel > xModel( mxOwnerDocument ); - aArgs[ 0 ] <<= xModel; - - BasicManager* pBasicMgr = getBasicManager(); - if( pBasicMgr ) + /* Force creation of the VBA Globals object. Each application will + create an instance of its own implementation and store it in + its Basic manager. Implementations will do all necessary + additional initialization, such as registering the global + "This***Doc" UNO constant, starting the document events + processor etc. + */ + try + { + Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref + Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW ); + xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) ); + } + catch( Exception& ) { - aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs ); - pBasicMgr->SetGlobalUNOConstant( "VBAGlobals", aGlobs ); } - pBasicMgr = BasicManagerRepository::getApplicationBasicManager( sal_False ); - if( pBasicMgr ) - pBasicMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[0] ); } script::ModuleInfo aModInfo; diff --git a/oovbaapi/ooo/vba/excel/XWorkbooks.idl b/oovbaapi/ooo/vba/excel/XWorkbooks.idl index 7c94ca1eac18..de7b031e3c0a 100644 --- a/oovbaapi/ooo/vba/excel/XWorkbooks.idl +++ b/oovbaapi/ooo/vba/excel/XWorkbooks.idl @@ -44,7 +44,7 @@ module ooo { module vba { module excel { interface XWorkbooks : com::sun::star::uno::XInterface { - any Add(); + any Add([in] any Template); any Open([in] string Filename, [in] any UpdateLinks, [in] any ReadOnly, [in] any Format, [in] any Password, [in] any WriteResPassword, [in] any IgnoreReadOnlyRecommended, [in] any Origin, [in] any Delimiter, [in] any Editable, [in] any Notify, [in] any Converter, [in] any AddToMru); void Close(); diff --git a/vbahelper/inc/vbahelper/vbadocumentsbase.hxx b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx index 36bc0a4963ee..8e4554b74b3d 100644 --- a/vbahelper/inc/vbahelper/vbadocumentsbase.hxx +++ b/vbahelper/inc/vbahelper/vbadocumentsbase.hxx @@ -57,10 +57,10 @@ public: // VbaDocumentsBase_BASE virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0; - // XDocumentsBase - virtual css::uno::Any SAL_CALL Add() throw (css::uno::RuntimeException); - virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ReadOnly, const css::uno::Sequence< css::beans::PropertyValue >& rProps ) throw (css::uno::RuntimeException); +protected: + css::uno::Any createDocument() throw (css::uno::RuntimeException); + void closeDocuments() throw (css::uno::RuntimeException); + css::uno::Any openDocument( const ::rtl::OUString& Filename, const css::uno::Any& ReadOnly, const css::uno::Sequence< css::beans::PropertyValue >& rProps ) throw (css::uno::RuntimeException); }; #endif /* SC_VBA_WORKBOOKS_HXX */ diff --git a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx index b637b742b26c..659837535ace 100755 --- a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx +++ b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx @@ -58,6 +58,17 @@ public: // XEventListener virtual void SAL_CALL disposing( const css::lang::EventObject& aSource ) throw (css::uno::RuntimeException); + // little helpers --------------------------------------------------------- + + /** Throws, if the passed sequence does not contain a value at the specified index. */ + static inline void checkArgument( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException) + { if( (nIndex < 0) || (nIndex >= rArgs.getLength()) ) throw css::lang::IllegalArgumentException(); } + + /** Throws, if the passed sequence does not contain a value of a specific at the specified index. */ + template< typename Type > + static inline void checkArgumentType( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException) + { checkArgument( rArgs, nIndex ); if( !rArgs[ nIndex ].has< Type >() ) throw css::lang::IllegalArgumentException(); } + protected: // ------------------------------------------------------------------------ @@ -73,7 +84,7 @@ protected: /** Registers a supported event handler. - @param nEventId Event identifier from com.sun.star.script.vba.EventIdentifier. + @param nEventId Event identifier from com.sun.star.script.vba.VBAEventId. @param pcMacroName Name of the associated VBA event handler macro. @param eType Document event or global event. @param nCancelIndex 0-based index of Cancel parameter, or -1. @@ -85,15 +96,6 @@ protected: sal_Int32 nCancelIndex = -1, const css::uno::Any& rUserData = css::uno::Any() ); - /** Throws, if the passed sequence does not contain a value at the specified index. */ - static inline void checkArgument( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException) - { if( rArgs.getLength() <= nIndex ) throw css::lang::IllegalArgumentException(); } - - /** Throws, if the passed sequence does not contain a value of a specific at the specified index. */ - template< typename Type > - static inline void checkArgumentType( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException) - { if( (rArgs.getLength() <= nIndex) || !rArgs[ nIndex ].has< Type >() ) throw css::lang::IllegalArgumentException(); } - // ------------------------------------------------------------------------ struct EventQueueEntry diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index e01809d5fbc3..f2b70ab231c7 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -213,8 +213,7 @@ VbaDocumentsBase::VbaDocumentsBase( const uno::Reference< XHelperInterface >& xP { } -uno::Any SAL_CALL -VbaDocumentsBase::Add() throw (uno::RuntimeException) +uno::Any VbaDocumentsBase::createDocument() throw (uno::RuntimeException) { uno::Reference< lang::XMultiComponentFactory > xSMgr( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); @@ -244,8 +243,7 @@ VbaDocumentsBase::Add() throw (uno::RuntimeException) return uno::makeAny( xComponent ); } -void -VbaDocumentsBase::Close() throw (uno::RuntimeException) +void VbaDocumentsBase::closeDocuments() throw (uno::RuntimeException) { // #FIXME this *MUST* be wrong documents::close surely closes ALL documents // in the collection, use of getCurrentDocument here is totally wrong @@ -259,8 +257,7 @@ VbaDocumentsBase::Close() throw (uno::RuntimeException) } // #TODO# #FIXME# can any of the unused params below be used? -uno::Any -VbaDocumentsBase::Open( const rtl::OUString& rFileName, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (uno::RuntimeException) +uno::Any VbaDocumentsBase::openDocument( const rtl::OUString& rFileName, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (uno::RuntimeException) { // we need to detect if this is a URL, if not then assume its a file path rtl::OUString aURL; |