From 9be8a2f3cf03bb3d74ae098a44732017fddb7fcf Mon Sep 17 00:00:00 2001 From: Ingrid Halama Date: Thu, 19 Aug 2010 09:18:38 +0200 Subject: chart49: #i113722# duplicate chart creation - OSingleFactoryHelper::createInstanceWithArgumentsAndContext leak --- embeddedobj/source/commonembedding/persistence.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'embeddedobj') diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 0312d28315a6..d7ab39f33ecc 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -229,11 +229,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 ); } -- cgit From 9551bf5a1ee5c9275a26f8ec4021e0b7f5665176 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:10:07 +0200 Subject: sb129: #i113189# change UNO components to use passive registration --- embeddedobj/prj/d.lst | 2 + embeddedobj/source/commonembedding/register.cxx | 42 --------------------- embeddedobj/source/msole/emboleobj.component | 35 ++++++++++++++++++ .../source/msole/emboleobj.windows.component | 39 ++++++++++++++++++++ embeddedobj/source/msole/exports.dxp | 1 - embeddedobj/source/msole/makefile.mk | 11 ++++++ embeddedobj/util/embobj.component | 43 ++++++++++++++++++++++ embeddedobj/util/exports.dxp | 1 - embeddedobj/util/makefile.mk | 8 ++++ 9 files changed, 138 insertions(+), 44 deletions(-) create mode 100644 embeddedobj/source/msole/emboleobj.component create mode 100644 embeddedobj/source/msole/emboleobj.windows.component create mode 100644 embeddedobj/util/embobj.component (limited to 'embeddedobj') diff --git a/embeddedobj/prj/d.lst b/embeddedobj/prj/d.lst index 69721747166a..e85b439a1e34 100644 --- a/embeddedobj/prj/d.lst +++ b/embeddedobj/prj/d.lst @@ -4,3 +4,5 @@ mkdir: %_DEST%\xml%_EXT%\registry\spool ..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib ..\dtd\*.dtd %_DEST%\bin%_EXT%\*.* +..\%__SRC%\misc\embobj.component %_DEST%\xml%_EXT%\embobj.component +..\%__SRC%\misc\emboleobj.component %_DEST%\xml%_EXT%\emboleobj.component diff --git a/embeddedobj/source/commonembedding/register.cxx b/embeddedobj/source/commonembedding/register.cxx index bd2a64b299f1..8dbbd9ee4980 100644 --- a/embeddedobj/source/commonembedding/register.cxx +++ b/embeddedobj/source/commonembedding/register.cxx @@ -87,47 +87,5 @@ 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" diff --git a/embeddedobj/source/msole/emboleobj.component b/embeddedobj/source/msole/emboleobj.component new file mode 100644 index 000000000000..96f8ed0d8d57 --- /dev/null +++ b/embeddedobj/source/msole/emboleobj.component @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/embeddedobj/source/msole/emboleobj.windows.component b/embeddedobj/source/msole/emboleobj.windows.component new file mode 100644 index 000000000000..644a1d4f19a1 --- /dev/null +++ b/embeddedobj/source/msole/emboleobj.windows.component @@ -0,0 +1,39 @@ + + + + + + + + + + + + + diff --git a/embeddedobj/source/msole/exports.dxp b/embeddedobj/source/msole/exports.dxp index 9630d7e06768..f0e1c69934bc 100644 --- a/embeddedobj/source/msole/exports.dxp +++ b/embeddedobj/source/msole/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/embeddedobj/source/msole/makefile.mk b/embeddedobj/source/msole/makefile.mk index 07b08bce6984..f40e231bc2dd 100644 --- a/embeddedobj/source/msole/makefile.mk +++ b/embeddedobj/source/msole/makefile.mk @@ -130,3 +130,14 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/emboleobj.component + +.IF "$(OS)" == "WNT" +my_platform = .windows +.END + +$(MISC)/emboleobj.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + emboleobj.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt emboleobj$(my_platform).component diff --git a/embeddedobj/util/embobj.component b/embeddedobj/util/embobj.component new file mode 100644 index 000000000000..e46945dcb7e0 --- /dev/null +++ b/embeddedobj/util/embobj.component @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + diff --git a/embeddedobj/util/exports.dxp b/embeddedobj/util/exports.dxp index 9630d7e06768..f0e1c69934bc 100644 --- a/embeddedobj/util/exports.dxp +++ b/embeddedobj/util/exports.dxp @@ -1,3 +1,2 @@ component_getImplementationEnvironment -component_writeInfo component_getFactory diff --git a/embeddedobj/util/makefile.mk b/embeddedobj/util/makefile.mk index 763d64c164c4..eb2416bd4dd5 100644 --- a/embeddedobj/util/makefile.mk +++ b/embeddedobj/util/makefile.mk @@ -87,3 +87,11 @@ $(MISC)$/$(SHL1TARGET).flt: makefile.mk @echo CLEAR_THE_FILE > $@ @echo __CT >>$@ + +ALLTAR : $(MISC)/embobj.component + +$(MISC)/embobj.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + embobj.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt embobj.component -- cgit From 1885dddbdd2382f95aef15df15d4cd110f8d7854 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 22 Oct 2010 10:37:46 +0200 Subject: sb131: #i115124# $(XSLTPROC) implies LIBXSLT:libxslt --- embeddedobj/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'embeddedobj') diff --git a/embeddedobj/prj/build.lst b/embeddedobj/prj/build.lst index a61305e19221..c2f366c4deec 100644 --- a/embeddedobj/prj/build.lst +++ b/embeddedobj/prj/build.lst @@ -1,4 +1,4 @@ -eo embeddedobj : offuh sal cppu cppuhelper comphelper tools unotools vos NULL +eo embeddedobj : offuh sal cppu cppuhelper comphelper tools unotools vos LIBXSLT:libxslt NULL eo embeddedobj usr1 - all eo_mkout NULL eo embeddedobj\inc nmake - all eo_inc NULL eo embeddedobj\source\commonembedding nmake - all eo_commonembed eo_inc NULL -- cgit From afe888269b8e5b3520d2017760cbbe237e96df32 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 15 Nov 2010 22:12:46 +0100 Subject: undoapi: doVerb: release mutex before calling into changeState --- embeddedobj/source/commonembedding/embedobj.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'embeddedobj') diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index 3d360245f1ea..ae5c0043153e 100644 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -235,7 +235,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() ) @@ -538,7 +541,7 @@ void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID ) { RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::doVerb" ); - ::osl::MutexGuard aGuard( m_aMutex ); + ::osl::ClearableMutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO @@ -561,7 +564,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 ); + } } //---------------------------------------------- -- cgit From b8fde585bdd8bc2df622001352ae4f0e027a0813 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 1 Dec 2010 11:22:11 +0100 Subject: fwk160: #i74950# let imported links be readonly --- embeddedobj/source/commonembedding/miscobj.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'embeddedobj') diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index 97cc5d2d499b..e0ff1266921a 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -39,6 +39,7 @@ #include #include +#include #include "closepreventer.hxx" #include "intercept.hxx" @@ -240,6 +241,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; -- cgit From b927224032e0ca68961cb6730c02de04f56633a5 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 1 Dec 2010 15:29:44 +0100 Subject: fwk160: #i107138# fix the saveCompleted handling --- embeddedobj/source/commonembedding/persistence.cxx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'embeddedobj') diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx index 0312d28315a6..f6ac51c0ebe6 100644 --- a/embeddedobj/source/commonembedding/persistence.cxx +++ b/embeddedobj/source/commonembedding/persistence.cxx @@ -978,7 +978,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::createFromAscii( "The object waits for saveCompleted() call!\n" ), -- cgit From d63890542329e089e5a596622276f290c4f97e8b Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Fri, 3 Dec 2010 10:58:55 +0100 Subject: fwk162: #i115726# support activation of object from other threads --- embeddedobj/source/commonembedding/embedobj.cxx | 21 ++++++++++++--------- embeddedobj/source/commonembedding/miscobj.cxx | 14 ++++++-------- 2 files changed, 18 insertions(+), 17 deletions(-) (limited to 'embeddedobj') diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx index 3d360245f1ea..2a56a0acb52a 100644 --- a/embeddedobj/source/commonembedding/embedobj.cxx +++ b/embeddedobj/source/commonembedding/embedobj.cxx @@ -165,7 +165,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 ) { @@ -485,14 +485,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) ) ); } } @@ -501,7 +506,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 @@ -517,7 +521,6 @@ sal_Int32 SAL_CALL OCommonEmbeddedObject::getCurrentState() throw ( embed::WrongStateException, uno::RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); if ( m_bDisposed ) throw lang::DisposedException(); // TODO @@ -538,7 +541,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 @@ -561,7 +564,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 ); + } } //---------------------------------------------- @@ -569,7 +575,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 @@ -606,7 +611,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 @@ -659,7 +663,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/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx index 97cc5d2d499b..9aa7df919e3e 100644 --- a/embeddedobj/source/commonembedding/miscobj.cxx +++ b/embeddedobj/source/commonembedding/miscobj.cxx @@ -333,7 +333,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() ) { @@ -467,9 +467,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; } @@ -478,9 +477,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; } @@ -512,9 +510,9 @@ uno::Reference< util::XCloseable > SAL_CALL OCommonEmbeddedObject::getComponent( } // if ( m_bWaitSaveCompleted ) - // throw embed::WrongStateException( - // ::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ), - // uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); + // throw embed::WrongStateException( + // ::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ), + // uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); return uno::Reference< util::XCloseable >( m_pDocHolder->GetComponent(), uno::UNO_QUERY ); } -- cgit