diff -u -r ./old/basic/inc/basic/sbobjmod.hxx ./new/basic/inc/basic/sbobjmod.hxx --- ./old/basic/inc/basic/sbobjmod.hxx 2009-12-26 10:40:12.000000000 +0800 +++ ./new/basic/inc/basic/sbobjmod.hxx 2010-01-19 18:29:44.000000000 +0800 @@ -14,7 +14,7 @@ * * GNU Lesser General Public License Version 2.1 * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. + * Copyright 2005, 2010 by Sun Microsystems, Inc. * 901 San Antonio Road, Palo Alto, CA 94303, USA * * This library is free software; you can redistribute it and/or @@ -74,6 +74,7 @@ public: TYPEINFO(); SbUserFormModule( const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat ); + ~SbUserFormModule(); virtual SbxVariable* Find( const XubString& rName, SbxClassType t ); void ResetApiObj(); void Unload(); diff -u -r ./old/basic/source/classes/sbxmod.cxx ./new/basic/source/classes/sbxmod.cxx --- ./old/basic/source/classes/sbxmod.cxx 2009-12-26 10:40:16.000000000 +0800 +++ ./new/basic/source/classes/sbxmod.cxx 2010-01-19 18:31:58.000000000 +0800 @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2008, 2010 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -1730,6 +1730,7 @@ removeListener(); } sal_Bool isShowing() { return mbShowing; } + bool isDisposed() { return mbDisposed; } void removeListener() { try @@ -1832,6 +1833,37 @@ m_xModel.set( mInfo.ModuleObject, uno::UNO_QUERY_THROW ); } +SbUserFormModule::~SbUserFormModule() +{ + bool bHasDisposed = true; + FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() ); + if ( pFormListener ) + { + bHasDisposed = pFormListener->isDisposed(); + pFormListener->removeListener(); + } + + // Sometime, when the SbUserFormModule is destructed, but the dialog is not disposed, we need to dispose the dialog here. + // Such as: If the dialog is shown in modeless mode, we can close the document, but the dialog is not closed, so we dispose it. + if ( m_xDialog.is() && !bHasDisposed ) + { + try + { + uno::Reference< lang::XComponent > xComponent( m_xDialog, uno::UNO_QUERY ); + if ( xComponent.is() ) + { + xComponent->dispose(); + } + } + catch( const uno::Exception& ex ) + { + } + } + m_xDialog = NULL; + m_DialogListener = NULL; + pDocObject = NULL; +} + void SbUserFormModule::ResetApiObj() { if ( m_xDialog.is() ) // probably someone close the dialog window @@ -1946,7 +1978,7 @@ triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ), aParams); aParams[0] >>= nCancel; - if (nCancel == 1) + if (nCancel != 0) { return; } @@ -1969,7 +2001,11 @@ bWaitForDispose = pFormListener->isShowing(); OSL_TRACE("Showing %d", bWaitForDispose ); } + // Hold the reference of pDocObject, because call pMeth->Get( aVals) will use this reference, but pDocObject will be set to NULL in the call. + SbxObjectRef pObjectHold = pDocObject; pMeth->Get( aVals); + // Release the reference after call pMeth->Get( aVals); + pObjectHold = NULL; if ( !bWaitForDispose ) { // we've either already got a dispose or we'er never going to get one Only in ./new/offapi/com/sun/star/awt: XDialog3.idl diff -u -r ./old/offapi/com/sun/star/awt/makefile.mk ./new/offapi/com/sun/star/awt/makefile.mk --- ./old/offapi/com/sun/star/awt/makefile.mk 2009-12-26 10:57:04.000000000 +0800 +++ ./new/offapi/com/sun/star/awt/makefile.mk 2010-01-20 14:27:02.000000000 +0800 @@ -2,7 +2,7 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2008, 2010 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite # @@ -323,6 +323,7 @@ XMenuExtended.idl\ MaxChildrenException.idl\ XDialog2.idl\ + XDialog3.idl\ XLayoutContainer.idl\ XLayoutFlow.idl\ XLayoutFlowContainer.idl\ diff -u -r ./old/oovbaapi/ooo/vba/msforms/XUserForm.idl ./new/oovbaapi/ooo/vba/msforms/XUserForm.idl --- ./old/oovbaapi/ooo/vba/msforms/XUserForm.idl 2009-12-26 10:59:42.000000000 +0800 +++ ./new/oovbaapi/ooo/vba/msforms/XUserForm.idl 2010-01-19 18:33:10.000000000 +0800 @@ -14,7 +14,7 @@ * * GNU Lesser General Public License Version 2.1 * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. + * Copyright 2005, 2010 by Sun Microsystems, Inc. * 901 San Antonio Road, Palo Alto, CA 94303, USA * * This library is free software; you can redistribute it and/or @@ -47,7 +47,7 @@ //interface ::ooo::vba::XHelperInterface; interface ::com::sun::star::script::XInvocation; [attribute] string Caption; - void Show(); + void Show( [in] any modal ); void Hide(); void RePaint(); void UnloadObject(); diff -u -r ./old/toolkit/inc/toolkit/awt/vclxwindows.hxx ./new/toolkit/inc/toolkit/awt/vclxwindows.hxx --- ./old/toolkit/inc/toolkit/awt/vclxwindows.hxx 2009-12-26 11:11:18.000000000 +0800 +++ ./new/toolkit/inc/toolkit/awt/vclxwindows.hxx 2010-01-19 18:35:00.000000000 +0800 @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2008, 2010 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -79,6 +79,7 @@ #include #include #include +#include #include #include #include @@ -392,7 +393,7 @@ // ---------------------------------------------------- // class VCLXDialog // ---------------------------------------------------- -class VCLXDialog : public ::com::sun::star::awt::XDialog, +class VCLXDialog : public ::com::sun::star::awt::XDialog, public ::com::sun::star::awt::XDialog3, public ::com::sun::star::document::XVbaMethodParameter, //liuchen 2009-6-22, add the support of input/output parameters to VBA UserForm_QueryClose event public VCLXTopWindow { @@ -415,6 +416,9 @@ sal_Int16 SAL_CALL execute( ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL endExecute( ) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XDialog3 + void SAL_CALL show( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XView void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException); diff -u -r ./old/toolkit/inc/toolkit/controls/dialogcontrol.hxx ./new/toolkit/inc/toolkit/controls/dialogcontrol.hxx --- ./old/toolkit/inc/toolkit/controls/dialogcontrol.hxx 2009-12-26 11:11:18.000000000 +0800 +++ ./new/toolkit/inc/toolkit/controls/dialogcontrol.hxx 2010-01-19 18:35:24.000000000 +0800 @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2008, 2010 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -40,7 +40,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -201,9 +203,10 @@ // ---------------------------------------------------- // class UnoDialogControl // ---------------------------------------------------- -typedef ::cppu::ImplHelper6 < ::com::sun::star::container::XContainerListener +typedef ::cppu::ImplHelper7 < ::com::sun::star::container::XContainerListener , ::com::sun::star::awt::XTopWindow , ::com::sun::star::awt::XDialog + , ::com::sun::star::awt::XDialog3 , ::com::sun::star::util::XChangesListener , ::com::sun::star::util::XModifyListener , ::com::sun::star::awt::XWindowListener @@ -295,6 +298,9 @@ sal_Int16 SAL_CALL execute() throw(::com::sun::star::uno::RuntimeException); void SAL_CALL endExecute() throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::awt::XDialog3 + void SAL_CALL show( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException); + // ::com::sun::star::lang::XTypeProvider ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); diff -u -r ./old/toolkit/source/awt/vclxwindows.cxx ./new/toolkit/source/awt/vclxwindows.cxx --- ./old/toolkit/source/awt/vclxwindows.cxx 2009-12-26 11:11:22.000000000 +0800 +++ ./new/toolkit/source/awt/vclxwindows.cxx 2010-01-19 18:37:06.000000000 +0800 @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2008, 2010 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -2228,6 +2228,7 @@ { ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( ::com::sun::star::document::XVbaMethodParameter*, this ), //liuchen 2009-6-23 + SAL_STATIC_CAST( ::com::sun::star::awt::XDialog3*, this ), SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) ); return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType )); } @@ -2235,6 +2236,7 @@ // ::com::sun::star::lang::XTypeProvider IMPL_XTYPEPROVIDER_START( VCLXDialog ) getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::document::XVbaMethodParameter>* ) NULL ), //liuchen 2009-6-23 + getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog3>* ) NULL ), getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ), VCLXTopWindow::getTypes() IMPL_XTYPEPROVIDER_END @@ -2276,6 +2278,7 @@ if( pFrame != pDlg ) pDlg->SetParent( pFrame ); } + pDlg->SetInShow( FALSE ); nRet = pDlg->Execute(); if ( pOldParent ) pDlg->SetParent( pOldParent ); @@ -2292,6 +2295,21 @@ pDlg->EndDialog( 0 ); } +void SAL_CALL VCLXDialog::show( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + { + Dialog* pDlg = (Dialog* ) GetWindow(); + if ( pDlg ) + { + pDlg->SetInShow( bVisible ); + pDlg->Show( bVisible ); + } + } +} + void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( GetMutex() ); @@ -3838,8 +3856,8 @@ #ifndef __SUNPRO_CC OSL_TRACE ("%s", __FUNCTION__); #endif -} - +} + // ::com::sun::star::uno::XInterface ::com::sun::star::uno::Any VCLXComboBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { @@ -6085,4 +6103,4 @@ { return getAccessibleFactory().createAccessibleContext( this ); } - + diff -u -r ./old/toolkit/source/controls/dialogcontrol.cxx ./new/toolkit/source/controls/dialogcontrol.cxx --- ./old/toolkit/source/controls/dialogcontrol.cxx 2009-12-26 11:11:22.000000000 +0800 +++ ./new/toolkit/source/controls/dialogcontrol.cxx 2010-01-19 18:37:58.000000000 +0800 @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2008, 2010 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -2102,6 +2102,19 @@ } } +void SAL_CALL UnoDialogControl::show( sal_Bool bVisible ) throw(RuntimeException) +{ + if ( getPeer().is() ) + { + Reference< XDialog3 > xDlg( getPeer(), UNO_QUERY ); + if( xDlg.is() ) + { + GetComponentInfos().bVisible = bVisible; + xDlg->show( bVisible ); + } + } +} + void UnoDialogControl::addingControl( const Reference< XControl >& _rxControl ) { vos::OGuard aSolarGuard( Application::GetSolarMutex() ); diff -u -r ./old/vbahelper/source/msforms/vbauserform.cxx ./new/vbahelper/source/msforms/vbauserform.cxx --- ./old/vbahelper/source/msforms/vbauserform.cxx 2009-12-26 11:12:06.000000000 +0800 +++ ./new/vbahelper/source/msforms/vbauserform.cxx 2010-01-22 13:34:06.000000000 +0800 @@ -14,7 +14,7 @@ * * GNU Lesser General Public License Version 2.1 * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. + * Copyright 2005, 2010 by Sun Microsystems, Inc. * 901 San Antonio Road, Palo Alto, CA 94303, USA * * This library is free software; you can redistribute it and/or @@ -36,7 +36,10 @@ #include "vbauserform.hxx" #include #include +#include +#include #include +#include #include #include #include @@ -45,6 +48,84 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +typedef cppu::WeakImplHelper1< awt::XTopWindowListener > FormEventListener_BASE; + +class UserFormEventListener : public FormEventListener_BASE +{ + sal_Bool mbDisposed; + ScVbaUserForm* m_pUserForm; + uno::Reference< awt::XDialog > m_xDialog; + + DECL_LINK( disposeDialog, void* ); + +public: + UserFormEventListener( ScVbaUserForm* pUserForm, const uno::Reference< awt::XDialog >& xDialog ) : m_pUserForm( pUserForm ), m_xDialog( xDialog ), mbDisposed( sal_False ) + { + if ( m_xDialog.is() ) + { + uno::Reference< awt::XTopWindow > xTopWindow( m_xDialog, uno::UNO_QUERY_THROW ); + xTopWindow->addTopWindowListener( this ); + } + } + + ~UserFormEventListener() + { + removeListener(); + } + + void removeListener() + { + try + { + if ( m_xDialog.is() && !mbDisposed ) + { + uno::Reference< awt::XTopWindow > xTopWindow( m_xDialog, uno::UNO_QUERY_THROW ); + xTopWindow->removeTopWindowListener( this ); + } + } + catch( const uno::Exception& ex ) + { + } + m_xDialog = NULL; + } + + virtual void SAL_CALL windowOpened( const lang::EventObject& ) throw (uno::RuntimeException) {} + virtual void SAL_CALL windowMinimized( const lang::EventObject& ) throw (uno::RuntimeException) {} + virtual void SAL_CALL windowNormalized( const lang::EventObject& ) throw (uno::RuntimeException) {} + virtual void SAL_CALL windowActivated( const lang::EventObject& ) throw (uno::RuntimeException) {} + virtual void SAL_CALL windowDeactivated( const lang::EventObject& ) throw (uno::RuntimeException) {} + virtual void SAL_CALL windowClosing( const lang::EventObject& ) throw (uno::RuntimeException) {} + virtual void SAL_CALL windowClosed( const lang::EventObject& ) throw (uno::RuntimeException) + { + // When click the Close button on modeless dialog to close it, we need to dispose the XDialog. + // We need to dispose it in another thread, because dispose it in current thread will cause crash. + Application::PostUserEvent( LINK( this, UserFormEventListener, disposeDialog ), NULL ); + } + + virtual void SAL_CALL disposing( const lang::EventObject& ) throw (uno::RuntimeException) + { + mbDisposed = sal_True; + m_xDialog = NULL; + } +}; + +IMPL_LINK( UserFormEventListener, disposeDialog, void*, pParam ) +{ + if ( !mbDisposed && m_pUserForm && !m_pUserForm->IsModal() && m_pUserForm->IsCanDispose() ) + { + try + { + uno::Reference< lang::XComponent > xComponent( m_xDialog, uno::UNO_QUERY_THROW ); + m_xDialog = NULL; + xComponent->dispose(); + } + catch( const uno::Exception& ex ) + { + } + } + return 0; +} + // some little notes // XDialog implementation has the following interesting bits // a Controls property ( which is an array of the container controls ) @@ -58,6 +139,8 @@ ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) throw ( lang::IllegalArgumentException ) : ScVbaUserForm_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext, getXSomethingFromArgs< uno::XInterface >( aArgs, 1 ), getXSomethingFromArgs< frame::XModel >( aArgs, 2 ), static_cast< ooo::vba::AbstractGeometryAttributes* >(0) ), mbDispose( true ) { m_xDialog.set( m_xControl, uno::UNO_QUERY_THROW ); + mbModal = false; + m_DialogListener = new UserFormEventListener( this, m_xDialog ); uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW ); m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW ); setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) ); @@ -68,25 +151,58 @@ } void SAL_CALL -ScVbaUserForm::Show( ) throw (uno::RuntimeException) +ScVbaUserForm::Show( const uno::Any& modal ) throw (uno::RuntimeException) { OSL_TRACE("ScVbaUserForm::Show( )"); - short aRet = 0; - mbDispose = true; - if ( m_xDialog.is() ) - aRet = m_xDialog->execute(); - OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet); - if ( mbDispose ) + + sal_Bool isModal = sal_True; + // Convert the parameter. + uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext ); + if ( modal.hasValue() && xConverter.is() ) { - try + uno::Any aConverted; + try + { + aConverted = xConverter->convertTo( modal, getCppuType( (const sal_Bool*) 0 ) ); + aConverted >>= isModal; + } + catch( const uno::Exception& ex ) { - uno::Reference< lang::XComponent > xComp( m_xDialog, uno::UNO_QUERY_THROW ); - m_xDialog = NULL; - xComp->dispose(); - mbDispose = false; } - catch( uno::Exception& ) + } + + mbDispose = true; + if ( isModal ) // Show the dialog in modal mode. + { + short aRet = 0; + mbModal = true; + if ( m_xDialog.is() ) { + aRet = m_xDialog->execute(); + } + OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet); + if ( mbDispose ) + { + try + { + uno::Reference< lang::XComponent > xComponent( m_xDialog, uno::UNO_QUERY_THROW ); + m_xDialog = NULL; + xComponent->dispose(); + mbDispose = false; + } + catch( const uno::Exception& ex ) + { + } + } + mbModal = false; + } + else // Show the dialog in modeless mode. + { + mbModal = false; + uno::Reference< awt::XDialog3 > xDialog3( m_xDialog, uno::UNO_QUERY ); + if ( xDialog3.is() ) + { + xDialog3->show( sal_True ); } } } @@ -109,7 +225,20 @@ { mbDispose = false; // hide not dispose if ( m_xDialog.is() ) - m_xDialog->endExecute(); + { + if ( mbModal ) // Hide the Modal Dialog. + { + m_xDialog->endExecute(); + } + else // Hide the Modeless Dialog. + { + uno::Reference< awt::XDialog3 > xDialog3( m_xDialog, uno::UNO_QUERY ); + if ( xDialog3.is() ) + { + xDialog3->show( sal_False ); + } + } + } } void SAL_CALL @@ -122,8 +251,36 @@ ScVbaUserForm::UnloadObject( ) throw (uno::RuntimeException) { mbDispose = true; + UserFormEventListener* pFormListener = dynamic_cast< UserFormEventListener* >( m_DialogListener.get() ); + if ( pFormListener ) + { + pFormListener->removeListener(); + } + if ( m_xDialog.is() ) - m_xDialog->endExecute(); + { + if ( mbModal ) // End the Modal Dialog. + { + m_xDialog->endExecute(); + } + else // Hide the Modeless Dialog and dispose it. + { + uno::Reference< awt::XDialog3 > xDialog3( m_xDialog, uno::UNO_QUERY ); + if ( xDialog3.is() ) + { + xDialog3->show( sal_False ); + } + try + { + uno::Reference< lang::XComponent > xComponent( m_xDialog, uno::UNO_QUERY_THROW ); + xComponent->dispose(); + } + catch( const uno::Exception& ex ) + { + } + m_xDialog = NULL; + } + } } rtl::OUString& diff -u -r ./old/vbahelper/source/msforms/vbauserform.hxx ./new/vbahelper/source/msforms/vbauserform.hxx --- ./old/vbahelper/source/msforms/vbauserform.hxx 2009-12-26 11:12:06.000000000 +0800 +++ ./new/vbahelper/source/msforms/vbauserform.hxx 2010-01-19 18:42:02.000000000 +0800 @@ -14,7 +14,7 @@ * * GNU Lesser General Public License Version 2.1 * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. + * Copyright 2005, 2010 by Sun Microsystems, Inc. * 901 San Antonio Road, Palo Alto, CA 94303, USA * * This library is free software; you can redistribute it and/or @@ -50,14 +50,20 @@ { private: css::uno::Reference< css::awt::XDialog > m_xDialog; + css::uno::Reference< css::lang::XEventListener > m_DialogListener; bool mbDispose; + bool mbModal; protected: public: ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException ); virtual ~ScVbaUserForm(); + + bool IsCanDispose() { return mbDispose; } + bool IsModal() { return mbModal; } + // XUserForm virtual void SAL_CALL RePaint( ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Show( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL Show( const css::uno::Any& modal ) throw (css::uno::RuntimeException); // XIntrospection virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); diff -u -r ./old/vcl/inc/vcl/dialog.hxx ./new/vcl/inc/vcl/dialog.hxx --- ./old/vcl/inc/vcl/dialog.hxx 2009-12-26 11:12:16.000000000 +0800 +++ ./new/vcl/inc/vcl/dialog.hxx 2010-01-19 18:39:32.000000000 +0800 @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2008, 2010 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -56,6 +56,7 @@ BOOL mbOldSaveBack; BOOL mbInClose; BOOL mbModalMode; + BOOL mbInShow; sal_Int8 mnCancelClose; //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event SAL_DLLPRIVATE void ImplInitDialogData(); @@ -122,6 +123,9 @@ void SetModalInputMode( BOOL bModal, BOOL bSubModalDialogs ); BOOL IsModalInputMode() const { return mbModalMode; } + void SetInShow( BOOL bInShow ) { mbInShow = bInShow; } + BOOL IsInShow() const { return mbInShow; } + void GrabFocusToFirstControl(); }; diff -u -r ./old/vcl/source/window/dialog.cxx ./new/vcl/source/window/dialog.cxx --- ./old/vcl/source/window/dialog.cxx 2009-12-26 11:12:32.000000000 +0800 +++ ./new/vcl/source/window/dialog.cxx 2010-01-19 18:41:02.000000000 +0800 @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2008, 2010 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * @@ -261,6 +261,7 @@ mbOldSaveBack = FALSE; mbInClose = FALSE; mbModalMode = FALSE; + mbInShow = FALSE; mnMousePositioned = 0; mpDialogImpl = new DialogImpl; } @@ -553,7 +554,7 @@ //liuchen 2009-7-22, support Excel VBA UserForm_QueryClose event mnCancelClose = 0; ImplCallEventListeners( VCLEVENT_WINDOW_CLOSE ); - if (mnCancelClose == 1) + if (mnCancelClose != 0) { return FALSE; } @@ -562,7 +563,7 @@ return FALSE; ImplRemoveDel( &aDelData ); - if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() && !IsInExecute() ) + if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() && !IsInExecute() && !IsInShow() ) return FALSE; mbInClose = TRUE; @@ -594,6 +595,12 @@ mbInClose = FALSE; return TRUE; } + else if ( IsInShow() ) + { + Hide(); + mbInClose = FALSE; + return TRUE; + } else { mbInClose = FALSE;