update dev300-m58
[ooovba.git] / embeddedobj / source / msole / olemisc.cxx
blobc57ad637307ed66af9246d517713d1a2679edd45
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: olemisc.cxx,v $
10 * $Revision: 1.28 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_embeddedobj.hxx"
33 #include <com/sun/star/embed/EmbedUpdateModes.hpp>
34 #include <com/sun/star/embed/EmbedStates.hpp>
35 #include <com/sun/star/lang/XComponent.hpp>
36 #include <com/sun/star/lang/DisposedException.hpp>
38 #include <cppuhelper/interfacecontainer.h>
40 #include <oleembobj.hxx>
41 #include <olecomponent.hxx>
43 #include "ownview.hxx"
45 using namespace ::com::sun::star;
47 sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory );
50 //------------------------------------------------------
51 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
52 const uno::Sequence< sal_Int8 >& aClassID,
53 const ::rtl::OUString& aClassName )
54 : m_pOleComponent( NULL )
55 , m_pInterfaceContainer( NULL )
56 , m_bReadOnly( sal_False )
57 , m_bDisposed( sal_False )
58 , m_nObjectState( -1 )
59 , m_nTargetState( -1 )
60 , m_nUpdateMode ( embed::EmbedUpdateModes::ALWAYS_UPDATE )
61 , m_xFactory( xFactory )
62 , m_aClassID( aClassID )
63 , m_aClassName( aClassName )
64 , m_bWaitSaveCompleted( sal_False )
65 , m_bNewVisReplInStream( sal_True )
66 , m_bStoreLoaded( sal_False )
67 , m_bVisReplInitialized( sal_False )
68 , m_bVisReplInStream( sal_False )
69 , m_bStoreVisRepl( sal_False )
70 , m_bIsLink( sal_False )
71 , m_bHasCachedSize( sal_False )
72 , m_nCachedAspect( 0 )
73 , m_bHasSizeToSet( sal_False )
74 , m_nAspectToSet( 0 )
75 , m_bGotStatus( sal_False )
76 , m_nStatus( 0 )
77 , m_nStatusAspect( 0 )
78 , m_pOwnView( NULL )
79 , m_bFromClipboard( sal_False )
80 , m_bTriedConversion( sal_False )
84 //------------------------------------------------------
85 // In case of loading from persistent entry the classID of the object
86 // will be retrieved from the entry, during construction it is unknown
87 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory, sal_Bool bLink )
88 : m_pOleComponent( NULL )
89 , m_pInterfaceContainer( NULL )
90 , m_bReadOnly( sal_False )
91 , m_bDisposed( sal_False )
92 , m_nObjectState( -1 )
93 , m_nTargetState( -1 )
94 , m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE )
95 , m_xFactory( xFactory )
96 , m_bWaitSaveCompleted( sal_False )
97 , m_bNewVisReplInStream( sal_True )
98 , m_bStoreLoaded( sal_False )
99 , m_bVisReplInitialized( sal_False )
100 , m_bVisReplInStream( sal_False )
101 , m_bStoreVisRepl( sal_False )
102 , m_bIsLink( bLink )
103 , m_bHasCachedSize( sal_False )
104 , m_nCachedAspect( 0 )
105 , m_bHasSizeToSet( sal_False )
106 , m_nAspectToSet( 0 )
107 , m_bGotStatus( sal_False )
108 , m_nStatus( 0 )
109 , m_nStatusAspect( 0 )
110 , m_pOwnView( NULL )
111 , m_bFromClipboard( sal_False )
112 , m_bTriedConversion( sal_False )
115 #ifdef WNT
116 //------------------------------------------------------
117 // this constructor let object be initialized from clipboard
118 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
119 : m_pOleComponent( NULL )
120 , m_pInterfaceContainer( NULL )
121 , m_bReadOnly( sal_False )
122 , m_bDisposed( sal_False )
123 , m_nObjectState( -1 )
124 , m_nTargetState( -1 )
125 , m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE )
126 , m_xFactory( xFactory )
127 , m_bWaitSaveCompleted( sal_False )
128 , m_bNewVisReplInStream( sal_True )
129 , m_bStoreLoaded( sal_False )
130 , m_bVisReplInitialized( sal_False )
131 , m_bVisReplInStream( sal_False )
132 , m_bStoreVisRepl( sal_False )
133 , m_bIsLink( sal_False )
134 , m_bHasCachedSize( sal_False )
135 , m_nCachedAspect( 0 )
136 , m_bHasSizeToSet( sal_False )
137 , m_nAspectToSet( 0 )
138 , m_bGotStatus( sal_False )
139 , m_nStatus( 0 )
140 , m_nStatusAspect( 0 )
141 , m_pOwnView( NULL )
142 , m_bFromClipboard( sal_True )
143 , m_bTriedConversion( sal_False )
146 #endif
147 //------------------------------------------------------
148 OleEmbeddedObject::~OleEmbeddedObject()
150 OSL_ENSURE( !m_pInterfaceContainer && !m_pOleComponent && !m_xObjectStream.is(),
151 "The object is not closed! DISASTER is possible!" );
153 if ( m_pOleComponent || m_pInterfaceContainer || m_xObjectStream.is() )
155 // the component must be cleaned during closing
156 m_refCount++; // to avoid crash
157 try {
158 Dispose();
159 } catch( uno::Exception& ) {}
162 if ( m_aTempURL.getLength() )
163 KillFile_Impl( m_aTempURL, m_xFactory );
166 //------------------------------------------------------
167 void OleEmbeddedObject::MakeEventListenerNotification_Impl( const ::rtl::OUString& aEventName )
169 if ( m_pInterfaceContainer )
171 ::cppu::OInterfaceContainerHelper* pContainer =
172 m_pInterfaceContainer->getContainer(
173 ::getCppuType( ( const uno::Reference< document::XEventListener >*) NULL ) );
174 if ( pContainer != NULL )
176 document::EventObject aEvent( static_cast< ::cppu::OWeakObject* >( this ), aEventName );
177 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
178 while (pIterator.hasMoreElements())
182 ((document::XEventListener*)pIterator.next())->notifyEvent( aEvent );
184 catch( uno::RuntimeException& )
191 #ifdef WNT
192 //----------------------------------------------
193 void OleEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState )
195 if ( m_pInterfaceContainer )
197 ::cppu::OInterfaceContainerHelper* pContainer = m_pInterfaceContainer->getContainer(
198 ::getCppuType( ( const uno::Reference< embed::XStateChangeListener >*) NULL ) );
199 if ( pContainer != NULL )
201 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
202 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
204 while (pIterator.hasMoreElements())
206 if ( bBeforeChange )
210 ((embed::XStateChangeListener*)pIterator.next())->changingState( aSource, nOldState, nNewState );
212 catch( uno::Exception& )
214 // even if the listener complains ignore it for now
217 else
221 ((embed::XStateChangeListener*)pIterator.next())->stateChanged( aSource, nOldState, nNewState );
223 catch( uno::Exception& )
225 // if anything happened it is problem of listener, ignore it
232 #endif
233 //------------------------------------------------------
234 void OleEmbeddedObject::GetRidOfComponent()
236 #ifdef WNT
237 if ( m_pOleComponent )
239 if ( m_nObjectState != -1 && m_nObjectState != embed::EmbedStates::LOADED )
240 SaveObject_Impl();
242 m_pOleComponent->removeCloseListener( m_xClosePreventer );
245 m_pOleComponent->close( sal_False );
247 catch( uno::Exception& )
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;
255 m_pOleComponent->disconnectEmbeddedObject();
256 m_pOleComponent->release();
257 m_pOleComponent = NULL;
259 #endif
262 //------------------------------------------------------
263 void OleEmbeddedObject::Dispose()
265 if ( m_pInterfaceContainer )
267 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
268 m_pInterfaceContainer->disposeAndClear( aSource );
269 delete m_pInterfaceContainer;
270 m_pInterfaceContainer = NULL;
273 if ( m_pOwnView )
275 m_pOwnView->Close();
276 m_pOwnView->release();
277 m_pOwnView = NULL;
280 if ( m_pOleComponent )
281 try {
282 GetRidOfComponent();
283 } catch( uno::Exception& )
285 m_bDisposed = true;
286 throw; // TODO: there should be a special listener that will close object when
287 // component is finally closed
290 if ( m_xObjectStream.is() )
292 uno::Reference< lang::XComponent > xComp( m_xObjectStream, uno::UNO_QUERY );
293 OSL_ENSURE( xComp.is(), "Storage stream doesn't support XComponent!\n" );
295 if ( xComp.is() )
297 try {
298 xComp->dispose();
299 } catch( uno::Exception& ) {}
301 m_xObjectStream = uno::Reference< io::XStream >();
304 m_xParentStorage = uno::Reference< embed::XStorage >();
306 m_bDisposed = true;
309 //------------------------------------------------------
310 uno::Sequence< sal_Int8 > SAL_CALL OleEmbeddedObject::getClassID()
311 throw ( uno::RuntimeException )
313 // begin wrapping related part ====================
314 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
315 if ( xWrappedObject.is() )
317 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
318 return xWrappedObject->getClassID();
320 // end wrapping related part ====================
322 ::osl::MutexGuard aGuard( m_aMutex );
323 if ( m_bDisposed )
324 throw lang::DisposedException(); // TODO
326 return m_aClassID;
329 //------------------------------------------------------
330 ::rtl::OUString SAL_CALL OleEmbeddedObject::getClassName()
331 throw ( uno::RuntimeException )
333 // begin wrapping related part ====================
334 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
335 if ( xWrappedObject.is() )
337 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
338 return xWrappedObject->getClassName();
340 // end wrapping related part ====================
342 ::osl::MutexGuard aGuard( m_aMutex );
343 if ( m_bDisposed )
344 throw lang::DisposedException(); // TODO
346 return m_aClassName;
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 )
355 // begin wrapping related part ====================
356 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
357 if ( xWrappedObject.is() )
359 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
360 xWrappedObject->setClassInfo( aClassID, aClassName );
361 return;
363 // end wrapping related part ====================
365 // the object class info can not be changed explicitly
366 throw lang::NoSupportException(); //TODO:
369 //------------------------------------------------------
370 uno::Reference< util::XCloseable > SAL_CALL OleEmbeddedObject::getComponent()
371 throw ( uno::RuntimeException )
373 // begin wrapping related part ====================
374 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
375 if ( xWrappedObject.is() )
377 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
378 return xWrappedObject->getComponent();
380 // end wrapping related part ====================
382 ::osl::MutexGuard aGuard( m_aMutex );
383 if ( m_bDisposed )
384 throw lang::DisposedException(); // TODO
386 if ( m_nObjectState == -1 ) // || m_nObjectState == embed::EmbedStates::LOADED )
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) ) );
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) ) );
398 if ( !m_pOleComponent )
400 // TODO/LATER: Is it correct???
401 return uno::Reference< util::XCloseable >();
402 // throw uno::RuntimeException(); // TODO
405 return uno::Reference< util::XCloseable >( static_cast< ::cppu::OWeakObject* >( m_pOleComponent ), uno::UNO_QUERY );
408 //----------------------------------------------
409 void SAL_CALL OleEmbeddedObject::addStateChangeListener( const uno::Reference< embed::XStateChangeListener >& xListener )
410 throw ( uno::RuntimeException )
412 // begin wrapping related part ====================
413 uno::Reference< embed::XStateChangeBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
414 if ( xWrappedObject.is() )
416 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
417 xWrappedObject->addStateChangeListener( xListener );
418 return;
420 // end wrapping related part ====================
422 ::osl::MutexGuard aGuard( m_aMutex );
423 if ( m_bDisposed )
424 throw lang::DisposedException(); // TODO
426 if ( !m_pInterfaceContainer )
427 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
429 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
430 xListener );
433 //----------------------------------------------
434 void SAL_CALL OleEmbeddedObject::removeStateChangeListener(
435 const uno::Reference< embed::XStateChangeListener >& xListener )
436 throw (uno::RuntimeException)
438 // begin wrapping related part ====================
439 uno::Reference< embed::XStateChangeBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
440 if ( xWrappedObject.is() )
442 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
443 xWrappedObject->removeStateChangeListener( xListener );
444 return;
446 // end wrapping related part ====================
448 ::osl::MutexGuard aGuard( m_aMutex );
449 if ( m_pInterfaceContainer )
450 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
451 xListener );
455 //----------------------------------------------
456 void SAL_CALL OleEmbeddedObject::close( sal_Bool bDeliverOwnership )
457 throw ( util::CloseVetoException,
458 uno::RuntimeException )
460 // begin wrapping related part ====================
461 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
462 if ( xWrappedObject.is() )
464 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
465 xWrappedObject->close( bDeliverOwnership );
466 return;
468 // end wrapping related part ====================
470 ::osl::MutexGuard aGuard( m_aMutex );
471 if ( m_bDisposed )
472 throw lang::DisposedException(); // TODO
474 uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) );
475 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
477 if ( m_pInterfaceContainer )
479 ::cppu::OInterfaceContainerHelper* pContainer =
480 m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
481 if ( pContainer != NULL )
483 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
484 while (pIterator.hasMoreElements())
488 ((util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnership );
490 catch( uno::RuntimeException& )
492 pIterator.remove();
497 pContainer = m_pInterfaceContainer->getContainer(
498 ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
499 if ( pContainer != NULL )
501 ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer);
502 while (pCloseIterator.hasMoreElements())
506 ((util::XCloseListener*)pCloseIterator.next())->notifyClosing( aSource );
508 catch( uno::RuntimeException& )
510 pCloseIterator.remove();
516 Dispose();
519 //----------------------------------------------
520 void SAL_CALL OleEmbeddedObject::addCloseListener( const uno::Reference< util::XCloseListener >& xListener )
521 throw ( uno::RuntimeException )
523 // begin wrapping related part ====================
524 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
525 if ( xWrappedObject.is() )
527 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
528 xWrappedObject->addCloseListener( xListener );
529 return;
531 // end wrapping related part ====================
533 ::osl::MutexGuard aGuard( m_aMutex );
534 if ( m_bDisposed )
535 throw lang::DisposedException(); // TODO
537 if ( !m_pInterfaceContainer )
538 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
540 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ), xListener );
543 //----------------------------------------------
544 void SAL_CALL OleEmbeddedObject::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener )
545 throw (uno::RuntimeException)
547 // begin wrapping related part ====================
548 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
549 if ( xWrappedObject.is() )
551 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
552 xWrappedObject->removeCloseListener( xListener );
553 return;
555 // end wrapping related part ====================
557 ::osl::MutexGuard aGuard( m_aMutex );
558 if ( m_bDisposed )
559 throw lang::DisposedException(); // TODO
561 if ( m_pInterfaceContainer )
562 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ),
563 xListener );
566 //------------------------------------------------------
567 void SAL_CALL OleEmbeddedObject::addEventListener( const uno::Reference< document::XEventListener >& xListener )
568 throw ( uno::RuntimeException )
570 // begin wrapping related part ====================
571 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
572 if ( xWrappedObject.is() )
574 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
575 xWrappedObject->addEventListener( xListener );
576 return;
578 // end wrapping related part ====================
580 ::osl::MutexGuard aGuard( m_aMutex );
581 if ( m_bDisposed )
582 throw lang::DisposedException(); // TODO
584 if ( !m_pInterfaceContainer )
585 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
587 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ), xListener );
590 //------------------------------------------------------
591 void SAL_CALL OleEmbeddedObject::removeEventListener(
592 const uno::Reference< document::XEventListener >& xListener )
593 throw ( uno::RuntimeException )
595 // begin wrapping related part ====================
596 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
597 if ( xWrappedObject.is() )
599 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
600 xWrappedObject->removeEventListener( xListener );
601 return;
603 // end wrapping related part ====================
605 ::osl::MutexGuard aGuard( m_aMutex );
606 if ( m_bDisposed )
607 throw lang::DisposedException(); // TODO
609 if ( m_pInterfaceContainer )
610 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ),
611 xListener );
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 )
622 // begin wrapping related part ====================
623 uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
624 if ( xWrappedObject.is() )
626 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
627 xWrappedObject->setObjectRectangles( aPosRect, aClipRect );
628 return;
630 // end wrapping related part ====================
632 throw embed::WrongStateException();
635 //------------------------------------------------------
636 void SAL_CALL OleEmbeddedObject::enableModeless( sal_Bool bEnable )
637 throw ( embed::WrongStateException,
638 uno::Exception,
639 uno::RuntimeException )
641 // begin wrapping related part ====================
642 uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
643 if ( xWrappedObject.is() )
645 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
646 xWrappedObject->enableModeless( bEnable );
647 return;
649 // end wrapping related part ====================
651 throw embed::WrongStateException();
654 //------------------------------------------------------
655 void SAL_CALL OleEmbeddedObject::translateAccelerators(
656 const uno::Sequence< awt::KeyEvent >& aKeys )
657 throw ( embed::WrongStateException,
658 uno::RuntimeException )
660 // begin wrapping related part ====================
661 uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
662 if ( xWrappedObject.is() )
664 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
665 xWrappedObject->translateAccelerators( aKeys );
666 return;
668 // end wrapping related part ====================
670 // throw embed::WrongStateException();
673 // XChild
674 //------------------------------------------------------
675 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL OleEmbeddedObject::getParent() throw (::com::sun::star::uno::RuntimeException)
677 // begin wrapping related part ====================
678 uno::Reference< container::XChild > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
679 if ( xWrappedObject.is() )
681 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
682 return xWrappedObject->getParent();
684 // end wrapping related part ====================
686 return m_xParent;
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)
692 // begin wrapping related part ====================
693 uno::Reference< container::XChild > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
694 if ( xWrappedObject.is() )
696 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
697 xWrappedObject->setParent( xParent );
698 return;
700 // end wrapping related part ====================
702 m_xParent = xParent;