1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_basic.hxx" 30 31 //#include <stl_queue.h> 32 #include <osl/mutex.hxx> 33 #include <comphelper/processfactory.hxx> 34 35 36 #include <com/sun/star/script/XEventAttacher.hpp> 37 #include <com/sun/star/script/XAllListener.hpp> 38 #include <com/sun/star/script/XScriptEventsSupplier.hpp> 39 #include <com/sun/star/script/XScriptEventsAttacher.hpp> 40 #include <com/sun/star/script/ScriptEventDescriptor.hpp> 41 #include <com/sun/star/script/XLibraryContainer.hpp> 42 #include <com/sun/star/beans/XPropertySet.hpp> 43 #include <com/sun/star/container/XNameContainer.hpp> 44 #include <com/sun/star/resource/XStringResourceSupplier.hpp> 45 #include <com/sun/star/resource/XStringResourceManager.hpp> 46 #include <com/sun/star/awt/XControlContainer.hpp> 47 #include <com/sun/star/awt/XControlModel.hpp> 48 #include <com/sun/star/awt/XControl.hpp> 49 #include <com/sun/star/awt/XDialog.hpp> 50 #include <com/sun/star/awt/XWindow.hpp> 51 #include <com/sun/star/script/provider/XScriptProviderFactory.hpp> 52 53 #include <com/sun/star/script/provider/XScriptProviderSupplier.hpp> 54 #include <com/sun/star/script/provider/XScriptProvider.hpp> 55 #include <com/sun/star/awt/XDialogProvider.hpp> 56 57 #include <com/sun/star/frame/XModel.hpp> 58 #include <com/sun/star/frame/XDesktop.hpp> 59 #include <com/sun/star/container/XEnumerationAccess.hpp> 60 #include <basic/basicmanagerrepository.hxx> 61 #include <basic/basmgr.hxx> 62 //================================================================================================== 63 64 #include <xmlscript/xmldlg_imexp.hxx> 65 #include <sbunoobj.hxx> 66 #include <basic/sbstar.hxx> 67 #include <basic/sbmeth.hxx> 68 #include <basic/sbuno.hxx> 69 #include <runtime.hxx> 70 #include <sbintern.hxx> 71 72 73 #include <cppuhelper/implbase1.hxx> 74 using namespace ::com::sun::star; 75 using namespace ::com::sun::star::uno; 76 using namespace ::com::sun::star::script; 77 using namespace ::com::sun::star::resource; 78 79 using namespace ::com::sun::star::uno; 80 using namespace ::com::sun::star::lang; 81 using namespace ::com::sun::star::beans; 82 using namespace ::com::sun::star::script; 83 using namespace ::com::sun::star::container; 84 using namespace ::com::sun::star::reflection; 85 using namespace ::com::sun::star::awt; 86 using namespace ::com::sun::star::io; 87 using namespace ::cppu; 88 using namespace ::osl; 89 90 91 void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Reference< frame::XModel >& xModel ) 92 { 93 OSL_TRACE("SFURL_firing_impl() processing script url %s", 94 ::rtl::OUStringToOString( aScriptEvent.ScriptCode, 95 RTL_TEXTENCODING_ASCII_US ).pData->buffer ); 96 try 97 { 98 Reference< provider::XScriptProvider > xScriptProvider; 99 if ( xModel.is() ) 100 { 101 Reference< provider::XScriptProviderSupplier > xSupplier( xModel, UNO_QUERY ); 102 OSL_ENSURE( xSupplier.is(), "SFURL_firing_impl: failed to get script provider supplier" ); 103 if ( xSupplier.is() ) 104 xScriptProvider.set( xSupplier->getScriptProvider() ); 105 } 106 else 107 { 108 Reference< XComponentContext > xContext; 109 Reference< XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY ); 110 OSL_ASSERT( xProps.is() ); 111 OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString::createFromAscii( "DefaultContext" ) ) >>= xContext ); 112 if ( xContext.is() ) 113 { 114 Reference< provider::XScriptProviderFactory > xFactory( 115 xContext->getValueByName( 116 ::rtl::OUString::createFromAscii( "/singletons/com.sun.star.script.provider.theMasterScriptProviderFactory" ) ), 117 UNO_QUERY ); 118 OSL_ENSURE( xFactory.is(), "SFURL_firing_impl: failed to get master script provider factory" ); 119 if ( xFactory.is() ) 120 { 121 Any aCtx; 122 aCtx <<= ::rtl::OUString::createFromAscii( "user" ); 123 xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY ); 124 } 125 } 126 } 127 128 if ( !xScriptProvider.is() ) 129 { 130 OSL_TRACE("SFURL_firing_impl() Failed to create msp"); 131 return; 132 } 133 Sequence< Any > inArgs( 0 ); 134 Sequence< Any > outArgs( 0 ); 135 Sequence< sal_Int16 > outIndex; 136 137 // get Arguments for script 138 inArgs = aScriptEvent.Arguments; 139 140 Reference< provider::XScript > xScript = xScriptProvider->getScript( aScriptEvent.ScriptCode ); 141 142 if ( !xScript.is() ) 143 { 144 OSL_TRACE("SFURL_firing_impl() Failed to obtain XScript"); 145 return; 146 } 147 148 Any result = xScript->invoke( inArgs, outIndex, outArgs ); 149 if ( pRet ) 150 { 151 *pRet = result; 152 } 153 } 154 catch ( RuntimeException& re ) 155 { 156 OSL_TRACE("SFURL_firing_impl() Caught RuntimeException reason %s.", 157 ::rtl::OUStringToOString( re.Message, 158 RTL_TEXTENCODING_ASCII_US ).pData->buffer ); 159 } 160 catch ( Exception& e ) 161 { 162 OSL_TRACE("SFURL_firing_impl() Caught Exception reason %s.", 163 ::rtl::OUStringToOString( e.Message, 164 RTL_TEXTENCODING_ASCII_US ).pData->buffer ); 165 } 166 167 } 168 169 170 class BasicScriptListener_Impl : public WeakImplHelper1< XScriptListener > 171 { 172 StarBASICRef maBasicRef; 173 Reference< frame::XModel > m_xModel; 174 175 virtual void firing_impl(const ScriptEvent& aScriptEvent, Any* pRet); 176 177 public: 178 BasicScriptListener_Impl( StarBASIC* pBasic, const Reference< frame::XModel >& xModel ) 179 : maBasicRef( pBasic ), m_xModel( xModel ) {} 180 181 // Methods of XAllListener 182 virtual void SAL_CALL firing(const ScriptEvent& aScriptEvent) 183 throw( RuntimeException ); 184 virtual Any SAL_CALL approveFiring(const ScriptEvent& aScriptEvent) 185 throw( InvocationTargetException, RuntimeException ); 186 187 // Methods of XEventListener 188 virtual void SAL_CALL disposing(const EventObject& Source) 189 throw( RuntimeException ); 190 }; 191 192 // Methods XAllListener 193 void BasicScriptListener_Impl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException ) 194 { 195 firing_impl( aScriptEvent, NULL ); 196 } 197 198 Any BasicScriptListener_Impl::approveFiring( const ScriptEvent& aScriptEvent ) 199 throw ( InvocationTargetException, RuntimeException ) 200 { 201 Any aRetAny; 202 firing_impl( aScriptEvent, &aRetAny ); 203 return aRetAny; 204 } 205 206 // Methods XEventListener 207 void BasicScriptListener_Impl::disposing(const EventObject& ) throw ( RuntimeException ) 208 { 209 // TODO: ??? 210 //vos::OGuard guard( Application::GetSolarMutex() ); 211 //xSbxObj.Clear(); 212 } 213 214 215 void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any* pRet ) 216 { 217 //Guard< Mutex > aGuard( Mutex::getGlobalMutex() ); 218 //{ 219 if( aScriptEvent.ScriptType.compareToAscii( "StarBasic" ) == 0 ) 220 { 221 // Full qualified name? 222 String aMacro( aScriptEvent.ScriptCode ); 223 String aLibName; 224 String aLocation; 225 if( aMacro.GetTokenCount( '.' ) == 3 ) 226 { 227 sal_uInt16 nLast = 0; 228 ::rtl::OUString aFullLibName = aMacro.GetToken( 0, '.', nLast ); 229 230 sal_Int32 nIndex = aFullLibName.indexOf( (sal_Unicode)':' ); 231 if (nIndex >= 0) 232 { 233 aLocation = aFullLibName.copy( 0, nIndex ); 234 aLibName = aFullLibName.copy( nIndex + 1 ); 235 } 236 237 String aModul = aMacro.GetToken( 0, '.', nLast ); 238 aMacro.Erase( 0, nLast ); 239 } 240 241 SbxObject* p = maBasicRef; 242 SbxObject* pParent = p->GetParent(); 243 SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL; 244 245 StarBASICRef xAppStandardBasic; 246 StarBASICRef xDocStandardBasic; 247 if( pParentParent ) 248 { 249 // Own basic must be document library 250 xAppStandardBasic = (StarBASIC*)pParentParent; 251 xDocStandardBasic = (StarBASIC*)pParent; 252 } 253 else if( pParent ) 254 { 255 String aName = p->GetName(); 256 if( aName.EqualsAscii("Standard") ) 257 { 258 // Own basic is doc standard lib 259 xDocStandardBasic = (StarBASIC*)p; 260 } 261 xAppStandardBasic = (StarBASIC*)pParent; 262 } 263 else 264 { 265 xAppStandardBasic = (StarBASIC*)p; 266 } 267 268 sal_Bool bSearchLib = true; 269 StarBASICRef xLibSearchBasic; 270 if( aLocation.EqualsAscii("application") ) 271 xLibSearchBasic = xAppStandardBasic; 272 else if( aLocation.EqualsAscii("document") ) 273 xLibSearchBasic = xDocStandardBasic; 274 else 275 bSearchLib = false; 276 277 SbxVariable* pMethVar = NULL; 278 // Be still tolerant and make default search if no search basic exists 279 if( bSearchLib && xLibSearchBasic.Is() ) 280 { 281 StarBASICRef xLibBasic; 282 sal_Int16 nCount = xLibSearchBasic->GetObjects()->Count(); 283 for( sal_Int16 nObj = -1; nObj < nCount ; nObj++ ) 284 { 285 StarBASIC* pBasic; 286 if( nObj == -1 ) 287 { 288 pBasic = (StarBASIC*)xLibSearchBasic; 289 } 290 else 291 { 292 SbxVariable* pVar = xLibSearchBasic->GetObjects()->Get( nObj ); 293 pBasic = PTR_CAST(StarBASIC,pVar); 294 } 295 if( pBasic ) 296 { 297 String aName = pBasic->GetName(); 298 if( aName == aLibName ) 299 { 300 // Search only in the lib, not automatically in application basic 301 sal_uInt16 nFlags = pBasic->GetFlags(); 302 pBasic->ResetFlag( SBX_GBLSEARCH ); 303 pMethVar = pBasic->Find( aMacro, SbxCLASS_DONTCARE ); 304 pBasic->SetFlags( nFlags ); 305 break; 306 } 307 } 308 } 309 } 310 311 // Default: Be tolerant and search everywhere 312 if( (!pMethVar || !pMethVar->ISA(SbMethod)) && maBasicRef.Is() ) 313 pMethVar = maBasicRef->FindQualified( aMacro, SbxCLASS_DONTCARE ); 314 315 SbMethod* pMeth = PTR_CAST(SbMethod,pMethVar); 316 if( !pMeth ) 317 return; 318 319 // Setup parameters 320 SbxArrayRef xArray; 321 String aTmp; 322 sal_Int32 nCnt = aScriptEvent.Arguments.getLength(); 323 if( nCnt ) 324 { 325 xArray = new SbxArray; 326 const Any *pArgs = aScriptEvent.Arguments.getConstArray(); 327 for( sal_Int32 i = 0; i < nCnt; i++ ) 328 { 329 SbxVariableRef xVar = new SbxVariable( SbxVARIANT ); 330 unoToSbxValue( (SbxVariable*)xVar, pArgs[i] ); 331 xArray->Put( xVar, sal::static_int_cast< sal_uInt16 >(i+1) ); 332 } 333 } 334 335 // Call method 336 SbxVariableRef xValue = pRet ? new SbxVariable : 0; 337 if( xArray.Is() ) 338 pMeth->SetParameters( xArray ); 339 pMeth->Call( xValue ); 340 if( pRet ) 341 *pRet = sbxToUnoValue( xValue ); 342 pMeth->SetParameters( NULL ); 343 } 344 else // scripting framework script 345 { 346 //callBasic via scripting framework 347 SFURL_firing_impl( aScriptEvent, pRet, m_xModel ); 348 349 } 350 } 351 352 Any implFindDialogLibForDialog( const Any& rDlgAny, SbxObject* pBasic ) 353 { 354 Any aRetDlgLibAny; 355 356 SbxVariable* pDlgLibContVar = pBasic->Find 357 ( String::CreateFromAscii("DialogLibraries"), SbxCLASS_OBJECT ); 358 if( pDlgLibContVar && pDlgLibContVar->ISA(SbUnoObject) ) 359 { 360 SbUnoObject* pDlgLibContUnoObj = (SbUnoObject*)(SbxBase*)pDlgLibContVar; 361 Any aDlgLibContAny = pDlgLibContUnoObj->getUnoAny(); 362 363 Reference< XLibraryContainer > xDlgLibContNameAccess( aDlgLibContAny, UNO_QUERY ); 364 OSL_ENSURE( xDlgLibContNameAccess.is(), "implFindDialogLibForDialog: no lib container for the given dialog!" ); 365 if( xDlgLibContNameAccess.is() ) 366 { 367 Sequence< ::rtl::OUString > aLibNames = xDlgLibContNameAccess->getElementNames(); 368 const ::rtl::OUString* pLibNames = aLibNames.getConstArray(); 369 sal_Int32 nLibNameCount = aLibNames.getLength(); 370 371 for( sal_Int32 iLib = 0 ; iLib < nLibNameCount ; iLib++ ) 372 { 373 if ( !xDlgLibContNameAccess->isLibraryLoaded( pLibNames[ iLib ] ) ) 374 // if the library isn't loaded, then the dialog cannot originate from this lib 375 continue; 376 377 Any aDlgLibAny = xDlgLibContNameAccess->getByName( pLibNames[ iLib ] ); 378 379 Reference< XNameAccess > xDlgLibNameAccess( aDlgLibAny, UNO_QUERY ); 380 OSL_ENSURE( xDlgLibNameAccess.is(), "implFindDialogLibForDialog: invalid dialog lib!" ); 381 if( xDlgLibNameAccess.is() ) 382 { 383 Sequence< ::rtl::OUString > aDlgNames = xDlgLibNameAccess->getElementNames(); 384 const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray(); 385 sal_Int32 nDlgNameCount = aDlgNames.getLength(); 386 387 for( sal_Int32 iDlg = 0 ; iDlg < nDlgNameCount ; iDlg++ ) 388 { 389 Any aDlgAny = xDlgLibNameAccess->getByName( pDlgNames[ iDlg ] ); 390 if( aDlgAny == rDlgAny ) 391 { 392 aRetDlgLibAny = aDlgLibAny; 393 break; 394 } 395 } 396 } 397 } 398 } 399 } 400 401 return aRetDlgLibAny; 402 } 403 404 Any implFindDialogLibForDialogBasic( const Any& aAnyISP, SbxObject* pBasic, StarBASIC*& pFoundBasic ) 405 { 406 Any aDlgLibAny; 407 // Find dialog library for dialog, direct access is not possible here 408 StarBASIC* pStartedBasic = (StarBASIC*)pBasic; 409 SbxObject* pParentBasic = pStartedBasic ? pStartedBasic->GetParent() : NULL; 410 SbxObject* pParentParentBasic = pParentBasic ? pParentBasic->GetParent() : NULL; 411 412 SbxObject* pSearchBasic1 = NULL; 413 SbxObject* pSearchBasic2 = NULL; 414 if( pParentParentBasic ) 415 { 416 pSearchBasic1 = pParentBasic; 417 pSearchBasic2 = pParentParentBasic; 418 } 419 else 420 { 421 pSearchBasic1 = pStartedBasic; 422 pSearchBasic2 = pParentBasic; 423 } 424 if( pSearchBasic1 ) 425 { 426 aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic1 ); 427 428 if ( aDlgLibAny.hasValue() ) 429 pFoundBasic = (StarBASIC*)pSearchBasic1; 430 431 else if( pSearchBasic2 ) 432 { 433 aDlgLibAny = implFindDialogLibForDialog( aAnyISP, pSearchBasic2 ); 434 if ( aDlgLibAny.hasValue() ) 435 pFoundBasic = (StarBASIC*)pSearchBasic2; 436 } 437 } 438 return aDlgLibAny; 439 } 440 441 static ::rtl::OUString aDecorationPropName = 442 ::rtl::OUString::createFromAscii( "Decoration" ); 443 static ::rtl::OUString aTitlePropName = 444 ::rtl::OUString::createFromAscii( "Title" ); 445 446 void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) 447 { 448 static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAscii( "ResourceResolver" ); 449 450 (void)pBasic; 451 (void)bWrite; 452 453 Reference< XMultiServiceFactory > xMSF( comphelper::getProcessServiceFactory() ); 454 if( !xMSF.is() ) 455 return; 456 457 // We need at least 1 parameter 458 if ( rPar.Count() < 2 ) 459 { 460 StarBASIC::Error( SbERR_BAD_ARGUMENT ); 461 return; 462 } 463 464 // Get dialog 465 SbxBaseRef pObj = (SbxBase*)rPar.Get( 1 )->GetObject(); 466 if( !(pObj && pObj->ISA(SbUnoObject)) ) 467 { 468 StarBASIC::Error( SbERR_BAD_ARGUMENT ); 469 return; 470 } 471 SbUnoObject* pUnoObj = (SbUnoObject*)(SbxBase*)pObj; 472 Any aAnyISP = pUnoObj->getUnoAny(); 473 TypeClass eType = aAnyISP.getValueType().getTypeClass(); 474 475 if( eType != TypeClass_INTERFACE ) 476 { 477 StarBASIC::Error( SbERR_BAD_ARGUMENT ); 478 return; 479 } 480 481 // Create new uno dialog 482 Reference< XNameContainer > xDialogModel( xMSF->createInstance 483 ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), 484 UNO_QUERY ); 485 if( !xDialogModel.is() ) 486 return; 487 488 Reference< XInputStreamProvider > xISP; 489 aAnyISP >>= xISP; 490 if( !xISP.is() ) 491 return; 492 493 Reference< XComponentContext > xContext; 494 Reference< XPropertySet > xProps( xMSF, UNO_QUERY ); 495 OSL_ASSERT( xProps.is() ); 496 OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext ); 497 498 // Import the DialogModel 499 Reference< XInputStream > xInput( xISP->createInputStream() ); 500 501 // i83963 Force decoration 502 uno::Reference< beans::XPropertySet > xDlgModPropSet( xDialogModel, uno::UNO_QUERY ); 503 if( xDlgModPropSet.is() ) 504 { 505 bool bDecoration = true; 506 try 507 { 508 Any aDecorationAny = xDlgModPropSet->getPropertyValue( aDecorationPropName ); 509 aDecorationAny >>= bDecoration; 510 if( !bDecoration ) 511 { 512 xDlgModPropSet->setPropertyValue( aDecorationPropName, makeAny( true ) ); 513 xDlgModPropSet->setPropertyValue( aTitlePropName, makeAny( ::rtl::OUString() ) ); 514 } 515 } 516 catch( UnknownPropertyException& ) 517 {} 518 } 519 520 Any aDlgLibAny; 521 bool bDocDialog = false; 522 StarBASIC* pFoundBasic = NULL; 523 OSL_TRACE("About to try get a hold of ThisComponent"); 524 Reference< frame::XModel > xModel = StarBASIC::GetModelFromBasic( pINST->GetBasic() ) ; 525 aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic ); 526 // If we found the dialog then it belongs to the Search basic 527 if ( !pFoundBasic ) 528 { 529 Reference< frame::XDesktop > xDesktop( xMSF->createInstance 530 ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), 531 UNO_QUERY ); 532 Reference< container::XEnumeration > xModels; 533 if ( xDesktop.is() ) 534 { 535 Reference< container::XEnumerationAccess > xComponents( xDesktop->getComponents(), UNO_QUERY ); 536 if ( xComponents.is() ) 537 xModels.set( xComponents->createEnumeration(), UNO_QUERY ); 538 if ( xModels.is() ) 539 { 540 while ( xModels->hasMoreElements() ) 541 { 542 Reference< frame::XModel > xNextModel( xModels->nextElement(), UNO_QUERY ); 543 if ( xNextModel.is() ) 544 { 545 BasicManager* pMgr = basic::BasicManagerRepository::getDocumentBasicManager( xNextModel ); 546 if ( pMgr ) 547 aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pMgr->GetLib(0), pFoundBasic ); 548 if ( aDlgLibAny.hasValue() ) 549 { 550 bDocDialog = true; 551 xModel = xNextModel; 552 break; 553 } 554 } 555 } 556 } 557 } 558 } 559 if ( pFoundBasic ) 560 bDocDialog = pFoundBasic->IsDocBasic(); 561 Reference< XScriptListener > xScriptListener = new BasicScriptListener_Impl( pINST->GetBasic(), xModel ); 562 563 Sequence< Any > aArgs( 4 ); 564 if( bDocDialog ) 565 aArgs[ 0 ] <<= xModel; 566 else 567 aArgs[ 0 ] <<= uno::Reference< uno::XInterface >(); 568 aArgs[ 1 ] <<= xInput; 569 aArgs[ 2 ] = aDlgLibAny; 570 aArgs[ 3 ] <<= xScriptListener; 571 // Create a "living" Dialog 572 Reference< XControl > xCntrl; 573 try 574 { 575 Reference< XDialogProvider > xDlgProv( xMSF->createInstanceWithArguments( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.scripting.DialogProvider" ) ), aArgs ), UNO_QUERY ); 576 xCntrl.set( xDlgProv->createDialog( rtl::OUString() ), UNO_QUERY_THROW ); 577 // Add dialog model to dispose vector 578 Reference< XComponent > xDlgComponent( xCntrl->getModel(), UNO_QUERY ); 579 pINST->getComponentVector().push_back( xDlgComponent ); 580 // need ThisCompoent from calling script 581 } 582 // preserve existing bad behaviour, it's possible... but probably 583 // illegal to open 2 dialogs ( they ARE modal ) when this happens, sometimes 584 // create dialog fails. So, in this case let's not throw, just leave basic 585 // detect the unset object. 586 catch( uno::Exception& ) 587 { 588 } 589 590 // Return dialog 591 Any aRetVal; 592 aRetVal <<= xCntrl; 593 SbxVariableRef refVar = rPar.Get(0); 594 unoToSbxValue( (SbxVariable*)refVar, aRetVal ); 595 } 596 597 598 //=================================================================== 599 600