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