diff options
author | npower Developer <npower@openoffice.org> | 2010-02-26 18:29:25 +0000 |
---|---|---|
committer | npower Developer <npower@openoffice.org> | 2010-02-26 18:29:25 +0000 |
commit | 7ee98e0af577d3953c4809fd5004d73c0a0635ba (patch) | |
tree | 0c42be42f1f559c1156cbd0fffb5f139ecf8120f /svx | |
parent | 0c3567dc6b7defaa244fd08d2ec8ce15e1d7661d (diff) |
npower14miscfixes: #i109644# don't load vba stuff for odf document ( untill you go into vbamode in basic )
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/form/fmundo.cxx | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index 3900c5b694..c674648e08 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -90,25 +90,7 @@ class ScriptEventListenerWrapper : public ScriptEventListener_BASE public: ScriptEventListenerWrapper( FmFormModel& _rModel) throw ( RuntimeException ) : pModel(&_rModel) { - Reference < XPropertySet > xProps( - ::comphelper::getProcessServiceFactory(), UNO_QUERY ); - if ( xProps.is() ) - { - Reference< XComponentContext > xCtx( xProps->getPropertyValue( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY ); - if ( xCtx.is() ) - { - Reference< XMultiComponentFactory > xMFac( - xCtx->getServiceManager(), UNO_QUERY ); - if ( xMFac.is() ) - { - m_vbaListener.set( xMFac->createInstanceWithContext( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "ooo.vba.EventListener" ) ), xCtx ), - UNO_QUERY_THROW ); - } - } - } + } // XEventListener virtual void SAL_CALL disposing(const EventObject& ) throw( RuntimeException ){} @@ -136,6 +118,33 @@ public: private: void setModel() { + if ( !m_vbaListener.is() ) + { + Reference < XPropertySet > xProps( + ::comphelper::getProcessServiceFactory(), UNO_QUERY ); + if ( xProps.is() ) + { + Reference< XComponentContext > xCtx( xProps->getPropertyValue( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))), UNO_QUERY ); + if ( xCtx.is() ) + { + Reference< XMultiComponentFactory > xMFac( + xCtx->getServiceManager(), UNO_QUERY ); + SfxObjectShellRef xObjSh = pModel->GetObjectShell(); + Reference< XMultiServiceFactory > xDocFac; + if ( xObjSh.Is() ) + xDocFac.set( xObjSh->GetModel(), UNO_QUERY ); + + if ( xMFac.is() ) + { + m_vbaListener.set( xMFac->createInstanceWithContext( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "ooo.vba.EventListener" ) ), xCtx ), + UNO_QUERY_THROW ); + } + } + } + } Reference< XPropertySet > xProps( m_vbaListener, UNO_QUERY ); if ( xProps.is() ) { |