LCOV - code coverage report
Current view: top level - embeddedobj/source/msole - olemisc.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 204 0.0 %
Date: 2014-04-14 Functions: 0 23 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10