summaryrefslogtreecommitdiff
path: root/basic/source/classes/sbxmod.cxx
diff options
context:
space:
mode:
authorDaniel Rentz [dr] <daniel.rentz@oracle.com>2010-08-30 14:38:29 +0200
committerDaniel Rentz [dr] <daniel.rentz@oracle.com>2010-08-30 14:38:29 +0200
commit74c37f3287f6427eba89f108b8365c98ae617b7a (patch)
tree4aec1a62c88e2d3d7badcd22988f053b43e446f1 /basic/source/classes/sbxmod.cxx
parentc14df458b4b7da8da38e9be28db9122ee8765ad2 (diff)
parent9e0ef7ed32b5d2e1cdb64e82f329d348ac769fbd (diff)
mib19: branch merge
Diffstat (limited to 'basic/source/classes/sbxmod.cxx')
-rwxr-xr-xbasic/source/classes/sbxmod.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 46a1488844c1..6a2380acedcd 100755
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -2494,6 +2494,8 @@ void SbUserFormModule::Unload()
}
//liuchen
+void registerComponentToBeDisposedForBasic( Reference< XComponent > xComponent, StarBASIC* pBasic );
+
void SbUserFormModule::InitObject()
{
try
@@ -2525,6 +2527,25 @@ void SbUserFormModule::InitObject()
aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() );
pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) );
uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
+
+ // the dialog must be disposed at the end!
+ if( xComponent.is() )
+ {
+ StarBASIC* pParentBasic = NULL;
+ SbxObject* pCurObject = this;
+ do
+ {
+ SbxObject* pParent = pCurObject->GetParent();
+ pParentBasic = PTR_CAST(StarBASIC,pParent);
+ pCurObject = pParent;
+ }
+ while( pParentBasic == NULL && pCurObject != NULL );
+
+ OSL_ASSERT( pParentBasic != NULL );
+ registerComponentToBeDisposedForBasic( xComponent, pParentBasic );
+ }
+
+
// remove old listener if it exists
if ( m_DialogListener.get() )
m_DialogListener->removeListener();