build fix
[LibreOffice.git] / embeddedobj / source / commonembedding / miscobj.cxx
blobfa020e92f7b203a1fa7a8ccc014a47128e8e24b1
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 <commonembobj.hxx>
21 #include <com/sun/star/embed/EmbedStates.hpp>
22 #include <com/sun/star/embed/EmbedVerbs.hpp>
23 #include <com/sun/star/embed/XStorage.hpp>
24 #include <com/sun/star/embed/EmbedUpdateModes.hpp>
25 #include <com/sun/star/embed/XInplaceClient.hpp>
26 #include <com/sun/star/lang/DisposedException.hpp>
27 #include <com/sun/star/beans/NamedValue.hpp>
29 #include <cppuhelper/typeprovider.hxx>
30 #include <cppuhelper/queryinterface.hxx>
31 #include <cppuhelper/interfacecontainer.h>
32 #include <comphelper/mimeconfighelper.hxx>
33 #include <comphelper/processfactory.hxx>
35 #include <vcl/svapp.hxx>
37 #include "closepreventer.hxx"
38 #include "intercept.hxx"
39 #include "persistence.hxx"
41 using namespace ::com::sun::star;
44 OCommonEmbeddedObject::OCommonEmbeddedObject( const uno::Reference< uno::XComponentContext >& rxContext,
45 const uno::Sequence< beans::NamedValue >& aObjProps )
46 : m_pDocHolder( nullptr )
47 , m_pInterfaceContainer( nullptr )
48 , m_bReadOnly( false )
49 , m_bDisposed( false )
50 , m_bClosed( false )
51 , m_nObjectState( -1 )
52 , m_nTargetState( -1 )
53 , m_nUpdateMode ( embed::EmbedUpdateModes::ALWAYS_UPDATE )
54 , m_xContext( rxContext )
55 , m_nMiscStatus( 0 )
56 , m_bEmbeddedScriptSupport( true )
57 , m_bDocumentRecoverySupport( true )
58 , m_bWaitSaveCompleted( false )
59 , m_bIsLink( false )
60 , m_bLinkHasPassword( false )
61 , m_bHasClonedSize( false )
62 , m_nClonedMapUnit( 0 )
64 CommonInit_Impl( aObjProps );
68 OCommonEmbeddedObject::OCommonEmbeddedObject(
69 const uno::Reference< uno::XComponentContext >& rxContext,
70 const uno::Sequence< beans::NamedValue >& aObjProps,
71 const uno::Sequence< beans::PropertyValue >& aMediaDescr,
72 const uno::Sequence< beans::PropertyValue >& aObjectDescr )
73 : m_pDocHolder( nullptr )
74 , m_pInterfaceContainer( nullptr )
75 , m_bReadOnly( false )
76 , m_bDisposed( false )
77 , m_bClosed( false )
78 , m_nObjectState( embed::EmbedStates::LOADED )
79 , m_nTargetState( -1 )
80 , m_nUpdateMode ( embed::EmbedUpdateModes::ALWAYS_UPDATE )
81 , m_xContext( rxContext )
82 , m_nMiscStatus( 0 )
83 , m_bEmbeddedScriptSupport( true )
84 , m_bDocumentRecoverySupport( true )
85 , m_bWaitSaveCompleted( false )
86 , m_bIsLink( true )
87 , m_bLinkHasPassword( false )
88 , m_bHasClonedSize( false )
89 , m_nClonedMapUnit( 0 )
91 // linked object has no own persistence so it is in loaded state starting from creation
92 LinkInit_Impl( aObjProps, aMediaDescr, aObjectDescr );
96 void OCommonEmbeddedObject::CommonInit_Impl( const uno::Sequence< beans::NamedValue >& aObjectProps )
98 OSL_ENSURE( m_xContext.is(), "No ServiceFactory is provided!\n" );
99 if ( !m_xContext.is() )
100 throw uno::RuntimeException();
102 m_pDocHolder = new DocumentHolder( m_xContext, this );
103 m_pDocHolder->acquire();
105 // parse configuration entries
106 // TODO/LATER: in future UI names can be also provided here
107 for ( sal_Int32 nInd = 0; nInd < aObjectProps.getLength(); nInd++ )
109 if ( aObjectProps[nInd].Name == "ClassID" )
110 aObjectProps[nInd].Value >>= m_aClassID;
111 else if ( aObjectProps[nInd].Name == "ObjectDocumentServiceName" )
112 aObjectProps[nInd].Value >>= m_aDocServiceName;
113 else if ( aObjectProps[nInd].Name == "ObjectDocumentFilterName" )
114 aObjectProps[nInd].Value >>= m_aPresetFilterName;
115 else if ( aObjectProps[nInd].Name == "ObjectMiscStatus" )
116 aObjectProps[nInd].Value >>= m_nMiscStatus;
117 else if ( aObjectProps[nInd].Name == "ObjectVerbs" )
118 aObjectProps[nInd].Value >>= m_aObjectVerbs;
121 if ( m_aClassID.getLength() != 16 /*|| !m_aDocServiceName.getLength()*/ )
122 throw uno::RuntimeException(); // something goes really wrong
124 // accepted states
125 m_aAcceptedStates.realloc( NUM_SUPPORTED_STATES );
127 m_aAcceptedStates[0] = embed::EmbedStates::LOADED;
128 m_aAcceptedStates[1] = embed::EmbedStates::RUNNING;
129 m_aAcceptedStates[2] = embed::EmbedStates::INPLACE_ACTIVE;
130 m_aAcceptedStates[3] = embed::EmbedStates::UI_ACTIVE;
131 m_aAcceptedStates[4] = embed::EmbedStates::ACTIVE;
134 // intermediate states
135 // In the following table the first index points to starting state,
136 // the second one to the target state, and the sequence referenced by
137 // first two indexes contains intermediate states, that should be
138 // passed by object to reach the target state.
139 // If the sequence is empty that means that indirect switch from start
140 // state to the target state is forbidden, only if direct switch is possible
141 // the state can be reached.
143 m_pIntermediateStatesSeqs[0][2].realloc( 1 );
144 m_pIntermediateStatesSeqs[0][2][0] = embed::EmbedStates::RUNNING;
146 m_pIntermediateStatesSeqs[0][3].realloc( 2 );
147 m_pIntermediateStatesSeqs[0][3][0] = embed::EmbedStates::RUNNING;
148 m_pIntermediateStatesSeqs[0][3][1] = embed::EmbedStates::INPLACE_ACTIVE;
150 m_pIntermediateStatesSeqs[0][4].realloc( 1 );
151 m_pIntermediateStatesSeqs[0][4][0] = embed::EmbedStates::RUNNING;
153 m_pIntermediateStatesSeqs[1][3].realloc( 1 );
154 m_pIntermediateStatesSeqs[1][3][0] = embed::EmbedStates::INPLACE_ACTIVE;
156 m_pIntermediateStatesSeqs[2][0].realloc( 1 );
157 m_pIntermediateStatesSeqs[2][0][0] = embed::EmbedStates::RUNNING;
159 m_pIntermediateStatesSeqs[3][0].realloc( 2 );
160 m_pIntermediateStatesSeqs[3][0][0] = embed::EmbedStates::INPLACE_ACTIVE;
161 m_pIntermediateStatesSeqs[3][0][1] = embed::EmbedStates::RUNNING;
163 m_pIntermediateStatesSeqs[3][1].realloc( 1 );
164 m_pIntermediateStatesSeqs[3][1][0] = embed::EmbedStates::INPLACE_ACTIVE;
166 m_pIntermediateStatesSeqs[4][0].realloc( 1 );
167 m_pIntermediateStatesSeqs[4][0][0] = embed::EmbedStates::RUNNING;
169 // verbs table
170 sal_Int32 nVerbTableSize = 0;
171 for ( sal_Int32 nVerbInd = 0; nVerbInd < m_aObjectVerbs.getLength(); nVerbInd++ )
173 if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_PRIMARY )
175 m_aVerbTable.realloc( ++nVerbTableSize );
176 m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
177 m_aVerbTable[nVerbTableSize - 1][0] = m_aObjectVerbs[nVerbInd].VerbID;
178 m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::UI_ACTIVE;
180 else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_SHOW )
182 m_aVerbTable.realloc( ++nVerbTableSize );
183 m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
184 m_aVerbTable[nVerbTableSize - 1][0] = m_aObjectVerbs[nVerbInd].VerbID;
185 m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::UI_ACTIVE;
187 else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_OPEN )
189 m_aVerbTable.realloc( ++nVerbTableSize );
190 m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
191 m_aVerbTable[nVerbTableSize - 1][0] = m_aObjectVerbs[nVerbInd].VerbID;
192 m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::ACTIVE;
194 else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_IPACTIVATE )
196 m_aVerbTable.realloc( ++nVerbTableSize );
197 m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
198 m_aVerbTable[nVerbTableSize - 1][0] = m_aObjectVerbs[nVerbInd].VerbID;
199 m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::INPLACE_ACTIVE;
201 else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_UIACTIVATE )
203 m_aVerbTable.realloc( ++nVerbTableSize );
204 m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
205 m_aVerbTable[nVerbTableSize - 1][0] = m_aObjectVerbs[nVerbInd].VerbID;
206 m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::UI_ACTIVE;
208 else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_HIDE )
210 m_aVerbTable.realloc( ++nVerbTableSize );
211 m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
212 m_aVerbTable[nVerbTableSize - 1][0] = m_aObjectVerbs[nVerbInd].VerbID;
213 m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::RUNNING;
219 void OCommonEmbeddedObject::LinkInit_Impl(
220 const uno::Sequence< beans::NamedValue >& aObjectProps,
221 const uno::Sequence< beans::PropertyValue >& aMediaDescr,
222 const uno::Sequence< beans::PropertyValue >& aObjectDescr )
224 // setPersistance has no effect on own links, so the complete initialization must be done here
226 for ( sal_Int32 nInd = 0; nInd < aMediaDescr.getLength(); nInd++ )
227 if ( aMediaDescr[nInd].Name == "URL" )
228 aMediaDescr[nInd].Value >>= m_aLinkURL;
229 else if ( aMediaDescr[nInd].Name == "FilterName" )
230 aMediaDescr[nInd].Value >>= m_aLinkFilterName;
232 OSL_ENSURE( m_aLinkURL.getLength() && m_aLinkFilterName.getLength(), "Filter and URL must be provided!\n" );
234 m_bReadOnly = true;
235 if ( m_aLinkFilterName.getLength() )
237 ::comphelper::MimeConfigurationHelper aHelper( m_xContext );
238 OUString aExportFilterName = aHelper.GetExportFilterFromImportFilter( m_aLinkFilterName );
239 m_bReadOnly = !( aExportFilterName.equals( m_aLinkFilterName ) );
242 m_aDocMediaDescriptor = GetValuableArgs_Impl( aMediaDescr, false );
244 uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor;
245 for ( sal_Int32 nObjInd = 0; nObjInd < aObjectDescr.getLength(); nObjInd++ )
246 if ( aObjectDescr[nObjInd].Name == "OutplaceDispatchInterceptor" )
248 aObjectDescr[nObjInd].Value >>= xDispatchInterceptor;
249 break;
251 else if ( aObjectDescr[nObjInd].Name == "Parent" )
253 aObjectDescr[nObjInd].Value >>= m_xParent;
256 CommonInit_Impl( aObjectProps );
258 if ( xDispatchInterceptor.is() )
259 m_pDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
263 OCommonEmbeddedObject::~OCommonEmbeddedObject()
265 if ( m_pInterfaceContainer || m_pDocHolder )
267 m_refCount++;
268 try {
269 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
271 if ( m_pInterfaceContainer )
273 m_pInterfaceContainer->disposeAndClear( aSource );
275 delete m_pInterfaceContainer;
276 m_pInterfaceContainer = nullptr;
278 } catch( const uno::Exception& ) {}
280 try {
281 if ( m_pDocHolder )
283 m_pDocHolder->CloseFrame();
284 try {
285 m_pDocHolder->CloseDocument( true, true );
286 } catch ( const uno::Exception& ) {}
287 m_pDocHolder->FreeOffice();
289 m_pDocHolder->release();
290 m_pDocHolder = nullptr;
292 } catch( const uno::Exception& ) {}
297 void OCommonEmbeddedObject::requestPositioning( const awt::Rectangle& aRect )
299 // the method is called in case object is inplace active and the object window was resized
301 OSL_ENSURE( m_xClientSite.is(), "The client site must be set for inplace active object!\n" );
302 if ( m_xClientSite.is() )
304 uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
306 OSL_ENSURE( xInplaceClient.is(), "The client site must support XInplaceClient to allow inplace activation!\n" );
307 if ( xInplaceClient.is() )
309 try {
310 xInplaceClient->changedPlacement( aRect );
312 catch( const uno::Exception& )
314 OSL_FAIL( "Exception on request to resize!\n" );
321 void OCommonEmbeddedObject::PostEvent_Impl( const OUString& aEventName )
323 if ( m_pInterfaceContainer )
325 ::cppu::OInterfaceContainerHelper* pIC = m_pInterfaceContainer->getContainer(
326 cppu::UnoType<document::XEventListener>::get());
327 if( pIC )
329 document::EventObject aEvent;
330 aEvent.EventName = aEventName;
331 aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
332 // For now all the events are sent as object events
333 // aEvent.Source = ( xSource.is() ? xSource
334 // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) );
335 ::cppu::OInterfaceIteratorHelper aIt( *pIC );
336 while( aIt.hasMoreElements() )
340 static_cast<document::XEventListener *>(aIt.next())->notifyEvent( aEvent );
342 catch( const uno::RuntimeException& )
344 aIt.remove();
347 // the listener could dispose the object.
348 if ( m_bDisposed )
349 return;
356 uno::Any SAL_CALL OCommonEmbeddedObject::queryInterface( const uno::Type& rType )
357 throw( uno::RuntimeException, std::exception )
359 uno::Any aReturn;
361 if ( rType == cppu::UnoType<embed::XEmbeddedObject>::get() )
363 void * p = static_cast< embed::XEmbeddedObject * >( this );
364 return uno::Any( &p, rType );
366 else if (rType == cppu::UnoType<embed::XEmbedPersist2>::get())
368 void* p = static_cast<embed::XEmbedPersist2*>(this);
369 return uno::Any(&p, rType);
371 else
372 aReturn = ::cppu::queryInterface(
373 rType,
374 static_cast< embed::XInplaceObject* >( this ),
375 static_cast< embed::XVisualObject* >( this ),
376 static_cast< embed::XCommonEmbedPersist* >( static_cast< embed::XEmbedPersist* >( this ) ),
377 static_cast< embed::XEmbedPersist* >( this ),
378 static_cast< embed::XLinkageSupport* >( this ),
379 static_cast< embed::XStateChangeBroadcaster* >( this ),
380 static_cast< embed::XClassifiedObject* >( this ),
381 static_cast< embed::XComponentSupplier* >( this ),
382 static_cast< util::XCloseable* >( this ),
383 static_cast< container::XChild* >( this ),
384 static_cast< chart2::XDefaultSizeTransmitter* >( this ),
385 static_cast< document::XEventBroadcaster* >( this ) );
387 if ( aReturn.hasValue() )
388 return aReturn;
389 else
390 return ::cppu::OWeakObject::queryInterface( rType ) ;
395 void SAL_CALL OCommonEmbeddedObject::acquire()
396 throw()
398 ::cppu::OWeakObject::acquire() ;
402 void SAL_CALL OCommonEmbeddedObject::release()
403 throw()
405 ::cppu::OWeakObject::release() ;
409 uno::Sequence< sal_Int8 > SAL_CALL OCommonEmbeddedObject::getClassID()
410 throw ( uno::RuntimeException, std::exception )
412 if ( m_bDisposed )
413 throw lang::DisposedException();
415 return m_aClassID;
418 OUString SAL_CALL OCommonEmbeddedObject::getClassName()
419 throw ( uno::RuntimeException, std::exception )
421 if ( m_bDisposed )
422 throw lang::DisposedException();
424 return m_aClassName;
427 void SAL_CALL OCommonEmbeddedObject::setClassInfo(
428 const uno::Sequence< sal_Int8 >& /*aClassID*/, const OUString& /*aClassName*/ )
429 throw ( lang::NoSupportException,
430 uno::RuntimeException, std::exception )
432 // the object class info can not be changed explicitly
433 throw lang::NoSupportException(); //TODO:
437 uno::Reference< util::XCloseable > SAL_CALL OCommonEmbeddedObject::getComponent()
438 throw ( uno::RuntimeException, std::exception )
440 SolarMutexGuard aGuard;
441 if ( m_bDisposed )
442 throw lang::DisposedException(); // TODO
444 // add an exception
445 if ( m_nObjectState == -1 )
447 // the object is still not loaded
448 throw uno::RuntimeException( "Can't store object without persistence!",
449 static_cast< ::cppu::OWeakObject* >(this) );
452 return uno::Reference< util::XCloseable >( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
456 void SAL_CALL OCommonEmbeddedObject::addStateChangeListener( const uno::Reference< embed::XStateChangeListener >& xListener )
457 throw ( uno::RuntimeException, std::exception )
459 SolarMutexGuard aGuard;
460 if ( m_bDisposed )
461 throw lang::DisposedException(); // TODO
463 if ( !m_pInterfaceContainer )
464 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
466 m_pInterfaceContainer->addInterface( cppu::UnoType<embed::XStateChangeListener>::get(),
467 xListener );
471 void SAL_CALL OCommonEmbeddedObject::removeStateChangeListener(
472 const uno::Reference< embed::XStateChangeListener >& xListener )
473 throw (uno::RuntimeException, std::exception)
475 SolarMutexGuard aGuard;
476 if ( m_pInterfaceContainer )
477 m_pInterfaceContainer->removeInterface( cppu::UnoType<embed::XStateChangeListener>::get(),
478 xListener );
482 void SAL_CALL OCommonEmbeddedObject::close( sal_Bool bDeliverOwnership )
483 throw ( util::CloseVetoException,
484 uno::RuntimeException, std::exception )
486 SolarMutexGuard aGuard;
487 if ( m_bClosed )
488 throw lang::DisposedException(); // TODO
490 uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) );
491 lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
493 if ( m_pInterfaceContainer )
495 ::cppu::OInterfaceContainerHelper* pContainer =
496 m_pInterfaceContainer->getContainer( cppu::UnoType<util::XCloseListener>::get());
497 if ( pContainer != nullptr )
499 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
500 while (pIterator.hasMoreElements())
504 static_cast<util::XCloseListener*>(pIterator.next())->queryClosing( aSource, bDeliverOwnership );
506 catch( const uno::RuntimeException& )
508 pIterator.remove();
513 pContainer = m_pInterfaceContainer->getContainer(
514 cppu::UnoType<util::XCloseListener>::get());
515 if ( pContainer != nullptr )
517 ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer);
518 while (pCloseIterator.hasMoreElements())
522 static_cast<util::XCloseListener*>(pCloseIterator.next())->notifyClosing( aSource );
524 catch( const uno::RuntimeException& )
526 pCloseIterator.remove();
531 m_pInterfaceContainer->disposeAndClear( aSource );
534 m_bDisposed = true; // the object is disposed now for outside
536 // it is possible that the document can not be closed, in this case if the argument is false
537 // the exception will be thrown otherwise in addition to exception the object must register itself
538 // as termination listener and listen for document events
540 if ( m_pDocHolder )
542 m_pDocHolder->CloseFrame();
544 try {
545 m_pDocHolder->CloseDocument( bDeliverOwnership, bDeliverOwnership );
547 catch( const uno::Exception& )
549 if ( bDeliverOwnership )
551 m_pDocHolder->release();
552 m_pDocHolder = nullptr;
553 m_bClosed = true;
556 throw;
559 m_pDocHolder->FreeOffice();
561 m_pDocHolder->release();
562 m_pDocHolder = nullptr;
565 // TODO: for now the storage will be disposed by the object, but after the document
566 // will use the storage, the storage will be disposed by the document and recreated by the object
567 if ( m_xObjectStorage.is() )
569 uno::Reference< lang::XComponent > xComp( m_xObjectStorage, uno::UNO_QUERY );
570 OSL_ENSURE( xComp.is(), "Storage does not support XComponent!\n" );
572 if ( xComp.is() )
574 try {
575 xComp->dispose();
576 } catch ( const uno::Exception& ) {}
579 m_xObjectStorage.clear();
580 m_xRecoveryStorage.clear();
583 m_bClosed = true; // the closing succeeded
587 void SAL_CALL OCommonEmbeddedObject::addCloseListener( const uno::Reference< util::XCloseListener >& xListener )
588 throw ( uno::RuntimeException, std::exception )
590 SolarMutexGuard aGuard;
591 if ( m_bDisposed )
592 throw lang::DisposedException(); // TODO
594 if ( !m_pInterfaceContainer )
595 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper(m_aMutex);
597 m_pInterfaceContainer->addInterface( cppu::UnoType<util::XCloseListener>::get(), xListener );
601 void SAL_CALL OCommonEmbeddedObject::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener )
602 throw (uno::RuntimeException, std::exception)
604 SolarMutexGuard aGuard;
605 if ( m_pInterfaceContainer )
606 m_pInterfaceContainer->removeInterface( cppu::UnoType<util::XCloseListener>::get(),
607 xListener );
611 void SAL_CALL OCommonEmbeddedObject::addEventListener( const uno::Reference< document::XEventListener >& xListener )
612 throw ( uno::RuntimeException, std::exception )
614 SolarMutexGuard aGuard;
615 if ( m_bDisposed )
616 throw lang::DisposedException(); // TODO
618 if ( !m_pInterfaceContainer )
619 m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper(m_aMutex);
621 m_pInterfaceContainer->addInterface( cppu::UnoType<document::XEventListener>::get(), xListener );
625 void SAL_CALL OCommonEmbeddedObject::removeEventListener( const uno::Reference< document::XEventListener >& xListener )
626 throw ( uno::RuntimeException, std::exception )
628 SolarMutexGuard aGuard;
629 if ( m_pInterfaceContainer )
630 m_pInterfaceContainer->removeInterface( cppu::UnoType<document::XEventListener>::get(),
631 xListener );
634 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */