Version 3.6.0.2, tag libreoffice-3.6.0.2
[LibreOffice.git] / embeddedobj / source / msole / olemisc.cxx
blob5947ae2bba9b7de7dca1609b0003621f6d4d4f25
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <com/sun/star/embed/EmbedUpdateModes.hpp>
30 #include <com/sun/star/embed/EmbedStates.hpp>
31 #include <com/sun/star/lang/XComponent.hpp>
32 #include <com/sun/star/lang/DisposedException.hpp>
34 #include <cppuhelper/interfacecontainer.h>
36 #include <oleembobj.hxx>
37 #include <olecomponent.hxx>
39 #include "ownview.hxx"
41 using namespace ::com::sun::star;
43 sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory );
46 //------------------------------------------------------
47 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
48 const uno::Sequence< sal_Int8 >& aClassID,
49 const ::rtl::OUString& aClassName )
50 : m_pOleComponent( NULL )
51 , m_pInterfaceContainer( NULL )
52 , m_bReadOnly( sal_False )
53 , m_bDisposed( sal_False )
54 , m_nObjectState( -1 )
55 , m_nTargetState( -1 )
56 , m_nUpdateMode ( embed::EmbedUpdateModes::ALWAYS_UPDATE )
57 , m_xFactory( xFactory )
58 , m_aClassID( aClassID )
59 , m_aClassName( aClassName )
60 , m_bWaitSaveCompleted( sal_False )
61 , m_bNewVisReplInStream( sal_True )
62 , m_bStoreLoaded( sal_False )
63 , m_bVisReplInitialized( sal_False )
64 , m_bVisReplInStream( sal_False )
65 , m_bStoreVisRepl( sal_False )
66 , m_bIsLink( sal_False )
67 , m_bHasCachedSize( sal_False )
68 , m_nCachedAspect( 0 )
69 , m_bHasSizeToSet( sal_False )
70 , m_nAspectToSet( 0 )
71 , m_bGotStatus( sal_False )
72 , m_nStatus( 0 )
73 , m_nStatusAspect( 0 )
74 , m_pOwnView( NULL )
75 , m_bFromClipboard( sal_False )
76 , m_bTriedConversion( sal_False )
80 //------------------------------------------------------
81 // In case of loading from persistent entry the classID of the object
82 // will be retrieved from the entry, during construction it is unknown
83 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory, sal_Bool bLink )
84 : m_pOleComponent( NULL )
85 , m_pInterfaceContainer( NULL )
86 , m_bReadOnly( sal_False )
87 , m_bDisposed( sal_False )
88 , m_nObjectState( -1 )
89 , m_nTargetState( -1 )
90 , m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE )
91 , m_xFactory( xFactory )
92 , m_bWaitSaveCompleted( sal_False )
93 , m_bNewVisReplInStream( sal_True )
94 , m_bStoreLoaded( sal_False )
95 , m_bVisReplInitialized( sal_False )
96 , m_bVisReplInStream( sal_False )
97 , m_bStoreVisRepl( sal_False )
98 , m_bIsLink( bLink )
99 , m_bHasCachedSize( sal_False )
100 , m_nCachedAspect( 0 )
101 , m_bHasSizeToSet( sal_False )
102 , m_nAspectToSet( 0 )
103 , m_bGotStatus( sal_False )
104 , m_nStatus( 0 )
105 , m_nStatusAspect( 0 )
106 , m_pOwnView( NULL )
107 , m_bFromClipboard( sal_False )
108 , m_bTriedConversion( sal_False )
111 #ifdef WNT
112 //------------------------------------------------------
113 // this constructor let object be initialized from clipboard
114 OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
115 : m_pOleComponent( NULL )
116 , m_pInterfaceContainer( NULL )
117 , m_bReadOnly( sal_False )
118 , m_bDisposed( sal_False )
119 , m_nObjectState( -1 )
120 , m_nTargetState( -1 )
121 , m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE )
122 , m_xFactory( xFactory )
123 , m_bWaitSaveCompleted( sal_False )
124 , m_bNewVisReplInStream( sal_True )
125 , m_bStoreLoaded( sal_False )
126 , m_bVisReplInitialized( sal_False )
127 , m_bVisReplInStream( sal_False )
128 , m_bStoreVisRepl( sal_False )
129 , m_bIsLink( sal_False )
130 , m_bHasCachedSize( sal_False )
131 , m_nCachedAspect( 0 )
132 , m_bHasSizeToSet( sal_False )
133 , m_nAspectToSet( 0 )
134 , m_bGotStatus( sal_False )
135 , m_nStatus( 0 )
136 , m_nStatusAspect( 0 )
137 , m_pOwnView( NULL )
138 , m_bFromClipboard( sal_True )
139 , m_bTriedConversion( sal_False )
142 #endif
143 //------------------------------------------------------
144 OleEmbeddedObject::~OleEmbeddedObject()
146 OSL_ENSURE( !m_pInterfaceContainer && !m_pOleComponent && !m_xObjectStream.is(),
147 "The object is not closed! DISASTER is possible!" );
149 if ( m_pOleComponent || m_pInterfaceContainer || m_xObjectStream.is() )
151 // the component must be cleaned during closing
152 m_refCount++; // to avoid crash
153 try {
154 Dispose();
155 } catch( const uno::Exception& ) {}
158 if ( !m_aTempURL.isEmpty() )
159 KillFile_Impl( m_aTempURL, m_xFactory );
161 if ( !m_aTempDumpURL.isEmpty() )
162 KillFile_Impl( m_aTempDumpURL, m_xFactory );
165 //------------------------------------------------------
166 void OleEmbeddedObject::MakeEventListenerNotification_Impl( const ::rtl::OUString& aEventName )
168 if ( m_pInterfaceContainer )
170 ::cppu::OInterfaceContainerHelper* pContainer =
171 m_pInterfaceContainer->getContainer(
172 ::getCppuType( ( const uno::Reference< document::XEventListener >*) NULL ) );
173 if ( pContainer != NULL )
175 document::EventObject aEvent( static_cast< ::cppu::OWeakObject* >( this ), aEventName );
176 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
177 while (pIterator.hasMoreElements())
181 ((document::XEventListener*)pIterator.next())->notifyEvent( aEvent );
183 catch( const uno::RuntimeException& )
190 #ifdef WNT
191 //----------------------------------------------
192 void OleEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState )
194 if ( m_pInterfaceContainer )
196 ::cppu::OInterfaceContainerHelper* pContainer = m_pInterfaceContainer->getContainer(
197 ::getCppuType( ( const uno::Reference< embed::XStateChangeListener >*) NULL ) );
198 if ( pContainer != NULL )
200 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
201 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
203 while (pIterator.hasMoreElements())
205 if ( bBeforeChange )
209 ((embed::XStateChangeListener*)pIterator.next())->changingState( aSource, nOldState, nNewState );
211 catch( const uno::Exception& )
213 // even if the listener complains ignore it for now
216 else
220 ((embed::XStateChangeListener*)pIterator.next())->stateChanged( aSource, nOldState, nNewState );
222 catch( const uno::Exception& )
224 // if anything happened it is problem of listener, ignore it
231 #endif
232 //------------------------------------------------------
233 void OleEmbeddedObject::GetRidOfComponent()
235 #ifdef WNT
236 if ( m_pOleComponent )
238 if ( m_nObjectState != -1 && m_nObjectState != embed::EmbedStates::LOADED )
239 SaveObject_Impl();
241 m_pOleComponent->removeCloseListener( m_xClosePreventer );
244 m_pOleComponent->close( sal_False );
246 catch( const uno::Exception& )
248 // TODO: there should be a special listener to wait for component closing
249 // and to notify object, may be object itself can be such a listener
250 m_pOleComponent->addCloseListener( m_xClosePreventer );
251 throw;
254 m_pOleComponent->disconnectEmbeddedObject();
255 m_pOleComponent->release();
256 m_pOleComponent = NULL;
258 #endif
261 //------------------------------------------------------
262 void OleEmbeddedObject::Dispose()
264 if ( m_pInterfaceContainer )
266 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
267 m_pInterfaceContainer->disposeAndClear( aSource );
268 delete m_pInterfaceContainer;
269 m_pInterfaceContainer = NULL;
272 if ( m_pOwnView )
274 m_pOwnView->Close();
275 m_pOwnView->release();
276 m_pOwnView = NULL;
279 if ( m_pOleComponent )
280 try {
281 GetRidOfComponent();
282 } catch( const uno::Exception& )
284 m_bDisposed = true;
285 throw; // TODO: there should be a special listener that will close object when
286 // component is finally closed
289 if ( m_xObjectStream.is() )
291 uno::Reference< lang::XComponent > xComp( m_xObjectStream, uno::UNO_QUERY );
292 OSL_ENSURE( xComp.is(), "Storage stream doesn't support XComponent!\n" );
294 if ( xComp.is() )
296 try {
297 xComp->dispose();
298 } catch( const uno::Exception& ) {}
300 m_xObjectStream = uno::Reference< io::XStream >();
303 m_xParentStorage = uno::Reference< embed::XStorage >();
305 m_bDisposed = true;
308 //------------------------------------------------------
309 uno::Sequence< sal_Int8 > SAL_CALL OleEmbeddedObject::getClassID()
310 throw ( uno::RuntimeException )
312 // begin wrapping related part ====================
313 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
314 if ( xWrappedObject.is() )
316 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
317 return xWrappedObject->getClassID();
319 // end wrapping related part ====================
321 ::osl::MutexGuard aGuard( m_aMutex );
322 if ( m_bDisposed )
323 throw lang::DisposedException(); // TODO
325 return m_aClassID;
328 //------------------------------------------------------
329 ::rtl::OUString SAL_CALL OleEmbeddedObject::getClassName()
330 throw ( uno::RuntimeException )
332 // begin wrapping related part ====================
333 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
334 if ( xWrappedObject.is() )
336 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
337 return xWrappedObject->getClassName();
339 // end wrapping related part ====================
341 ::osl::MutexGuard aGuard( m_aMutex );
342 if ( m_bDisposed )
343 throw lang::DisposedException(); // TODO
345 return m_aClassName;
348 //------------------------------------------------------
349 void SAL_CALL OleEmbeddedObject::setClassInfo(
350 const uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName )
351 throw ( lang::NoSupportException,
352 uno::RuntimeException )
354 // begin wrapping related part ====================
355 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
356 if ( xWrappedObject.is() )
358 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
359 xWrappedObject->setClassInfo( aClassID, aClassName );
360 return;
362 // end wrapping related part ====================
364 // the object class info can not be changed explicitly
365 throw lang::NoSupportException(); //TODO:
368 //------------------------------------------------------
369 uno::Reference< util::XCloseable > SAL_CALL OleEmbeddedObject::getComponent()
370 throw ( uno::RuntimeException )
372 // begin wrapping related part ====================
373 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
374 if ( xWrappedObject.is() )
376 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
377 return xWrappedObject->getComponent();
379 // end wrapping related part ====================
381 ::osl::MutexGuard aGuard( m_aMutex );
382 if ( m_bDisposed )
383 throw lang::DisposedException(); // TODO
385 if ( m_nObjectState == -1 ) // || m_nObjectState == embed::EmbedStates::LOADED )
387 // the object is still not running
388 throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is not loaded!\n" )),
389 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
392 if ( !m_pOleComponent )
394 // TODO/LATER: Is it correct???
395 return uno::Reference< util::XCloseable >();
396 // throw uno::RuntimeException(); // TODO
399 return uno::Reference< util::XCloseable >( static_cast< ::cppu::OWeakObject* >( m_pOleComponent ), uno::UNO_QUERY );
402 //----------------------------------------------
403 void SAL_CALL OleEmbeddedObject::addStateChangeListener( const uno::Reference< embed::XStateChangeListener >& xListener )
404 throw ( uno::RuntimeException )
406 // begin wrapping related part ====================
407 uno::Reference< embed::XStateChangeBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
408 if ( xWrappedObject.is() )
410 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
411 xWrappedObject->addStateChangeListener( xListener );
412 return;
414 // end wrapping related part ====================
416 ::osl::MutexGuard aGuard( m_aMutex );
417 if ( m_bDisposed )
418 throw lang::DisposedException(); // TODO
420 if ( !m_pInterfaceContainer )
421 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
423 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
424 xListener );
427 //----------------------------------------------
428 void SAL_CALL OleEmbeddedObject::removeStateChangeListener(
429 const uno::Reference< embed::XStateChangeListener >& xListener )
430 throw (uno::RuntimeException)
432 // begin wrapping related part ====================
433 uno::Reference< embed::XStateChangeBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
434 if ( xWrappedObject.is() )
436 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
437 xWrappedObject->removeStateChangeListener( xListener );
438 return;
440 // end wrapping related part ====================
442 ::osl::MutexGuard aGuard( m_aMutex );
443 if ( m_pInterfaceContainer )
444 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
445 xListener );
449 //----------------------------------------------
450 void SAL_CALL OleEmbeddedObject::close( sal_Bool bDeliverOwnership )
451 throw ( util::CloseVetoException,
452 uno::RuntimeException )
454 // begin wrapping related part ====================
455 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
456 if ( xWrappedObject.is() )
458 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
459 xWrappedObject->close( bDeliverOwnership );
460 return;
462 // end wrapping related part ====================
464 ::osl::MutexGuard aGuard( m_aMutex );
465 if ( m_bDisposed )
466 throw lang::DisposedException(); // TODO
468 uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) );
469 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
471 if ( m_pInterfaceContainer )
473 ::cppu::OInterfaceContainerHelper* pContainer =
474 m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
475 if ( pContainer != NULL )
477 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
478 while (pIterator.hasMoreElements())
482 ((util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnership );
484 catch( const uno::RuntimeException& )
486 pIterator.remove();
491 pContainer = m_pInterfaceContainer->getContainer(
492 ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
493 if ( pContainer != NULL )
495 ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer);
496 while (pCloseIterator.hasMoreElements())
500 ((util::XCloseListener*)pCloseIterator.next())->notifyClosing( aSource );
502 catch( const uno::RuntimeException& )
504 pCloseIterator.remove();
510 Dispose();
513 //----------------------------------------------
514 void SAL_CALL OleEmbeddedObject::addCloseListener( const uno::Reference< util::XCloseListener >& xListener )
515 throw ( uno::RuntimeException )
517 // begin wrapping related part ====================
518 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
519 if ( xWrappedObject.is() )
521 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
522 xWrappedObject->addCloseListener( xListener );
523 return;
525 // end wrapping related part ====================
527 ::osl::MutexGuard aGuard( m_aMutex );
528 if ( m_bDisposed )
529 throw lang::DisposedException(); // TODO
531 if ( !m_pInterfaceContainer )
532 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
534 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ), xListener );
537 //----------------------------------------------
538 void SAL_CALL OleEmbeddedObject::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener )
539 throw (uno::RuntimeException)
541 // begin wrapping related part ====================
542 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
543 if ( xWrappedObject.is() )
545 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
546 xWrappedObject->removeCloseListener( xListener );
547 return;
549 // end wrapping related part ====================
551 ::osl::MutexGuard aGuard( m_aMutex );
552 if ( m_bDisposed )
553 throw lang::DisposedException(); // TODO
555 if ( m_pInterfaceContainer )
556 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ),
557 xListener );
560 //------------------------------------------------------
561 void SAL_CALL OleEmbeddedObject::addEventListener( const uno::Reference< document::XEventListener >& xListener )
562 throw ( uno::RuntimeException )
564 // begin wrapping related part ====================
565 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
566 if ( xWrappedObject.is() )
568 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
569 xWrappedObject->addEventListener( xListener );
570 return;
572 // end wrapping related part ====================
574 ::osl::MutexGuard aGuard( m_aMutex );
575 if ( m_bDisposed )
576 throw lang::DisposedException(); // TODO
578 if ( !m_pInterfaceContainer )
579 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
581 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ), xListener );
584 //------------------------------------------------------
585 void SAL_CALL OleEmbeddedObject::removeEventListener(
586 const uno::Reference< document::XEventListener >& xListener )
587 throw ( uno::RuntimeException )
589 // begin wrapping related part ====================
590 uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
591 if ( xWrappedObject.is() )
593 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
594 xWrappedObject->removeEventListener( xListener );
595 return;
597 // end wrapping related part ====================
599 ::osl::MutexGuard aGuard( m_aMutex );
600 if ( m_bDisposed )
601 throw lang::DisposedException(); // TODO
603 if ( m_pInterfaceContainer )
604 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ),
605 xListener );
608 // XInplaceObject ( wrapper related implementation )
609 //------------------------------------------------------
610 void SAL_CALL OleEmbeddedObject::setObjectRectangles( const awt::Rectangle& aPosRect,
611 const awt::Rectangle& aClipRect )
612 throw ( embed::WrongStateException,
613 uno::Exception,
614 uno::RuntimeException )
616 // begin wrapping related part ====================
617 uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
618 if ( xWrappedObject.is() )
620 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
621 xWrappedObject->setObjectRectangles( aPosRect, aClipRect );
622 return;
624 // end wrapping related part ====================
626 throw embed::WrongStateException();
629 //------------------------------------------------------
630 void SAL_CALL OleEmbeddedObject::enableModeless( sal_Bool bEnable )
631 throw ( embed::WrongStateException,
632 uno::Exception,
633 uno::RuntimeException )
635 // begin wrapping related part ====================
636 uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
637 if ( xWrappedObject.is() )
639 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
640 xWrappedObject->enableModeless( bEnable );
641 return;
643 // end wrapping related part ====================
645 throw embed::WrongStateException();
648 //------------------------------------------------------
649 void SAL_CALL OleEmbeddedObject::translateAccelerators(
650 const uno::Sequence< awt::KeyEvent >& aKeys )
651 throw ( embed::WrongStateException,
652 uno::RuntimeException )
654 // begin wrapping related part ====================
655 uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
656 if ( xWrappedObject.is() )
658 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
659 xWrappedObject->translateAccelerators( aKeys );
660 return;
662 // end wrapping related part ====================
666 // XChild
667 //------------------------------------------------------
668 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL OleEmbeddedObject::getParent() throw (::com::sun::star::uno::RuntimeException)
670 // begin wrapping related part ====================
671 uno::Reference< container::XChild > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
672 if ( xWrappedObject.is() )
674 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
675 return xWrappedObject->getParent();
677 // end wrapping related part ====================
679 return m_xParent;
682 //------------------------------------------------------
683 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)
685 // begin wrapping related part ====================
686 uno::Reference< container::XChild > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
687 if ( xWrappedObject.is() )
689 // the object was converted to OOo embedded object, the current implementation is now only a wrapper
690 xWrappedObject->setParent( xParent );
691 return;
693 // end wrapping related part ====================
695 m_xParent = xParent;
698 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */