diff options
Diffstat (limited to 'scripting/source/dlgprov')
-rw-r--r-- | scripting/source/dlgprov/dlgevtatt.cxx | 22 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgevtatt.hxx | 2 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgprov.cxx | 22 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgprov.hxx | 4 |
4 files changed, 32 insertions, 18 deletions
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx index 6c3694ea237d..79b1ab43d667 100644 --- a/scripting/source/dlgprov/dlgevtatt.cxx +++ b/scripting/source/dlgprov/dlgevtatt.cxx @@ -108,13 +108,14 @@ namespace dlgprov { protected: rtl::OUString msDialogCodeName; + rtl::OUString msDialogLibName; Reference< script::XScriptListener > mxListener; virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet ); public: - DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel ); + DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName ); }; - DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel ) : DialogScriptListenerImpl( rxContext ) + DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName ) : DialogScriptListenerImpl( rxContext ), msDialogLibName( sDialogLibName ) { Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() ); Sequence< Any > args(1); @@ -145,7 +146,7 @@ namespace dlgprov if ( aScriptEvent.ScriptType.equals( rtl::OUString::createFromAscii("VBAInterop") ) && mxListener.is() ) { ScriptEvent aScriptEventCopy( aScriptEvent ); - aScriptEventCopy.ScriptCode = msDialogCodeName; + aScriptEventCopy.ScriptCode = msDialogLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( msDialogCodeName ); try { mxListener->firing( aScriptEventCopy ); @@ -163,7 +164,7 @@ namespace dlgprov // DialogEventsAttacherImpl // ============================================================================= - DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener ) + DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener, const rtl::OUString& sDialogLibName ) :mbUseFakeVBAEvents( false ), m_xContext( rxContext ) { // key listeners by protocol when ScriptType = 'Script' @@ -186,11 +187,11 @@ namespace dlgprov { pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId())); if ( pFoundShell ) - mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell ); + mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell ) || ooo::vba::isAlienWordDoc( *pFoundShell ) ; } } if ( mbUseFakeVBAEvents ) - listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel ); + listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel, sDialogLibName ); } // ----------------------------------------------------------------------------- @@ -217,6 +218,7 @@ namespace dlgprov Reference< ooo::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAToOOEventDesc" ) ), m_xContext ), UNO_QUERY ); if ( xVBAToOOEvtDesc.is() ) xEventsSupplier.set( xVBAToOOEvtDesc->getEventSupplier( xControl, sControlName ), UNO_QUERY ); + } return xEventsSupplier; } @@ -409,7 +411,7 @@ namespace dlgprov void DialogAllListenerImpl::firing( const AllEventObject& Event ) throw ( RuntimeException ) { - ::osl::MutexGuard aGuard( getMutex() ); + //::osl::MutexGuard aGuard( getMutex() ); firing_impl( Event, NULL ); } @@ -419,7 +421,7 @@ namespace dlgprov Any DialogAllListenerImpl::approveFiring( const AllEventObject& Event ) throw ( reflection::InvocationTargetException, RuntimeException ) { - ::osl::MutexGuard aGuard( getMutex() ); + //::osl::MutexGuard aGuard( getMutex() ); Any aReturn; firing_impl( Event, &aReturn ); @@ -655,7 +657,7 @@ namespace dlgprov void DialogScriptListenerImpl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException ) { - ::osl::MutexGuard aGuard( getMutex() ); + //::osl::MutexGuard aGuard( getMutex() ); firing_impl( aScriptEvent, NULL ); } @@ -665,7 +667,7 @@ namespace dlgprov Any DialogScriptListenerImpl::approveFiring( const ScriptEvent& aScriptEvent ) throw ( reflection::InvocationTargetException, RuntimeException ) { - ::osl::MutexGuard aGuard( getMutex() ); + //::osl::MutexGuard aGuard( getMutex() ); Any aReturn; firing_impl( aScriptEvent, &aReturn ); diff --git a/scripting/source/dlgprov/dlgevtatt.hxx b/scripting/source/dlgprov/dlgevtatt.hxx index 838073a2f10a..f4360c63b87f 100644 --- a/scripting/source/dlgprov/dlgevtatt.hxx +++ b/scripting/source/dlgprov/dlgevtatt.hxx @@ -76,7 +76,7 @@ namespace dlgprov const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& xIntrospect, bool bProviderMode, - const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener ); + const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener ,const rtl::OUString& sDialogLibName ); virtual ~DialogEventsAttacherImpl(); // XScriptEventsAttacher diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index 0fc0778c71d9..a87263af75d0 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -189,7 +189,15 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY ); xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL ); - ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext ); + // #TODO we really need to detect the source of the Dialog, is it + // located in the document or not. m_xModel need not be the location of + // the dialog. E.g. if the dialog was created from basic ( then we just + // can't tell where its from ) + // If we are happy to always substitute the form model for the awt + // one then maybe the presence of a document model is enough to trigger + // swapping out the models ( or perhaps we only want to do this + // for vba mode ) there are a number of feasible and valid possibilities + ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext, m_xModel ); // Set resource property if( xStringResourceManager.is() ) { @@ -403,6 +411,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs if ( xISP.is() ) xInput = xISP->createInputStream(); + msDialogLibName = sLibName; } // import dialog model @@ -520,7 +529,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs const Reference< XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< XIntrospectionAccess >& rxIntrospectionAccess, - bool bDialogProviderMode ) + bool bDialogProviderMode, const rtl::OUString& sDialogLibName ) { if ( rxControl.is() ) { @@ -544,7 +553,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs Reference< XScriptEventsAttacher > xScriptEventsAttacher = new DialogEventsAttacherImpl ( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess, - bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ) ); + bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ), msDialogLibName ); Any aHelper; xScriptEventsAttacher->attachEvents( aObjects, Reference< XScriptListener >(), aHelper ); @@ -649,7 +658,10 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs aArguments[0] >>= m_xModel; m_BasicInfo.reset( new BasicRTLParams() ); m_BasicInfo->mxInput.set( aArguments[ 1 ], UNO_QUERY_THROW ); - m_BasicInfo->mxDlgLib.set( aArguments[ 2 ], UNO_QUERY_THROW ); + // allow null mxDlgLib, a document dialog instantiated from + // from application basic is unable to provide ( or find ) it's + // Library + aArguments[ 2 ] >>= m_BasicInfo->mxDlgLib; // leave the possibility to optionally allow the old dialog creation // to use the new XScriptListener ( which converts the old style macro // to a SF url ) @@ -733,7 +745,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs { //xDialog = Reference< XDialog >( xCtrl, UNO_QUERY ); Reference< XIntrospectionAccess > xIntrospectionAccess = inspectHandler( xHandler ); - attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode ); + attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode, msDialogLibName ); } } diff --git a/scripting/source/dlgprov/dlgprov.hxx b/scripting/source/dlgprov/dlgprov.hxx index bc15831d2ff1..c1e77b917388 100644 --- a/scripting/source/dlgprov/dlgprov.hxx +++ b/scripting/source/dlgprov/dlgprov.hxx @@ -81,7 +81,7 @@ namespace dlgprov ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; - + rtl::OUString msDialogLibName; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModel( const ::rtl::OUString& sURL ); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl( @@ -91,7 +91,7 @@ namespace dlgprov void attachControlEvents( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxControlContainer, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& rxIntrospectionAccess, - bool bDialogProviderMode ); + bool bDialogProviderMode, const rtl::OUString& ); ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > inspectHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler ); // helper methods |