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