diff options
Diffstat (limited to 'embeddedobj/source/commonembedding')
-rwxr-xr-x[-rw-r--r--] | embeddedobj/source/commonembedding/embedobj.cxx | 26 | ||||
-rwxr-xr-x[-rw-r--r--] | embeddedobj/source/commonembedding/inplaceobj.cxx | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | embeddedobj/source/commonembedding/makefile.mk | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | embeddedobj/source/commonembedding/miscobj.cxx | 17 | ||||
-rwxr-xr-x[-rw-r--r--] | embeddedobj/source/commonembedding/persistence.cxx | 22 | ||||
-rwxr-xr-x[-rw-r--r--] | embeddedobj/source/commonembedding/register.cxx | 42 | ||||
-rwxr-xr-x[-rw-r--r--] | embeddedobj/source/commonembedding/specialobject.cxx | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | embeddedobj/source/commonembedding/visobj.cxx | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | embeddedobj/source/commonembedding/xfactory.cxx | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | embeddedobj/source/commonembedding/xfactory.hxx | 0 |
10 files changed, 46 insertions, 61 deletions
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index c53ffb377ab0..29b76d346a71 100644..100755 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -166,7 +166,7 @@ void OCommonEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState ) { // TODO: may be needs interaction handler to detect wherether the object state - // can be changed even after errors + // can be changed even after errors if ( m_nObjectState == embed::EmbedStates::LOADED ) { @@ -236,7 +236,10 @@ void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState ) if ( nNextState == embed::EmbedStates::INPLACE_ACTIVE ) { if ( !m_xClientSite.is() ) - throw embed::WrongStateException(); //TODO: client site is not set! + throw embed::WrongStateException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "client site not set, yet" ) ), + *this + ); uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY ); if ( xInplaceClient.is() && xInplaceClient->canInplaceActivate() ) @@ -486,14 +489,19 @@ void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState ) { if ( nOldState != m_nObjectState ) // notify listeners that the object has changed the state - StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState ,aGuard); + StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState, aGuard ); throw; } } // notify listeners that the object has changed the state - StateChangeNotification_Impl( sal_False, nOldState, nNewState,aGuard ); + StateChangeNotification_Impl( sal_False, nOldState, nNewState, aGuard ); + + // let the object window be shown + if ( nNewState == embed::EmbedStates::UI_ACTIVE || nNewState == embed::EmbedStates::INPLACE_ACTIVE ) + PostEvent_Impl( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnVisAreaChanged" ) ), + uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) ); } } @@ -502,7 +510,6 @@ uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getReachableStates() throw ( embed::WrongStateException, uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO @@ -518,7 +525,6 @@ sal_Int32 SAL_CALL OCommonEmbeddedObject::getCurrentState() throw ( embed::WrongStateException, uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO @@ -539,7 +545,7 @@ void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID ) { RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::doVerb" ); - ::osl::MutexGuard aGuard( m_aMutex ); + ::osl::ResettableMutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO @@ -562,7 +568,10 @@ void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID ) // TODO/LATER: check if the verb is a supported one and if it is produce related operation } else + { + aGuard.clear(); changeState( nNewState ); + } } //---------------------------------------------- @@ -570,7 +579,6 @@ uno::Sequence< embed::VerbDescriptor > SAL_CALL OCommonEmbeddedObject::getSuppor throw ( embed::WrongStateException, uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO @@ -607,7 +615,6 @@ uno::Reference< embed::XEmbeddedClient > SAL_CALL OCommonEmbeddedObject::getClie throw ( embed::WrongStateException, uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO @@ -660,7 +667,6 @@ sal_Int64 SAL_CALL OCommonEmbeddedObject::getStatus( sal_Int64 ) throw ( embed::WrongStateException, uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO diff --git a/embeddedobj/source/commonembedding/inplaceobj.cxx b/embeddedobj/source/commonembedding/inplaceobj.cxx index 6ca80ce1c2d6..6ca80ce1c2d6 100644..100755 --- a/embeddedobj/source/commonembedding/inplaceobj.cxx +++ b/embeddedobj/source/commonembedding/inplaceobj.cxx diff --git a/embeddedobj/source/commonembedding/makefile.mk b/embeddedobj/source/commonembedding/makefile.mk index d731b729d919..d731b729d919 100644..100755 --- a/embeddedobj/source/commonembedding/makefile.mk +++ b/embeddedobj/source/commonembedding/makefile.mk diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index 1e9282a4b2e6..2ca46ed1227e 100644..100755 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -40,6 +40,7 @@ #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/interfacecontainer.h> +#include <comphelper/mimeconfighelper.hxx> #include "closepreventer.hxx" #include "intercept.hxx" @@ -241,6 +242,14 @@ void OCommonEmbeddedObject::LinkInit_Impl( OSL_ENSURE( m_aLinkURL.getLength() && m_aLinkFilterName.getLength(), "Filter and URL must be provided!\n" ); + m_bReadOnly = sal_True; + if ( m_aLinkFilterName.getLength() ) + { + ::comphelper::MimeConfigurationHelper aHelper( m_xFactory ); + ::rtl::OUString aExportFilterName = aHelper.GetExportFilterFromImportFilter( m_aLinkFilterName ); + m_bReadOnly = !( aExportFilterName.equals( m_aLinkFilterName ) ); + } + m_aDocMediaDescriptor = GetValuableArgs_Impl( aMediaDescr, sal_False ); uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor; @@ -334,7 +343,7 @@ void OCommonEmbeddedObject::PostEvent_Impl( const ::rtl::OUString& aEventName, aEvent.Source = uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ); // For now all the events are sent as object events // aEvent.Source = ( xSource.is() ? xSource - // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) ); + // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) ); ::cppu::OInterfaceIteratorHelper aIt( *pIC ); while( aIt.hasMoreElements() ) { @@ -468,9 +477,8 @@ uno::Sequence< sal_Int8 > SAL_CALL OCommonEmbeddedObject::getImplementationId() uno::Sequence< sal_Int8 > SAL_CALL OCommonEmbeddedObject::getClassID() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); // TODO + throw lang::DisposedException(); return m_aClassID; } @@ -479,9 +487,8 @@ uno::Sequence< sal_Int8 > SAL_CALL OCommonEmbeddedObject::getClassID() ::rtl::OUString SAL_CALL OCommonEmbeddedObject::getClassName() throw ( uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) - throw lang::DisposedException(); // TODO + throw lang::DisposedException(); return m_aClassName; } diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index bc62bebd0b4a..708142c679d5 100644..100755 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -228,11 +228,11 @@ static uno::Reference< util::XCloseable > CreateDocument( const uno::Reference< } catch( const uno::Exception& ) { - // some of our embedded object implementations (in particular chart) do neither support - // the EmbeddedObject, nor the EmbeddedScriptSupport argument. Also, they do not support - // XInitialization, which means the default factory from cppuhelper will throw an + // if an embedded object implementation does not support XInitialization, + // the default factory from cppuhelper will throw an // IllegalArgumentException when we try to create the instance with arguments. // Okay, so we fall back to creating the instance without any arguments. + OSL_ASSERT("Consider implementing interface XInitialization to avoid duplicate construction"); xDocument = _rxFactory->createInstance( _rDocumentServiceName ); } @@ -975,7 +975,21 @@ void SAL_CALL OCommonEmbeddedObject::setPersistentEntry( if ( m_bWaitSaveCompleted ) { if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT ) - saveCompleted( ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) ) ); + { + // saveCompleted is expected, handle it accordingly + if ( m_xNewParentStorage == xStorage && m_aNewEntryName.equals( sEntName ) ) + { + saveCompleted( sal_True ); + return; + } + + // if a completely different entry is provided, switch first back to the old persistence in saveCompleted + // and then switch to the target persistence + sal_Bool bSwitchFurther = ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) ); + saveCompleted( sal_False ); + if ( !bSwitchFurther ) + return; + } else throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )), diff --git a/embeddedobj/source/commonembedding/register.cxx b/embeddedobj/source/commonembedding/register.cxx index 0266d8386257..6dbfe46c0c86 100644..100755 --- a/embeddedobj/source/commonembedding/register.cxx +++ b/embeddedobj/source/commonembedding/register.cxx @@ -88,48 +88,6 @@ void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServic return pRet; } -sal_Bool SAL_CALL component_writeInfo( void * /*pServiceManager*/, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - sal_Int32 nInd = 0; - uno::Reference< registry::XRegistryKey > xKey( reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ) ); - - uno::Reference< registry::XRegistryKey > xNewKey; - - xNewKey = xKey->createKey( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + - OOoEmbeddedObjectFactory::impl_staticGetImplementationName() + - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ); - uno::Sequence< ::rtl::OUString > rServices = OOoEmbeddedObjectFactory::impl_staticGetSupportedServiceNames(); - for( nInd = 0; nInd < rServices.getLength(); nInd++ ) - xNewKey->createKey( rServices.getConstArray()[nInd] ); - - xNewKey = xKey->createKey( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + - OOoSpecialEmbeddedObjectFactory::impl_staticGetImplementationName() + - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ); - rServices = OOoSpecialEmbeddedObjectFactory::impl_staticGetSupportedServiceNames(); - for( nInd = 0; nInd < rServices.getLength(); nInd++ ) - xNewKey->createKey( rServices.getConstArray()[nInd] ); - - xNewKey = xKey->createKey( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + - UNOEmbeddedObjectCreator::impl_staticGetImplementationName() + - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ); - rServices = UNOEmbeddedObjectCreator::impl_staticGetSupportedServiceNames(); - for( nInd = 0; nInd < rServices.getLength(); nInd++ ) - xNewKey->createKey( rServices.getConstArray()[nInd] ); - - return sal_True; - } - catch (registry::InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; -} - } // extern "C" /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/embeddedobj/source/commonembedding/specialobject.cxx b/embeddedobj/source/commonembedding/specialobject.cxx index 802056b72af7..802056b72af7 100644..100755 --- a/embeddedobj/source/commonembedding/specialobject.cxx +++ b/embeddedobj/source/commonembedding/specialobject.cxx diff --git a/embeddedobj/source/commonembedding/visobj.cxx b/embeddedobj/source/commonembedding/visobj.cxx index 7be21d75f92b..7be21d75f92b 100644..100755 --- a/embeddedobj/source/commonembedding/visobj.cxx +++ b/embeddedobj/source/commonembedding/visobj.cxx diff --git a/embeddedobj/source/commonembedding/xfactory.cxx b/embeddedobj/source/commonembedding/xfactory.cxx index 28321bfc3aa5..28321bfc3aa5 100644..100755 --- a/embeddedobj/source/commonembedding/xfactory.cxx +++ b/embeddedobj/source/commonembedding/xfactory.cxx diff --git a/embeddedobj/source/commonembedding/xfactory.hxx b/embeddedobj/source/commonembedding/xfactory.hxx index 7f0b668bb750..7f0b668bb750 100644..100755 --- a/embeddedobj/source/commonembedding/xfactory.hxx +++ b/embeddedobj/source/commonembedding/xfactory.hxx |