[ooo-build-commit] patches/dev300 patches/vba

Noel Power noelp at kemper.freedesktop.org
Wed Nov 18 04:47:15 PST 2009


 patches/dev300/apply                        |    1 
 patches/vba/eventhelper-closecrash-fix.diff |  122 ++++++++++++++++++++++++++++
 2 files changed, 123 insertions(+)

New commits:
commit be2906285063a50c6cf7be197f8e750449d10619
Author: Noel Power <noel.power at novell.com>
Date:   Wed Nov 18 12:44:26 2009 +0000

    fix for n#438606
    
    * patches/dev300/apply:
    * patches/vba/eventhelper-closecrash-fix.diff:  fix for n#438606

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 8ac928d..1b1f7f0 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -1688,6 +1688,7 @@ vba-thiscomponent-fix.diff
 # more Writer VBA support, need to merger into cws-vbasupportdev
 vba-word-support-m4.diff, Fong
 vba-reenable-cwssheetproctectbits.diff
+eventhelper-closecrash-fix.diff, n#438606
 [VBAUntested]
 SectionOwner => noelpwer
 # doesn't work
diff --git a/patches/vba/eventhelper-closecrash-fix.diff b/patches/vba/eventhelper-closecrash-fix.diff
new file mode 100644
index 0000000..b7a44ff
--- /dev/null
+++ b/patches/vba/eventhelper-closecrash-fix.diff
@@ -0,0 +1,122 @@
+diff -u -r scripting/source/vbaevents/eventhelper.cxx ./new/scripting/source/vbaevents/eventhelper.cxx
+--- scripting/source/vbaevents/eventhelper.cxx	2009-10-15 22:39:42.000000000 +0800
++++ scripting/source/vbaevents/eventhelper.cxx	2009-10-21 16:43:38.000000000 +0800
+@@ -14,6 +43,9 @@
+ #include <com/sun/star/lang/XServiceInfo.hpp>
+ #include <com/sun/star/lang/XInitialization.hpp>
+ 
++#include <com/sun/star/util/XCloseListener.hpp>
++#include <com/sun/star/util/XCloseBroadcaster.hpp>
++
+ #include <com/sun/star/frame/XModel.hpp>
+ 
+ #include <com/sun/star/script/XLibraryContainer.hpp>
+@@ -47,7 +79,7 @@
+ #include <com/sun/star/lang/XMultiComponentFactory.hpp>
+ #include <com/sun/star/script/XScriptListener.hpp>
+ #include <cppuhelper/implbase1.hxx>
+-#include <cppuhelper/implbase2.hxx>
++#include <cppuhelper/implbase3.hxx>
+ #include <comphelper/evtmethodhelper.hxx>
+ 
+ #include <set>
+@@ -610,7 +642,7 @@
+     Reference< container::XNameContainer > m_xNameContainer;
+ };
+ 
+-typedef ::cppu::WeakImplHelper2< XScriptListener, lang::XInitialization > EventListener_BASE;
++typedef ::cppu::WeakImplHelper3< XScriptListener, util::XCloseListener, lang::XInitialization > EventListener_BASE;
+ 
+ #define EVENTLSTNR_PROPERTY_ID_MODEL         1
+ #define EVENTLSTNR_PROPERTY_MODEL            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) )
+@@ -630,6 +662,9 @@
+     // XScriptListener
+     virtual void SAL_CALL firing(const ScriptEvent& evt) throw(RuntimeException);
+     virtual Any SAL_CALL approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException);
++    // XCloseListener
++    virtual void SAL_CALL queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException);
++    virtual void SAL_CALL notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException);
+     // XPropertySet
+     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw (::com::sun::star::uno::RuntimeException);    
+     // XInitialization
+@@ -641,8 +676,27 @@
+     DECLARE_XTYPEPROVIDER()
+     virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+     {
++        if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
++        {
++            uno::Reference< frame::XModel > xModel( rValue, uno::UNO_QUERY );
++            if( xModel != m_xModel)
++            {
++                // Remove the listener from the old XCloseBroadcaster.
++                uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
++                if (xCloseBroadcaster.is())
++                {
++                    xCloseBroadcaster->removeCloseListener( this );
++                }
++                // Add the listener into the new XCloseBroadcaster.
++                xCloseBroadcaster = uno::Reference< util::XCloseBroadcaster >( xModel, uno::UNO_QUERY );
++                if (xCloseBroadcaster.is())
++                {
++                    xCloseBroadcaster->addCloseListener( this );
++                }
++            }
++        }
+         OPropertyContainer::setFastPropertyValue( nHandle, rValue );
+-	if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
++        if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
+             setShellFromModel();
+     }
+ 
+@@ -663,11 +717,12 @@
+     Reference< XComponentContext > m_xContext;
+     Reference< frame::XModel > m_xModel;
+     SfxObjectShell* mpShell;
++    sal_Bool m_bDocClosed;
+     
+ };
+ 
+ EventListener::EventListener( const Reference< XComponentContext >& rxContext ) :
+-OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), mpShell( 0 )
++OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), m_bDocClosed(sal_False), mpShell( 0 )
+ {
+     registerProperty( EVENTLSTNR_PROPERTY_MODEL, EVENTLSTNR_PROPERTY_ID_MODEL,
+         beans::PropertyAttribute::TRANSIENT, &m_xModel, ::getCppuType( &m_xModel ) );
+@@ -743,6 +798,24 @@
+     return ret;
+ }
+ 
++// XCloseListener
++void SAL_CALL 
++EventListener::queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException)
++{
++    //Nothing to do
++}
++
++void SAL_CALL 
++EventListener::notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException)
++{
++    m_bDocClosed = sal_True;
++    uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
++    if (xCloseBroadcaster.is())
++    {
++        xCloseBroadcaster->removeCloseListener( this );
++    }
++}
++
+ // XInitialization
+ void SAL_CALL 
+ EventListener::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
+@@ -924,6 +997,12 @@
+         OSL_TRACE("sMacroLoc is %s", rtl::OUStringToOString( sMacroLoc, RTL_TEXTENCODING_UTF8 ).getStr() );
+         for ( ; txInfo != txInfo_end; ++txInfo )
+         {
++            // If the document is closed, we should not execute macro.
++            if (m_bDocClosed)
++            {
++                break;
++            }
++			
+             rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName ); 
+             // see if we have a match for the handlerextension
+             // where ScriptCode is methodname_handlerextension 


More information about the ooo-build-commit mailing list