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_embeddedobj.hxx" 30 #include <com/sun/star/embed/EmbedUpdateModes.hpp> 31 #include <com/sun/star/embed/EmbedStates.hpp> 32 #include <com/sun/star/lang/XComponent.hpp> 33 #include <com/sun/star/lang/DisposedException.hpp> 34 35 #include <cppuhelper/interfacecontainer.h> 36 37 #include <oleembobj.hxx> 38 #include <olecomponent.hxx> 39 40 #include "ownview.hxx" 41 42 using namespace ::com::sun::star; 43 44 sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory ); 45 46 47 //------------------------------------------------------ 48 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory, 49 const uno::Sequence< sal_Int8 >& aClassID, 50 const ::rtl::OUString& aClassName ) 51 : m_pOleComponent( NULL ) 52 , m_pInterfaceContainer( NULL ) 53 , m_bReadOnly( sal_False ) 54 , m_bDisposed( sal_False ) 55 , m_nObjectState( -1 ) 56 , m_nTargetState( -1 ) 57 , m_nUpdateMode ( embed::EmbedUpdateModes::ALWAYS_UPDATE ) 58 , m_xFactory( xFactory ) 59 , m_aClassID( aClassID ) 60 , m_aClassName( aClassName ) 61 , m_bWaitSaveCompleted( sal_False ) 62 , m_bNewVisReplInStream( sal_True ) 63 , m_bStoreLoaded( sal_False ) 64 , m_bVisReplInitialized( sal_False ) 65 , m_bVisReplInStream( sal_False ) 66 , m_bStoreVisRepl( sal_False ) 67 , m_bIsLink( sal_False ) 68 , m_bHasCachedSize( sal_False ) 69 , m_nCachedAspect( 0 ) 70 , m_bHasSizeToSet( sal_False ) 71 , m_nAspectToSet( 0 ) 72 , m_bGotStatus( sal_False ) 73 , m_nStatus( 0 ) 74 , m_nStatusAspect( 0 ) 75 , m_pOwnView( NULL ) 76 , m_bFromClipboard( sal_False ) 77 , m_bTriedConversion( sal_False ) 78 { 79 } 80 81 //------------------------------------------------------ 82 // In case of loading from persistent entry the classID of the object 83 // will be retrieved from the entry, during construction it is unknown 84 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory, sal_Bool bLink ) 85 : m_pOleComponent( NULL ) 86 , m_pInterfaceContainer( NULL ) 87 , m_bReadOnly( sal_False ) 88 , m_bDisposed( sal_False ) 89 , m_nObjectState( -1 ) 90 , m_nTargetState( -1 ) 91 , m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE ) 92 , m_xFactory( xFactory ) 93 , m_bWaitSaveCompleted( sal_False ) 94 , m_bNewVisReplInStream( sal_True ) 95 , m_bStoreLoaded( sal_False ) 96 , m_bVisReplInitialized( sal_False ) 97 , m_bVisReplInStream( sal_False ) 98 , m_bStoreVisRepl( sal_False ) 99 , m_bIsLink( bLink ) 100 , m_bHasCachedSize( sal_False ) 101 , m_nCachedAspect( 0 ) 102 , m_bHasSizeToSet( sal_False ) 103 , m_nAspectToSet( 0 ) 104 , m_bGotStatus( sal_False ) 105 , m_nStatus( 0 ) 106 , m_nStatusAspect( 0 ) 107 , m_pOwnView( NULL ) 108 , m_bFromClipboard( sal_False ) 109 , m_bTriedConversion( sal_False ) 110 { 111 } 112 #ifdef WNT 113 //------------------------------------------------------ 114 // this constructor let object be initialized from clipboard 115 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory ) 116 : m_pOleComponent( NULL ) 117 , m_pInterfaceContainer( NULL ) 118 , m_bReadOnly( sal_False ) 119 , m_bDisposed( sal_False ) 120 , m_nObjectState( -1 ) 121 , m_nTargetState( -1 ) 122 , m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE ) 123 , m_xFactory( xFactory ) 124 , m_bWaitSaveCompleted( sal_False ) 125 , m_bNewVisReplInStream( sal_True ) 126 , m_bStoreLoaded( sal_False ) 127 , m_bVisReplInitialized( sal_False ) 128 , m_bVisReplInStream( sal_False ) 129 , m_bStoreVisRepl( sal_False ) 130 , m_bIsLink( sal_False ) 131 , m_bHasCachedSize( sal_False ) 132 , m_nCachedAspect( 0 ) 133 , m_bHasSizeToSet( sal_False ) 134 , m_nAspectToSet( 0 ) 135 , m_bGotStatus( sal_False ) 136 , m_nStatus( 0 ) 137 , m_nStatusAspect( 0 ) 138 , m_pOwnView( NULL ) 139 , m_bFromClipboard( sal_True ) 140 , m_bTriedConversion( sal_False ) 141 { 142 } 143 #endif 144 //------------------------------------------------------ 145 OleEmbeddedObject::~OleEmbeddedObject() 146 { 147 OSL_ENSURE( !m_pInterfaceContainer && !m_pOleComponent && !m_xObjectStream.is(), 148 "The object is not closed! DISASTER is possible!" ); 149 150 if ( m_pOleComponent || m_pInterfaceContainer || m_xObjectStream.is() ) 151 { 152 // the component must be cleaned during closing 153 m_refCount++; // to avoid crash 154 try { 155 Dispose(); 156 } catch( uno::Exception& ) {} 157 } 158 159 if ( m_aTempURL.getLength() ) 160 KillFile_Impl( m_aTempURL, m_xFactory ); 161 162 if ( m_aTempDumpURL.getLength() ) 163 KillFile_Impl( m_aTempDumpURL, m_xFactory ); 164 } 165 166 //------------------------------------------------------ 167 void OleEmbeddedObject::MakeEventListenerNotification_Impl( const ::rtl::OUString& aEventName ) 168 { 169 if ( m_pInterfaceContainer ) 170 { 171 ::cppu::OInterfaceContainerHelper* pContainer = 172 m_pInterfaceContainer->getContainer( 173 ::getCppuType( ( const uno::Reference< document::XEventListener >*) NULL ) ); 174 if ( pContainer != NULL ) 175 { 176 document::EventObject aEvent( static_cast< ::cppu::OWeakObject* >( this ), aEventName ); 177 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); 178 while (pIterator.hasMoreElements()) 179 { 180 try 181 { 182 ((document::XEventListener*)pIterator.next())->notifyEvent( aEvent ); 183 } 184 catch( uno::RuntimeException& ) 185 { 186 } 187 } 188 } 189 } 190 } 191 #ifdef WNT 192 //---------------------------------------------- 193 void OleEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState ) 194 { 195 if ( m_pInterfaceContainer ) 196 { 197 ::cppu::OInterfaceContainerHelper* pContainer = m_pInterfaceContainer->getContainer( 198 ::getCppuType( ( const uno::Reference< embed::XStateChangeListener >*) NULL ) ); 199 if ( pContainer != NULL ) 200 { 201 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) ); 202 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); 203 204 while (pIterator.hasMoreElements()) 205 { 206 if ( bBeforeChange ) 207 { 208 try 209 { 210 ((embed::XStateChangeListener*)pIterator.next())->changingState( aSource, nOldState, nNewState ); 211 } 212 catch( uno::Exception& ) 213 { 214 // even if the listener complains ignore it for now 215 } 216 } 217 else 218 { 219 try 220 { 221 ((embed::XStateChangeListener*)pIterator.next())->stateChanged( aSource, nOldState, nNewState ); 222 } 223 catch( uno::Exception& ) 224 { 225 // if anything happened it is problem of listener, ignore it 226 } 227 } 228 } 229 } 230 } 231 } 232 #endif 233 //------------------------------------------------------ 234 void OleEmbeddedObject::GetRidOfComponent() 235 { 236 #ifdef WNT 237 if ( m_pOleComponent ) 238 { 239 if ( m_nObjectState != -1 && m_nObjectState != embed::EmbedStates::LOADED ) 240 SaveObject_Impl(); 241 242 m_pOleComponent->removeCloseListener( m_xClosePreventer ); 243 try 244 { 245 m_pOleComponent->close( sal_False ); 246 } 247 catch( uno::Exception& ) 248 { 249 // TODO: there should be a special listener to wait for component closing 250 // and to notify object, may be object itself can be such a listener 251 m_pOleComponent->addCloseListener( m_xClosePreventer ); 252 throw; 253 } 254 255 m_pOleComponent->disconnectEmbeddedObject(); 256 m_pOleComponent->release(); 257 m_pOleComponent = NULL; 258 } 259 #endif 260 } 261 262 //------------------------------------------------------ 263 void OleEmbeddedObject::Dispose() 264 { 265 if ( m_pInterfaceContainer ) 266 { 267 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) ); 268 m_pInterfaceContainer->disposeAndClear( aSource ); 269 delete m_pInterfaceContainer; 270 m_pInterfaceContainer = NULL; 271 } 272 273 if ( m_pOwnView ) 274 { 275 m_pOwnView->Close(); 276 m_pOwnView->release(); 277 m_pOwnView = NULL; 278 } 279 280 if ( m_pOleComponent ) 281 try { 282 GetRidOfComponent(); 283 } catch( uno::Exception& ) 284 { 285 m_bDisposed = true; 286 throw; // TODO: there should be a special listener that will close object when 287 // component is finally closed 288 } 289 290 if ( m_xObjectStream.is() ) 291 { 292 uno::Reference< lang::XComponent > xComp( m_xObjectStream, uno::UNO_QUERY ); 293 OSL_ENSURE( xComp.is(), "Storage stream doesn't support XComponent!\n" ); 294 295 if ( xComp.is() ) 296 { 297 try { 298 xComp->dispose(); 299 } catch( uno::Exception& ) {} 300 } 301 m_xObjectStream = uno::Reference< io::XStream >(); 302 } 303 304 m_xParentStorage = uno::Reference< embed::XStorage >(); 305 306 m_bDisposed = true; 307 } 308 309 //------------------------------------------------------ 310 uno::Sequence< sal_Int8 > SAL_CALL OleEmbeddedObject::getClassID() 311 throw ( uno::RuntimeException ) 312 { 313 // begin wrapping related part ==================== 314 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject; 315 if ( xWrappedObject.is() ) 316 { 317 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 318 return xWrappedObject->getClassID(); 319 } 320 // end wrapping related part ==================== 321 322 ::osl::MutexGuard aGuard( m_aMutex ); 323 if ( m_bDisposed ) 324 throw lang::DisposedException(); // TODO 325 326 return m_aClassID; 327 } 328 329 //------------------------------------------------------ 330 ::rtl::OUString SAL_CALL OleEmbeddedObject::getClassName() 331 throw ( uno::RuntimeException ) 332 { 333 // begin wrapping related part ==================== 334 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject; 335 if ( xWrappedObject.is() ) 336 { 337 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 338 return xWrappedObject->getClassName(); 339 } 340 // end wrapping related part ==================== 341 342 ::osl::MutexGuard aGuard( m_aMutex ); 343 if ( m_bDisposed ) 344 throw lang::DisposedException(); // TODO 345 346 return m_aClassName; 347 } 348 349 //------------------------------------------------------ 350 void SAL_CALL OleEmbeddedObject::setClassInfo( 351 const uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName ) 352 throw ( lang::NoSupportException, 353 uno::RuntimeException ) 354 { 355 // begin wrapping related part ==================== 356 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject; 357 if ( xWrappedObject.is() ) 358 { 359 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 360 xWrappedObject->setClassInfo( aClassID, aClassName ); 361 return; 362 } 363 // end wrapping related part ==================== 364 365 // the object class info can not be changed explicitly 366 throw lang::NoSupportException(); //TODO: 367 } 368 369 //------------------------------------------------------ 370 uno::Reference< util::XCloseable > SAL_CALL OleEmbeddedObject::getComponent() 371 throw ( uno::RuntimeException ) 372 { 373 // begin wrapping related part ==================== 374 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject; 375 if ( xWrappedObject.is() ) 376 { 377 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 378 return xWrappedObject->getComponent(); 379 } 380 // end wrapping related part ==================== 381 382 ::osl::MutexGuard aGuard( m_aMutex ); 383 if ( m_bDisposed ) 384 throw lang::DisposedException(); // TODO 385 386 if ( m_nObjectState == -1 ) // || m_nObjectState == embed::EmbedStates::LOADED ) 387 { 388 // the object is still not running 389 throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object is not loaded!\n" ), 390 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); 391 } 392 393 // if ( m_bWaitSaveCompleted ) 394 // throw embed::WrongStateException( 395 // ::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ), 396 // uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); 397 398 if ( !m_pOleComponent ) 399 { 400 // TODO/LATER: Is it correct??? 401 return uno::Reference< util::XCloseable >(); 402 // throw uno::RuntimeException(); // TODO 403 } 404 405 return uno::Reference< util::XCloseable >( static_cast< ::cppu::OWeakObject* >( m_pOleComponent ), uno::UNO_QUERY ); 406 } 407 408 //---------------------------------------------- 409 void SAL_CALL OleEmbeddedObject::addStateChangeListener( const uno::Reference< embed::XStateChangeListener >& xListener ) 410 throw ( uno::RuntimeException ) 411 { 412 // begin wrapping related part ==================== 413 uno::Reference< embed::XStateChangeBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY ); 414 if ( xWrappedObject.is() ) 415 { 416 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 417 xWrappedObject->addStateChangeListener( xListener ); 418 return; 419 } 420 // end wrapping related part ==================== 421 422 ::osl::MutexGuard aGuard( m_aMutex ); 423 if ( m_bDisposed ) 424 throw lang::DisposedException(); // TODO 425 426 if ( !m_pInterfaceContainer ) 427 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex ); 428 429 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ), 430 xListener ); 431 } 432 433 //---------------------------------------------- 434 void SAL_CALL OleEmbeddedObject::removeStateChangeListener( 435 const uno::Reference< embed::XStateChangeListener >& xListener ) 436 throw (uno::RuntimeException) 437 { 438 // begin wrapping related part ==================== 439 uno::Reference< embed::XStateChangeBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY ); 440 if ( xWrappedObject.is() ) 441 { 442 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 443 xWrappedObject->removeStateChangeListener( xListener ); 444 return; 445 } 446 // end wrapping related part ==================== 447 448 ::osl::MutexGuard aGuard( m_aMutex ); 449 if ( m_pInterfaceContainer ) 450 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ), 451 xListener ); 452 } 453 454 455 //---------------------------------------------- 456 void SAL_CALL OleEmbeddedObject::close( sal_Bool bDeliverOwnership ) 457 throw ( util::CloseVetoException, 458 uno::RuntimeException ) 459 { 460 // begin wrapping related part ==================== 461 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject; 462 if ( xWrappedObject.is() ) 463 { 464 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 465 xWrappedObject->close( bDeliverOwnership ); 466 return; 467 } 468 // end wrapping related part ==================== 469 470 ::osl::MutexGuard aGuard( m_aMutex ); 471 if ( m_bDisposed ) 472 throw lang::DisposedException(); // TODO 473 474 uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) ); 475 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) ); 476 477 if ( m_pInterfaceContainer ) 478 { 479 ::cppu::OInterfaceContainerHelper* pContainer = 480 m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) ); 481 if ( pContainer != NULL ) 482 { 483 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); 484 while (pIterator.hasMoreElements()) 485 { 486 try 487 { 488 ((util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnership ); 489 } 490 catch( uno::RuntimeException& ) 491 { 492 pIterator.remove(); 493 } 494 } 495 } 496 497 pContainer = m_pInterfaceContainer->getContainer( 498 ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) ); 499 if ( pContainer != NULL ) 500 { 501 ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer); 502 while (pCloseIterator.hasMoreElements()) 503 { 504 try 505 { 506 ((util::XCloseListener*)pCloseIterator.next())->notifyClosing( aSource ); 507 } 508 catch( uno::RuntimeException& ) 509 { 510 pCloseIterator.remove(); 511 } 512 } 513 } 514 } 515 516 Dispose(); 517 } 518 519 //---------------------------------------------- 520 void SAL_CALL OleEmbeddedObject::addCloseListener( const uno::Reference< util::XCloseListener >& xListener ) 521 throw ( uno::RuntimeException ) 522 { 523 // begin wrapping related part ==================== 524 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject; 525 if ( xWrappedObject.is() ) 526 { 527 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 528 xWrappedObject->addCloseListener( xListener ); 529 return; 530 } 531 // end wrapping related part ==================== 532 533 ::osl::MutexGuard aGuard( m_aMutex ); 534 if ( m_bDisposed ) 535 throw lang::DisposedException(); // TODO 536 537 if ( !m_pInterfaceContainer ) 538 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex ); 539 540 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ), xListener ); 541 } 542 543 //---------------------------------------------- 544 void SAL_CALL OleEmbeddedObject::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener ) 545 throw (uno::RuntimeException) 546 { 547 // begin wrapping related part ==================== 548 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject; 549 if ( xWrappedObject.is() ) 550 { 551 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 552 xWrappedObject->removeCloseListener( xListener ); 553 return; 554 } 555 // end wrapping related part ==================== 556 557 ::osl::MutexGuard aGuard( m_aMutex ); 558 if ( m_bDisposed ) 559 throw lang::DisposedException(); // TODO 560 561 if ( m_pInterfaceContainer ) 562 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ), 563 xListener ); 564 } 565 566 //------------------------------------------------------ 567 void SAL_CALL OleEmbeddedObject::addEventListener( const uno::Reference< document::XEventListener >& xListener ) 568 throw ( uno::RuntimeException ) 569 { 570 // begin wrapping related part ==================== 571 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject; 572 if ( xWrappedObject.is() ) 573 { 574 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 575 xWrappedObject->addEventListener( xListener ); 576 return; 577 } 578 // end wrapping related part ==================== 579 580 ::osl::MutexGuard aGuard( m_aMutex ); 581 if ( m_bDisposed ) 582 throw lang::DisposedException(); // TODO 583 584 if ( !m_pInterfaceContainer ) 585 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex ); 586 587 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ), xListener ); 588 } 589 590 //------------------------------------------------------ 591 void SAL_CALL OleEmbeddedObject::removeEventListener( 592 const uno::Reference< document::XEventListener >& xListener ) 593 throw ( uno::RuntimeException ) 594 { 595 // begin wrapping related part ==================== 596 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject; 597 if ( xWrappedObject.is() ) 598 { 599 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 600 xWrappedObject->removeEventListener( xListener ); 601 return; 602 } 603 // end wrapping related part ==================== 604 605 ::osl::MutexGuard aGuard( m_aMutex ); 606 if ( m_bDisposed ) 607 throw lang::DisposedException(); // TODO 608 609 if ( m_pInterfaceContainer ) 610 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ), 611 xListener ); 612 } 613 614 // XInplaceObject ( wrapper related implementation ) 615 //------------------------------------------------------ 616 void SAL_CALL OleEmbeddedObject::setObjectRectangles( const awt::Rectangle& aPosRect, 617 const awt::Rectangle& aClipRect ) 618 throw ( embed::WrongStateException, 619 uno::Exception, 620 uno::RuntimeException ) 621 { 622 // begin wrapping related part ==================== 623 uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY ); 624 if ( xWrappedObject.is() ) 625 { 626 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 627 xWrappedObject->setObjectRectangles( aPosRect, aClipRect ); 628 return; 629 } 630 // end wrapping related part ==================== 631 632 throw embed::WrongStateException(); 633 } 634 635 //------------------------------------------------------ 636 void SAL_CALL OleEmbeddedObject::enableModeless( sal_Bool bEnable ) 637 throw ( embed::WrongStateException, 638 uno::Exception, 639 uno::RuntimeException ) 640 { 641 // begin wrapping related part ==================== 642 uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY ); 643 if ( xWrappedObject.is() ) 644 { 645 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 646 xWrappedObject->enableModeless( bEnable ); 647 return; 648 } 649 // end wrapping related part ==================== 650 651 throw embed::WrongStateException(); 652 } 653 654 //------------------------------------------------------ 655 void SAL_CALL OleEmbeddedObject::translateAccelerators( 656 const uno::Sequence< awt::KeyEvent >& aKeys ) 657 throw ( embed::WrongStateException, 658 uno::RuntimeException ) 659 { 660 // begin wrapping related part ==================== 661 uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY ); 662 if ( xWrappedObject.is() ) 663 { 664 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 665 xWrappedObject->translateAccelerators( aKeys ); 666 return; 667 } 668 // end wrapping related part ==================== 669 670 // throw embed::WrongStateException(); 671 } 672 673 // XChild 674 //------------------------------------------------------ 675 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL OleEmbeddedObject::getParent() throw (::com::sun::star::uno::RuntimeException) 676 { 677 // begin wrapping related part ==================== 678 uno::Reference< container::XChild > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY ); 679 if ( xWrappedObject.is() ) 680 { 681 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 682 return xWrappedObject->getParent(); 683 } 684 // end wrapping related part ==================== 685 686 return m_xParent; 687 } 688 689 //------------------------------------------------------ 690 void SAL_CALL OleEmbeddedObject::setParent( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& xParent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException) 691 { 692 // begin wrapping related part ==================== 693 uno::Reference< container::XChild > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY ); 694 if ( xWrappedObject.is() ) 695 { 696 // the object was converted to OOo embedded object, the current implementation is now only a wrapper 697 xWrappedObject->setParent( xParent ); 698 return; 699 } 700 // end wrapping related part ==================== 701 702 m_xParent = xParent; 703 } 704 705