Version 4.2.0.1, tag libreoffice-4.2.0.1
[LibreOffice.git] / embeddedobj / source / general / dummyobject.cxx
blob94679bb145e0ae24c019b65cd78041c66cb6dc78
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/embed/EmbedStates.hpp>
21 #include <com/sun/star/embed/EmbedVerbs.hpp>
22 #include <com/sun/star/embed/EmbedUpdateModes.hpp>
23 #include <com/sun/star/embed/XEmbeddedClient.hpp>
24 #include <com/sun/star/embed/XInplaceClient.hpp>
25 #include <com/sun/star/embed/XWindowSupplier.hpp>
26 #include <com/sun/star/embed/StateChangeInProgressException.hpp>
27 #include <com/sun/star/embed/Aspects.hpp>
28 #include <com/sun/star/embed/EmbedMapUnits.hpp>
29 #include <com/sun/star/embed/EntryInitModes.hpp>
30 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
31 #include <com/sun/star/lang/DisposedException.hpp>
33 #include <cppuhelper/interfacecontainer.h>
35 #include <dummyobject.hxx>
38 using namespace ::com::sun::star;
40 //----------------------------------------------
41 void ODummyEmbeddedObject::CheckInit()
43 if ( m_bDisposed )
44 throw lang::DisposedException();
46 if ( m_nObjectState == -1 )
47 throw embed::WrongStateException( OUString( "The object has no persistence!\n" ),
48 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
51 //----------------------------------------------
52 void ODummyEmbeddedObject::PostEvent_Impl( const OUString& aEventName )
54 if ( m_pInterfaceContainer )
56 ::cppu::OInterfaceContainerHelper* pIC = m_pInterfaceContainer->getContainer(
57 ::getCppuType((const uno::Reference< document::XEventListener >*)0) );
58 if( pIC )
60 document::EventObject aEvent;
61 aEvent.EventName = aEventName;
62 aEvent.Source = uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) );
63 // For now all the events are sent as object events
64 // aEvent.Source = ( xSource.is() ? xSource
65 // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) );
66 ::cppu::OInterfaceIteratorHelper aIt( *pIC );
67 while( aIt.hasMoreElements() )
69 try
71 ((document::XEventListener *)aIt.next())->notifyEvent( aEvent );
73 catch( const uno::RuntimeException& )
75 aIt.remove();
78 // the listener could dispose the object.
79 if ( m_bDisposed )
80 return;
86 //----------------------------------------------
87 ODummyEmbeddedObject::~ODummyEmbeddedObject()
91 //----------------------------------------------
92 void SAL_CALL ODummyEmbeddedObject::changeState( sal_Int32 nNewState )
93 throw ( embed::UnreachableStateException,
94 embed::WrongStateException,
95 uno::Exception,
96 uno::RuntimeException )
98 ::osl::MutexGuard aGuard( m_aMutex );
99 CheckInit();
101 if ( nNewState == embed::EmbedStates::LOADED )
102 return;
104 throw embed::UnreachableStateException();
107 //----------------------------------------------
108 uno::Sequence< sal_Int32 > SAL_CALL ODummyEmbeddedObject::getReachableStates()
109 throw ( embed::WrongStateException,
110 uno::RuntimeException )
112 ::osl::MutexGuard aGuard( m_aMutex );
113 CheckInit();
115 uno::Sequence< sal_Int32 > aResult( 1 );
116 aResult[0] = embed::EmbedStates::LOADED;
118 return aResult;
121 //----------------------------------------------
122 sal_Int32 SAL_CALL ODummyEmbeddedObject::getCurrentState()
123 throw ( embed::WrongStateException,
124 uno::RuntimeException )
126 ::osl::MutexGuard aGuard( m_aMutex );
127 CheckInit();
129 return m_nObjectState;
132 //----------------------------------------------
133 void SAL_CALL ODummyEmbeddedObject::doVerb( sal_Int32 )
134 throw ( lang::IllegalArgumentException,
135 embed::WrongStateException,
136 embed::UnreachableStateException,
137 uno::Exception,
138 uno::RuntimeException )
140 ::osl::MutexGuard aGuard( m_aMutex );
141 CheckInit();
143 // no supported verbs
146 //----------------------------------------------
147 uno::Sequence< embed::VerbDescriptor > SAL_CALL ODummyEmbeddedObject::getSupportedVerbs()
148 throw ( embed::WrongStateException,
149 uno::RuntimeException )
151 ::osl::MutexGuard aGuard( m_aMutex );
152 CheckInit();
154 return uno::Sequence< embed::VerbDescriptor >();
157 //----------------------------------------------
158 void SAL_CALL ODummyEmbeddedObject::setClientSite(
159 const uno::Reference< embed::XEmbeddedClient >& xClient )
160 throw ( embed::WrongStateException,
161 uno::RuntimeException )
163 ::osl::MutexGuard aGuard( m_aMutex );
164 CheckInit();
166 m_xClientSite = xClient;
169 //----------------------------------------------
170 uno::Reference< embed::XEmbeddedClient > SAL_CALL ODummyEmbeddedObject::getClientSite()
171 throw ( embed::WrongStateException,
172 uno::RuntimeException )
174 ::osl::MutexGuard aGuard( m_aMutex );
175 CheckInit();
177 return m_xClientSite;
180 //----------------------------------------------
181 void SAL_CALL ODummyEmbeddedObject::update()
182 throw ( embed::WrongStateException,
183 uno::Exception,
184 uno::RuntimeException )
186 ::osl::MutexGuard aGuard( m_aMutex );
187 CheckInit();
190 //----------------------------------------------
191 void SAL_CALL ODummyEmbeddedObject::setUpdateMode( sal_Int32 )
192 throw ( embed::WrongStateException,
193 uno::RuntimeException )
195 ::osl::MutexGuard aGuard( m_aMutex );
196 CheckInit();
199 //----------------------------------------------
200 sal_Int64 SAL_CALL ODummyEmbeddedObject::getStatus( sal_Int64 )
201 throw ( embed::WrongStateException,
202 uno::RuntimeException )
204 ::osl::MutexGuard aGuard( m_aMutex );
205 CheckInit();
207 return 0;
210 //----------------------------------------------
211 void SAL_CALL ODummyEmbeddedObject::setContainerName( const OUString& )
212 throw ( uno::RuntimeException )
214 ::osl::MutexGuard aGuard( m_aMutex );
215 CheckInit();
218 //----------------------------------------------
219 void SAL_CALL ODummyEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const awt::Size& aSize )
220 throw ( lang::IllegalArgumentException,
221 embed::WrongStateException,
222 uno::Exception,
223 uno::RuntimeException )
225 ::osl::MutexGuard aGuard( m_aMutex );
226 CheckInit();
228 OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
229 if ( nAspect == embed::Aspects::MSOLE_ICON )
230 // no representation can be retrieved
231 throw embed::WrongStateException( OUString( "Illegal call!\n" ),
232 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
234 m_nCachedAspect = nAspect;
235 m_aCachedSize = aSize;
236 m_bHasCachedSize = sal_True;
239 //----------------------------------------------
240 awt::Size SAL_CALL ODummyEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
241 throw ( lang::IllegalArgumentException,
242 embed::WrongStateException,
243 uno::Exception,
244 uno::RuntimeException )
246 ::osl::MutexGuard aGuard( m_aMutex );
247 CheckInit();
249 OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
250 if ( nAspect == embed::Aspects::MSOLE_ICON )
251 // no representation can be retrieved
252 throw embed::WrongStateException( OUString( "Illegal call!\n" ),
253 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
255 if ( !m_bHasCachedSize || m_nCachedAspect != nAspect )
256 throw embed::NoVisualAreaSizeException(
257 OUString( "No size available!\n" ),
258 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
260 return m_aCachedSize;
263 //----------------------------------------------
264 sal_Int32 SAL_CALL ODummyEmbeddedObject::getMapUnit( sal_Int64 nAspect )
265 throw ( uno::Exception,
266 uno::RuntimeException)
268 ::osl::MutexGuard aGuard( m_aMutex );
269 CheckInit();
271 OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
272 if ( nAspect == embed::Aspects::MSOLE_ICON )
273 // no representation can be retrieved
274 throw embed::WrongStateException( OUString( "Illegal call!\n" ),
275 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
277 return embed::EmbedMapUnits::ONE_100TH_MM;
280 //----------------------------------------------
281 embed::VisualRepresentation SAL_CALL ODummyEmbeddedObject::getPreferredVisualRepresentation( sal_Int64 )
282 throw ( lang::IllegalArgumentException,
283 embed::WrongStateException,
284 uno::Exception,
285 uno::RuntimeException )
287 ::osl::MutexGuard aGuard( m_aMutex );
288 CheckInit();
290 // no representation can be retrieved
291 throw embed::WrongStateException( OUString( "Illegal call!\n" ),
292 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
295 //----------------------------------------------
296 void SAL_CALL ODummyEmbeddedObject::setPersistentEntry(
297 const uno::Reference< embed::XStorage >& xStorage,
298 const OUString& sEntName,
299 sal_Int32 nEntryConnectionMode,
300 const uno::Sequence< beans::PropertyValue >& /* lArguments */,
301 const uno::Sequence< beans::PropertyValue >& /* lObjArgs */ )
302 throw ( lang::IllegalArgumentException,
303 embed::WrongStateException,
304 io::IOException,
305 uno::Exception,
306 uno::RuntimeException )
308 ::osl::MutexGuard aGuard( m_aMutex );
309 if ( m_bDisposed )
310 throw lang::DisposedException(); // TODO
312 if ( !xStorage.is() )
313 throw lang::IllegalArgumentException( OUString( "No parent storage is provided!\n" ),
314 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
315 1 );
317 if ( sEntName.isEmpty() )
318 throw lang::IllegalArgumentException( OUString( "Empty element name is provided!\n" ),
319 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
320 2 );
322 if ( ( m_nObjectState != -1 || nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
323 && ( m_nObjectState == -1 || nEntryConnectionMode != embed::EntryInitModes::NO_INIT ) )
325 throw embed::WrongStateException(
326 OUString( "Can't change persistent representation of activated object!\n" ),
327 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
330 if ( m_bWaitSaveCompleted )
332 if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
333 saveCompleted( ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) ) );
334 else
335 throw embed::WrongStateException(
336 OUString( "The object waits for saveCompleted() call!\n" ),
337 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
340 if ( nEntryConnectionMode == embed::EntryInitModes::DEFAULT_INIT
341 || nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
343 if ( xStorage->hasByName( sEntName ) )
346 m_xParentStorage = xStorage;
347 m_aEntryName = sEntName;
348 m_nObjectState = embed::EmbedStates::LOADED;
350 else
351 throw lang::IllegalArgumentException( OUString( "Wrong entry is provided!\n" ),
352 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
353 2 );
356 else
357 throw lang::IllegalArgumentException( OUString( "Wrong connection mode is provided!\n" ),
358 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
359 3 );
362 //------------------------------------------------------
363 void SAL_CALL ODummyEmbeddedObject::storeToEntry( const uno::Reference< embed::XStorage >& xStorage,
364 const OUString& sEntName,
365 const uno::Sequence< beans::PropertyValue >& /* lArguments */,
366 const uno::Sequence< beans::PropertyValue >& /* lObjArgs */ )
367 throw ( lang::IllegalArgumentException,
368 embed::WrongStateException,
369 io::IOException,
370 uno::Exception,
371 uno::RuntimeException )
373 ::osl::MutexGuard aGuard( m_aMutex );
374 CheckInit();
376 if ( m_bWaitSaveCompleted )
377 throw embed::WrongStateException(
378 OUString( "The object waits for saveCompleted() call!\n" ),
379 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
381 m_xParentStorage->copyElementTo( m_aEntryName, xStorage, sEntName );
384 //------------------------------------------------------
385 void SAL_CALL ODummyEmbeddedObject::storeAsEntry( const uno::Reference< embed::XStorage >& xStorage,
386 const OUString& sEntName,
387 const uno::Sequence< beans::PropertyValue >& /* lArguments */,
388 const uno::Sequence< beans::PropertyValue >& /* lObjArgs */ )
389 throw ( lang::IllegalArgumentException,
390 embed::WrongStateException,
391 io::IOException,
392 uno::Exception,
393 uno::RuntimeException )
395 ::osl::MutexGuard aGuard( m_aMutex );
396 CheckInit();
398 if ( m_bWaitSaveCompleted )
399 throw embed::WrongStateException(
400 OUString( "The object waits for saveCompleted() call!\n" ),
401 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
403 PostEvent_Impl( OUString( "OnSaveAs" ) );
405 m_xParentStorage->copyElementTo( m_aEntryName, xStorage, sEntName );
407 m_bWaitSaveCompleted = sal_True;
408 m_xNewParentStorage = xStorage;
409 m_aNewEntryName = sEntName;
412 //------------------------------------------------------
413 void SAL_CALL ODummyEmbeddedObject::saveCompleted( sal_Bool bUseNew )
414 throw ( embed::WrongStateException,
415 uno::Exception,
416 uno::RuntimeException )
418 ::osl::MutexGuard aGuard( m_aMutex );
419 CheckInit();
421 // it is allowed to call saveCompleted( false ) for nonstored objects
422 if ( !m_bWaitSaveCompleted && !bUseNew )
423 return;
425 OSL_ENSURE( m_bWaitSaveCompleted, "Unexpected saveCompleted() call!\n" );
426 if ( !m_bWaitSaveCompleted )
427 throw io::IOException(); // TODO: illegal call
429 OSL_ENSURE( m_xNewParentStorage.is() , "Internal object information is broken!\n" );
430 if ( !m_xNewParentStorage.is() )
431 throw uno::RuntimeException(); // TODO: broken internal information
433 if ( bUseNew )
435 m_xParentStorage = m_xNewParentStorage;
436 m_aEntryName = m_aNewEntryName;
438 PostEvent_Impl( OUString( "OnSaveAsDone" ) );
441 m_xNewParentStorage = uno::Reference< embed::XStorage >();
442 m_aNewEntryName = OUString();
443 m_bWaitSaveCompleted = sal_False;
446 //------------------------------------------------------
447 sal_Bool SAL_CALL ODummyEmbeddedObject::hasEntry()
448 throw ( embed::WrongStateException,
449 uno::RuntimeException )
451 ::osl::MutexGuard aGuard( m_aMutex );
452 CheckInit();
454 if ( m_bWaitSaveCompleted )
455 throw embed::WrongStateException(
456 OUString( "The object waits for saveCompleted() call!\n" ),
457 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
459 if ( !m_aEntryName.isEmpty() )
460 return sal_True;
462 return sal_False;
465 //------------------------------------------------------
466 OUString SAL_CALL ODummyEmbeddedObject::getEntryName()
467 throw ( embed::WrongStateException,
468 uno::RuntimeException )
470 ::osl::MutexGuard aGuard( m_aMutex );
471 CheckInit();
473 if ( m_bWaitSaveCompleted )
474 throw embed::WrongStateException(
475 OUString( "The object waits for saveCompleted() call!\n" ),
476 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
478 return m_aEntryName;
481 //------------------------------------------------------
482 void SAL_CALL ODummyEmbeddedObject::storeOwn()
483 throw ( embed::WrongStateException,
484 io::IOException,
485 uno::Exception,
486 uno::RuntimeException )
488 ::osl::MutexGuard aGuard( m_aMutex );
489 CheckInit();
491 if ( m_bWaitSaveCompleted )
492 throw embed::WrongStateException(
493 OUString( "The object waits for saveCompleted() call!\n" ),
494 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
496 // the object can not be activated or changed
497 return;
500 //------------------------------------------------------
501 sal_Bool SAL_CALL ODummyEmbeddedObject::isReadonly()
502 throw ( embed::WrongStateException,
503 uno::RuntimeException )
505 ::osl::MutexGuard aGuard( m_aMutex );
506 CheckInit();
508 if ( m_bWaitSaveCompleted )
509 throw embed::WrongStateException(
510 OUString( "The object waits for saveCompleted() call!\n" ),
511 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
513 // this object can not be changed
514 return sal_True;
517 //------------------------------------------------------
518 void SAL_CALL ODummyEmbeddedObject::reload(
519 const uno::Sequence< beans::PropertyValue >& /* lArguments */,
520 const uno::Sequence< beans::PropertyValue >& /* lObjArgs */ )
521 throw ( lang::IllegalArgumentException,
522 embed::WrongStateException,
523 io::IOException,
524 uno::Exception,
525 uno::RuntimeException )
527 ::osl::MutexGuard aGuard( m_aMutex );
528 CheckInit();
530 if ( m_bWaitSaveCompleted )
531 throw embed::WrongStateException(
532 OUString( "The object waits for saveCompleted() call!\n" ),
533 uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
535 // nothing to reload
538 //------------------------------------------------------
539 uno::Sequence< sal_Int8 > SAL_CALL ODummyEmbeddedObject::getClassID()
540 throw ( uno::RuntimeException )
542 ::osl::MutexGuard aGuard( m_aMutex );
543 CheckInit();
545 // currently the class ID is empty
546 // TODO/LATER: should a special class ID be used in this case?
547 return uno::Sequence< sal_Int8 >();
550 //------------------------------------------------------
551 OUString SAL_CALL ODummyEmbeddedObject::getClassName()
552 throw ( uno::RuntimeException )
554 ::osl::MutexGuard aGuard( m_aMutex );
555 if ( m_bDisposed )
556 throw lang::DisposedException(); // TODO
558 return OUString();
561 //------------------------------------------------------
562 void SAL_CALL ODummyEmbeddedObject::setClassInfo(
563 const uno::Sequence< sal_Int8 >& /*aClassID*/, const OUString& /*aClassName*/ )
564 throw ( lang::NoSupportException,
565 uno::RuntimeException )
567 throw lang::NoSupportException();
570 //------------------------------------------------------
571 uno::Reference< util::XCloseable > SAL_CALL ODummyEmbeddedObject::getComponent()
572 throw ( uno::RuntimeException )
574 ::osl::MutexGuard aGuard( m_aMutex );
575 CheckInit();
577 return uno::Reference< util::XCloseable >();
580 //----------------------------------------------
581 void SAL_CALL ODummyEmbeddedObject::addStateChangeListener( const uno::Reference< embed::XStateChangeListener >& xListener )
582 throw ( uno::RuntimeException )
584 ::osl::MutexGuard aGuard( m_aMutex );
585 if ( m_bDisposed )
586 return;
588 if ( !m_pInterfaceContainer )
589 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
591 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
592 xListener );
595 //----------------------------------------------
596 void SAL_CALL ODummyEmbeddedObject::removeStateChangeListener(
597 const uno::Reference< embed::XStateChangeListener >& xListener )
598 throw (uno::RuntimeException)
600 ::osl::MutexGuard aGuard( m_aMutex );
601 if ( m_pInterfaceContainer )
602 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
603 xListener );
606 //----------------------------------------------
607 void SAL_CALL ODummyEmbeddedObject::close( sal_Bool bDeliverOwnership )
608 throw ( util::CloseVetoException,
609 uno::RuntimeException )
611 ::osl::MutexGuard aGuard( m_aMutex );
612 if ( m_bDisposed )
613 throw lang::DisposedException(); // TODO
615 uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) );
616 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
618 if ( m_pInterfaceContainer )
620 ::cppu::OInterfaceContainerHelper* pContainer =
621 m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
622 if ( pContainer != NULL )
624 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
625 while (pIterator.hasMoreElements())
629 ((util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnership );
631 catch( const uno::RuntimeException& )
633 pIterator.remove();
638 pContainer = m_pInterfaceContainer->getContainer(
639 ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
640 if ( pContainer != NULL )
642 ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer);
643 while (pCloseIterator.hasMoreElements())
647 ((util::XCloseListener*)pCloseIterator.next())->notifyClosing( aSource );
649 catch( const uno::RuntimeException& )
651 pCloseIterator.remove();
656 m_pInterfaceContainer->disposeAndClear( aSource );
659 m_bDisposed = sal_True; // the object is disposed now for outside
662 //----------------------------------------------
663 void SAL_CALL ODummyEmbeddedObject::addCloseListener( const uno::Reference< util::XCloseListener >& xListener )
664 throw ( uno::RuntimeException )
666 ::osl::MutexGuard aGuard( m_aMutex );
667 if ( m_bDisposed )
668 return;
670 if ( !m_pInterfaceContainer )
671 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
673 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ), xListener );
676 //----------------------------------------------
677 void SAL_CALL ODummyEmbeddedObject::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener )
678 throw (uno::RuntimeException)
680 ::osl::MutexGuard aGuard( m_aMutex );
681 if ( m_pInterfaceContainer )
682 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ),
683 xListener );
686 //------------------------------------------------------
687 void SAL_CALL ODummyEmbeddedObject::addEventListener( const uno::Reference< document::XEventListener >& xListener )
688 throw ( uno::RuntimeException )
690 ::osl::MutexGuard aGuard( m_aMutex );
691 if ( m_bDisposed )
692 return;
694 if ( !m_pInterfaceContainer )
695 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
697 m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ), xListener );
700 //------------------------------------------------------
701 void SAL_CALL ODummyEmbeddedObject::removeEventListener( const uno::Reference< document::XEventListener >& xListener )
702 throw ( uno::RuntimeException )
704 ::osl::MutexGuard aGuard( m_aMutex );
705 if ( m_pInterfaceContainer )
706 m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ),
707 xListener );
710 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */