diff options
Diffstat (limited to 'basic/source/classes/eventatt.cxx')
-rw-r--r-- | basic/source/classes/eventatt.cxx | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 16d05a6661..f6858bad55 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -88,54 +88,6 @@ using namespace ::cppu; using namespace ::osl; - -Reference< frame::XModel > getModelFromBasic( SbxObject* pBasic ) -{ - OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" ); - if ( !pBasic ) - return NULL; - - // look for the ThisComponent variable, first in the parent (which - // might be the document's Basic), then in the parent's parent (which might be - // the application Basic) - const ::rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ); - SbxVariable* pThisComponent = NULL; - - SbxObject* pLookup = pBasic->GetParent(); - while ( pLookup && !pThisComponent ) - { - pThisComponent = pLookup->Find( sThisComponent, SbxCLASS_OBJECT ); - pLookup = pLookup->GetParent(); - } - if ( !pThisComponent ) - { - OSL_TRACE("Failed to get ThisComponent"); - // the application Basic, at the latest, should have this variable - return NULL; - } - - Any aThisComponent( sbxToUnoValue( pThisComponent ) ); - Reference< frame::XModel > xModel( aThisComponent, UNO_QUERY ); - if ( !xModel.is() ) - { - // it's no XModel. Okay, ThisComponent nowadays is allowed to be a controller. - Reference< frame::XController > xController( aThisComponent, UNO_QUERY ); - if ( xController.is() ) - xModel = xController->getModel(); - } - - if ( !xModel.is() ) - return NULL; - -#if OSL_DEBUG_LEVEL > 0 - OSL_TRACE("Have model ThisComponent points to url %s", - ::rtl::OUStringToOString( xModel->getURL(), - RTL_TEXTENCODING_ASCII_US ).pData->buffer ); -#endif - - return xModel; -} - void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Reference< frame::XModel >& xModel ) { OSL_TRACE("SFURL_firing_impl() processing script url %s", @@ -569,7 +521,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite ) bool bDocDialog = false; StarBASIC* pFoundBasic = NULL; OSL_TRACE("About to try get a hold of ThisComponent"); - Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ; + Reference< frame::XModel > xModel = StarBASIC::GetModelFromBasic( pINST->GetBasic() ) ; aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic ); // If we found the dialog then it belongs to the Search basic if ( !pFoundBasic ) |