1bfd08df8SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3bfd08df8SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4bfd08df8SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5bfd08df8SAndrew Rist  * distributed with this work for additional information
6bfd08df8SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7bfd08df8SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8bfd08df8SAndrew Rist  * "License"); you may not use this file except in compliance
9bfd08df8SAndrew Rist  * with the License.  You may obtain a copy of the License at
10bfd08df8SAndrew Rist  *
11bfd08df8SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12bfd08df8SAndrew Rist  *
13bfd08df8SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14bfd08df8SAndrew Rist  * software distributed under the License is distributed on an
15bfd08df8SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16bfd08df8SAndrew Rist  * KIND, either express or implied.  See the License for the
17bfd08df8SAndrew Rist  * specific language governing permissions and limitations
18bfd08df8SAndrew Rist  * under the License.
19bfd08df8SAndrew Rist  *
20bfd08df8SAndrew Rist  *************************************************************/
21bfd08df8SAndrew Rist 
22bfd08df8SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "precompiled_embeddedobj.hxx"
25cdf0e10cSrcweir #include <com/sun/star/embed/EmbedStates.hpp>
26cdf0e10cSrcweir #include <com/sun/star/embed/EmbedVerbs.hpp>
27cdf0e10cSrcweir #include <com/sun/star/embed/EmbedUpdateModes.hpp>
28cdf0e10cSrcweir #include <com/sun/star/embed/XEmbeddedClient.hpp>
29cdf0e10cSrcweir #include <com/sun/star/embed/XInplaceClient.hpp>
30cdf0e10cSrcweir #include <com/sun/star/embed/XWindowSupplier.hpp>
31cdf0e10cSrcweir #include <com/sun/star/embed/StateChangeInProgressException.hpp>
32cdf0e10cSrcweir #include <com/sun/star/embed/EmbedStates.hpp>
33cdf0e10cSrcweir #include <com/sun/star/embed/Aspects.hpp>
34cdf0e10cSrcweir #include <com/sun/star/embed/EmbedMapUnits.hpp>
35cdf0e10cSrcweir #include <com/sun/star/embed/EntryInitModes.hpp>
36cdf0e10cSrcweir #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
37cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h>
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include <dummyobject.hxx>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 
44cdf0e10cSrcweir using namespace ::com::sun::star;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir //----------------------------------------------
CheckInit()47cdf0e10cSrcweir void ODummyEmbeddedObject::CheckInit()
48cdf0e10cSrcweir {
49cdf0e10cSrcweir 	if ( m_bDisposed )
50cdf0e10cSrcweir 		throw lang::DisposedException();
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	if ( m_nObjectState == -1 )
53cdf0e10cSrcweir 		throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object has no persistence!\n" ),
54cdf0e10cSrcweir 										uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
55cdf0e10cSrcweir }
56cdf0e10cSrcweir 
57cdf0e10cSrcweir //----------------------------------------------
PostEvent_Impl(const::rtl::OUString & aEventName,const uno::Reference<uno::XInterface> &)58cdf0e10cSrcweir void ODummyEmbeddedObject::PostEvent_Impl( const ::rtl::OUString& aEventName,
59cdf0e10cSrcweir 											const uno::Reference< uno::XInterface >& /*xSource*/ )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir 	if ( m_pInterfaceContainer )
62cdf0e10cSrcweir 	{
63cdf0e10cSrcweir 		::cppu::OInterfaceContainerHelper* pIC = m_pInterfaceContainer->getContainer(
64cdf0e10cSrcweir 											::getCppuType((const uno::Reference< document::XEventListener >*)0) );
65cdf0e10cSrcweir 		if( pIC )
66cdf0e10cSrcweir 		{
67cdf0e10cSrcweir 			document::EventObject aEvent;
68cdf0e10cSrcweir 			aEvent.EventName = aEventName;
69cdf0e10cSrcweir 			aEvent.Source = uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) );
70cdf0e10cSrcweir 			// For now all the events are sent as object events
71cdf0e10cSrcweir 			// aEvent.Source = ( xSource.is() ? xSource
72cdf0e10cSrcweir 			//					   : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) );
73cdf0e10cSrcweir 			::cppu::OInterfaceIteratorHelper aIt( *pIC );
74cdf0e10cSrcweir 			while( aIt.hasMoreElements() )
75cdf0e10cSrcweir         	{
76cdf0e10cSrcweir             	try
77cdf0e10cSrcweir             	{
78cdf0e10cSrcweir                 	((document::XEventListener *)aIt.next())->notifyEvent( aEvent );
79cdf0e10cSrcweir             	}
80cdf0e10cSrcweir             	catch( uno::RuntimeException& )
81cdf0e10cSrcweir             	{
82cdf0e10cSrcweir                 	aIt.remove();
83cdf0e10cSrcweir             	}
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 				// the listener could dispose the object.
86cdf0e10cSrcweir 				if ( m_bDisposed )
87cdf0e10cSrcweir 					return;
88cdf0e10cSrcweir         	}
89cdf0e10cSrcweir 		}
90cdf0e10cSrcweir 	}
91cdf0e10cSrcweir }
92cdf0e10cSrcweir 
93cdf0e10cSrcweir //----------------------------------------------
~ODummyEmbeddedObject()94cdf0e10cSrcweir ODummyEmbeddedObject::~ODummyEmbeddedObject()
95cdf0e10cSrcweir {
96cdf0e10cSrcweir }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir //----------------------------------------------
changeState(sal_Int32 nNewState)99cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::changeState( sal_Int32 nNewState )
100cdf0e10cSrcweir 		throw ( embed::UnreachableStateException,
101cdf0e10cSrcweir 				embed::WrongStateException,
102cdf0e10cSrcweir 				uno::Exception,
103cdf0e10cSrcweir 				uno::RuntimeException )
104cdf0e10cSrcweir {
105cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
106cdf0e10cSrcweir 	CheckInit();
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	if ( nNewState == embed::EmbedStates::LOADED )
109cdf0e10cSrcweir 		return;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	throw embed::UnreachableStateException();
112cdf0e10cSrcweir }
113cdf0e10cSrcweir 
114cdf0e10cSrcweir //----------------------------------------------
getReachableStates()115cdf0e10cSrcweir uno::Sequence< sal_Int32 > SAL_CALL ODummyEmbeddedObject::getReachableStates()
116cdf0e10cSrcweir 		throw ( embed::WrongStateException,
117cdf0e10cSrcweir 				uno::RuntimeException )
118cdf0e10cSrcweir {
119cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
120cdf0e10cSrcweir 	CheckInit();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	uno::Sequence< sal_Int32 > aResult( 1 );
123cdf0e10cSrcweir 	aResult[0] = embed::EmbedStates::LOADED;
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	return aResult;
126cdf0e10cSrcweir }
127cdf0e10cSrcweir 
128cdf0e10cSrcweir //----------------------------------------------
getCurrentState()129cdf0e10cSrcweir sal_Int32 SAL_CALL ODummyEmbeddedObject::getCurrentState()
130cdf0e10cSrcweir 		throw ( embed::WrongStateException,
131cdf0e10cSrcweir 				uno::RuntimeException )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
134cdf0e10cSrcweir 	CheckInit();
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	return m_nObjectState;
137cdf0e10cSrcweir }
138cdf0e10cSrcweir 
139cdf0e10cSrcweir //----------------------------------------------
doVerb(sal_Int32)140cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::doVerb( sal_Int32 )
141cdf0e10cSrcweir 		throw ( lang::IllegalArgumentException,
142cdf0e10cSrcweir 				embed::WrongStateException,
143cdf0e10cSrcweir 				embed::UnreachableStateException,
144cdf0e10cSrcweir 				uno::Exception,
145cdf0e10cSrcweir 				uno::RuntimeException )
146cdf0e10cSrcweir {
147cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
148cdf0e10cSrcweir 	CheckInit();
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	// no supported verbs
151cdf0e10cSrcweir }
152cdf0e10cSrcweir 
153cdf0e10cSrcweir //----------------------------------------------
getSupportedVerbs()154cdf0e10cSrcweir uno::Sequence< embed::VerbDescriptor > SAL_CALL ODummyEmbeddedObject::getSupportedVerbs()
155cdf0e10cSrcweir 		throw ( embed::WrongStateException,
156cdf0e10cSrcweir 				uno::RuntimeException )
157cdf0e10cSrcweir {
158cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
159cdf0e10cSrcweir 	CheckInit();
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 	return uno::Sequence< embed::VerbDescriptor >();
162cdf0e10cSrcweir }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir //----------------------------------------------
setClientSite(const uno::Reference<embed::XEmbeddedClient> & xClient)165cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::setClientSite(
166cdf0e10cSrcweir 				const uno::Reference< embed::XEmbeddedClient >& xClient )
167cdf0e10cSrcweir 		throw ( embed::WrongStateException,
168cdf0e10cSrcweir 				uno::RuntimeException )
169cdf0e10cSrcweir {
170cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
171cdf0e10cSrcweir 	CheckInit();
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 	m_xClientSite = xClient;
174cdf0e10cSrcweir }
175cdf0e10cSrcweir 
176cdf0e10cSrcweir //----------------------------------------------
getClientSite()177cdf0e10cSrcweir uno::Reference< embed::XEmbeddedClient > SAL_CALL ODummyEmbeddedObject::getClientSite()
178cdf0e10cSrcweir 		throw ( embed::WrongStateException,
179cdf0e10cSrcweir 				uno::RuntimeException )
180cdf0e10cSrcweir {
181cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
182cdf0e10cSrcweir 	CheckInit();
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 	return m_xClientSite;
185cdf0e10cSrcweir }
186cdf0e10cSrcweir 
187cdf0e10cSrcweir //----------------------------------------------
update()188cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::update()
189cdf0e10cSrcweir 		throw ( embed::WrongStateException,
190cdf0e10cSrcweir 				uno::Exception,
191cdf0e10cSrcweir 				uno::RuntimeException )
192cdf0e10cSrcweir {
193cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
194cdf0e10cSrcweir 	CheckInit();
195cdf0e10cSrcweir }
196cdf0e10cSrcweir 
197cdf0e10cSrcweir //----------------------------------------------
setUpdateMode(sal_Int32)198cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::setUpdateMode( sal_Int32 )
199cdf0e10cSrcweir 		throw ( embed::WrongStateException,
200cdf0e10cSrcweir 				uno::RuntimeException )
201cdf0e10cSrcweir {
202cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
203cdf0e10cSrcweir 	CheckInit();
204cdf0e10cSrcweir }
205cdf0e10cSrcweir 
206cdf0e10cSrcweir //----------------------------------------------
getStatus(sal_Int64)207cdf0e10cSrcweir sal_Int64 SAL_CALL ODummyEmbeddedObject::getStatus( sal_Int64 )
208cdf0e10cSrcweir 		throw ( embed::WrongStateException,
209cdf0e10cSrcweir 				uno::RuntimeException )
210cdf0e10cSrcweir {
211cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
212cdf0e10cSrcweir 	CheckInit();
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 	return 0;
215cdf0e10cSrcweir }
216cdf0e10cSrcweir 
217cdf0e10cSrcweir //----------------------------------------------
setContainerName(const::rtl::OUString &)218cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::setContainerName( const ::rtl::OUString& )
219cdf0e10cSrcweir 		throw ( uno::RuntimeException )
220cdf0e10cSrcweir {
221cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
222cdf0e10cSrcweir 	CheckInit();
223cdf0e10cSrcweir }
224cdf0e10cSrcweir 
225cdf0e10cSrcweir //----------------------------------------------
setVisualAreaSize(sal_Int64 nAspect,const awt::Size & aSize)226cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const awt::Size& aSize )
227cdf0e10cSrcweir 		throw ( lang::IllegalArgumentException,
228cdf0e10cSrcweir 				embed::WrongStateException,
229cdf0e10cSrcweir 				uno::Exception,
230cdf0e10cSrcweir 				uno::RuntimeException )
231cdf0e10cSrcweir {
232cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
233cdf0e10cSrcweir 	CheckInit();
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 	OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
236cdf0e10cSrcweir 	if ( nAspect == embed::Aspects::MSOLE_ICON )
237cdf0e10cSrcweir 		// no representation can be retrieved
238cdf0e10cSrcweir 		throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ),
239cdf0e10cSrcweir 									uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 	m_nCachedAspect = nAspect;
242cdf0e10cSrcweir 	m_aCachedSize = aSize;
243cdf0e10cSrcweir 	m_bHasCachedSize = sal_True;
244cdf0e10cSrcweir }
245cdf0e10cSrcweir 
246cdf0e10cSrcweir //----------------------------------------------
getVisualAreaSize(sal_Int64 nAspect)247cdf0e10cSrcweir awt::Size SAL_CALL ODummyEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
248cdf0e10cSrcweir 		throw ( lang::IllegalArgumentException,
249cdf0e10cSrcweir 				embed::WrongStateException,
250cdf0e10cSrcweir 				uno::Exception,
251cdf0e10cSrcweir 				uno::RuntimeException )
252cdf0e10cSrcweir {
253cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
254cdf0e10cSrcweir 	CheckInit();
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 	OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
257cdf0e10cSrcweir 	if ( nAspect == embed::Aspects::MSOLE_ICON )
258cdf0e10cSrcweir 		// no representation can be retrieved
259cdf0e10cSrcweir 		throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ),
260cdf0e10cSrcweir 									uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 	if ( !m_bHasCachedSize || m_nCachedAspect != nAspect )
263cdf0e10cSrcweir 		throw embed::NoVisualAreaSizeException(
264cdf0e10cSrcweir 				::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No size available!\n" ) ),
265cdf0e10cSrcweir 				uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 	return m_aCachedSize;
268cdf0e10cSrcweir }
269cdf0e10cSrcweir 
270cdf0e10cSrcweir //----------------------------------------------
getMapUnit(sal_Int64 nAspect)271cdf0e10cSrcweir sal_Int32 SAL_CALL ODummyEmbeddedObject::getMapUnit( sal_Int64 nAspect )
272cdf0e10cSrcweir 		throw ( uno::Exception,
273cdf0e10cSrcweir 				uno::RuntimeException)
274cdf0e10cSrcweir {
275cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
276cdf0e10cSrcweir 	CheckInit();
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 	OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
279cdf0e10cSrcweir 	if ( nAspect == embed::Aspects::MSOLE_ICON )
280cdf0e10cSrcweir 		// no representation can be retrieved
281cdf0e10cSrcweir 		throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ),
282cdf0e10cSrcweir 									uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 	return embed::EmbedMapUnits::ONE_100TH_MM;
285cdf0e10cSrcweir }
286cdf0e10cSrcweir 
287cdf0e10cSrcweir //----------------------------------------------
getPreferredVisualRepresentation(sal_Int64)288cdf0e10cSrcweir embed::VisualRepresentation SAL_CALL ODummyEmbeddedObject::getPreferredVisualRepresentation( sal_Int64 )
289cdf0e10cSrcweir 		throw ( lang::IllegalArgumentException,
290cdf0e10cSrcweir 				embed::WrongStateException,
291cdf0e10cSrcweir 				uno::Exception,
292cdf0e10cSrcweir 				uno::RuntimeException )
293cdf0e10cSrcweir {
294cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
295cdf0e10cSrcweir 	CheckInit();
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 	// no representation can be retrieved
298cdf0e10cSrcweir 	throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ),
299cdf0e10cSrcweir 								uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
300cdf0e10cSrcweir }
301cdf0e10cSrcweir 
302cdf0e10cSrcweir //----------------------------------------------
setPersistentEntry(const uno::Reference<embed::XStorage> & xStorage,const::rtl::OUString & sEntName,sal_Int32 nEntryConnectionMode,const uno::Sequence<beans::PropertyValue> &,const uno::Sequence<beans::PropertyValue> &)303cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::setPersistentEntry(
304cdf0e10cSrcweir 					const uno::Reference< embed::XStorage >& xStorage,
305cdf0e10cSrcweir 					const ::rtl::OUString& sEntName,
306cdf0e10cSrcweir 					sal_Int32 nEntryConnectionMode,
307cdf0e10cSrcweir 					const uno::Sequence< beans::PropertyValue >& /* lArguments */,
308cdf0e10cSrcweir 					const uno::Sequence< beans::PropertyValue >& /* lObjArgs */ )
309cdf0e10cSrcweir 		throw ( lang::IllegalArgumentException,
310cdf0e10cSrcweir 				embed::WrongStateException,
311cdf0e10cSrcweir 				io::IOException,
312cdf0e10cSrcweir 				uno::Exception,
313cdf0e10cSrcweir 				uno::RuntimeException )
314cdf0e10cSrcweir {
315cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
316cdf0e10cSrcweir 	if ( m_bDisposed )
317cdf0e10cSrcweir 		throw lang::DisposedException(); // TODO
318cdf0e10cSrcweir 
319cdf0e10cSrcweir 	if ( !xStorage.is() )
320cdf0e10cSrcweir 		throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "No parent storage is provided!\n" ),
321cdf0e10cSrcweir 											uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
322cdf0e10cSrcweir 											1 );
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 	if ( !sEntName.getLength() )
325cdf0e10cSrcweir 		throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Empty element name is provided!\n" ),
326cdf0e10cSrcweir 											uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
327cdf0e10cSrcweir 											2 );
328cdf0e10cSrcweir 
329cdf0e10cSrcweir 	if ( ( m_nObjectState != -1 || nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
330cdf0e10cSrcweir 	  && ( m_nObjectState == -1 || nEntryConnectionMode != embed::EntryInitModes::NO_INIT ) )
331cdf0e10cSrcweir 	{
332cdf0e10cSrcweir 		throw embed::WrongStateException(
333*07a3d7f1SPedro Giffuni 					::rtl::OUString::createFromAscii( "Can't change persistent representation of activated object!\n" ),
334cdf0e10cSrcweir 					uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
335cdf0e10cSrcweir 	}
336cdf0e10cSrcweir 
337cdf0e10cSrcweir     if ( m_bWaitSaveCompleted )
338cdf0e10cSrcweir 	{
339cdf0e10cSrcweir 		if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
340cdf0e10cSrcweir 			saveCompleted( ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) ) );
341cdf0e10cSrcweir 		else
342cdf0e10cSrcweir 			throw embed::WrongStateException(
343cdf0e10cSrcweir 						::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
344cdf0e10cSrcweir 						uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
345cdf0e10cSrcweir 	}
346cdf0e10cSrcweir 
347cdf0e10cSrcweir 	if ( nEntryConnectionMode == embed::EntryInitModes::DEFAULT_INIT
348cdf0e10cSrcweir 	  || nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
349cdf0e10cSrcweir 	{
350cdf0e10cSrcweir 		if ( xStorage->hasByName( sEntName ) )
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 		{
353cdf0e10cSrcweir 			m_xParentStorage = xStorage;
354cdf0e10cSrcweir 			m_aEntryName = sEntName;
355cdf0e10cSrcweir 			m_nObjectState = embed::EmbedStates::LOADED;
356cdf0e10cSrcweir 		}
357cdf0e10cSrcweir 		else
358cdf0e10cSrcweir 			throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Wrong entry is provided!\n" ),
359cdf0e10cSrcweir 								uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
360cdf0e10cSrcweir 								2 );
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 	}
363cdf0e10cSrcweir 	else
364cdf0e10cSrcweir 		throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Wrong connection mode is provided!\n" ),
365cdf0e10cSrcweir 								uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
366cdf0e10cSrcweir 								3 );
367cdf0e10cSrcweir }
368cdf0e10cSrcweir 
369cdf0e10cSrcweir //------------------------------------------------------
storeToEntry(const uno::Reference<embed::XStorage> & xStorage,const::rtl::OUString & sEntName,const uno::Sequence<beans::PropertyValue> &,const uno::Sequence<beans::PropertyValue> &)370cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::storeToEntry( const uno::Reference< embed::XStorage >& xStorage,
371cdf0e10cSrcweir 							const ::rtl::OUString& sEntName,
372cdf0e10cSrcweir 							const uno::Sequence< beans::PropertyValue >& /* lArguments */,
373cdf0e10cSrcweir 							const uno::Sequence< beans::PropertyValue >& /* lObjArgs */ )
374cdf0e10cSrcweir 		throw ( lang::IllegalArgumentException,
375cdf0e10cSrcweir 				embed::WrongStateException,
376cdf0e10cSrcweir 				io::IOException,
377cdf0e10cSrcweir 				uno::Exception,
378cdf0e10cSrcweir 				uno::RuntimeException )
379cdf0e10cSrcweir {
380cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
381cdf0e10cSrcweir 	CheckInit();
382cdf0e10cSrcweir 
383cdf0e10cSrcweir 	if ( m_bWaitSaveCompleted )
384cdf0e10cSrcweir 		throw embed::WrongStateException(
385cdf0e10cSrcweir 					::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
386cdf0e10cSrcweir 					uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 	m_xParentStorage->copyElementTo( m_aEntryName, xStorage, sEntName );
389cdf0e10cSrcweir }
390cdf0e10cSrcweir 
391cdf0e10cSrcweir //------------------------------------------------------
storeAsEntry(const uno::Reference<embed::XStorage> & xStorage,const::rtl::OUString & sEntName,const uno::Sequence<beans::PropertyValue> &,const uno::Sequence<beans::PropertyValue> &)392cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::storeAsEntry( const uno::Reference< embed::XStorage >& xStorage,
393cdf0e10cSrcweir 							const ::rtl::OUString& sEntName,
394cdf0e10cSrcweir 							const uno::Sequence< beans::PropertyValue >& /* lArguments */,
395cdf0e10cSrcweir 							const uno::Sequence< beans::PropertyValue >& /* lObjArgs */ )
396cdf0e10cSrcweir 		throw ( lang::IllegalArgumentException,
397cdf0e10cSrcweir 				embed::WrongStateException,
398cdf0e10cSrcweir 				io::IOException,
399cdf0e10cSrcweir 				uno::Exception,
400cdf0e10cSrcweir 				uno::RuntimeException )
401cdf0e10cSrcweir {
402cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
403cdf0e10cSrcweir 	CheckInit();
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 	if ( m_bWaitSaveCompleted )
406cdf0e10cSrcweir 		throw embed::WrongStateException(
407cdf0e10cSrcweir 					::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
408cdf0e10cSrcweir 					uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 	PostEvent_Impl( ::rtl::OUString::createFromAscii( "OnSaveAs" ),
411cdf0e10cSrcweir 					uno::Reference< uno::XInterface >( static_cast< cppu::OWeakObject* >( this ) ) );
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 	m_xParentStorage->copyElementTo( m_aEntryName, xStorage, sEntName );
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 	m_bWaitSaveCompleted = sal_True;
416cdf0e10cSrcweir 	m_xNewParentStorage = xStorage;
417cdf0e10cSrcweir     m_aNewEntryName = sEntName;
418cdf0e10cSrcweir }
419cdf0e10cSrcweir 
420cdf0e10cSrcweir //------------------------------------------------------
saveCompleted(sal_Bool bUseNew)421cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::saveCompleted( sal_Bool bUseNew )
422cdf0e10cSrcweir 		throw ( embed::WrongStateException,
423cdf0e10cSrcweir 				uno::Exception,
424cdf0e10cSrcweir 				uno::RuntimeException )
425cdf0e10cSrcweir {
426cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
427cdf0e10cSrcweir 	CheckInit();
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 	// it is allowed to call saveCompleted( false ) for nonstored objects
430cdf0e10cSrcweir 	if ( !m_bWaitSaveCompleted && !bUseNew )
431cdf0e10cSrcweir 		return;
432cdf0e10cSrcweir 
433cdf0e10cSrcweir 	OSL_ENSURE( m_bWaitSaveCompleted, "Unexpected saveCompleted() call!\n" );
434cdf0e10cSrcweir 	if ( !m_bWaitSaveCompleted )
435cdf0e10cSrcweir 		throw io::IOException(); // TODO: illegal call
436cdf0e10cSrcweir 
437cdf0e10cSrcweir 	OSL_ENSURE( m_xNewParentStorage.is() , "Internal object information is broken!\n" );
438cdf0e10cSrcweir 	if ( !m_xNewParentStorage.is() )
439cdf0e10cSrcweir 		throw uno::RuntimeException(); // TODO: broken internal information
440cdf0e10cSrcweir 
441cdf0e10cSrcweir 	if ( bUseNew )
442cdf0e10cSrcweir 	{
443cdf0e10cSrcweir 		m_xParentStorage = m_xNewParentStorage;
444cdf0e10cSrcweir 		m_aEntryName = m_aNewEntryName;
445cdf0e10cSrcweir 
446cdf0e10cSrcweir 		PostEvent_Impl( ::rtl::OUString::createFromAscii( "OnSaveAsDone" ),
447cdf0e10cSrcweir 						uno::Reference< uno::XInterface >( static_cast< cppu::OWeakObject* >( this ) ) );
448cdf0e10cSrcweir 	}
449cdf0e10cSrcweir 
450cdf0e10cSrcweir 	m_xNewParentStorage = uno::Reference< embed::XStorage >();
451cdf0e10cSrcweir 	m_aNewEntryName = ::rtl::OUString();
452cdf0e10cSrcweir 	m_bWaitSaveCompleted = sal_False;
453cdf0e10cSrcweir }
454cdf0e10cSrcweir 
455cdf0e10cSrcweir //------------------------------------------------------
hasEntry()456cdf0e10cSrcweir sal_Bool SAL_CALL ODummyEmbeddedObject::hasEntry()
457cdf0e10cSrcweir 		throw ( embed::WrongStateException,
458cdf0e10cSrcweir 				uno::RuntimeException )
459cdf0e10cSrcweir {
460cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
461cdf0e10cSrcweir 	CheckInit();
462cdf0e10cSrcweir 
463cdf0e10cSrcweir 	if ( m_bWaitSaveCompleted )
464cdf0e10cSrcweir 		throw embed::WrongStateException(
465cdf0e10cSrcweir 					::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
466cdf0e10cSrcweir 					uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 	if ( m_aEntryName.getLength() )
469cdf0e10cSrcweir 		return sal_True;
470cdf0e10cSrcweir 
471cdf0e10cSrcweir 	return sal_False;
472cdf0e10cSrcweir }
473cdf0e10cSrcweir 
474cdf0e10cSrcweir //------------------------------------------------------
getEntryName()475cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODummyEmbeddedObject::getEntryName()
476cdf0e10cSrcweir 		throw ( embed::WrongStateException,
477cdf0e10cSrcweir 				uno::RuntimeException )
478cdf0e10cSrcweir {
479cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
480cdf0e10cSrcweir 	CheckInit();
481cdf0e10cSrcweir 
482cdf0e10cSrcweir 	if ( m_bWaitSaveCompleted )
483cdf0e10cSrcweir 		throw embed::WrongStateException(
484cdf0e10cSrcweir 					::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
485cdf0e10cSrcweir 					uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
486cdf0e10cSrcweir 
487cdf0e10cSrcweir 	return m_aEntryName;
488cdf0e10cSrcweir }
489cdf0e10cSrcweir 
490cdf0e10cSrcweir //------------------------------------------------------
storeOwn()491cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::storeOwn()
492cdf0e10cSrcweir 		throw ( embed::WrongStateException,
493cdf0e10cSrcweir 				io::IOException,
494cdf0e10cSrcweir 				uno::Exception,
495cdf0e10cSrcweir 				uno::RuntimeException )
496cdf0e10cSrcweir {
497cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
498cdf0e10cSrcweir 	CheckInit();
499cdf0e10cSrcweir 
500cdf0e10cSrcweir 	if ( m_bWaitSaveCompleted )
501cdf0e10cSrcweir 		throw embed::WrongStateException(
502cdf0e10cSrcweir 					::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
503cdf0e10cSrcweir 					uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
504cdf0e10cSrcweir 
505cdf0e10cSrcweir 	// the object can not be activated or changed
506cdf0e10cSrcweir 	return;
507cdf0e10cSrcweir }
508cdf0e10cSrcweir 
509cdf0e10cSrcweir //------------------------------------------------------
isReadonly()510cdf0e10cSrcweir sal_Bool SAL_CALL ODummyEmbeddedObject::isReadonly()
511cdf0e10cSrcweir 		throw ( embed::WrongStateException,
512cdf0e10cSrcweir 				uno::RuntimeException )
513cdf0e10cSrcweir {
514cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
515cdf0e10cSrcweir 	CheckInit();
516cdf0e10cSrcweir 
517cdf0e10cSrcweir 	if ( m_bWaitSaveCompleted )
518cdf0e10cSrcweir 		throw embed::WrongStateException(
519cdf0e10cSrcweir 					::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
520cdf0e10cSrcweir 					uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
521cdf0e10cSrcweir 
522cdf0e10cSrcweir 	// this object can not be changed
523cdf0e10cSrcweir 	return sal_True;
524cdf0e10cSrcweir }
525cdf0e10cSrcweir 
526cdf0e10cSrcweir //------------------------------------------------------
reload(const uno::Sequence<beans::PropertyValue> &,const uno::Sequence<beans::PropertyValue> &)527cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::reload(
528cdf0e10cSrcweir 				const uno::Sequence< beans::PropertyValue >& /* lArguments */,
529cdf0e10cSrcweir 				const uno::Sequence< beans::PropertyValue >& /* lObjArgs */ )
530cdf0e10cSrcweir 		throw ( lang::IllegalArgumentException,
531cdf0e10cSrcweir 				embed::WrongStateException,
532cdf0e10cSrcweir 				io::IOException,
533cdf0e10cSrcweir 				uno::Exception,
534cdf0e10cSrcweir 				uno::RuntimeException )
535cdf0e10cSrcweir {
536cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
537cdf0e10cSrcweir 	CheckInit();
538cdf0e10cSrcweir 
539cdf0e10cSrcweir 	if ( m_bWaitSaveCompleted )
540cdf0e10cSrcweir 		throw embed::WrongStateException(
541cdf0e10cSrcweir 					::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
542cdf0e10cSrcweir 					uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
543cdf0e10cSrcweir 
544cdf0e10cSrcweir 	// nothing to reload
545cdf0e10cSrcweir }
546cdf0e10cSrcweir 
547cdf0e10cSrcweir //------------------------------------------------------
getClassID()548cdf0e10cSrcweir uno::Sequence< sal_Int8 > SAL_CALL ODummyEmbeddedObject::getClassID()
549cdf0e10cSrcweir 		throw ( uno::RuntimeException )
550cdf0e10cSrcweir {
551cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
552cdf0e10cSrcweir 	CheckInit();
553cdf0e10cSrcweir 
554cdf0e10cSrcweir 	// currently the class ID is empty
555cdf0e10cSrcweir 	// TODO/LATER: should a special class ID be used in this case?
556cdf0e10cSrcweir 	return uno::Sequence< sal_Int8 >();
557cdf0e10cSrcweir }
558cdf0e10cSrcweir 
559cdf0e10cSrcweir //------------------------------------------------------
getClassName()560cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODummyEmbeddedObject::getClassName()
561cdf0e10cSrcweir 		throw ( uno::RuntimeException )
562cdf0e10cSrcweir {
563cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
564cdf0e10cSrcweir 	if ( m_bDisposed )
565cdf0e10cSrcweir 		throw lang::DisposedException(); // TODO
566cdf0e10cSrcweir 
567cdf0e10cSrcweir 	return ::rtl::OUString();
568cdf0e10cSrcweir }
569cdf0e10cSrcweir 
570cdf0e10cSrcweir //------------------------------------------------------
setClassInfo(const uno::Sequence<sal_Int8> &,const::rtl::OUString &)571cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::setClassInfo(
572cdf0e10cSrcweir 				const uno::Sequence< sal_Int8 >& /*aClassID*/, const ::rtl::OUString& /*aClassName*/ )
573cdf0e10cSrcweir 		throw ( lang::NoSupportException,
574cdf0e10cSrcweir 				uno::RuntimeException )
575cdf0e10cSrcweir {
576cdf0e10cSrcweir 	throw lang::NoSupportException();
577cdf0e10cSrcweir }
578cdf0e10cSrcweir 
579cdf0e10cSrcweir //------------------------------------------------------
getComponent()580cdf0e10cSrcweir uno::Reference< util::XCloseable > SAL_CALL ODummyEmbeddedObject::getComponent()
581cdf0e10cSrcweir 		throw ( uno::RuntimeException )
582cdf0e10cSrcweir {
583cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
584cdf0e10cSrcweir 	CheckInit();
585cdf0e10cSrcweir 
586cdf0e10cSrcweir     return uno::Reference< util::XCloseable >();
587cdf0e10cSrcweir }
588cdf0e10cSrcweir 
589cdf0e10cSrcweir //----------------------------------------------
addStateChangeListener(const uno::Reference<embed::XStateChangeListener> & xListener)590cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::addStateChangeListener( const uno::Reference< embed::XStateChangeListener >& xListener )
591cdf0e10cSrcweir 	throw ( uno::RuntimeException )
592cdf0e10cSrcweir {
593cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
594cdf0e10cSrcweir 	if ( m_bDisposed )
595cdf0e10cSrcweir 		return;
596cdf0e10cSrcweir 
597cdf0e10cSrcweir 	if ( !m_pInterfaceContainer )
598cdf0e10cSrcweir 		m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
599cdf0e10cSrcweir 
600cdf0e10cSrcweir 	m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
601cdf0e10cSrcweir 														xListener );
602cdf0e10cSrcweir }
603cdf0e10cSrcweir 
604cdf0e10cSrcweir //----------------------------------------------
removeStateChangeListener(const uno::Reference<embed::XStateChangeListener> & xListener)605cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::removeStateChangeListener(
606cdf0e10cSrcweir 					const uno::Reference< embed::XStateChangeListener >& xListener )
607cdf0e10cSrcweir 	throw (uno::RuntimeException)
608cdf0e10cSrcweir {
609cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
610cdf0e10cSrcweir 	if ( m_pInterfaceContainer )
611cdf0e10cSrcweir 		m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
612cdf0e10cSrcweir 												xListener );
613cdf0e10cSrcweir }
614cdf0e10cSrcweir 
615cdf0e10cSrcweir //----------------------------------------------
close(sal_Bool bDeliverOwnership)616cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::close( sal_Bool bDeliverOwnership )
617cdf0e10cSrcweir 	throw ( util::CloseVetoException,
618cdf0e10cSrcweir 			uno::RuntimeException )
619cdf0e10cSrcweir {
620cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
621cdf0e10cSrcweir 	if ( m_bDisposed )
622cdf0e10cSrcweir 		throw lang::DisposedException(); // TODO
623cdf0e10cSrcweir 
624cdf0e10cSrcweir     uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) );
625cdf0e10cSrcweir     lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
626cdf0e10cSrcweir 
627cdf0e10cSrcweir 	if ( m_pInterfaceContainer )
628cdf0e10cSrcweir 	{
629cdf0e10cSrcweir     	::cppu::OInterfaceContainerHelper* pContainer =
630cdf0e10cSrcweir 			m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
631cdf0e10cSrcweir     	if ( pContainer != NULL )
632cdf0e10cSrcweir 		{
633cdf0e10cSrcweir         	::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
634cdf0e10cSrcweir         	while (pIterator.hasMoreElements())
635cdf0e10cSrcweir         	{
636cdf0e10cSrcweir             	try
637cdf0e10cSrcweir             	{
638cdf0e10cSrcweir                 	((util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnership );
639cdf0e10cSrcweir             	}
640cdf0e10cSrcweir             	catch( uno::RuntimeException& )
641cdf0e10cSrcweir             	{
642cdf0e10cSrcweir                 	pIterator.remove();
643cdf0e10cSrcweir             	}
644cdf0e10cSrcweir         	}
645cdf0e10cSrcweir 		}
646cdf0e10cSrcweir 
647cdf0e10cSrcweir     	pContainer = m_pInterfaceContainer->getContainer(
648cdf0e10cSrcweir 									::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
649cdf0e10cSrcweir     	if ( pContainer != NULL )
650cdf0e10cSrcweir 		{
651cdf0e10cSrcweir         	::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer);
652cdf0e10cSrcweir         	while (pCloseIterator.hasMoreElements())
653cdf0e10cSrcweir         	{
654cdf0e10cSrcweir             	try
655cdf0e10cSrcweir             	{
656cdf0e10cSrcweir                 	((util::XCloseListener*)pCloseIterator.next())->notifyClosing( aSource );
657cdf0e10cSrcweir             	}
658cdf0e10cSrcweir             	catch( uno::RuntimeException& )
659cdf0e10cSrcweir             	{
660cdf0e10cSrcweir                 	pCloseIterator.remove();
661cdf0e10cSrcweir             	}
662cdf0e10cSrcweir         	}
663cdf0e10cSrcweir 		}
664cdf0e10cSrcweir 
665cdf0e10cSrcweir 		m_pInterfaceContainer->disposeAndClear( aSource );
666cdf0e10cSrcweir 	}
667cdf0e10cSrcweir 
668cdf0e10cSrcweir 	m_bDisposed = sal_True; // the object is disposed now for outside
669cdf0e10cSrcweir }
670cdf0e10cSrcweir 
671cdf0e10cSrcweir //----------------------------------------------
addCloseListener(const uno::Reference<util::XCloseListener> & xListener)672cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::addCloseListener( const uno::Reference< util::XCloseListener >& xListener )
673cdf0e10cSrcweir 	throw ( uno::RuntimeException )
674cdf0e10cSrcweir {
675cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
676cdf0e10cSrcweir 	if ( m_bDisposed )
677cdf0e10cSrcweir 		return;
678cdf0e10cSrcweir 
679cdf0e10cSrcweir 	if ( !m_pInterfaceContainer )
680cdf0e10cSrcweir 		m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
681cdf0e10cSrcweir 
682cdf0e10cSrcweir 	m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ), xListener );
683cdf0e10cSrcweir }
684cdf0e10cSrcweir 
685cdf0e10cSrcweir //----------------------------------------------
removeCloseListener(const uno::Reference<util::XCloseListener> & xListener)686cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener )
687cdf0e10cSrcweir 	throw (uno::RuntimeException)
688cdf0e10cSrcweir {
689cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
690cdf0e10cSrcweir 	if ( m_pInterfaceContainer )
691cdf0e10cSrcweir 		m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ),
692cdf0e10cSrcweir 												xListener );
693cdf0e10cSrcweir }
694cdf0e10cSrcweir 
695cdf0e10cSrcweir //------------------------------------------------------
addEventListener(const uno::Reference<document::XEventListener> & xListener)696cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::addEventListener( const uno::Reference< document::XEventListener >& xListener )
697cdf0e10cSrcweir 		throw ( uno::RuntimeException )
698cdf0e10cSrcweir {
699cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
700cdf0e10cSrcweir 	if ( m_bDisposed )
701cdf0e10cSrcweir 		return;
702cdf0e10cSrcweir 
703cdf0e10cSrcweir 	if ( !m_pInterfaceContainer )
704cdf0e10cSrcweir 		m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
705cdf0e10cSrcweir 
706cdf0e10cSrcweir 	m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ), xListener );
707cdf0e10cSrcweir }
708cdf0e10cSrcweir 
709cdf0e10cSrcweir //------------------------------------------------------
removeEventListener(const uno::Reference<document::XEventListener> & xListener)710cdf0e10cSrcweir void SAL_CALL ODummyEmbeddedObject::removeEventListener( const uno::Reference< document::XEventListener >& xListener )
711cdf0e10cSrcweir 		throw ( uno::RuntimeException )
712cdf0e10cSrcweir {
713cdf0e10cSrcweir 	::osl::MutexGuard aGuard( m_aMutex );
714cdf0e10cSrcweir 	if ( m_pInterfaceContainer )
715cdf0e10cSrcweir 		m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ),
716cdf0e10cSrcweir 												xListener );
717cdf0e10cSrcweir }
718cdf0e10cSrcweir 
719